diff options
author | Andrew Tridgell <tridge@samba.org> | 1999-12-21 09:25:59 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1999-12-21 09:25:59 +0000 |
commit | 4e1291a83f61a72989045879763d9ef05fd38f71 (patch) | |
tree | 0711bf9c940e930c327f9a5a00d65dd6ec1a8ae9 /source3/smbd/connection.c | |
parent | 69d24d869bf97978b31a51fe8e8d08cac4874d67 (diff) | |
download | samba-4e1291a83f61a72989045879763d9ef05fd38f71.tar.gz samba-4e1291a83f61a72989045879763d9ef05fd38f71.tar.bz2 samba-4e1291a83f61a72989045879763d9ef05fd38f71.zip |
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/smbd/connection.c')
-rw-r--r-- | source3/smbd/connection.c | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/source3/smbd/connection.c b/source3/smbd/connection.c index f88d707983..5b5ab005c8 100644 --- a/source3/smbd/connection.c +++ b/source3/smbd/connection.c @@ -27,27 +27,6 @@ extern fstring remote_machine; extern int DEBUGLEVEL; /**************************************************************************** -open the connections database -****************************************************************************/ -TDB_CONTEXT *open_db(char *name) -{ - pstring fname; - - pstrcpy(fname,lp_lockdir()); - trim_string(fname,"","/"); - - if (!directory_exist(fname,NULL)) { - mkdir(fname,0755); - } - - pstrcat(fname,"/connections.tdb"); - - return tdb_open(fname, 0, O_RDWR | O_CREAT, 0644); -} - - - -/**************************************************************************** delete a connection record ****************************************************************************/ BOOL yield_connection(connection_struct *conn,char *name,int max_connections) @@ -56,7 +35,8 @@ BOOL yield_connection(connection_struct *conn,char *name,int max_connections) TDB_DATA kbuf; TDB_CONTEXT *tdb; - if (!(tdb = open_db(name))) return False; + tdb = tdb_open(lock_path("connections.tdb"), 0, O_RDWR | O_CREAT, 0644); + if (!tdb) return False; DEBUG(3,("Yielding connection to %s\n",name)); @@ -100,7 +80,8 @@ BOOL claim_connection(connection_struct *conn,char *name,int max_connections,BOO if (max_connections <= 0) return(True); - if (!(tdb = open_db(name))) return False; + tdb = tdb_open(lock_path("connections.tdb"), 0, O_RDWR | O_CREAT, 0644); + if (!tdb) return False; DEBUG(5,("claiming %s %d\n",name,max_connections)); |