summaryrefslogtreecommitdiff
path: root/source3/utils/status.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1999-12-21 09:25:59 +0000
committerAndrew Tridgell <tridge@samba.org>1999-12-21 09:25:59 +0000
commit4e1291a83f61a72989045879763d9ef05fd38f71 (patch)
tree0711bf9c940e930c327f9a5a00d65dd6ec1a8ae9 /source3/utils/status.c
parent69d24d869bf97978b31a51fe8e8d08cac4874d67 (diff)
downloadsamba-4e1291a83f61a72989045879763d9ef05fd38f71.tar.gz
converted all our existing shared memory code to use a tdb database
instead of either sysv or mmap shared memory or lock files. this means we can now completely remove locking_shm.c locking_slow.c shmem.c shmem_sysv.c and lots of other things also got simpler locking.c got a bit larger, but is much better compartmentalised now (This used to be commit e48c2d9937eea0667b8cd3332e49c06314ef31e7)
Diffstat (limited to 'source3/utils/status.c')
-rw-r--r--source3/utils/status.c33
1 files changed, 9 insertions, 24 deletions
diff --git a/source3/utils/status.c b/source3/utils/status.c
index 594783bd39e..8f3461c082b 100644
--- a/source3/utils/status.c
+++ b/source3/utils/status.c
@@ -165,7 +165,6 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
static pid_t last_pid;
struct session_record *ptr;
struct connections_data crec;
- static int doneone;
memcpy(&crec, dbuf.dptr, sizeof(crec));
@@ -176,13 +175,6 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
}
if (brief) {
- if (!doneone) {
- printf("\nSamba version %s\n",VERSION);
- printf("PID Username Machine Time logged in\n");
- printf("-------------------------------------------------------------------\n");
- doneone = 1;
- }
-
ptr=srecs;
while (ptr!=NULL) {
if ((ptr->pid==crec.pid)&&(strncmp(ptr->machine,crec.machine,30)==0)) {
@@ -203,13 +195,6 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
srecs=ptr;
}
} else {
- if (!doneone) {
- printf("\nSamba version %s\n",VERSION);
- printf("Service uid gid pid machine\n");
- printf("----------------------------------------------\n");
- doneone = 1;
- }
-
Ucrit_addPid(crec.pid);
if (processes_only) {
if (last_pid != crec.pid)
@@ -292,19 +277,13 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
if (verbose) {
printf("using configfile = %s\n", servicesf);
- printf("lockdir = %s\n", *lp_lockdir() ? lp_lockdir() : "NULL");
}
if (profile_only) {
return profile_dump();
}
- pstrcpy(fname,lp_lockdir());
- standard_sub_basic(fname);
- trim_string(fname,"","/");
- pstrcat(fname,"/connections.tdb");
-
- tdb = tdb_open(fname, 0, O_RDONLY, 0);
+ tdb = tdb_open(lock_path("connections.tdb"), 0, O_RDONLY, 0);
if (!tdb) {
printf("Couldn't open status file %s\n",fname);
if (!lp_status(-1))
@@ -316,6 +295,14 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
if (locks_only) goto locks;
+ printf("\nSamba version %s\n",VERSION);
+ if (brief) {
+ printf("PID Username Machine Time logged in\n");
+ printf("-------------------------------------------------------------------\n");
+ } else {
+ printf("Service uid gid pid machine\n");
+ printf("----------------------------------------------\n");
+ }
tdb_traverse(tdb, traverse_fn1);
locks:
@@ -347,8 +334,6 @@ static int traverse_fn1(TDB_CONTEXT *tdb, TDB_DATA kbuf, TDB_DATA dbuf)
printf("\n");
- share_status(stdout);
-
locking_end();
}