blob: e304695134eb9a22133c18be87857d82cb7623df [file] [log] [blame]
plars865695b2001-08-27 22:15:12 +00001/*
2 * Copyright (c) 2000 Silicon Graphics, Inc. All Rights Reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of version 2 of the GNU General Public License as
6 * published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it would be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11 *
12 * Further, this software is distributed without any warranty that it is
13 * free of the rightful claim of any third person regarding infringement
14 * or the like. Any license provided herein, whether implied or
15 * otherwise, applies only to this software file. Patent licenses, if
16 * any, provided herein do not apply to combinations of this program with
17 * other software, or any other product whatsoever.
18 *
19 * You should have received a copy of the GNU General Public License along
Wanlong Gaofed96412012-10-24 10:10:29 +080020 * with this program; if not, write the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
plars865695b2001-08-27 22:15:12 +000022 *
23 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
24 * Mountain View, CA 94043, or:
25 *
26 * http://www.sgi.com
27 *
28 * For further information regarding this notice, see:
29 *
30 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
31 *
32 */
Cyril Hrubis7dc42c92013-09-12 14:55:55 +020033/*
plars865695b2001-08-27 22:15:12 +000034 * AUTHOR : William Roske
plars865695b2001-08-27 22:15:12 +000035 * CO-PILOT : Dave Fenner
Cyril Hrubis7dc42c92013-09-12 14:55:55 +020036 */
plars865695b2001-08-27 22:15:12 +000037#include <sys/types.h>
38#include <sys/fcntl.h>
39#include <errno.h>
plars865695b2001-08-27 22:15:12 +000040#include <signal.h>
Garrett Cooperebf7df22010-12-19 01:52:15 -080041#include <string.h>
Stanislav Kholmanskikh1c442442013-09-11 13:25:43 +040042
plars865695b2001-08-27 22:15:12 +000043#include "test.h"
subrata_modak153f98c2008-09-19 10:09:58 +000044#include "compat_16.h"
plars865695b2001-08-27 22:15:12 +000045
Cyril Hrubis7dc42c92013-09-12 14:55:55 +020046static void setup(void);
47static void cleanup(void);
plars865695b2001-08-27 22:15:12 +000048
Cyril Hrubisfdce7d52013-04-04 18:35:48 +020049TCID_DEFINE(getgid01);
50int TST_TOTAL = 1;
plars865695b2001-08-27 22:15:12 +000051
subrata_modak56207ce2009-03-23 13:35:39 +000052int main(int ac, char **av)
plars865695b2001-08-27 22:15:12 +000053{
Cyril Hrubis89af32a2012-10-24 16:39:11 +020054 int lc;
Cyril Hrubis0b9589f2014-05-27 17:40:33 +020055 const char *msg;
subrata_modak56207ce2009-03-23 13:35:39 +000056
Garrett Cooper45e285d2010-11-22 12:19:25 -080057 if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
Garrett Cooper60fa8012010-11-22 13:50:58 -080058 tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
plars865695b2001-08-27 22:15:12 +000059
subrata_modak56207ce2009-03-23 13:35:39 +000060 setup();
plars865695b2001-08-27 22:15:12 +000061
subrata_modak56207ce2009-03-23 13:35:39 +000062 for (lc = 0; TEST_LOOPING(lc); lc++) {
plars865695b2001-08-27 22:15:12 +000063
Caspar Zhangd59a6592013-03-07 14:59:12 +080064 tst_count = 0;
plars865695b2001-08-27 22:15:12 +000065
Stanislav Kholmanskikh1c442442013-09-11 13:25:43 +040066 TEST(GETGID(cleanup));
subrata_modakbdbaec52009-02-26 12:14:51 +000067
Cyril Hrubise38b9612014-06-02 17:20:57 +020068 if (TEST_RETURN == -1) {
Garrett Cooperebf7df22010-12-19 01:52:15 -080069 tst_resm(TFAIL, "getgid failed");
Cyril Hrubise38b9612014-06-02 17:20:57 +020070 } else {
71 tst_resm(TPASS, "getgid returned %ld",
72 TEST_RETURN);
subrata_modak56207ce2009-03-23 13:35:39 +000073 }
Garrett Cooper2c282152010-12-16 00:55:50 -080074 }
plars865695b2001-08-27 22:15:12 +000075
subrata_modak56207ce2009-03-23 13:35:39 +000076 cleanup();
Garrett Cooperebf7df22010-12-19 01:52:15 -080077 tst_exit();
Garrett Cooper2c282152010-12-16 00:55:50 -080078}
plars865695b2001-08-27 22:15:12 +000079
Cyril Hrubis7dc42c92013-09-12 14:55:55 +020080static void setup(void)
plars865695b2001-08-27 22:15:12 +000081{
subrata_modak56207ce2009-03-23 13:35:39 +000082 tst_sig(NOFORK, DEF_HANDLER, cleanup);
subrata_modak56207ce2009-03-23 13:35:39 +000083 TEST_PAUSE;
Garrett Cooper2c282152010-12-16 00:55:50 -080084}
plars865695b2001-08-27 22:15:12 +000085
Cyril Hrubis7dc42c92013-09-12 14:55:55 +020086static void cleanup(void)
plars865695b2001-08-27 22:15:12 +000087{
Chris Dearmanec6edca2012-10-17 19:54:01 -070088}