1 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2007
3 * This program is free software: you can redistribute it and/or modify
4 * it under the terms of version 2 the GNU General Public License as
5 * published by the Free Software Foundation.
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
12 * You should have received a copy of the GNU General Public License
13 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #include <asm-generic/ipc.h>
20 #include "ipc_common.c"
22 int main(int argc
, char **argv
)
28 fprintf(stderr
, "%s: you must specify an ipc operation\n", argv
[0]);
32 if (check_ipc_usage(argv
[1], argc
- 1))
35 if (translate_ipc_op(argv
[1], &op
))
45 if (translate_ipc_flags(argv
[3], &flags
))
50 if (translate_sem_flags(argv
[3], &flags
))
54 if (translate_shm_flags(argv
[3], &flags
))
62 exitval
= do_msgctl(atoi(argv
[2]), flags
);
65 exitval
= do_msgget(atoi(argv
[2]), flags
);
68 exitval
= do_msgrcv(atoi(argv
[2]), atoi(argv
[3]));
71 exitval
= do_msgsnd(atoi(argv
[2]), atoi(argv
[3]), argv
[4]);
74 exitval
= do_semctl(atoi(argv
[2]), flags
);
77 exitval
= do_semget(atoi(argv
[2]), flags
);
80 exitval
= do_semop(atoi(argv
[2]), flags
);
83 exitval
= do_semtimedop(atoi(argv
[2]), flags
);
86 exitval
= do_shmctl(atoi(argv
[2]), flags
);
89 exitval
= do_shmget(atoi(argv
[2]), flags
);
92 exitval
= do_shmat(atoi(argv
[2]), flags
);
95 fprintf(stderr
, "%s: %d is not a supported ipc operation\n", argv
[0], op
);
101 result
= exitval
== -1;
104 result
= exitval
< 0;
107 printf("%d %d %d\n", result
, result
? errno
: exitval
, getpid());