Imported Upstream version 20080930
[ltp-debian.git] / testcases / audit-test / utils / bin / do_shmget.c
blobcf547b299b04fe1dd0df9522f05f33c86e799a1a
1 /* (c) Copyright Hewlett-Packard Development Company, L.P., 2006
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.
6 *
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/>.
16 #include "includes.h"
18 #include "ipc_common.c"
20 int main(int argc, char **argv)
22 int exitval, result;
23 int flags = 0;
25 if (check_ipc_usage("shmget", argc))
26 return 1;
28 if (translate_ipc_flags(argv[2], &flags))
29 return 1;
31 errno = 0;
32 exitval = do_shmget(atoi(argv[1]), flags);
33 result = exitval < 0;
35 printf("%d %d %d\n", result, result ? errno : exitval, getpid());
36 return result;