@@ -535,6 +535,35 @@ s! {
535
535
pub _key: :: key_t,
536
536
}
537
537
538
+ // sys/sem.h
539
+
540
+ pub struct sembuf {
541
+ pub sem_num: :: c_ushort,
542
+ pub sem_op: :: c_short,
543
+ pub sem_flg: :: c_short,
544
+ }
545
+
546
+ #[ cfg_attr( feature = "rustc-dep-of-std" , repr( packed( 4 ) ) ) ]
547
+ pub struct semid_ds {
548
+ // Note the manpage shows different types than the system header.
549
+ pub sem_perm: ipc_perm,
550
+ pub sem_base: :: int32_t,
551
+ pub sem_nsems: :: c_ushort,
552
+ pub sem_otime: :: time_t,
553
+ pub sem_pad1: :: int32_t,
554
+ pub sem_ctime: :: time_t,
555
+ pub sem_pad2: :: int32_t,
556
+ pub sem_pad3: [ :: int32_t; 4 ] ,
557
+ }
558
+
559
+ pub union semun {
560
+ pub val: :: c_int,
561
+ pub buf: * mut semid_ds,
562
+ pub array: * mut :: c_ushort,
563
+ }
564
+
565
+ // sys/shm.h
566
+
538
567
#[ cfg_attr( feature = "rustc-dep-of-std" , repr( packed( 4 ) ) ) ]
539
568
pub struct shmid_ds {
540
569
pub shm_perm: ipc_perm,
@@ -2297,6 +2326,17 @@ pub const IPC_R: ::c_int = 0x100;
2297
2326
pub const IPC_W : :: c_int = 0x80 ;
2298
2327
pub const IPC_M : :: c_int = 0x1000 ;
2299
2328
2329
+ // sys/sem.h
2330
+ pub const SEM_UNDO : :: c_int = 0o10000 ;
2331
+
2332
+ pub const GETNCNT : :: c_int = 3 ;
2333
+ pub const GETPID : :: c_int = 4 ;
2334
+ pub const GETVAL : :: c_int = 5 ;
2335
+ pub const GETALL : :: c_int = 6 ;
2336
+ pub const GETZCNT : :: c_int = 7 ;
2337
+ pub const SETVAL : :: c_int = 8 ;
2338
+ pub const SETALL : :: c_int = 9 ;
2339
+
2300
2340
// sys/shm.h
2301
2341
pub const SHM_RDONLY : :: c_int = 0x1000 ;
2302
2342
pub const SHM_RND : :: c_int = 0x2000 ;
@@ -2387,6 +2427,13 @@ extern {
2387
2427
link_name = "mprotect$UNIX2003" ) ]
2388
2428
pub fn mprotect ( addr : * mut :: c_void , len : :: size_t , prot : :: c_int )
2389
2429
-> :: c_int ;
2430
+ pub fn semget ( key : key_t , nsems : :: c_int , semflg : :: c_int ) -> :: c_int ;
2431
+ #[ cfg_attr( all( target_os = "macos" , target_arch = "x86" ) ,
2432
+ link_name = "semctl$UNIX2003" ) ]
2433
+ pub fn semctl ( semid : :: c_int ,
2434
+ semnum : :: c_int ,
2435
+ cmd : :: c_int , ...) -> :: c_int ;
2436
+ pub fn semop ( semid : :: c_int , sops : * mut sembuf , nsops : :: size_t ) -> :: c_int ;
2390
2437
pub fn shm_open ( name : * const :: c_char , oflag : :: c_int , ...) -> :: c_int ;
2391
2438
pub fn ftok ( pathname : * const c_char , proj_id : :: c_int ) -> key_t ;
2392
2439
pub fn shmat ( shmid : :: c_int , shmaddr : * const :: c_void ,
0 commit comments