sem_init.3 (74e03642ee69c2183a72a32af6f7cc098e5d9737) | sem_init.3 (9d09157a0f55ef695b75eafb407f57206453a1f1) |
---|---|
1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice(s), this list of conditions and the following disclaimer as --- 40 unchanged lines hidden (view full) --- 49.Fa pshared 50specifies a shared semaphore that can be used by multiple processes, which this 51implementation is not capable of. 52.Pp 53Following a successful call to 54.Fn sem_init , 55.Fa sem 56can be used as an argument in subsequent calls to | 1.\" Copyright (C) 2000 Jason Evans <jasone@FreeBSD.org>. 2.\" All rights reserved. 3.\" 4.\" Redistribution and use in source and binary forms, with or without 5.\" modification, are permitted provided that the following conditions 6.\" are met: 7.\" 1. Redistributions of source code must retain the above copyright 8.\" notice(s), this list of conditions and the following disclaimer as --- 40 unchanged lines hidden (view full) --- 49.Fa pshared 50specifies a shared semaphore that can be used by multiple processes, which this 51implementation is not capable of. 52.Pp 53Following a successful call to 54.Fn sem_init , 55.Fa sem 56can be used as an argument in subsequent calls to |
57.Fa sem_wait , 58.Fa sem_trywait , 59.Fa sem_post , | 57.Xr sem_wait 3 , 58.Xr sem_trywait 3 , 59.Xr sem_post 3 , |
60and | 60and |
61.Fa sem_destroy . | 61.Xr sem_destroy 3 . 62The |
62.Fa sem | 63.Fa sem |
63is no longer valid after a successful call to 64.Fa sem_destroy . | 64argument is no longer valid after a successful call to 65.Xr sem_destroy 3 . |
65.Sh RETURN VALUES 66.Rv -std sem_init 67.Sh ERRORS | 66.Sh RETURN VALUES 67.Rv -std sem_init 68.Sh ERRORS |
69The |
|
68.Fn sem_init | 70.Fn sem_init |
69will fail if: | 71function will fail if: |
70.Bl -tag -width Er 71.It Bq Er EINVAL 72.Fa value 73exceeds SEM_VALUE_MAX. 74.It Bq Er ENOSPC 75Memory allocation error. 76.It Bq Er EPERM 77Unable to initialize a shared semaphore. 78.El 79.Sh SEE ALSO 80.Xr sem_destroy 3 , 81.Xr sem_post 3 , 82.Xr sem_trywait 3 , 83.Xr sem_wait 3 , 84.Xr sem 4 85.Sh STANDARDS | 72.Bl -tag -width Er 73.It Bq Er EINVAL 74.Fa value 75exceeds SEM_VALUE_MAX. 76.It Bq Er ENOSPC 77Memory allocation error. 78.It Bq Er EPERM 79Unable to initialize a shared semaphore. 80.El 81.Sh SEE ALSO 82.Xr sem_destroy 3 , 83.Xr sem_post 3 , 84.Xr sem_trywait 3 , 85.Xr sem_wait 3 , 86.Xr sem 4 87.Sh STANDARDS |
88The |
|
86.Fn sem_init | 89.Fn sem_init |
87conforms to | 90function conforms to |
88.St -p1003.1-96 . 89.Pp 90This implementation does not support shared semaphores, and reports this fact 91by setting 92.Va errno 93to 94.Er EPERM . 95This is perhaps a stretch of the intention of POSIX, but is 96compliant, with the caveat that 97.Fn sem_init 98always reports a permissions error when an attempt to create a shared semaphore 99is made. | 91.St -p1003.1-96 . 92.Pp 93This implementation does not support shared semaphores, and reports this fact 94by setting 95.Va errno 96to 97.Er EPERM . 98This is perhaps a stretch of the intention of POSIX, but is 99compliant, with the caveat that 100.Fn sem_init 101always reports a permissions error when an attempt to create a shared semaphore 102is made. |