From 693ffb8466ada58ecc59fde754ba79fc6f51528d Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 2 May 2000 02:23:41 +0000 Subject: Added sys_fork() and sys_getpid() functions to stop the overhead of doing a system call every time we want to just get our pid. Jeremy. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a) --- source3/lib/util.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index 955e1df080..8ac9223f2e 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -741,7 +741,7 @@ become a daemon, discarding the controlling terminal ****************************************************************************/ void become_daemon(void) { - if (fork()) { + if (sys_fork()) { _exit(0); } @@ -1584,7 +1584,7 @@ BOOL fcntl_lock(int fd, int op, SMB_OFF_T offset, SMB_OFF_T count, int type) if ((ret != -1) && (lock.l_type != F_UNLCK) && (lock.l_pid != 0) && - (lock.l_pid != getpid())) + (lock.l_pid != sys_getpid())) { DEBUG(3,("fd %d is locked by pid %d\n",fd,(int)lock.l_pid)); return(True); @@ -2110,7 +2110,7 @@ int _Insure_trap_error(int a1, int a2, int a3, int a4, int a5, int a6) char pidstr[10]; pstring cmd = "/usr/X11R6/bin/xterm -display :0 -T Panic -n Panic -e /bin/sh -c 'cat /tmp/ierrs.*.%d ; gdb /proc/%d/exe %d'"; - slprintf(pidstr, sizeof(pidstr), "%d", getpid()); + slprintf(pidstr, sizeof(pidstr), "%d", sys_getpid()); pstring_sub(cmd, "%d", pidstr); if (!fn) { -- cgit