Annotation of cci/usr/src/man/man2/semop.2i, revision 1.1

1.1     ! root        1: .TH SEMOP 2
        !             2: .SH NAME
        !             3: semop \- semaphore operations
        !             4: .SH SYNOPSIS
        !             5: .B #include <sys/types.h>
        !             6: .br
        !             7: .B #include <sys/ipc.h>
        !             8: .br
        !             9: .B #include <sys/sem.h>
        !            10: .PP
        !            11: .nf
        !            12: .B int semop (semid, sops, nsops)
        !            13: .B int semid;
        !            14: .B struct sembuf **sops;
        !            15: .B int nsops;
        !            16: .fi
        !            17: .SH DESCRIPTION
        !            18: .I Semop
        !            19: is used to automatically perform an array of semaphore operations on the
        !            20: set of semaphores associated with the semaphore identifier specified by
        !            21: .IR semid .
        !            22: .I Sops
        !            23: is a pointer to the array of semaphore-operation structures.
        !            24: .I Nsops
        !            25: is the number of such structures in the array.
        !            26: The contents of each structure includes the following members:
        !            27: .PP
        !            28: .RS
        !            29: .ta 8n 20n
        !            30: .nf
        !            31: short  sem_num;        /\(** semaphore number \(**/
        !            32: short  sem_op; /\(** semaphore operation \(**/
        !            33: short  sem_flg;        /\(** operation flags \(**/
        !            34: .fi
        !            35: .RE
        !            36: .PP
        !            37: Each semaphore operation specified by
        !            38: .I sem_op
        !            39: is performed on the corresponding semaphore specified by
        !            40: .IR semid " and " sem_num .
        !            41: .PP
        !            42: .I Sem_op
        !            43: specifies one of three semaphore operations as follows:
        !            44: .PP
        !            45: .RS 8
        !            46: If
        !            47: .I sem_op
        !            48: is a negative integer, one of the following will occur:
        !            49: .SM
        !            50: \%{ALTER}
        !            51: .IP
        !            52: If semval (see
        !            53: .IR intro (2))
        !            54: is greater than or equal to the absolute value of
        !            55: .IR sem_op ,
        !            56: the absolute value of
        !            57: .I sem_op
        !            58: is subtracted from semval.
        !            59: Also, if
        !            60: .RI ( sem_flg " &"
        !            61: .SM
        !            62: .BR SEM_UNDO\*S )
        !            63: is ``true'', the absolute value of
        !            64: .I sem_op
        !            65: is added to the calling process's semadj value (see
        !            66: .IR exit (2))
        !            67: for the specified semaphore.
        !            68: .IP
        !            69: If semval is less than the absolute value of
        !            70: .I sem_op
        !            71: and
        !            72: .RI ( sem_flg " &"
        !            73: .SM
        !            74: .BR IPC_NOWAIT\*S )
        !            75: is ``true'',
        !            76: .I semop
        !            77: will return immediately.
        !            78: .IP
        !            79: If semval is less than the absolute value of
        !            80: .I sem_op
        !            81: and
        !            82: .RI ( sem_flg " &"
        !            83: .SM
        !            84: .BR IPC_NOWAIT\*S )
        !            85: is ``false'',
        !            86: .I semop
        !            87: will increment the semncnt associated with the specified semaphore
        !            88: and suspend execution of the calling process 
        !            89: until one of the following conditions occurs.
        !            90: .RS 8
        !            91: .PP
        !            92: Semval becomes greater than or equal to the absolute value of
        !            93: .IR sem_op .
        !            94: When this occurs, the value of semncnt associated with the specified
        !            95: semaphore is decremented, the absolute value of
        !            96: .I sem_op
        !            97: is subtracted from semval and, if
        !            98: .RI ( sem_flg " &"
        !            99: .SM
        !           100: .BR SEM_UNDO\*S )
        !           101: is ``true'', the absolute value of
        !           102: .I sem_op
        !           103: is added to the calling process's semadj value for the specified semaphore.
        !           104: .PP
        !           105: The semid for which the calling process is awaiting action
        !           106: is removed from the system (see
        !           107: .IR semctl (2)).
        !           108: When this occurs,
        !           109: .I errno
        !           110: is set equal to
        !           111: .SM
        !           112: EIDRM\*S,
        !           113: and a value of \-1 is returned.
        !           114: .PP
        !           115: The calling process receives a signal that is to be caught.
        !           116: When this occurs, the value of semncnt associated with the specified
        !           117: semaphore is decremented,
        !           118: and the calling process resumes execution in the manner prescribed in
        !           119: .IR signal (2).
        !           120: .RE
        !           121: .PP
        !           122: If
        !           123: .I sem_op
        !           124: is a positive integer, the value of
        !           125: .I sem_op
        !           126: is added to semval
        !           127: and, if
        !           128: .RI ( sem_flg " &"
        !           129: .SM
        !           130: .BR SEM_UNDO\*S )
        !           131: is ``true'', the value of
        !           132: .I sem_op
        !           133: is subtracted from the calling process's semadj value for the specified
        !           134: semaphore.
        !           135: .SM
        !           136: \%{ALTER}
        !           137: .PP
        !           138: If
        !           139: .I sem_op
        !           140: is zero,
        !           141: one of the following will occur:
        !           142: .SM
        !           143: \%{READ}
        !           144: .IP
        !           145: If semval is zero,
        !           146: .I semop
        !           147: will return immediately.
        !           148: .IP
        !           149: If semval is not equal to zero and
        !           150: .RI ( sem_flg " &"
        !           151: .SM
        !           152: .BR IPC_NOWAIT\*S )
        !           153: is ``true'',
        !           154: .I semop
        !           155: will return immediately.
        !           156: .IP
        !           157: If semval is not equal to zero and
        !           158: .RI ( sem_flg " &"
        !           159: .SM
        !           160: .BR IPC_NOWAIT\*S )
        !           161: is ``false'',
        !           162: .I semop
        !           163: will increment the semzcnt associated with the specified semaphore
        !           164: and suspend execution of the calling process until
        !           165: one of the following occurs:
        !           166: .RS 8
        !           167: .PP
        !           168: Semval becomes zero, at which time the value of semzcnt associated with the
        !           169: specified semaphore is decremented.
        !           170: .PP
        !           171: The semid for which the calling process is awaiting action
        !           172: is removed from the system.
        !           173: When this occurs,
        !           174: .I errno
        !           175: is set equal to
        !           176: .SM
        !           177: EIDRM\*S,
        !           178: and a value of \-1 is returned.
        !           179: .PP
        !           180: The calling process receives a signal that is to be caught.
        !           181: When this occurs, the value of semzcnt associated with the specified
        !           182: semaphore is decremented,
        !           183: and the calling process resumes execution in the manner prescribed in
        !           184: .IR signal (2).
        !           185: .RE
        !           186: .RE
        !           187: .PP
        !           188: .I Semop
        !           189: will fail if one or more of the following are true for any of the semaphore
        !           190: operations specified by
        !           191: .IR sops :
        !           192: .TP 15
        !           193: .TP
        !           194: \s-1\%[EINVAL]\s+1
        !           195: .I Semid
        !           196: is not a valid semaphore identifier.
        !           197: .TP
        !           198: \s-1\%[EFBIG]\s+1
        !           199: .I Sem_num
        !           200: is less than zero or greater than or equal to the number of semaphores
        !           201: in the set associated with
        !           202: .IR semid .
        !           203: .TP
        !           204: \s-1\%[E2BIG]\s+1
        !           205: .I Nsops
        !           206: is greater than the system-imposed maximum.
        !           207: .TP
        !           208: \s-1\%[EACCES]\s+1
        !           209: Operation permission is denied to the calling process (see
        !           210: .IR intro (2)).
        !           211: .TP
        !           212: \s-1\%[EAGAIN]\s+1
        !           213: The operation would result in suspension of the calling process but
        !           214: .RI ( sem_flg " &"
        !           215: .SM
        !           216: .BR IPC_NOWAIT\*S )
        !           217: is ``true''.
        !           218: .TP
        !           219: \s-1\%[ENOSPC]\s+1
        !           220: The limit on the number of individual  processes requesting an
        !           221: .SM
        !           222: .B SEM_UNDO
        !           223: would be exceeded.
        !           224: .TP
        !           225: \s-1\%[EINVAL]\s+1
        !           226: The number of individual semaphores for which the calling process
        !           227: requests a
        !           228: .SM
        !           229: .B SEM_UNDO
        !           230: would exceed the limit.
        !           231: .TP
        !           232: \s-1\%[ERANGE]\s+1
        !           233: An operation would cause a semval to overflow the system-imposed limit.
        !           234: .TP
        !           235: \s-1\%[ERANGE]\s+1
        !           236: An operation would cause a semadj value to overflow the
        !           237: system-imposed limit.
        !           238: .TP
        !           239: \s-1\%[EFAULT]\s+1
        !           240: .I Sops
        !           241: points to an illegal address.
        !           242: .PP
        !           243: Upon successful completion, the value of sempid
        !           244: for each semaphore specified in the array pointed to by
        !           245: .I sops
        !           246: is set equal to the process
        !           247: .SM ID
        !           248: of the calling process.
        !           249: .SH RETURN VALUE
        !           250: .RI If " semop
        !           251: returns due to the receipt of a signal, a value of \-1 is returned to the
        !           252: calling process and
        !           253: .I errno
        !           254: is set to
        !           255: .SM
        !           256: \%EINTR\*S.
        !           257: If it returns due to the removal of a
        !           258: .I semid
        !           259: from the system, a value of \-1 is returned and
        !           260: .I errno
        !           261: is set to
        !           262: .SM
        !           263: \%EIDRM\*S.
        !           264: .PP
        !           265: Upon successful completion, the value of semval at the time of the call for the
        !           266: last operation in the array pointed to by
        !           267: .I sops
        !           268: is returned.
        !           269: Otherwise, a value of \-1 is returned and
        !           270: .I errno
        !           271: is set to indicate the error.
        !           272: .SH SEE ALSO
        !           273: exec(2), exit(2), fork(2), intro(2), semctl(2), semget(2).
        !           274: .\"    @(#)semop.2     6.2 of 9/6/83

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.