1*49cdfc7eSAndroid Build Coastguard Worker /* 2*49cdfc7eSAndroid Build Coastguard Worker * Copyright (c) 2016 Xiao Yang <[email protected]> 3*49cdfc7eSAndroid Build Coastguard Worker * 4*49cdfc7eSAndroid Build Coastguard Worker * This program is free software; you can redistribute it and/or modify 5*49cdfc7eSAndroid Build Coastguard Worker * it under the terms of the GNU General Public License as published by 6*49cdfc7eSAndroid Build Coastguard Worker * the Free Software Foundation; either version 2 of the License, or 7*49cdfc7eSAndroid Build Coastguard Worker * (at your option) any later version. 8*49cdfc7eSAndroid Build Coastguard Worker * 9*49cdfc7eSAndroid Build Coastguard Worker * This program is distributed in the hope that it will be useful, 10*49cdfc7eSAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of 11*49cdfc7eSAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 12*49cdfc7eSAndroid Build Coastguard Worker * the GNU General Public License for more details. 13*49cdfc7eSAndroid Build Coastguard Worker * 14*49cdfc7eSAndroid Build Coastguard Worker * You should have received a copy of the GNU General Public License 15*49cdfc7eSAndroid Build Coastguard Worker * along with this program. 16*49cdfc7eSAndroid Build Coastguard Worker */ 17*49cdfc7eSAndroid Build Coastguard Worker 18*49cdfc7eSAndroid Build Coastguard Worker /* 19*49cdfc7eSAndroid Build Coastguard Worker * common definitions for the IPC system calls. 20*49cdfc7eSAndroid Build Coastguard Worker */ 21*49cdfc7eSAndroid Build Coastguard Worker 22*49cdfc7eSAndroid Build Coastguard Worker #ifndef __LIBNEWIPC_H 23*49cdfc7eSAndroid Build Coastguard Worker #define __LIBNEWIPC_H 1 24*49cdfc7eSAndroid Build Coastguard Worker 25*49cdfc7eSAndroid Build Coastguard Worker #include <time.h> 26*49cdfc7eSAndroid Build Coastguard Worker #include <sys/types.h> 27*49cdfc7eSAndroid Build Coastguard Worker 28*49cdfc7eSAndroid Build Coastguard Worker #define MSG_RD 0400 29*49cdfc7eSAndroid Build Coastguard Worker #define MSG_WR 0200 30*49cdfc7eSAndroid Build Coastguard Worker #define MSG_RW (MSG_RD | MSG_WR) 31*49cdfc7eSAndroid Build Coastguard Worker #define MSGSIZE 1024 32*49cdfc7eSAndroid Build Coastguard Worker #define MSGTYPE 1 33*49cdfc7eSAndroid Build Coastguard Worker #define NR_MSGQUEUES 16 34*49cdfc7eSAndroid Build Coastguard Worker 35*49cdfc7eSAndroid Build Coastguard Worker #define SEM_RD 0400 36*49cdfc7eSAndroid Build Coastguard Worker #define SEM_ALT 0200 37*49cdfc7eSAndroid Build Coastguard Worker #define SEM_RA (SEM_RD | SEM_ALT) 38*49cdfc7eSAndroid Build Coastguard Worker #define PSEMS 10 39*49cdfc7eSAndroid Build Coastguard Worker 40*49cdfc7eSAndroid Build Coastguard Worker #define SHM_RD 0400 41*49cdfc7eSAndroid Build Coastguard Worker #define SHM_WR 0200 42*49cdfc7eSAndroid Build Coastguard Worker #define SHM_RW (SHM_RD | SHM_WR) 43*49cdfc7eSAndroid Build Coastguard Worker #define SHM_SIZE 2048 44*49cdfc7eSAndroid Build Coastguard Worker #define INT_SIZE 4 45*49cdfc7eSAndroid Build Coastguard Worker #define MODE_MASK 0x01FF 46*49cdfc7eSAndroid Build Coastguard Worker 47*49cdfc7eSAndroid Build Coastguard Worker key_t getipckey(const char *file, const int lineno); 48*49cdfc7eSAndroid Build Coastguard Worker #define GETIPCKEY() \ 49*49cdfc7eSAndroid Build Coastguard Worker getipckey(__FILE__, __LINE__) 50*49cdfc7eSAndroid Build Coastguard Worker 51*49cdfc7eSAndroid Build Coastguard Worker int get_used_sysvipc(const char *file, const int lineno, const char *sysvipc_file); 52*49cdfc7eSAndroid Build Coastguard Worker #define GET_USED_QUEUES() \ 53*49cdfc7eSAndroid Build Coastguard Worker get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/msg") 54*49cdfc7eSAndroid Build Coastguard Worker #define GET_USED_SEGMENTS() \ 55*49cdfc7eSAndroid Build Coastguard Worker get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/shm") 56*49cdfc7eSAndroid Build Coastguard Worker #define GET_USED_ARRAYS() \ 57*49cdfc7eSAndroid Build Coastguard Worker get_used_sysvipc(__FILE__, __LINE__, "/proc/sysvipc/sem") 58*49cdfc7eSAndroid Build Coastguard Worker 59*49cdfc7eSAndroid Build Coastguard Worker void *probe_free_addr(const char *file, const int lineno); 60*49cdfc7eSAndroid Build Coastguard Worker #define PROBE_FREE_ADDR() \ 61*49cdfc7eSAndroid Build Coastguard Worker probe_free_addr(__FILE__, __LINE__) 62*49cdfc7eSAndroid Build Coastguard Worker 63*49cdfc7eSAndroid Build Coastguard Worker #endif /* newlibipc.h */ 64