summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2012-03-24 20:17:08 +0100
committerJelmer Vernooij <jelmer@samba.org>2012-03-24 21:55:40 +0100
commitc0288e0612187ecbfc4a81d071fd504ea8737b7a (patch)
treed9928183d4eeca7c9aa55e4aabb91465fb72f09a /source3/smbd
parent55bd27935fe0bf31945d0137a1673499e7fcb1ad (diff)
downloadsamba-c0288e0612187ecbfc4a81d071fd504ea8737b7a.tar.gz
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 <jelmer@samba.org> Autobuild-Date: Sat Mar 24 21:55:41 CET 2012 on sn-devel-104
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/files.c2
-rw-r--r--source3/smbd/negprot.c28
-rw-r--r--source3/smbd/oplock_irix.c2
-rw-r--r--source3/smbd/process.c22
-rw-r--r--source3/smbd/server.c6
-rw-r--r--source3/smbd/service.c2
-rw-r--r--source3/smbd/session.c2
-rw-r--r--source3/smbd/utmp.c2
8 files changed, 33 insertions, 33 deletions
diff --git a/source3/smbd/files.c b/source3/smbd/files.c
index 6499a810ffc..e01a92e333d 100644
--- a/source3/smbd/files.c
+++ b/source3/smbd/files.c
@@ -60,7 +60,7 @@ NTSTATUS file_new(struct smb_request *req, connection_struct *conn,
increases the chance that the errant client will get an error rather
than causing corruption */
if (sconn->first_file == 0) {
- sconn->first_file = (sys_getpid() ^ (int)time(NULL));
+ sconn->first_file = (getpid() ^ (int)time(NULL));
sconn->first_file %= sconn->real_max_open_files;
}
diff --git a/source3/smbd/negprot.c b/source3/smbd/negprot.c
index e44ac5cb751..9ddafee657a 100644
--- a/source3/smbd/negprot.c
+++ b/source3/smbd/negprot.c
@@ -121,13 +121,13 @@ static void reply_lanman1(struct smb_request *req, uint16 choice)
set_Protocol(PROTOCOL_LANMAN1);
/* Reply, SMBlockread, SMBwritelock supported. */
- SCVAL(req->outbuf,smb_flg,FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
- SSVAL(req->outbuf,smb_vwv2,sconn->smb1.negprot.max_recv);
- SSVAL(req->outbuf,smb_vwv3,lp_maxmux()); /* maxmux */
- SSVAL(req->outbuf,smb_vwv4,1);
- SSVAL(req->outbuf,smb_vwv5,raw); /* tell redirector we support
+ SCVAL(req->outbuf,smb_flg, FLAG_REPLY|FLAG_SUPPORT_LOCKREAD);
+ SSVAL(req->outbuf,smb_vwv2, sconn->smb1.negprot.max_recv);
+ SSVAL(req->outbuf,smb_vwv3, lp_maxmux()); /* maxmux */
+ SSVAL(req->outbuf,smb_vwv4, 1);
+ SSVAL(req->outbuf,smb_vwv5, raw); /* tell redirector we support
readbraw writebraw (possibly) */
- SIVAL(req->outbuf,smb_vwv6,sys_getpid());
+ SIVAL(req->outbuf,smb_vwv6, getpid());
SSVAL(req->outbuf,smb_vwv10, set_server_zone_offset(t)/60);
srv_put_dos_date((char *)req->outbuf,smb_vwv8,t);
@@ -157,9 +157,9 @@ static void reply_lanman2(struct smb_request *req, uint16 choice)
reply_outbuf(req, 13, sconn->smb1.negprot.encrypted_passwords?8:0);
- SSVAL(req->outbuf,smb_vwv0,choice);
- SSVAL(req->outbuf,smb_vwv1,secword);
- SIVAL(req->outbuf,smb_vwv6,sys_getpid());
+ SSVAL(req->outbuf,smb_vwv0, choice);
+ SSVAL(req->outbuf,smb_vwv1, secword);
+ SIVAL(req->outbuf,smb_vwv6, getpid());
/* Create a token value and add it to the outgoing packet. */
if (sconn->smb1.negprot.encrypted_passwords) {
@@ -362,13 +362,13 @@ static void reply_nt1(struct smb_request *req, uint16 choice)
set_Protocol(PROTOCOL_NT1);
- SSVAL(req->outbuf,smb_vwv1+1,lp_maxmux()); /* maxmpx */
- SSVAL(req->outbuf,smb_vwv2+1,1); /* num vcs */
+ SSVAL(req->outbuf,smb_vwv1+1, lp_maxmux()); /* maxmpx */
+ SSVAL(req->outbuf,smb_vwv2+1, 1); /* num vcs */
SIVAL(req->outbuf,smb_vwv3+1,
sconn->smb1.negprot.max_recv); /* max buffer. LOTS! */
- SIVAL(req->outbuf,smb_vwv5+1,0x10000); /* raw size. full 64k */
- SIVAL(req->outbuf,smb_vwv7+1,sys_getpid()); /* session key */
- SIVAL(req->outbuf,smb_vwv9+1,capabilities); /* capabilities */
+ SIVAL(req->outbuf,smb_vwv5+1, 0x10000); /* raw size. full 64k */
+ SIVAL(req->outbuf,smb_vwv7+1, getpid()); /* session key */
+ SIVAL(req->outbuf,smb_vwv9+1, capabilities); /* capabilities */
clock_gettime(CLOCK_REALTIME,&ts);
put_long_date_timespec(TIMESTAMP_SET_NT_OR_BETTER,(char *)req->outbuf+smb_vwv11+1,ts);
SSVALS(req->outbuf,smb_vwv15+1,set_server_zone_offset(ts.tv_sec)/60);
diff --git a/source3/smbd/oplock_irix.c b/source3/smbd/oplock_irix.c
index 0bc964ffff6..2097945b975 100644
--- a/source3/smbd/oplock_irix.c
+++ b/source3/smbd/oplock_irix.c
@@ -50,7 +50,7 @@ static bool irix_oplocks_available(void)
tmpname = talloc_asprintf(ctx,
"%s/koplock.%d",
lp_lockdir(),
- (int)sys_getpid());
+ (int)getpid());
if (!tmpname) {
TALLOC_FREE(ctx);
return False;
diff --git a/source3/smbd/process.c b/source3/smbd/process.c
index defedf6d6ce..ed19e7f42bf 100644
--- a/source3/smbd/process.c
+++ b/source3/smbd/process.c
@@ -76,7 +76,7 @@ static bool smbd_lock_socket_internal(struct smbd_server_connection *sconn)
return true;
}
- DEBUG(10,("pid[%d] wait for socket lock\n", (int)sys_getpid()));
+ DEBUG(10,("pid[%d] wait for socket lock\n", (int)getpid()));
do {
ok = fcntl_lock(
@@ -89,7 +89,7 @@ static bool smbd_lock_socket_internal(struct smbd_server_connection *sconn)
return false;
}
- DEBUG(10,("pid[%d] got for socket lock\n", (int)sys_getpid()));
+ DEBUG(10,("pid[%d] got for socket lock\n", (int)getpid()));
return true;
}
@@ -126,7 +126,7 @@ static bool smbd_unlock_socket_internal(struct smbd_server_connection *sconn)
return false;
}
- DEBUG(10,("pid[%d] unlocked socket\n", (int)sys_getpid()));
+ DEBUG(10,("pid[%d] unlocked socket\n", (int)getpid()));
return true;
}
@@ -182,7 +182,7 @@ bool srv_send_smb(struct smbd_server_connection *sconn, char *buffer,
* client failed.
*/
DEBUG(1,("pid[%d] Error writing %d bytes to client %s. %d. (%s)\n",
- (int)sys_getpid(), (int)len,
+ (int)getpid(), (int)len,
get_peer_addr(sconn->sock, addr, sizeof(addr)),
(int)ret, strerror(errno) ));
@@ -1373,7 +1373,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req)
conn = req->conn;
DEBUG(3,("switch message %s (pid %d) conn 0x%lx\n", smb_fn_name(type),
- (int)sys_getpid(), (unsigned long)conn));
+ (int)getpid(), (unsigned long)conn));
smb_dump(smb_fn_name(type), 1, (const char *)req->inbuf);
@@ -2638,7 +2638,7 @@ static void smbd_echo_read_waited(struct tevent_req *subreq)
if (!fd_is_readable(sconn->sock)) {
DEBUG(10,("echo_handler[%d] the parent smbd was faster\n",
- (int)sys_getpid()));
+ (int)getpid()));
ok = smbd_unlock_socket_internal(sconn);
if (!ok) {
@@ -2667,7 +2667,7 @@ static void smbd_echo_read_waited(struct tevent_req *subreq)
if (tevent_req_nterror(req, status)) {
tevent_req_nterror(req, status);
DEBUG(1, ("echo_handler[%d]: receive_smb_raw_talloc failed: %s\n",
- (int)sys_getpid(), nt_errstr(status)));
+ (int)getpid(), nt_errstr(status)));
return;
}
@@ -2751,7 +2751,7 @@ static void smbd_echo_writer_done(struct tevent_req *req)
DEBUG(1, ("writev to parent failed: %s\n", strerror(err)));
exit(1);
}
- DEBUG(10,("echo_handler[%d]: forwarded pdu to main\n", (int)sys_getpid()));
+ DEBUG(10,("echo_handler[%d]: forwarded pdu to main\n", (int)getpid()));
smbd_echo_activate_writer(state);
}
@@ -2932,7 +2932,7 @@ static void smbd_echo_got_packet(struct tevent_req *req)
iov->iov_len = buflen;
DEBUG(10,("echo_handler[%d]: forward to main\n",
- (int)sys_getpid()));
+ (int)getpid()));
smbd_echo_activate_writer(state);
}
@@ -2965,7 +2965,7 @@ bool fork_echo_handler(struct smbd_server_connection *sconn)
goto fail;
}
- child = sys_fork();
+ child = fork();
if (child == 0) {
NTSTATUS status;
@@ -2987,7 +2987,7 @@ bool fork_echo_handler(struct smbd_server_connection *sconn)
listener_pipe[1] = -1;
sconn->smb1.echo_handler.trusted_fd = listener_pipe[0];
- DEBUG(10,("fork_echo_handler: main[%d] echo_child[%d]\n", (int)sys_getpid(), child));
+ DEBUG(10,("fork_echo_handler: main[%d] echo_child[%d]\n", (int)getpid(), child));
/*
* Without smb signing this is the same as the normal smbd
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index ef3f140f78e..d3bcc48893e 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -184,7 +184,7 @@ static void msg_inject_fault(struct messaging_context *msg,
procid_str_static(&src), sig));
#endif
- kill(sys_getpid(), sig);
+ kill(getpid(), sig);
}
#endif /* DEVELOPER */
@@ -484,7 +484,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
*/
unique_id = serverid_get_random_unique_id();
- pid = sys_fork();
+ pid = fork();
if (pid == 0) {
NTSTATUS status = NT_STATUS_OK;
@@ -545,7 +545,7 @@ static void smbd_accept_connection(struct tevent_context *ev,
}
if (pid < 0) {
- DEBUG(0,("smbd_accept_connection: sys_fork() failed: %s\n",
+ DEBUG(0,("smbd_accept_connection: fork() failed: %s\n",
strerror(errno)));
}
diff --git a/source3/smbd/service.c b/source3/smbd/service.c
index 867776571b2..c4d3486cdf6 100644
--- a/source3/smbd/service.c
+++ b/source3/smbd/service.c
@@ -874,7 +874,7 @@ static NTSTATUS make_connection_snum(struct smbd_server_connection *sconn,
dbgtext( "initially as user %s ",
conn->session_info->unix_info->unix_name );
dbgtext( "(uid=%d, gid=%d) ", (int)effuid, (int)effgid );
- dbgtext( "(pid %d)\n", (int)sys_getpid() );
+ dbgtext( "(pid %d)\n", (int)getpid() );
}
return status;
diff --git a/source3/smbd/session.c b/source3/smbd/session.c
index 1d89122ddd7..e03af1e0304 100644
--- a/source3/smbd/session.c
+++ b/source3/smbd/session.c
@@ -129,7 +129,7 @@ bool session_claim(struct smbd_server_connection *sconn, user_struct *vuser)
}
snprintf(sessionid.id_str, sizeof(sessionid.id_str),
- SESSION_TEMPLATE, (long unsigned int)sys_getpid(),
+ SESSION_TEMPLATE, (long unsigned int)getpid(),
vuser->vuid);
}
diff --git a/source3/smbd/utmp.c b/source3/smbd/utmp.c
index 6837c078cfe..34b77616b6a 100644
--- a/source3/smbd/utmp.c
+++ b/source3/smbd/utmp.c
@@ -528,7 +528,7 @@ static bool sys_utmp_fill(struct utmp *u,
utmp_strcpy(u->ut_line, id_str, sizeof(u->ut_line));
#if defined(HAVE_UT_UT_PID)
- u->ut_pid = sys_getpid();
+ u->ut_pid = getpid();
#endif
/*