diff options
49 files changed, 95 insertions, 136 deletions
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c index 4c1d29e5a7..92a75862bd 100644 --- a/lib/util/become_daemon.c +++ b/lib/util/become_daemon.c @@ -75,7 +75,7 @@ _PUBLIC_ void close_low_fds(bool stdin_too, bool stdout_too, bool stderr_too) _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout) { if (do_fork) { - if (sys_fork()) { + if (fork()) { _exit(0); } } diff --git a/lib/util/fault.c b/lib/util/fault.c index b3527bb22e..d0b34e540b 100644 --- a/lib/util/fault.c +++ b/lib/util/fault.c @@ -70,7 +70,7 @@ static void fault_report(int sig) counter++; DEBUGSEP(0); - DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)sys_getpid(),SAMBA_VERSION_STRING)); + DEBUG(0,("INTERNAL ERROR: Signal %d in pid %d (%s)",sig,(int)getpid(),SAMBA_VERSION_STRING)); DEBUG(0,("\nPlease read the Trouble-Shooting section of the Samba HOWTO\n")); DEBUGSEP(0); diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h index f989231102..6096722d17 100644 --- a/lib/util/samba_util.h +++ b/lib/util/samba_util.h @@ -113,16 +113,6 @@ void CatchChild(void); **/ void CatchChildLeaveStatus(void); -/** - * Wrapper for fork used to invalid pid cache. - **/ -_PUBLIC_ pid_t sys_fork(void); - -/** - * Wrapper for getpid. Ensures we only do a system call *once*. - **/ -_PUBLIC_ pid_t sys_getpid(void); - struct sockaddr; _PUBLIC_ int sys_getnameinfo(const struct sockaddr *psa, diff --git a/lib/util/system.c b/lib/util/system.c index f34fabd292..558aa5bc12 100644 --- a/lib/util/system.c +++ b/lib/util/system.c @@ -40,37 +40,6 @@ */ -/************************************************************************** - Wrapper for fork. Ensures we clear our pid cache. -****************************************************************************/ - -static pid_t mypid = (pid_t)-1; - -_PUBLIC_ pid_t sys_fork(void) -{ - pid_t forkret = fork(); - - if (forkret == (pid_t)0) { - /* Child - reset mypid so sys_getpid does a system call. */ - mypid = (pid_t) -1; - } - - return forkret; -} - -/************************************************************************** - Wrapper for getpid. Ensures we only do a system call *once*. -****************************************************************************/ - -_PUBLIC_ pid_t sys_getpid(void) -{ - if (mypid == (pid_t)-1) - mypid = getpid(); - - return mypid; -} - - _PUBLIC_ int sys_getnameinfo(const struct sockaddr *psa, int salen, char *host, diff --git a/source3/auth/pass_check.c b/source3/auth/pass_check.c index 74d6f1ffbc..ca99261678 100644 --- a/source3/auth/pass_check.c +++ b/source3/auth/pass_check.c @@ -378,7 +378,7 @@ static bool dfs_auth(char *user, char *password) } DEBUG(0, ("DCE login succeeded for principal %s on pid %d\n", - user, sys_getpid())); + user, getpid())); DEBUG(3, ("DCE principal: %s\n" " uid: %d\n" @@ -431,7 +431,7 @@ void dfs_unlogin(void) dce_error_inq_text(err, dce_errstr, &err2); DEBUG(0, ("DCE purge login context failed for server instance %d: %s\n", - sys_getpid(), dce_errstr)); + getpid(), dce_errstr)); } } #endif diff --git a/source3/client/client.c b/source3/client/client.c index 87ec3a9969..0d60103f26 100644 --- a/source3/client/client.c +++ b/source3/client/client.c @@ -2292,12 +2292,12 @@ static int cmd_print(void) rname = talloc_asprintf(ctx, "%s-%d", p+1, - (int)sys_getpid()); + (int)getpid()); } if (strequal(lname,"-")) { rname = talloc_asprintf(ctx, "stdin-%d", - (int)sys_getpid()); + (int)getpid()); } if (!rname) { return 1; diff --git a/source3/include/rpc_misc.h b/source3/include/rpc_misc.h index adc80167ca..a33406a917 100644 --- a/source3/include/rpc_misc.h +++ b/source3/include/rpc_misc.h @@ -28,8 +28,8 @@ **********************************************************************/ #define OUR_HANDLE(hnd) (((hnd)==NULL) ? "NULL" :\ - ( IVAL((hnd)->uuid.node,2) == (uint32)sys_getpid() ? "OURS" : \ + ( IVAL((hnd)->uuid.node,2) == (uint32)getpid() ? "OURS" : \ "OTHER")), ((unsigned int)IVAL((hnd)->uuid.node,2)),\ - ((unsigned int)sys_getpid() ) + ((unsigned int)getpid() ) #endif /* _RPC_MISC_H */ diff --git a/source3/lib/ctdbd_conn.c b/source3/lib/ctdbd_conn.c index 36e9e508f0..ba51137915 100644 --- a/source3/lib/ctdbd_conn.c +++ b/source3/lib/ctdbd_conn.c @@ -578,7 +578,7 @@ NTSTATUS ctdbd_messaging_connection(TALLOC_CTX *mem_ctx, return status; } - status = register_with_ctdbd(conn, (uint64_t)sys_getpid()); + status = register_with_ctdbd(conn, (uint64_t)getpid()); if (!NT_STATUS_IS_OK(status)) { goto fail; } @@ -665,7 +665,7 @@ static NTSTATUS ctdb_handle_message(uint8_t *buf, size_t length, } /* only messages to our pid or the broadcast are valid here */ - if (msg->srvid != sys_getpid() && msg->srvid != MSG_SRVID_SAMBA) { + if (msg->srvid != getpid() && msg->srvid != MSG_SRVID_SAMBA) { DEBUG(0,("Got unexpected message with srvid=%llu\n", (unsigned long long)msg->srvid)); TALLOC_FREE(buf); diff --git a/source3/lib/pidfile.c b/source3/lib/pidfile.c index 06fca91165..469ddbd95f 100644 --- a/source3/lib/pidfile.c +++ b/source3/lib/pidfile.c @@ -162,7 +162,7 @@ void pidfile_create(const char *program_name) } memset(buf, 0, sizeof(buf)); - slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int) sys_getpid()); + slprintf(buf, sizeof(buf) - 1, "%u\n", (unsigned int)getpid()); if (write(fd, buf, strlen(buf)) != (ssize_t)strlen(buf)) { DEBUG(0,("ERROR: can't write to file %s: %s\n", pidFile_name, strerror(errno))); diff --git a/source3/lib/server_prefork.c b/source3/lib/server_prefork.c index f9df91417c..3d35e1c6ca 100644 --- a/source3/lib/server_prefork.c +++ b/source3/lib/server_prefork.c @@ -106,7 +106,7 @@ bool prefork_create_pool(TALLOC_CTX *mem_ctx, pfp->pool[i].allowed_clients = 1; pfp->pool[i].started = now; - pid = sys_fork(); + pid = fork(); switch (pid) { case -1: DEBUG(1, ("Failed to prefork child n. %d !\n", i)); @@ -194,7 +194,7 @@ int prefork_add_children(struct tevent_context *ev_ctx, pfp->pool[i].allowed_clients = 1; pfp->pool[i].started = now; - pid = sys_fork(); + pid = fork(); switch (pid) { case -1: DEBUG(1, ("Failed to prefork child n. %d !\n", j)); diff --git a/source3/lib/smbldap.c b/source3/lib/smbldap.c index 51bcabd5eb..c01d3fdc69 100644 --- a/source3/lib/smbldap.c +++ b/source3/lib/smbldap.c @@ -1070,7 +1070,7 @@ static int smbldap_open(struct smbldap_state *ldap_state) ldap_state->last_ping = time_mono(NULL); - ldap_state->pid = sys_getpid(); + ldap_state->pid = getpid(); TALLOC_FREE(ldap_state->idle_event); @@ -1157,7 +1157,7 @@ static void setup_ldap_local_alarm(struct smbldap_state *ldap_state, time_t abso alarm(absolute_endtime - now); } - if (ldap_state->pid != sys_getpid()) { + if (ldap_state->pid != getpid()) { smbldap_close(ldap_state); } } diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c index 75713d2aa2..b38dee1665 100644 --- a/source3/lib/smbrun.c +++ b/source3/lib/smbrun.c @@ -92,7 +92,7 @@ static int smbrun_internal(const char *cmd, int *outfd, bool sanitize) CatchChildLeaveStatus(); - if ((pid=sys_fork()) < 0) { + if ((pid=fork()) < 0) { DEBUG(0,("smbrun: fork failed with error %s\n", strerror(errno) )); CatchChild(); if (outfd) { @@ -255,7 +255,7 @@ int smbrunsecret(const char *cmd, const char *secret) CatchChildLeaveStatus(); - if ((pid=sys_fork()) < 0) { + if ((pid=fork()) < 0) { DEBUG(0, ("smbrunsecret: fork failed with error %s\n", strerror(errno))); CatchChild(); return errno; diff --git a/source3/lib/substitute.c b/source3/lib/substitute.c index 08cc03eeb2..44582860a1 100644 --- a/source3/lib/substitute.c +++ b/source3/lib/substitute.c @@ -549,7 +549,7 @@ char *talloc_sub_basic(TALLOC_CTX *mem_ctx, get_remote_arch_str()); break; case 'd' : - slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)sys_getpid()); + slprintf(pidstr,sizeof(pidstr)-1, "%d",(int)getpid()); a_string = realloc_string_sub(a_string, "%d", pidstr); break; case 'h' : diff --git a/source3/lib/system.c b/source3/lib/system.c index f6558530f3..92e244fdbe 100644 --- a/source3/lib/system.c +++ b/source3/lib/system.c @@ -1404,7 +1404,7 @@ int sys_popen(const char *command) if(!(argl = extract_args(NULL, command))) goto err_exit; - entry->child_pid = sys_fork(); + entry->child_pid = fork(); if (entry->child_pid == -1) { goto err_exit; diff --git a/source3/lib/tdb_validate.c b/source3/lib/tdb_validate.c index 385f4d0ef8..e4f752023d 100644 --- a/source3/lib/tdb_validate.c +++ b/source3/lib/tdb_validate.c @@ -118,7 +118,7 @@ int tdb_validate(struct tdb_context *tdb, tdb_validate_data_func validate_fn) * just let the child panic. we catch the signal. */ DEBUG(10, ("tdb_validate: forking to let child do validation.\n")); - child_pid = sys_fork(); + child_pid = fork(); if (child_pid == 0) { /* child code */ DEBUG(10, ("tdb_validate (validation child): created\n")); diff --git a/source3/lib/util.c b/source3/lib/util.c index 9d3d787d63..7be056c68b 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -860,7 +860,7 @@ void smb_panic_s3(const char *why) int result; DEBUG(0,("PANIC (pid %llu): %s\n", - (unsigned long long)sys_getpid(), why)); + (unsigned long long)getpid(), why)); log_stack_trace(); #if defined(HAVE_PRCTL) && defined(PR_SET_PTRACER) @@ -1985,7 +1985,7 @@ static uint32 my_vnn = NONCLUSTER_VNN; void set_my_vnn(uint32 vnn) { - DEBUG(10, ("vnn pid %d = %u\n", (int)sys_getpid(), (unsigned int)vnn)); + DEBUG(10, ("vnn pid %d = %u\n", (int)getpid(), (unsigned int)vnn)); my_vnn = vnn; } @@ -2013,7 +2013,7 @@ struct server_id pid_to_procid(pid_t pid) struct server_id procid_self(void) { - return pid_to_procid(sys_getpid()); + return pid_to_procid(getpid()); } bool procid_equal(const struct server_id *p1, const struct server_id *p2) @@ -2035,7 +2035,7 @@ bool cluster_id_equal(const struct server_id *id1, bool procid_is_me(const struct server_id *pid) { - if (pid->pid != sys_getpid()) + if (pid->pid != getpid()) return False; if (pid->task_id != 0) return False; diff --git a/source3/libsmb/clientgen.c b/source3/libsmb/clientgen.c index 26fbd19616..75948b8e99 100644 --- a/source3/libsmb/clientgen.c +++ b/source3/libsmb/clientgen.c @@ -271,7 +271,7 @@ struct cli_state *cli_state_create(TALLOC_CTX *mem_ctx, goto error; } - cli->smb1.pid = (uint16_t)sys_getpid(); + cli->smb1.pid = (uint16_t)getpid(); cli->smb1.vc_num = cli->smb1.pid; cli->smb1.tid = UINT16_MAX; cli->smb1.uid = UID_FIELD_INVALID; diff --git a/source3/libsmb/libsmb_context.c b/source3/libsmb/libsmb_context.c index 6c78cb93d7..a8fd2dc45e 100644 --- a/source3/libsmb/libsmb_context.c +++ b/source3/libsmb/libsmb_context.c @@ -604,7 +604,7 @@ smbc_init_context(SMBCCTX *context) * Hmmm, I want to get hostname as well, but I am too * lazy for the moment */ - pid = sys_getpid(); + pid = getpid(); netbios_name = (char *)SMB_MALLOC(17); if (!netbios_name) { errno = ENOMEM; diff --git a/source3/modules/vfs_aio_fork.c b/source3/modules/vfs_aio_fork.c index bcd7c6ae2d..27f71165cf 100644 --- a/source3/modules/vfs_aio_fork.c +++ b/source3/modules/vfs_aio_fork.c @@ -500,7 +500,7 @@ static NTSTATUS create_aio_child(struct smbd_server_connection *sconn, goto fail; } - result->pid = sys_fork(); + result->pid = fork(); if (result->pid == -1) { status = map_nt_error_from_unix(errno); DEBUG(0, ("fork failed: %s\n", strerror(errno))); diff --git a/source3/modules/vfs_notify_fam.c b/source3/modules/vfs_notify_fam.c index 8a3487b9d3..7ac6609c53 100644 --- a/source3/modules/vfs_notify_fam.c +++ b/source3/modules/vfs_notify_fam.c @@ -87,7 +87,7 @@ static NTSTATUS fam_open_connection(FAMConnection *fam_conn, setenv("GAM_CLIENT_ID","SAMBA",0); #endif - if (asprintf(&name, "smbd (%lu)", (unsigned long)sys_getpid()) == -1) { + if (asprintf(&name, "smbd (%lu)", (unsigned long)getpid()) == -1) { DEBUG(0, ("No memory\n")); return NT_STATUS_NO_MEMORY; } diff --git a/source3/modules/vfs_preopen.c b/source3/modules/vfs_preopen.c index 3d7f6c1b03..3540d34c4f 100644 --- a/source3/modules/vfs_preopen.c +++ b/source3/modules/vfs_preopen.c @@ -224,7 +224,7 @@ static NTSTATUS preopen_init_helper(struct preopen_helper *h) return status; } - h->pid = sys_fork(); + h->pid = fork(); if (h->pid == -1) { return map_nt_error_from_unix(errno); diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c index a42ad25c20..90340efe39 100644 --- a/source3/nmbd/asyncdns.c +++ b/source3/nmbd/asyncdns.c @@ -147,7 +147,7 @@ void start_async_dns(struct messaging_context *msg) return; } - child_pid = sys_fork(); + child_pid = fork(); if (child_pid) { fd_in = fd1[0]; diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index eff1eca2f1..bb264d2274 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -830,7 +830,7 @@ static bool open_sockets(bool isdaemon, int port) StartupTime = time(NULL); - sys_srandom(time(NULL) ^ sys_getpid()); + sys_srandom(time(NULL) ^ getpid()); if (!override_logfile) { char *lfile = NULL; diff --git a/source3/nmbd/nmbd_packets.c b/source3/nmbd/nmbd_packets.c index f8bfe45c85..7a707a045b 100644 --- a/source3/nmbd/nmbd_packets.c +++ b/source3/nmbd/nmbd_packets.c @@ -150,7 +150,7 @@ static uint16 name_trn_id=0; static uint16 generate_name_trn_id(void) { if (!name_trn_id) { - name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)sys_getpid()%(unsigned)100); + name_trn_id = ((unsigned)time(NULL)%(unsigned)0x7FFF) + ((unsigned)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 1adccbd7d3..20ece6915a 100644 --- a/source3/nmbd/nmbd_synclists.c +++ b/source3/nmbd/nmbd_synclists.c @@ -167,7 +167,7 @@ done: /* the parent forks and returns, leaving the child to do the actual sync and call END_PROFILE*/ CatchChild(); - if ((s->pid = sys_fork())) return; + if ((s->pid = fork())) return; BlockSignals( False, SIGTERM ); diff --git a/source3/nmbd/nmbd_winsserver.c b/source3/nmbd/nmbd_winsserver.c index 48c10e25ae..0a06ebea66 100644 --- a/source3/nmbd/nmbd_winsserver.c +++ b/source3/nmbd/nmbd_winsserver.c @@ -2470,7 +2470,7 @@ void wins_write_database(time_t t, bool background) /* We will do the writing in a child process to ensure that the parent doesn't block while this is done */ if (background) { CatchChild(); - if (sys_fork()) { + if (fork()) { return; } if (tdb_reopen(wins_tdb)) { @@ -2487,7 +2487,7 @@ void wins_write_database(time_t t, bool background) /* This is safe as the 0 length means "don't expand". */ all_string_sub(fname,"//", "/", 0); - if (asprintf(&fnamenew, "%s.%u", fname, (unsigned int)sys_getpid()) < 0) { + if (asprintf(&fnamenew, "%s.%u", fname, (unsigned int)getpid()) < 0) { goto err_exit; } diff --git a/source3/passdb/pdb_smbpasswd.c b/source3/passdb/pdb_smbpasswd.c index 6dbb72a577..4d5bed4e10 100644 --- a/source3/passdb/pdb_smbpasswd.c +++ b/source3/passdb/pdb_smbpasswd.c @@ -1095,7 +1095,7 @@ static bool del_smbfilepwd_entry(struct smbpasswd_privates *smbpasswd_state, con pfile2 = talloc_asprintf(talloc_tos(), "%s.%u", - pfile, (unsigned)sys_getpid()); + pfile, (unsigned)getpid()); if (!pfile2) { return false; } diff --git a/source3/passdb/secrets.c b/source3/passdb/secrets.c index 94e514d218..33a266c2af 100644 --- a/source3/passdb/secrets.c +++ b/source3/passdb/secrets.c @@ -47,7 +47,7 @@ static struct db_context *db_ctx; */ static void get_rand_seed(void *userdata, int *new_seed) { - *new_seed = sys_getpid(); + *new_seed = getpid(); if (db_ctx) { dbwrap_trans_change_int32_atomic(db_ctx, "INFO/random_seed", new_seed, 1); diff --git a/source3/printing/print_cups.c b/source3/printing/print_cups.c index 95ddd570bb..79b146c076 100644 --- a/source3/printing/print_cups.c +++ b/source3/printing/print_cups.c @@ -411,7 +411,7 @@ static bool cups_pcap_load_async(struct tevent_context *ev, return false; } - pid = sys_fork(); + pid = fork(); if (pid == (pid_t)-1) { DEBUG(10,("cups_pcap_load_async: fork failed %s\n", strerror(errno) )); diff --git a/source3/printing/printing.c b/source3/printing/printing.c index f3a9a9a253..0d943a38df 100644 --- a/source3/printing/printing.c +++ b/source3/printing/printing.c @@ -1111,7 +1111,7 @@ static void set_updating_pid(const fstring sharename, bool updating) fstring keystr; TDB_DATA key; TDB_DATA data; - pid_t updating_pid = sys_getpid(); + pid_t updating_pid = getpid(); uint8 buffer[4]; struct tdb_print_db *pdb = get_print_db_byname(sharename); @@ -1752,7 +1752,7 @@ bool print_notify_register_pid(int snum) struct tdb_print_db *pdb = NULL; TDB_CONTEXT *tdb = NULL; const char *printername; - uint32 mypid = (uint32)sys_getpid(); + uint32_t mypid = (uint32_t)getpid(); bool ret = False; size_t i; @@ -1843,7 +1843,7 @@ bool print_notify_deregister_pid(int snum) struct tdb_print_db *pdb = NULL; TDB_CONTEXT *tdb = NULL; const char *printername; - uint32 mypid = (uint32)sys_getpid(); + uint32_t mypid = (uint32_t)getpid(); size_t i; bool ret = False; @@ -1948,7 +1948,7 @@ bool print_job_exists(const char* sharename, uint32 jobid) char *print_job_fname(const char* sharename, uint32 jobid) { struct printjob *pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->spooled || pjob->pid != sys_getpid()) + if (!pjob || pjob->spooled || pjob->pid != getpid()) return NULL; return pjob->filename; } @@ -1981,7 +1981,7 @@ bool print_job_set_name(struct tevent_context *ev, struct printjob *pjob; pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->pid != sys_getpid()) + if (!pjob || pjob->pid != getpid()) return False; fstrcpy(pjob->jobname, name); @@ -1997,7 +1997,7 @@ bool print_job_get_name(TALLOC_CTX *mem_ctx, const char *sharename, uint32_t job struct printjob *pjob; pjob = print_job_find(sharename, jobid); - if (!pjob || pjob->pid != sys_getpid()) { + if (!pjob || pjob->pid != getpid()) { return false; } @@ -2361,7 +2361,7 @@ ssize_t print_job_write(struct tevent_context *ev, if (!pjob) return -1; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != sys_getpid()) + if (pjob->pid != getpid()) return -1; /* if SMBD is spooling this can't be allowed */ @@ -2720,7 +2720,7 @@ WERROR print_job_start(const struct auth_session_info *server_info, ZERO_STRUCT(pjob); - pjob.pid = sys_getpid(); + pjob.pid = getpid(); pjob.sysjob = -1; pjob.fd = -1; pjob.starttime = time(NULL); @@ -2788,7 +2788,7 @@ void print_job_endpage(struct messaging_context *msg_ctx, if (!pjob) return; /* don't allow another process to get this info - it is meaningless */ - if (pjob->pid != sys_getpid()) + if (pjob->pid != getpid()) return; pjob->page_count++; @@ -2817,7 +2817,7 @@ NTSTATUS print_job_end(struct messaging_context *msg_ctx, int snum, return NT_STATUS_PRINT_CANCELLED; } - if (pjob->spooled || pjob->pid != sys_getpid()) { + if (pjob->spooled || pjob->pid != getpid()) { return NT_STATUS_ACCESS_DENIED; } diff --git a/source3/printing/printing_db.c b/source3/printing/printing_db.c index a3e10659d6..ecb8ff6463 100644 --- a/source3/printing/printing_db.c +++ b/source3/printing/printing_db.c @@ -193,7 +193,7 @@ TDB_DATA get_printer_notify_pid_list(struct tdb_context *tdb, const char *printe for( i = 0; i < data.dsize; i += 8) { pid_t pid = (pid_t)IVAL(data.dptr, i); - if (pid == sys_getpid()) + if (pid == getpid()) continue; /* Entry is dead if process doesn't exist or refcount is zero. */ diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index de41f8916d..6e50f5f4ff 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -244,7 +244,7 @@ pid_t start_background_queue(struct tevent_context *ev, BlockSignals(true, SIGTERM); BlockSignals(true, SIGHUP); - pid = sys_fork(); + pid = fork(); /* parent or error */ if (pid != 0) { diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index 5775505160..f4bba76bc7 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -644,7 +644,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx, BlockSignals(true, SIGTERM); BlockSignals(true, SIGHUP); - pid = sys_fork(); + pid = fork(); if (pid == -1) { DEBUG(0, ("Failed to fork SPOOLSS [%s]\n", diff --git a/source3/rpc_server/epmd.c b/source3/rpc_server/epmd.c index c28d8574c0..46b5c52bb7 100644 --- a/source3/rpc_server/epmd.c +++ b/source3/rpc_server/epmd.c @@ -146,7 +146,7 @@ void start_epmd(struct tevent_context *ev_ctx, DEBUG(1, ("Forking Endpoint Mapper Daemon\n")); - pid = sys_fork(); + pid = fork(); if (pid == -1) { DEBUG(0, ("Failed to fork Endpoint Mapper [%s], aborting ...\n", diff --git a/source3/rpc_server/lsasd.c b/source3/rpc_server/lsasd.c index ad184d89c9..6608d6ba33 100644 --- a/source3/rpc_server/lsasd.c +++ b/source3/rpc_server/lsasd.c @@ -858,7 +858,7 @@ void start_lsasd(struct tevent_context *ev_ctx, BlockSignals(true, SIGTERM); BlockSignals(true, SIGHUP); - pid = sys_fork(); + pid = fork(); if (pid == -1) { DEBUG(0, ("Failed to fork LSASD [%s], aborting ...\n", strerror(errno))); diff --git a/source3/rpc_server/rpc_handles.c b/source3/rpc_server/rpc_handles.c index f98b2355fc..d0b9777f6f 100644 --- a/source3/rpc_server/rpc_handles.c +++ b/source3/rpc_server/rpc_handles.c @@ -292,7 +292,7 @@ static struct dcesrv_handle *create_rpc_handle_internal(struct pipes_struct *p, /* something random */ SSVAL(rpc_hnd->wire_handle.uuid.node, 0, t); /* something more random */ - SIVAL(rpc_hnd->wire_handle.uuid.node, 2, sys_getpid()); + SIVAL(rpc_hnd->wire_handle.uuid.node, 2, getpid()); DLIST_ADD(p->pipe_handles->handles, rpc_hnd); p->pipe_handles->count++; diff --git a/source3/rpc_server/samr/srv_samr_chgpasswd.c b/source3/rpc_server/samr/srv_samr_chgpasswd.c index 083b048afe..1e8b14ead7 100644 --- a/source3/rpc_server/samr/srv_samr_chgpasswd.c +++ b/source3/rpc_server/samr/srv_samr_chgpasswd.c @@ -405,7 +405,7 @@ static bool chat_with_program(char *passwordprogram, const struct passwd *pass, CatchChildLeaveStatus(); - if ((pid = sys_fork()) < 0) { + if ((pid = fork()) < 0) { DEBUG(3, ("chat_with_program: Cannot fork() child for password change: %s\n", pass->pw_name)); SAFE_FREE(slavedev); close(master); diff --git a/source3/rpc_server/svcctl/srv_svcctl_nt.c b/source3/rpc_server/svcctl/srv_svcctl_nt.c index 37cfc46d58..74c55ab521 100644 --- a/source3/rpc_server/svcctl/srv_svcctl_nt.c +++ b/source3/rpc_server/svcctl/srv_svcctl_nt.c @@ -637,7 +637,7 @@ WERROR _svcctl_QueryServiceStatusEx(struct pipes_struct *p, /* Get the status of the service.. */ info->ops->service_status( info->name, &svc_stat_proc.status ); - svc_stat_proc.process_id = sys_getpid(); + svc_stat_proc.process_id = getpid(); svc_stat_proc.service_flags = 0x0; ndr_err = ndr_push_struct_blob(&blob, p->mem_ctx, &svc_stat_proc, diff --git a/source3/smbd/files.c b/source3/smbd/files.c index 6499a810ff..e01a92e333 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 e44ac5cb75..9ddafee657 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 0bc964ffff..2097945b97 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 defedf6d6c..ed19e7f42b 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 ef3f140f78..d3bcc48893 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 867776571b..c4d3486cdf 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 1d89122ddd..e03af1e030 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 6837c078cf..34b77616b6 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 /* diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index 66e53d9cae..a3b21425a0 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -431,7 +431,7 @@ static void winbind_msg_validate_cache(struct messaging_context *msg_ctx, * so we don't block the main winbindd and the validation * code can safely use fork/waitpid... */ - child_pid = sys_fork(); + child_pid = fork(); if (child_pid == -1) { DEBUG(1, ("winbind_msg_validate_cache: Could not fork: %s\n", diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 020a092f29..edd50d12bc 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -188,7 +188,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) struct dc_name_ip *dcs = NULL; int num_dcs = 0; TALLOC_CTX *mem_ctx = NULL; - pid_t parent_pid = sys_getpid(); + pid_t parent_pid = getpid(); char *lfile = NULL; NTSTATUS status; @@ -206,7 +206,7 @@ static bool fork_child_dc_connect(struct winbindd_domain *domain) domain->dc_probe_pid = (pid_t)-1; } - domain->dc_probe_pid = sys_fork(); + domain->dc_probe_pid = fork(); if (domain->dc_probe_pid == (pid_t)-1) { DEBUG(0, ("fork_child_dc_connect: Could not fork: %s\n", strerror(errno))); diff --git a/source3/winbindd/winbindd_dual.c b/source3/winbindd/winbindd_dual.c index f11dae7e08..4eef550b4b 100644 --- a/source3/winbindd/winbindd_dual.c +++ b/source3/winbindd/winbindd_dual.c @@ -1312,11 +1312,11 @@ static bool fork_domain_child(struct winbindd_child *child) } ZERO_STRUCT(state); - state.pid = sys_getpid(); + state.pid = getpid(); state.request = &request; state.response = &response; - child->pid = sys_fork(); + child->pid = fork(); if (child->pid == -1) { DEBUG(0, ("Could not fork: %s\n", strerror(errno))); @@ -1353,7 +1353,7 @@ static bool fork_domain_child(struct winbindd_child *child) /* Child */ child_domain = child->domain; - DEBUG(10, ("Child process %d\n", (int)sys_getpid())); + DEBUG(10, ("Child process %d\n", (int)getpid())); state.sock = fdpair[0]; close(fdpair[1]); |