mirror of
https://github.com/samba-team/samba.git
synced 2025-03-27 22:50:26 +03:00
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
This commit is contained in:
parent
55bd27935f
commit
c0288e0612
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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 */
|
||||
|
@ -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);
|
||||
|
@ -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)));
|
||||
|
@ -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));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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' :
|
||||
|
@ -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;
|
||||
|
@ -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"));
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)));
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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) ));
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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. */
|
||||
|
@ -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) {
|
||||
|
@ -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",
|
||||
|
@ -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",
|
||||
|
@ -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)));
|
||||
|
@ -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++;
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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)));
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
||||
/*
|
||||
|
@ -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",
|
||||
|
@ -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)));
|
||||
|
@ -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]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user