summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-05-02 02:23:41 +0000
committerJeremy Allison <jra@samba.org>2000-05-02 02:23:41 +0000
commit693ffb8466ada58ecc59fde754ba79fc6f51528d (patch)
tree639fae54b3d874aae78e5732aef20f52de5b60bf /source3/nmbd
parent830a9e571eee5330097376e94af7dc0f2d5f2f02 (diff)
downloadsamba-693ffb8466ada58ecc59fde754ba79fc6f51528d.tar.gz
samba-693ffb8466ada58ecc59fde754ba79fc6f51528d.tar.bz2
samba-693ffb8466ada58ecc59fde754ba79fc6f51528d.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. (This used to be commit 148628b616b5c29ba6340d65fc3ddbcabba6e67a)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/asyncdns.c2
-rw-r--r--source3/nmbd/nmbd.c2
-rw-r--r--source3/nmbd/nmbd_packets.c2
-rw-r--r--source3/nmbd/nmbd_synclists.c2
-rw-r--r--source3/nmbd/nmbd_winsserver.c4
5 files changed, 6 insertions, 6 deletions
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c
index 99e697b470..1fe04a39e3 100644
--- a/source3/nmbd/asyncdns.c
+++ b/source3/nmbd/asyncdns.c
@@ -140,7 +140,7 @@ void start_async_dns(void)
return;
}
- child_pid = fork();
+ child_pid = sys_fork();
if (child_pid) {
fd_in = fd1[0];
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index c7ebe48822..b59a626fff 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -652,7 +652,7 @@ static void usage(char *pname)
StartupTime = time(NULL);
- sys_srandom(time(NULL) ^ getpid());
+ sys_srandom(time(NULL) ^ sys_getpid());
TimeInit();
diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c
index a7c94f1544..ee2ba2e240 100644
--- a/source3/nmbd/nmbd_packets.c
+++ b/source3/nmbd/nmbd_packets.c
@@ -140,7 +140,7 @@ static uint16 generate_name_trn_id(void)
if (!name_trn_id)
{
- name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)getpid()%(unsigned)100);
+ name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)sys_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 7bf1790377..b69a9959c2 100644
--- a/source3/nmbd/nmbd_synclists.c
+++ b/source3/nmbd/nmbd_synclists.c
@@ -153,7 +153,7 @@ void sync_browse_lists(struct work_record *work,
/* the parent forks and returns, leaving the child to do the
actual sync */
CatchChild();
- if ((s->pid = fork())) return;
+ if ((s->pid = sys_fork())) return;
BlockSignals( False, SIGTERM );
diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c
index 2b99a8ce53..33b33040cb 100644
--- a/source3/nmbd/nmbd_winsserver.c
+++ b/source3/nmbd/nmbd_winsserver.c
@@ -1592,14 +1592,14 @@ void wins_write_database(BOOL background)
doesn't block while this is done */
if (background) {
CatchChild();
- if (fork()) {
+ if (sys_fork()) {
return;
}
}
slprintf(fname,sizeof(fname),"%s/%s", lp_lockdir(), WINS_LIST);
all_string_sub(fname,"//", "/", 0);
- slprintf(fnamenew,sizeof(fnamenew),"%s.%u", fname, (unsigned int)getpid());
+ slprintf(fnamenew,sizeof(fnamenew),"%s.%u", fname, (unsigned int)sys_getpid());
if((fp = sys_fopen(fnamenew,"w")) == NULL)
{