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 --- lib/util/system.c | 31 ------------------------------- 1 file changed, 31 deletions(-) (limited to 'lib/util/system.c') diff --git a/lib/util/system.c b/lib/util/system.c index f34fabd292..558aa5bc12 100644 --- a/lib/util/system.c +++ b/lib/util/system.c @@ -40,37 +40,6 @@ */ -/************************************************************************** - Wrapper for fork. Ensures we clear our pid cache. -****************************************************************************/ - -static pid_t mypid = (pid_t)-1; - -_PUBLIC_ pid_t sys_fork(void) -{ - pid_t forkret = fork(); - - if (forkret == (pid_t)0) { - /* Child - reset mypid so sys_getpid does a system call. */ - mypid = (pid_t) -1; - } - - return forkret; -} - -/************************************************************************** - Wrapper for getpid. Ensures we only do a system call *once*. -****************************************************************************/ - -_PUBLIC_ pid_t sys_getpid(void) -{ - if (mypid == (pid_t)-1) - mypid = getpid(); - - return mypid; -} - - _PUBLIC_ int sys_getnameinfo(const struct sockaddr *psa, int salen, char *host, -- cgit