semget man page on NetBSD

Man page or keyword search:  
man Server   9087 pages
apropos Keyword Search (all sections)
Output format
NetBSD logo
[printable version]

SEMGET(2)		    BSD System Calls Manual		     SEMGET(2)

NAME
     semget — get set of semaphores

LIBRARY
     Standard C Library (libc, -lc)

SYNOPSIS
     #include <sys/sem.h>

     int
     semget(key_t key, int nsems, int semflg);

DESCRIPTION
     The semget() system call returns the semaphore identifier associated with
     key.

     A new set containing nsems semaphores is created if either key is equal
     to IPC_PRIVATE, or key does not have a semaphore set associated with it
     and the IPC_CREAT bit is set in semflg.  If both the IPC_CREAT bit and
     the IPC_EXCL bit are set in semflg, and key has a semaphore set associ‐
     ated with it already, the operation will fail.

     If a new set of semaphores is created, the data structure associated with
     it (the semid_ds structure, see semctl(2)) is initialized as follows:

     ·	 sem_perm.cuid and sem_perm.uid are set to the effective uid of the
	 calling process.

     ·	 sem_perm.gid and sem_perm.cgid are set to the effective gid of the
	 calling process.

     ·	 sem_perm.mode is set to the lower 9 bits of semflg.

     ·	 sem_nsems is set to the value of nsems.

     ·	 sem_ctime is set to the current time.

     ·	 sem_otime is set to 0.

RETURN VALUES
     semget() returns a non-negative semaphore identifier if successful.  Oth‐
     erwise, -1 is returned and errno is set to reflect the error.

ERRORS
     [EACCES]		The caller has no permission to access a semaphore set
			already associated with key.

     [EEXIST]		Both IPC_CREAT and IPC_EXCL are set in semflg, and a
			semaphore set is already associated with key.

     [EINVAL]		nsems is less than 0 or greater than the system limit
			for the number in a semaphore set.

			A semaphore set associated with key exists, but has
			fewer semaphores than the number specified in nsems.

     [ENOSPC]		A new set of semaphores could not be created because
			the system limit for the number of semaphores or the
			number of semaphore sets has been reached.

     [ENOENT]		IPC_CREAT is not set in semflg and no semaphore set
			associated with key was found.

SEE ALSO
     ipcs(1), semctl(2), semop(2), ftok(3)

STANDARDS
     The semget system call conforms to X/Open System Interfaces and Headers
     Issue 5 (“XSH5”).

HISTORY
     Semaphores appeared in the first release of AT&T System V UNIX.

BSD				 May 13, 2004				   BSD
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server NetBSD

List of man pages available for NetBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net