From c0288e0612187ecbfc4a81d071fd504ea8737b7a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 24 Mar 2012 20:17:08 +0100 Subject: lib/util: Remove obsolete sys_getpid() and sys_fork(). The performance of these is minimal (these days) and they can return invalid results when used as part of applications that do not use sys_fork(). Autobuild-User: Jelmer Vernooij Autobuild-Date: Sat Mar 24 21:55:41 CET 2012 on sn-devel-104 --- source3/printing/print_cups.c | 2 +- source3/printing/printing.c | 20 ++++++++++---------- source3/printing/printing_db.c | 2 +- source3/printing/queue_process.c | 2 +- source3/printing/spoolssd.c | 2 +- 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'source3/printing') diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 95ddd570bb..79b146c076 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -411,7 +411,7 @@ static bool cups_pcap_load_async(struct tevent_context *ev, return false; } - pid = sys_fork(); + pid = fork(); if (pid == (pid_t)-1) { DEBUG(10,("cups_pcap_load_async: fork failed %s\n", strerror(errno) )); diff --git a/source3/printing/printing.c b/source3/printing/printing.c index f3a9a9a253..0d943a38df 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1111,7 +1111,7 @@ static void set_updating_pid(const fstring sharename, bool updating) fstring keystr; TDB_DATA key; TDB_DATA data; - pid_t updating_pid = sys_getpid(); + pid_t updating_pid = getpid(); uint8 buffer[4]; struct tdb_print_db *pdb = get_print_db_byname(sharename); @@ -1752,7 +1752,7 @@ bool print_notify_register_pid(int snum) struct tdb_print_db *pdb = NULL; TDB_CONTEXT *tdb = NULL; const char *printername; - uint32 mypid = (uint32)sys_getpid(); + uint32_t mypid = (uint32_t)getpid(); bool ret = False; size_t i; @@ -1843,7 +1843,7 @@ bool print_notify_deregister_pid(int snum) struct tdb_print_db *pdb = NULL; TDB_CONTEXT *tdb = NULL; const char *printername; - uint32 mypid = (uint32)sys_getpid(); + uint32_t mypid = (uint32_t)getpid(); size_t i; bool ret = False; @@ -1948,7 +1948,7 @@ bool print_job_exists(const char* sharename, uint32 jobid) char *print_job_fname(const char* sharename, uint32 jobid) { struct printjob *pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->spooled || pjob->pid != sys_getpid()) + if (!pjob || pjob->spooled || pjob->pid != getpid()) return NULL; return pjob->filename; } @@ -1981,7 +1981,7 @@ bool print_job_set_name(struct tevent_context *ev, struct printjob *pjob; pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->pid != sys_getpid()) + if (!pjob || pjob->pid != getpid()) return False; fstrcpy(pjob->jobname, name); @@ -1997,7 +1997,7 @@ bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t job struct printjob *pjob; pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->pid != sys_getpid()) { + if (!pjob || pjob->pid != getpid()) { return false; } @@ -2361,7 +2361,7 @@ ssize_t print_job_write(struct tevent_context *ev, if (!pjob) return -1; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != sys_getpid()) + if (pjob->pid != getpid()) return -1; /* if SMBD is spooling this can't be allowed */ @@ -2720,7 +2720,7 @@ WERROR print_job_start(const struct auth_session_info *server_info, ZERO_STRUCT(pjob); - pjob.pid = sys_getpid(); + pjob.pid = getpid(); pjob.sysjob = -1; pjob.fd = -1; pjob.starttime = time(NULL); @@ -2788,7 +2788,7 @@ void print_job_endpage(struct messaging_context *msg_ctx, if (!pjob) return; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != sys_getpid()) + if (pjob->pid != getpid()) return; pjob->page_count++; @@ -2817,7 +2817,7 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum, return NT_STATUS_PRINT_CANCELLED; } - if (pjob->spooled || pjob->pid != sys_getpid()) { + if (pjob->spooled || pjob->pid != getpid()) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source3/printing/printing_db.c b/source3/printing/printing_db.c index a3e10659d6..ecb8ff6463 100644 --- a/source3/printing/printing_db.c +++ b/source3/printing/printing_db.c @@ -193,7 +193,7 @@ TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printe for( i = 0; i < data.dsize; i += 8) { pid_t pid = (pid_t)IVAL(data.dptr, i); - if (pid == sys_getpid()) + if (pid == getpid()) continue; /* Entry is dead if process doesn't exist or refcount is zero. */ diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index de41f8916d..6e50f5f4ff 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -244,7 +244,7 @@ pid_t start_background_queue(struct tevent_context *ev, BlockSignals(true, SIGTERM); BlockSignals(true, SIGHUP); - pid = sys_fork(); + pid = fork(); /* parent or error */ if (pid != 0) { diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 5775505160..f4bba76bc7 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -644,7 +644,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx, BlockSignals(true, SIGTERM); BlockSignals(true, SIGHUP); - pid = sys_fork(); + pid = fork(); if (pid == -1) { DEBUG(0, ("Failed to fork SPOOLSS [%s]\n", -- cgit