Elliott Hughes | 21b56eb | 2017-10-20 17:57:17 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2017 The Android Open Source Project |
| 3 | * All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * * Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * * Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in |
| 12 | * the documentation and/or other materials provided with the |
| 13 | * distribution. |
| 14 | * |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 17 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 18 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 19 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS |
| 22 | * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT |
| 25 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | * SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #include <sys/sem.h> |
| 30 | |
| 31 | #include "header_checks.h" |
| 32 | |
| 33 | static void sys_sem_h() { |
| 34 | MACRO(SEM_UNDO); |
| 35 | |
| 36 | MACRO(GETNCNT); |
| 37 | MACRO(GETPID); |
| 38 | MACRO(GETVAL); |
| 39 | MACRO(GETALL); |
| 40 | MACRO(GETZCNT); |
| 41 | MACRO(SETVAL); |
| 42 | MACRO(SETALL); |
| 43 | |
| 44 | TYPE(struct semid_ds); |
| 45 | STRUCT_MEMBER(struct semid_ds, struct ipc_perm, sem_perm); |
| 46 | #if defined(__linux__) // POSIX says short, Linux says long. |
| 47 | STRUCT_MEMBER(struct semid_ds, unsigned long, sem_nsems); |
| 48 | #else |
| 49 | STRUCT_MEMBER(struct semid_ds, unsigned short, sem_nsems); |
| 50 | #endif |
| 51 | STRUCT_MEMBER(struct semid_ds, time_t, sem_otime); |
| 52 | STRUCT_MEMBER(struct semid_ds, time_t, sem_ctime); |
| 53 | |
| 54 | TYPE(pid_t); |
| 55 | TYPE(size_t); |
| 56 | TYPE(time_t); |
| 57 | |
| 58 | TYPE(struct sembuf); |
| 59 | STRUCT_MEMBER(struct sembuf, unsigned short, sem_num); |
| 60 | STRUCT_MEMBER(struct sembuf, short, sem_op); |
| 61 | STRUCT_MEMBER(struct sembuf, short, sem_flg); |
| 62 | |
| 63 | FUNCTION(semctl, int (*f)(int, int, int, ...)); |
| 64 | FUNCTION(semget, int (*f)(key_t, int, int)); |
| 65 | FUNCTION(semop, int (*f)(int, struct sembuf*, size_t)); |
| 66 | } |