mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
- handle ENOSPC in shmem init.
- be a little bit more friendly about grabbing semaphores
This commit is contained in:
parent
90b8675b88
commit
87f8870893
@ -557,8 +557,9 @@ struct shmem_ops *sysv_shm_open(int ronly)
|
|||||||
while (hash_size > 1) {
|
while (hash_size > 1) {
|
||||||
sem_id = semget(SEMAPHORE_KEY, hash_size+1,
|
sem_id = semget(SEMAPHORE_KEY, hash_size+1,
|
||||||
IPC_CREAT|IPC_EXCL| SEMAPHORE_PERMS);
|
IPC_CREAT|IPC_EXCL| SEMAPHORE_PERMS);
|
||||||
if (sem_id != -1 || errno != EINVAL) break;
|
if (sem_id != -1 ||
|
||||||
hash_size--;
|
(errno != EINVAL && errno != ENOSPC)) break;
|
||||||
|
hash_size -= 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sem_id == -1) {
|
if (sem_id == -1) {
|
||||||
@ -639,8 +640,9 @@ struct shmem_ops *sysv_shm_open(int ronly)
|
|||||||
while (shm_size > MIN_SHM_SIZE) {
|
while (shm_size > MIN_SHM_SIZE) {
|
||||||
shm_id = shmget(SHMEM_KEY, shm_size,
|
shm_id = shmget(SHMEM_KEY, shm_size,
|
||||||
IPC_CREAT | IPC_EXCL | IPC_PERMS);
|
IPC_CREAT | IPC_EXCL | IPC_PERMS);
|
||||||
if (shm_id != -1 || errno != EINVAL) break;
|
if (shm_id != -1 ||
|
||||||
shm_size *= 0.9;
|
(errno != EINVAL && errno != ENOSPC)) break;
|
||||||
|
shm_size *= 0.8;
|
||||||
}
|
}
|
||||||
created_new = (shm_id != -1);
|
created_new = (shm_id != -1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user