diff options
author | Jeremy Allison <jra@samba.org> | 2000-05-02 02:23:41 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-05-02 02:23:41 +0000 |
commit | 148628b616b5c29ba6340d65fc3ddbcabba6e67a (patch) | |
tree | f8482fb2dcfa68baeb38a38e2c73ee105abb00a2 /source/lib/util.c | |
parent | 3b25f7368be3877e9ad27498bc9451ec88d4b07f (diff) | |
download | samba-148628b616b5c29ba6340d65fc3ddbcabba6e67a.tar.gz samba-148628b616b5c29ba6340d65fc3ddbcabba6e67a.tar.xz samba-148628b616b5c29ba6340d65fc3ddbcabba6e67a.zip |
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.
Diffstat (limited to 'source/lib/util.c')
-rw-r--r-- | source/lib/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/source/lib/util.c b/source/lib/util.c index 955e1df080a..8ac9223f2eb 100644 --- a/source/lib/util.c +++ b/source/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) { |