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/nmbd/asyncdns.c | 2 +- source3/nmbd/nmbd.c | 2 +- source3/nmbd/nmbd_packets.c | 2 +- source3/nmbd/nmbd_synclists.c | 2 +- source3/nmbd/nmbd_winsserver.c | 4 ++-- 5 files changed, 6 insertions(+), 6 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c index a42ad25c20..90340efe39 100644 --- a/source3/nmbd/asyncdns.c +++ b/source3/nmbd/asyncdns.c @@ -147,7 +147,7 @@ void start_async_dns(struct messaging_context *msg) return; } - child_pid = sys_fork(); + child_pid = fork(); if (child_pid) { fd_in = fd1[0]; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index eff1eca2f1..bb264d2274 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -830,7 +830,7 @@ static bool open_sockets(bool isdaemon, int port) StartupTime = time(NULL); - sys_srandom(time(NULL) ^ sys_getpid()); + sys_srandom(time(NULL) ^ getpid()); if (!override_logfile) { char *lfile = NULL; diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index f8bfe45c85..7a707a045b 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -150,7 +150,7 @@ static uint16 name_trn_id=0; static uint16 generate_name_trn_id(void) { if (!name_trn_id) { - name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)sys_getpid()%(unsigned)100); + name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)getpid()%(unsigned)100); } name_trn_id = (name_trn_id+1) % (unsigned)0x7FFF; return name_trn_id; diff --git a/source3/nmbd/nmbd_synclists.c b/source3/nmbd/nmbd_synclists.c index 1adccbd7d3..20ece6915a 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -167,7 +167,7 @@ done: /* the parent forks and returns, leaving the child to do the actual sync and call END_PROFILE*/ CatchChild(); - if ((s->pid = sys_fork())) return; + if ((s->pid = fork())) return; BlockSignals( False, SIGTERM ); diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index 48c10e25ae..0a06ebea66 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -2470,7 +2470,7 @@ void wins_write_database(time_t t, bool background) /* We will do the writing in a child process to ensure that the parent doesn't block while this is done */ if (background) { CatchChild(); - if (sys_fork()) { + if (fork()) { return; } if (tdb_reopen(wins_tdb)) { @@ -2487,7 +2487,7 @@ void wins_write_database(time_t t, bool background) /* This is safe as the 0 length means "don't expand". */ all_string_sub(fname,"//", "/", 0); - if (asprintf(&fnamenew, "%s.%u", fname, (unsigned int)sys_getpid()) < 0) { + if (asprintf(&fnamenew, "%s.%u", fname, (unsigned int)getpid()) < 0) { goto err_exit; } -- cgit