Check for ENOSPC on shmget() failure
authorJens Axboe <axboe@kernel.dk>
Fri, 21 Sep 2012 13:05:45 +0000 (15:05 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 21 Sep 2012 13:05:45 +0000 (15:05 +0200)
We scale down the number of jobs based on EINVAL and ENOMEM,
but ENOSPC is a valid 'segment too big' error as well.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
init.c

diff --git a/init.c b/init.c
index da1f472..b3215f5 100644 (file)
--- a/init.c
+++ b/init.c
@@ -254,7 +254,7 @@ static int setup_thread_area(void)
                shm_id = shmget(0, size, IPC_CREAT | 0600);
                if (shm_id != -1)
                        break;
                shm_id = shmget(0, size, IPC_CREAT | 0600);
                if (shm_id != -1)
                        break;
-               if (errno != EINVAL && errno != ENOMEM) {
+               if (errno != EINVAL && errno != ENOMEM && errno != ENOSPC) {
                        perror("shmget");
                        break;
                }
                        perror("shmget");
                        break;
                }