Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Unusual semget() behaviour in FreeBSD

Options
  • 27-10-2003 9:37pm
    #1
    Registered Users Posts: 2,518 ✭✭✭


    I'm trying to use the semget() call in freebsd to create a semaphore but it keeps returning -1, with error number 28 (ENOSPC). This indicates the systems max. number of semaphores is being exceeded.

    Here's the offending code:
    ...snip snip...

    static struct sembuf op_lock[2]={0, 0, 0, 0, 1, 0};

    static struct sembuf op_unlock[1]={0, -1, IPC_NOWAIT};

    #define IPCPERMS 0644
    #define SEMID 888880

    int semid = -1;

    void lock_var(int count){

    if (semid < 0) {

    semid = semget(SEMID, 1, IPC_CREAT | IPCPERMS);
    if (semid < 0) {
    printf("\nError: %d Could not create semaphore\n", errno);
    }
    }

    I've tested this on linux (debian) with zero problems, is there some flaw in freebsds implementation of semaphores?


Comments

  • Closed Accounts Posts: 22 gerald


    - Check your kernel semaphores parameters.
    samples in /usr/src/sys/i386/conf/LINT

    - ipcs -a


Advertisement