summaryrefslogtreecommitdiff
path: root/source3/lib
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/lib
parent55bd27935fe0bf31945d0137a1673499e7fcb1ad (diff)
downloadsamba-c0288e0612187ecbfc4a81d071fd504ea8737b7a.tar.gz
samba-c0288e0612187ecbfc4a81d071fd504ea8737b7a.tar.bz2
samba-c0288e0612187ecbfc4a81d071fd504ea8737b7a.zip
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/lib')
-rw-r--r--source3/lib/ctdbd_conn.c4
-rw-r--r--source3/lib/pidfile.c2
-rw-r--r--source3/lib/server_prefork.c4
-rw-r--r--source3/lib/smbldap.c4
-rw-r--r--source3/lib/smbrun.c4
-rw-r--r--source3/lib/substitute.c2
-rw-r--r--source3/lib/system.c2
-rw-r--r--source3/lib/tdb_validate.c2
-rw-r--r--source3/lib/util.c8
9 files changed, 16 insertions, 16 deletions
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;