summaryrefslogtreecommitdiff
path: root/source3/locking
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-08-03 19:07:55 +0000
committerJeremy Allison <jra@samba.org>1998-08-03 19:07:55 +0000
commit7448091da6ee11709b8e5117ff6810515567f88a (patch)
tree3fd35134c9636b00e3737e718a0cb04eaf902064 /source3/locking
parent103857e8e33c724805baf5283335dc4e3901f007 (diff)
downloadsamba-7448091da6ee11709b8e5117ff6810515567f88a.tar.gz
samba-7448091da6ee11709b8e5117ff6810515567f88a.tar.bz2
samba-7448091da6ee11709b8e5117ff6810515567f88a.zip
First implementation of ChangeNotify - this version only checks
for changes in the directory modify timestamps. A better version will look at the requested client flags, and create a hash that represents the current state of the directory, and check against this instead. debug.c: Added lp_timestamp_logs() function. loadparm.c: Added "change notify timeout" in seconds (default 60) - this is the scan rate for a directory. Added ""timestamp logs" boolean - default True. Turns off log timestamps (so I can read them :-). nttrans.c: ChangeNotify implementation. server.c: ChangeNotify implementation. shmem_sysv.c: Added exits on shmem errors (without them smbd can core dump if some calls fail). smb.h: Added ChangeNotify flags for future use. util.c: Tidied up typedef. Jeremy. (This used to be commit a0748c3f53974483680ebe2ea4f556ece8d7fa43)
Diffstat (limited to 'source3/locking')
-rw-r--r--source3/locking/shmem_sysv.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/source3/locking/shmem_sysv.c b/source3/locking/shmem_sysv.c
index 0809e0546f..b8b9c2cb45 100644
--- a/source3/locking/shmem_sysv.c
+++ b/source3/locking/shmem_sysv.c
@@ -572,7 +572,8 @@ struct shmem_ops *sysv_shm_open(int ronly)
su.val = 1;
for (i=0;i<hash_size+1;i++) {
if (semctl(sem_id, i, SETVAL, su) != 0) {
- DEBUG(1,("Failed to init semaphore %d\n", i));
+ DEBUG(1,("Failed to init semaphore %d. Error was %s\n",
+ i, strerror(errno)));
}
}
}
@@ -581,14 +582,16 @@ struct shmem_ops *sysv_shm_open(int ronly)
sem_id = semget(SEMAPHORE_KEY, 0, 0);
}
if (sem_id == -1) {
- DEBUG(0,("Can't create or use semaphore %s\n",
+ DEBUG(0,("Can't create or use semaphore.Error was %s\n",
strerror(errno)));
return NULL;
}
su.buf = &sem_ds;
if (semctl(sem_id, 0, IPC_STAT, su) != 0) {
- DEBUG(0,("ERROR shm_open : can't IPC_STAT\n"));
+ DEBUG(0,("ERROR semctl: can't IPC_STAT. Error was %s\n",
+ strerror(errno)));
+ return NULL;
}
hash_size = sem_ds.sem_nsems-1;
@@ -604,18 +607,18 @@ struct shmem_ops *sysv_shm_open(int ronly)
pid));
su.val = 1;
if (semctl(sem_id, 0, SETVAL, su) != 0) {
- DEBUG(0,("ERROR: Failed to clear global lock\n"));
+ DEBUG(0,("ERROR: Failed to clear global lock. Error was %s\n",
+ strerror(errno)));
}
}
sem_ds.sem_perm.mode = SEMAPHORE_PERMS;
if (semctl(sem_id, 0, IPC_SET, su) != 0) {
- DEBUG(0,("ERROR shm_open : can't IPC_SET\n"));
+ DEBUG(0,("ERROR shmctl : can't IPC_SET. Error was %s\n",
+ strerror(errno)));
}
}
-
-
if (!global_lock())
return NULL;
@@ -627,7 +630,8 @@ struct shmem_ops *sysv_shm_open(int ronly)
i, pid));
su.val = 1;
if (semctl(sem_id, i, SETVAL, su) != 0) {
- DEBUG(0,("ERROR: Failed to clear IPC lock %d\n", i));
+ DEBUG(0,("ERROR: Failed to clear IPC lock %d. Error was %s\n",
+ i, strerror(errno)));
}
}
}
@@ -674,7 +678,7 @@ struct shmem_ops *sysv_shm_open(int ronly)
we use a registration file containing the processids of the file
mapping processes */
if (shmctl(shm_id, IPC_STAT, &shm_ds) != 0) {
- DEBUG(0,("ERROR shm_open : can't IPC_STAT. Error was %s\n", strerror(errno)));
+ DEBUG(0,("ERROR shmctl : can't IPC_STAT. Error was %s\n", strerror(errno)));
}
if (!read_only) {