Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Unusual semget() behaviour in FreeBSD

  • 27-10-2003 09:37PM
    #1
    Registered Users, Registered Users 2 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