summaryrefslogtreecommitdiffstats
path: root/source/client
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
commit148628b616b5c29ba6340d65fc3ddbcabba6e67a (patch)
treef8482fb2dcfa68baeb38a38e2c73ee105abb00a2 /source/client
parent3b25f7368be3877e9ad27498bc9451ec88d4b07f (diff)
downloadsamba-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/client')
-rw-r--r--source/client/client.c8
-rw-r--r--source/client/smbmount.c4
2 files changed, 6 insertions, 6 deletions
diff --git a/source/client/client.c b/source/client/client.c
index ade1436871c..7431b2704e5 100644
--- a/source/client/client.c
+++ b/source/client/client.c
@@ -849,7 +849,7 @@ static void cmd_more(void)
fstrcat(rname,"\\");
slprintf(tmpname,
sizeof(fstring)-1,
- "%s/smbmore.%d",tmpdir(),(int)getpid());
+ "%s/smbmore.%d",tmpdir(),(int)sys_getpid());
fstrcpy(lname,tmpname);
if (!next_token(NULL,rname+strlen(rname),NULL,sizeof(rname)-strlen(rname))) {
@@ -1159,7 +1159,7 @@ static void cmd_mput(void)
FILE *f;
slprintf(tmpname,sizeof(pstring)-1,
- "%s/ls.smb.%d",tmpdir(),(int)getpid());
+ "%s/ls.smb.%d",tmpdir(),(int)sys_getpid());
if (recurse)
slprintf(cmd,sizeof(pstring)-1,
"find . -name \"%s\" -print > %s",p,tmpname);
@@ -1269,11 +1269,11 @@ static void cmd_print(void)
pstrcpy(rname,lname);
p = strrchr(rname,'/');
if (p) {
- slprintf(rname, sizeof(rname)-1, "%s-%d", p+1, (int)getpid());
+ slprintf(rname, sizeof(rname)-1, "%s-%d", p+1, (int)sys_getpid());
}
if (strequal(lname,"-")) {
- slprintf(rname, sizeof(rname)-1, "stdin-%d", (int)getpid());
+ slprintf(rname, sizeof(rname)-1, "stdin-%d", (int)sys_getpid());
}
do_put(rname, lname);
diff --git a/source/client/smbmount.c b/source/client/smbmount.c
index 18af824c1fd..ec3f32bd366 100644
--- a/source/client/smbmount.c
+++ b/source/client/smbmount.c
@@ -72,7 +72,7 @@ static void daemonize(void)
signal( SIGTERM, exit_parent );
- if ((child_pid = fork()) < 0) {
+ if ((child_pid = sys_fork()) < 0) {
fprintf(stderr,"could not fork\n");
}
@@ -437,7 +437,7 @@ static void init_mount(void)
args[i++] = xstrdup(tmp);
}
- if (fork() == 0) {
+ if (sys_fork() == 0) {
if (file_exist(BINDIR "/smbmnt", NULL)) {
execv(BINDIR "/smbmnt", args);
fprintf(stderr,"execv of %s failed. Error was %s.", BINDIR "/smbmnt", strerror(errno));