Home
Search all pages
Subjects
By activity
Professions, Sciences, Humanities, Business, ...
User Interface
Text-based, GUI, Audio, Video, Keyboards, Mouse, Images,...
Text Strings
Conversions, tests, processing, manipulation,...
Math
Integer, Floating point, Matrix, Statistics, Boolean, ...
Processing
Algorithms, Memory, Process control, Debugging, ...
Stored Data
Data storage, Integrity, Encryption, Compression, ...
Communications
Networks, protocols, Interprocess, Remote, Client Server, ...
Hard World Timing, Calendar and Clock, Audio, Video, Printer, Controls...
File System
Management, Filtering, File & Directory access, Viewers, ...
|
|
|
RocketLink!--> Man page versions:
OpenBSD
FreeBSD
NetBSD
RedHat
Solaris
Others
SEMGET(2) OpenBSD Programmer's Manual SEMGET(2)
NAME
semget - get semaphore set
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#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.
The access modes of the created semaphores is specified in semflg by
OR'ing the following values:
SEM_A alter permission for owner
SEM_R read permission for owner
SEM_A >> 3 alter permission for group
SEM_R >> 3 read permission for group
SEM_A >> 6 alter permission for other
SEM_R >> 6 read permission for other
If a new set of semaphores is created, the data structure associated with
it (the semid_ds structure, see semctl(2)) is intialized 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 al-
ready 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 was not set in semflg and no semaphore set asso-
ciated with key was found.
SEE ALSO
semctl(2), semop(2)
OpenBSD 2.6 August 17, 1995 2
Source: OpenBSD 2.6 man pages. Copyright: Portions are copyrighted by BERKELEY SOFTWARE DESIGN, INC., The Regents of the University of California, Massachusetts Institute of Technology, Free Software Foundation, FreeBSD Inc., and others. |
(Corrections, notes, and links courtesy of RocketAware.com)
Up to: Local Process Communication - Communication between processes running on the same system. Synchronization. File locking. Signals. FIFOs, pipes, et al
Up to: Process Signals and Events - Sending and handling signals and events.
RocketLink!--> Man page versions:
OpenBSD
FreeBSD
NetBSD
RedHat
Solaris
Others
Rapid-Links:
Search | About | Comments | Submit Path: RocketAware > man pages >
semget.2/
RocketAware.com is a service of Mib Software Copyright 1999, Forrest J. Cavalier III. All Rights Reserved. We welcome submissions and comments
|