*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->IRIX man pages -> usopenpollsema (3p)              



NAME    [Toc]    [Back]

     usopenpollsema - attach a file descriptor to a pollable semaphore

C SYNOPSIS    [Toc]    [Back]

     #include <ulocks.h>

     int usopenpollsema	(usema_t *sema,	mode_t acc);

DESCRIPTION    [Toc]    [Back]

     usopenpollsema attaches a file descriptor to a pollable semaphore.	 The
     returned file descriptor is used when calling poll(2) or select(2)	to
     acquire the semaphore after an unsuccessful uspsema(3P).

     If	the caller is the first	process	to call	usopenpollsema on sema then a
     new semaphore device is allocated (see usema(7M)).	 The user and group id
     of	the semaphore device take on the effective user/group id of the
     caller.  The access mode is set to	acc(see	chmod(2)).  Calls to
     usopenpollsema on the same	semaphore by other processes simply attach to
     the previously allocated device.  They must pass standard Unix file
     permission	tests to be allowed to attach.

     All processes sharing a pollable semaphore, related and unrelated alike,
     must call usopenpollsema before performing	any semaphore operation	on

     Forked children must perform their	own usopenpollsema, as the file
     descriptor	inherited from the parent through the fork(2) will not be

     A process requires	the file descriptor to call usvsema even if it never
     calls uspsema.

     usopenpollsema will fail if one or	more of	the following are true:

     [EACCES]	   The caller does not have the	required permission to open
		   one or both of the two semaphore device files, /dev/usema
		   and /dev/usemaclone.

     [EACCES]	   The caller is attempting to attach to a previously
		   allocated semaphore device and does not have	the requisite

     [ENOSPC]	   There are no	more selectable	semaphores available in	the
		   system.  This is configurable up to 255.  See

     [EMFILE]	   The system imposed limit for	open file descriptors per
		   process {OPEN_MAX} has already been reached.

     [ENFILE]	   The system file table has exceeded {NFILE_MAX} concurrently
		   open	files.

									Page 1


     [ENXIO]	   One or both of the two semaphore device files, /dev/usema
		   and /dev/usemaclone,	do not exist, or the device is not
		   configured into the system.

SEE ALSO    [Toc]    [Back]

     chmod(2), open(2),	amalloc(3P), usclosepollsema(3P), usconfig(3P),
     uscpsema(3P), usctlsema(3P), usdumpsema(3P), usfreesema(3P),
     usfreepollsema(3P), usinit(3P), usnewsema(3P), usnewpollsema(3P),
     uspsema(3P), usvsema(3P), usema(7M).

DIAGNOSTICS    [Toc]    [Back]

     Upon successful completion, a file	descriptor is returned.	Otherwise, a
     value of -1 is returned and errno is set to indicate the error.

									PPPPaaaaggggeeee 2222
[ Back ]
 Similar pages
Name OS Title
usclosepollsema IRIX detach a file descriptor from a pollable semaphore
usfreepollsema IRIX free a pollable semaphore
usnewpollsema IRIX allocate and initialize a pollable semaphore
fattach Tru64 Attach a STREAMS-based file descriptor to a file in the file system name space
fattach IRIX attach a STREAMS-based file descriptor to an object in the filesystem name space
pxfisatty IRIX Determines if file descriptor corresponds to a valid file descriptor
fdetach Tru64 Detach a STREAMS-based file descriptor from a file in the file system name space
AFopenfile IRIX allocate an AFfilehandle structure for an audio file identified by name / by a Unix file descriptor
AFidentifyfd IRIX retrieve the audio file format of a file descriptor / open AFfilehandle
acl_set_fd Tru64 Sets the ACL on the file or directory designated by the file descriptor
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service