From 8338fe6ac878ef8c04276229ae6e6a8edf9c3e3a Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 16 Feb 2016 15:46:06 +0100 Subject: [PATCH] lib: Remove sys_waitpid We have waitpid in libreplace Signed-off-by: Volker Lendecke Reviewed-by: Michael Adam --- source3/include/proto.h | 1 - source3/lib/server_prefork.c | 2 +- source3/lib/smbrun.c | 4 ++-- source3/lib/system.c | 15 +-------------- source3/lib/tdb_validate.c | 2 +- source3/printing/queue_process.c | 2 +- source3/printing/spoolssd.c | 2 +- source3/rpc_server/samr/srv_samr_chgpasswd.c | 2 +- source3/smbd/server.c | 2 +- source3/winbindd/winbindd.c | 2 +- tests/fcntl_lock_thread.c | 5 ----- 11 files changed, 10 insertions(+), 29 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index 09e991507fc..aaa5aee2958 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -243,7 +243,6 @@ int sys_fallocate(int fd, uint32_t mode, off_t offset, off_t len); void kernel_flock(int fd, uint32_t share_mode, uint32_t access_mask); DIR *sys_fdopendir(int fd); int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev); -int sys_waitpid(pid_t pid,int *status,int options); char *sys_getwd(void); void set_effective_capability(enum smbd_capability capability); void drop_effective_capability(enum smbd_capability capability); diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c index c725607e957..1d64db2af0c 100644 --- a/source3/lib/server_prefork.c +++ b/source3/lib/server_prefork.c @@ -329,7 +329,7 @@ static void prefork_cleanup_loop(struct prefork_pool *pfp) continue; } - pid = sys_waitpid(pfp->pool[i].pid, &status, WNOHANG); + pid = waitpid(pfp->pool[i].pid, &status, WNOHANG); if (pid > 0) { if (pfp->pool[i].status != PF_WORKER_EXITING) { diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 55f7a871d3a..63b0323c51c 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -116,7 +116,7 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize) /* the parent just waits for the child to exit */ - while((wpid = sys_waitpid(pid,&status,0)) < 0) { + while((wpid = waitpid(pid,&status,0)) < 0) { if(errno == EINTR) { errno = 0; continue; @@ -287,7 +287,7 @@ int smbrunsecret(const char *cmd, const char *secret) close(ifd[1]); /* the parent just waits for the child to exit */ - while((wpid = sys_waitpid(pid, &status, 0)) < 0) { + while((wpid = waitpid(pid, &status, 0)) < 0) { if(errno == EINTR) { errno = 0; continue; diff --git a/source3/lib/system.c b/source3/lib/system.c index 0351e376265..acc121de14d 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -571,19 +571,6 @@ int sys_mknod(const char *path, mode_t mode, SMB_DEV_T dev) #endif } -/******************************************************************* -The wait() calls vary between systems -********************************************************************/ - -int sys_waitpid(pid_t pid,int *status,int options) -{ -#ifdef HAVE_WAITPID - return waitpid(pid,status,options); -#else /* HAVE_WAITPID */ - return wait4(pid, status, options, NULL); -#endif /* HAVE_WAITPID */ -} - /******************************************************************* System wrapper for getwd. Always returns MALLOC'ed memory, or NULL on error (malloc fail usually). @@ -1200,7 +1187,7 @@ int sys_pclose(int fd) */ do { - wait_pid = sys_waitpid (entry->child_pid, &wstatus, 0); + wait_pid = waitpid (entry->child_pid, &wstatus, 0); } while (wait_pid == -1 && errno == EINTR); SAFE_FREE(entry); diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c index 2592402afd8..9db182fb0b3 100644 --- a/source3/lib/tdb_validate.c +++ b/source3/lib/tdb_validate.c @@ -135,7 +135,7 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn) (unsigned int)child_pid)); DEBUG(10, ("tdb_validate: waiting for child to finish...\n")); - while ((wait_pid = sys_waitpid(child_pid, &child_status, 0)) < 0) { + while ((wait_pid = waitpid(child_pid, &child_status, 0)) < 0) { if (errno == EINTR) { DEBUG(10, ("tdb_validate: got signal during waitpid, " "retrying\n")); diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index 6e31ee4c21a..c9e55223b13 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -269,7 +269,7 @@ static void bq_sig_chld_handler(struct tevent_context *ev_ctx, int status; pid_t pid; - pid = sys_waitpid(-1, &status, WNOHANG); + pid = waitpid(-1, &status, WNOHANG); if (WIFEXITED(status)) { DEBUG(6, ("Bq child process %d terminated with %d\n", (int)pid, WEXITSTATUS(status))); diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 51d10b63e05..48a914ef6de 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -478,7 +478,7 @@ static void check_updater_child(struct tevent_context *ev_ctx, return; } - pid = sys_waitpid(background_lpq_updater_pid, &status, WNOHANG); + pid = waitpid(background_lpq_updater_pid, &status, WNOHANG); if (pid > 0) { DEBUG(2, ("The background queue child died... Restarting!\n")); pid = start_background_queue(ev_ctx, msg_ctx, bq_logfile); diff --git a/source3/rpc_server/samr/srv_samr_chgpasswd.c b/source3/rpc_server/samr/srv_samr_chgpasswd.c index bfb7af6051b..ad4eaa72a01 100644 --- a/source3/rpc_server/samr/srv_samr_chgpasswd.c +++ b/source3/rpc_server/samr/srv_samr_chgpasswd.c @@ -430,7 +430,7 @@ static bool chat_with_program(char *passwordprogram, const struct passwd *pass, kill(pid, SIGKILL); /* be sure to end this process */ } - while ((wpid = sys_waitpid(pid, &wstat, 0)) < 0) { + while ((wpid = waitpid(pid, &wstat, 0)) < 0) { if (errno == EINTR) { errno = 0; continue; diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 42fcad6de1b..d68615e864e 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -630,7 +630,7 @@ static void smbd_sig_chld_handler(struct tevent_context *ev, talloc_get_type_abort(private_data, struct smbd_parent_context); - while ((pid = sys_waitpid(-1, &status, WNOHANG)) > 0) { + while ((pid = waitpid(-1, &status, WNOHANG)) > 0) { bool unclean_shutdown = False; /* If the child terminated normally, assume diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 78df632f498..002ba3f5e8c 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -432,7 +432,7 @@ static void winbindd_sig_chld_handler(struct tevent_context *ev, { pid_t pid; - while ((pid = sys_waitpid(-1, NULL, WNOHANG)) > 0) { + while ((pid = waitpid(-1, NULL, WNOHANG)) > 0) { winbind_child_died(pid); } } diff --git a/tests/fcntl_lock_thread.c b/tests/fcntl_lock_thread.c index f31105626c2..e3415146a7f 100644 --- a/tests/fcntl_lock_thread.c +++ b/tests/fcntl_lock_thread.c @@ -15,11 +15,6 @@ #include #include -static int sys_waitpid(pid_t pid,int *status,int options) -{ - return waitpid(pid,status,options); -} - #define DATA "conftest.fcntl" #define SEEK_SET 0 -- 2.34.1