blob: dd81370314fbfc9e92779853625a6c6de5e02dd5 [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 Hrubis61e3e022013-09-12 15:37:26 +020033
34/*
plars865695b2001-08-27 22:15:12 +000035 * AUTHOR : William Roske
plars865695b2001-08-27 22:15:12 +000036 * CO-PILOT : Dave Fenner
Cyril Hrubis61e3e022013-09-12 15:37:26 +020037 */
plars865695b2001-08-27 22:15:12 +000038
Garrett Cooperebf7df22010-12-19 01:52:15 -080039#include <sys/types.h>
plars865695b2001-08-27 22:15:12 +000040#include <errno.h>
41#include <string.h>
42#include <signal.h>
43
plars865695b2001-08-27 22:15:12 +000044#include "test.h"
subrata_modak4f41ee32008-09-22 06:52:57 +000045#include "compat_16.h"
46
Cyril Hrubis61e3e022013-09-12 15:37:26 +020047static void setup();
48static void cleanup();
plars865695b2001-08-27 22:15:12 +000049
Cyril Hrubisfdce7d52013-04-04 18:35:48 +020050TCID_DEFINE(getegid01);
51int TST_TOTAL = 1;
plars865695b2001-08-27 22:15:12 +000052
subrata_modak56207ce2009-03-23 13:35:39 +000053int main(int ac, char **av)
plars865695b2001-08-27 22:15:12 +000054{
Cyril Hrubis89af32a2012-10-24 16:39:11 +020055 int lc;
Cyril Hrubis0b9589f2014-05-27 17:40:33 +020056 const char *msg;
subrata_modak56207ce2009-03-23 13:35:39 +000057
Garrett Cooper45e285d2010-11-22 12:19:25 -080058 if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
Garrett Cooper60fa8012010-11-22 13:50:58 -080059 tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
plars865695b2001-08-27 22:15:12 +000060
subrata_modak56207ce2009-03-23 13:35:39 +000061 setup();
plars865695b2001-08-27 22:15:12 +000062
subrata_modak56207ce2009-03-23 13:35:39 +000063 for (lc = 0; TEST_LOOPING(lc); lc++) {
plars865695b2001-08-27 22:15:12 +000064
Caspar Zhangd59a6592013-03-07 14:59:12 +080065 tst_count = 0;
plars865695b2001-08-27 22:15:12 +000066
Stanislav Kholmanskikh4940d002013-09-11 13:25:44 +040067 TEST(GETEGID(cleanup));
subrata_modakbdbaec52009-02-26 12:14:51 +000068
Garrett Cooperebf7df22010-12-19 01:52:15 -080069 if (TEST_RETURN == -1) {
Wanlong Gao354ebb42012-12-07 10:10:04 +080070 tst_resm(TFAIL | TTERRNO, "getegid failed");
subrata_modak56207ce2009-03-23 13:35:39 +000071 continue; /* next loop for MTKERNEL */
72 }
plars865695b2001-08-27 22:15:12 +000073
Cyril Hrubise38b9612014-06-02 17:20:57 +020074 tst_resm(TPASS, "getegid returned %ld", TEST_RETURN);
Garrett Cooper2c282152010-12-16 00:55:50 -080075 }
plars865695b2001-08-27 22:15:12 +000076
subrata_modak56207ce2009-03-23 13:35:39 +000077 cleanup();
Garrett Cooperebf7df22010-12-19 01:52:15 -080078 tst_exit();
Garrett Cooper2c282152010-12-16 00:55:50 -080079}
plars865695b2001-08-27 22:15:12 +000080
Cyril Hrubis61e3e022013-09-12 15:37:26 +020081static void setup(void)
plars865695b2001-08-27 22:15:12 +000082{
subrata_modak56207ce2009-03-23 13:35:39 +000083 tst_sig(NOFORK, DEF_HANDLER, cleanup);
subrata_modak56207ce2009-03-23 13:35:39 +000084 TEST_PAUSE;
Garrett Cooper2c282152010-12-16 00:55:50 -080085}
plars865695b2001-08-27 22:15:12 +000086
Cyril Hrubis61e3e022013-09-12 15:37:26 +020087static void cleanup(void)
plars865695b2001-08-27 22:15:12 +000088{
Chris Dearmanec6edca2012-10-17 19:54:01 -070089}