2 Unix SMB/CIFS implementation.
3 Implementation of a reliable server_exists()
4 Copyright (C) Volker Lendecke 2010
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>.
21 #include "lib/util/server_id.h"
23 #include "lib/param/param.h"
24 #include "ctdbd_conn.h"
25 #include "lib/messages_ctdb.h"
26 #include "lib/messaging/messages_dgm.h"
28 static bool serverid_exists_local(const struct server_id
*id
)
30 bool exists
= process_exists_by_pid(id
->pid
);
38 if (id
->unique_id
== SERVERID_UNIQUE_ID_NOT_TO_VERIFY
) {
42 ret
= messaging_dgm_get_unique(id
->pid
, &unique
);
47 return (unique
== id
->unique_id
);
50 bool serverid_exists(const struct server_id
*id
)
52 if (procid_is_local(id
)) {
53 return serverid_exists_local(id
);
56 if (lp_clustering()) {
57 return ctdbd_process_exists(messaging_ctdb_connection(),
58 id
->vnn
, id
->pid
, id
->unique_id
);