From ba0171f72402d823abc86504c35312a29749f9b2 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Wed, 26 Oct 2011 12:18:21 +0200 Subject: s3: Add processes_exist --- source3/include/proto.h | 2 ++ source3/lib/util.c | 66 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) diff --git a/source3/include/proto.h b/source3/include/proto.h index 6ff2854ca2..39a5d03d76 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -512,6 +512,8 @@ int interpret_protocol(const char *str,int def); char *automount_lookup(TALLOC_CTX *ctx, const char *user_name); char *automount_lookup(TALLOC_CTX *ctx, const char *user_name); bool process_exists(const struct server_id pid); +bool processes_exist(const struct server_id *pids, int num_pids, + bool *results); const char *uidtoname(uid_t uid); char *gidtoname(gid_t gid); uid_t nametouid(const char *name); diff --git a/source3/lib/util.c b/source3/lib/util.c index f547ec2a56..9b9d34c22f 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -657,6 +657,72 @@ bool process_exists(const struct server_id pid) #endif } +bool processes_exist(const struct server_id *pids, int num_pids, + bool *results) +{ + struct server_id *remote_pids = NULL; + int *remote_idx = NULL; + bool *remote_results = NULL; + int i, num_remote_pids; + bool result = false; + + remote_pids = talloc_array(talloc_tos(), struct server_id, num_pids); + if (remote_pids == NULL) { + goto fail; + } + remote_idx = talloc_array(talloc_tos(), int, num_pids); + if (remote_idx == NULL) { + goto fail; + } + remote_results = talloc_array(talloc_tos(), bool, num_pids); + if (remote_results == NULL) { + goto fail; + } + + num_remote_pids = 0; + + for (i=0; i