Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 1 | /*************************************************************************/ |
| 2 | /* Copyright (c) Crackerjack Project., 2007 */ |
| 3 | /* */ |
| 4 | /* This program is free software; you can redistribute it and/or modify */ |
| 5 | /* it under the terms of the GNU General Public License as published by */ |
| 6 | /* the Free Software Foundation; either version 2 of the License, or */ |
| 7 | /* (at your option) any later version. */ |
| 8 | /* */ |
| 9 | /* This program is distributed in the hope that it will be useful, */ |
| 10 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ |
| 11 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See */ |
| 12 | /* the GNU General Public License for more details. */ |
| 13 | /* */ |
| 14 | /* You should have received a copy of the GNU General Public License */ |
| 15 | /* along with this program; if not, write to the Free Software */ |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 16 | /* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 17 | /* */ |
| 18 | /*************************************************************************/ |
| 19 | /*************************************************************************/ |
| 20 | /* */ |
| 21 | /* File: unshare01.c */ |
| 22 | /* */ |
| 23 | /* Description: This tests the unshare() syscall. */ |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 24 | /* unshare() allows a process to disassociate parts of its */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 25 | /* execution context that are currently being shared with other */ |
| 26 | /* processes. Part of the execution context, such as the namespace */ |
| 27 | /* ,is shared implicitly when a new process is created using */ |
| 28 | /* fork(2) or vfork(2), while other parts, such as virtual memory */ |
| 29 | /* , may be shared by explicit request when creating a process */ |
| 30 | /* using clone(2). */ |
| 31 | /* */ |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 32 | /* The main use of unshare() is to allow a process to control its */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 33 | /* shared execution context without creating a new process. */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 34 | /* */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 35 | /* */ |
| 36 | /* The flags argument is a bit mask that specifies which parts of */ |
| 37 | /* the execution context should be unshared. This argument is */ |
| 38 | /* specified by ORing together zero or more of the following cons- */ |
| 39 | /* tants: */ |
| 40 | /* */ |
| 41 | /* CLONE_FILES: */ |
| 42 | /* Reverse the effect of the clone(2) CLONE_FILES flag. */ |
| 43 | /* Unshare the file descriptor table, so that the calling */ |
| 44 | /* process no longer shares its file descriptors with any */ |
| 45 | /* other process. */ |
| 46 | /* CLONE_FS: */ |
| 47 | /* Reverse the effect of the clone(2) CLONE_FS flag.Unshare*/ |
| 48 | /* file system attributes, so that the calling process no */ |
| 49 | /* longer shares its root directory, current directory, or */ |
| 50 | /* umask attributes with any other process. */ |
| 51 | /* CLONE_NEWNS: */ |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 52 | /* This flag has the same effect as the clone(2) CLONE_NEWNS*/ |
| 53 | /* flag. Unshare the namespace, so that the calling process*/ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 54 | /* has a private copy of its namespacei which is not shared*/ |
| 55 | /* with any other process. Specifying this flag automat- */ |
| 56 | /* ically implies CLONE_FS as well. */ |
| 57 | /* */ |
| 58 | /* If flags is specified as zero, then unshare() is a no-op; no */ |
| 59 | /* changes are made to the calling process's execution context. */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 60 | /* */ |
| 61 | /* Usage: <for command-line> */ |
| 62 | /* unshare01 [-c n] [-e][-i n] [-I x] [-p x] [-t] */ |
| 63 | /* where, -c n : Run n copies concurrently. */ |
| 64 | /* -e : Turn on errno logging. */ |
| 65 | /* -i n : Execute test n times. */ |
| 66 | /* -I x : Execute test for x seconds. */ |
| 67 | /* -P x : Pause for x seconds between iterations. */ |
| 68 | /* -t : Turn on syscall timing. */ |
| 69 | /* */ |
| 70 | /* Total Tests: 1 */ |
| 71 | /* */ |
| 72 | /* Test Name: unshare01 */ |
| 73 | /* History: Porting from Crackerjack to LTP is done by */ |
| 74 | /* Manas Kumar Nayak maknayak@in.ibm.com> */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 75 | /********************************************************************************/ |
| 76 | |
Cyril Hrubis | 019ed6c | 2011-08-26 12:59:32 +0200 | [diff] [blame] | 77 | #define _GNU_SOURCE |
| 78 | |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 79 | #include <stdio.h> |
| 80 | #include <sys/wait.h> |
| 81 | #include <sys/types.h> |
| 82 | #include <sched.h> |
| 83 | #include <limits.h> |
| 84 | #include <unistd.h> |
| 85 | #include <sys/types.h> |
| 86 | #include <sys/syscall.h> |
| 87 | #include <errno.h> |
| 88 | #include <pwd.h> |
| 89 | #include <grp.h> |
| 90 | #include <string.h> |
| 91 | #include <sys/param.h> |
| 92 | #include <stdio.h> |
| 93 | |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 94 | #include "test.h" |
subrata_modak | 4827e86 | 2009-08-25 07:39:15 +0000 | [diff] [blame] | 95 | #include "config.h" |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 96 | |
Cyril Hrubis | fdce7d5 | 2013-04-04 18:35:48 +0200 | [diff] [blame] | 97 | char *TCID = "unshare01"; |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 98 | int testno; |
Cyril Hrubis | fdce7d5 | 2013-04-04 18:35:48 +0200 | [diff] [blame] | 99 | int TST_TOTAL = 1; |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 100 | |
subrata_modak | 4827e86 | 2009-08-25 07:39:15 +0000 | [diff] [blame] | 101 | #ifdef HAVE_UNSHARE |
| 102 | |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 103 | /* Extern Global Functions */ |
| 104 | /******************************************************************************/ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 105 | /* */ |
| 106 | /* Function: cleanup */ |
| 107 | /* */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 108 | /* Description: Performs all one time clean up for this test on successful */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 109 | /* completion, premature exit or failure. Closes all temporary */ |
| 110 | /* files, removes all temporary directories exits the test with */ |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 111 | /* appropriate return code by calling tst_exit() function. */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 112 | /* */ |
| 113 | /* Input: None. */ |
| 114 | /* */ |
| 115 | /* Output: None. */ |
| 116 | /* */ |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 117 | /* Return: On failure - Exits calling tst_exit(). Non '0' return code. */ |
| 118 | /* On success - Exits calling tst_exit(). With '0' return code. */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 119 | /* */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 120 | /******************************************************************************/ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 121 | void cleanup(void) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 122 | { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 123 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 124 | tst_rmdir(); |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 125 | } |
| 126 | |
| 127 | /* Local Functions */ |
| 128 | /******************************************************************************/ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 129 | /* */ |
| 130 | /* Function: setup */ |
| 131 | /* */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 132 | /* Description: Performs all one time setup for this test. This function is */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 133 | /* typically used to capture signals, create temporary dirs */ |
| 134 | /* and temporary files that may be used in the course of this */ |
| 135 | /* test. */ |
| 136 | /* */ |
| 137 | /* Input: None. */ |
| 138 | /* */ |
| 139 | /* Output: None. */ |
| 140 | /* */ |
| 141 | /* Return: On failure - Exits by calling cleanup(). */ |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 142 | /* On success - returns 0. */ |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 143 | /* */ |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 144 | /******************************************************************************/ |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 145 | void setup(void) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 146 | { |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 147 | /* Capture signals if any */ |
| 148 | /* Create temporary directories */ |
| 149 | TEST_PAUSE; |
| 150 | tst_tmpdir(); |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 151 | } |
| 152 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 153 | int main(int ac, char **av) |
| 154 | { |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 155 | pid_t pid1; |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 156 | int lc; |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 157 | int rval; |
Cyril Hrubis | 0b9589f | 2014-05-27 17:40:33 +0200 | [diff] [blame] | 158 | const char *msg; |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 159 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 160 | if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL) |
| 161 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 162 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 163 | setup(); |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 164 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 165 | for (lc = 0; TEST_LOOPING(lc); ++lc) { |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 166 | tst_count = 0; |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 167 | for (testno = 0; testno < TST_TOTAL; ++testno) { |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 168 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 169 | pid1 = fork(); //call to fork() |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 170 | if (pid1 == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 171 | tst_brkm(TFAIL | TERRNO, cleanup, |
| 172 | "fork failed"); |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 173 | } else if (pid1 == 0) { |
| 174 | switch (unshare(CLONE_FILES)) { |
| 175 | case 0: |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 176 | printf("unshare with CLONE_FILES call " |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 177 | "succeeded\n"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 178 | rval = 0; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 179 | break; |
| 180 | case -1: |
| 181 | if (errno == ENOSYS) |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 182 | rval = 1; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 183 | else { |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 184 | perror("unshare failed"); |
| 185 | rval = 2; |
| 186 | } |
subrata_modak | 4827e86 | 2009-08-25 07:39:15 +0000 | [diff] [blame] | 187 | } |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 188 | exit(rval); |
| 189 | } else { |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 190 | if (wait(&rval) == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 191 | tst_brkm(TBROK | TERRNO, cleanup, |
| 192 | "wait failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 193 | if (rval != 0 && WIFEXITED(rval)) { |
| 194 | switch (WEXITSTATUS(rval)) { |
| 195 | case 1: |
| 196 | tst_brkm(TCONF, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 197 | "unshare not supported in " |
| 198 | "kernel"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 199 | break; |
| 200 | default: |
| 201 | tst_brkm(TFAIL, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 202 | "unshare failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 203 | } |
| 204 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 205 | } |
| 206 | |
Garrett Cooper | 5374050 | 2010-12-16 00:04:01 -0800 | [diff] [blame] | 207 | pid1 = fork(); |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 208 | if (pid1 == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 209 | tst_brkm(TFAIL | TERRNO, cleanup, |
| 210 | "fork failed"); |
Garrett Cooper | 5374050 | 2010-12-16 00:04:01 -0800 | [diff] [blame] | 211 | } else if (pid1 == 0) { |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 212 | switch (unshare(CLONE_FS)) { |
| 213 | case 0: |
Garrett Cooper | 5374050 | 2010-12-16 00:04:01 -0800 | [diff] [blame] | 214 | printf("unshare with CLONE_FS call " |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 215 | "succeeded\n"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 216 | rval = 0; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 217 | break; |
| 218 | case -1: |
| 219 | if (errno == ENOSYS) |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 220 | rval = 1; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 221 | else { |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 222 | perror("unshare failed"); |
| 223 | rval = 2; |
| 224 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 225 | } |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 226 | exit(rval); |
| 227 | } else { |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 228 | if (wait(&rval) == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 229 | tst_brkm(TBROK | TERRNO, cleanup, |
| 230 | "wait failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 231 | if (rval != 0 && WIFEXITED(rval)) { |
| 232 | switch (WEXITSTATUS(rval)) { |
| 233 | case 1: |
| 234 | tst_brkm(TCONF, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 235 | "unshare not supported in " |
| 236 | "kernel"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 237 | break; |
| 238 | default: |
| 239 | tst_brkm(TFAIL, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 240 | "unshare failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 241 | } |
| 242 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 243 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 244 | |
Garrett Cooper | 5374050 | 2010-12-16 00:04:01 -0800 | [diff] [blame] | 245 | pid1 = fork(); |
| 246 | if (pid1 == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 247 | tst_brkm(TFAIL | TERRNO, cleanup, |
| 248 | "fork() failed."); |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 249 | } else if (pid1 == 0) { |
| 250 | switch (unshare(CLONE_NEWNS)) { |
| 251 | case 0: |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 252 | printf("unshare call with CLONE_NEWNS " |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 253 | "succeeded\n"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 254 | rval = 0; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 255 | break; |
| 256 | case -1: |
| 257 | if (errno == ENOSYS) |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 258 | rval = 1; |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 259 | else { |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 260 | perror("unshare failed"); |
| 261 | rval = 2; |
| 262 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 263 | } |
Garrett Cooper | 870d30e | 2010-12-16 17:05:15 -0800 | [diff] [blame] | 264 | exit(rval); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 265 | } else { |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 266 | if (wait(&rval) == -1) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 267 | tst_brkm(TBROK | TERRNO, cleanup, |
| 268 | "wait failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 269 | if (rval != 0 && WIFEXITED(rval)) { |
| 270 | switch (WEXITSTATUS(rval)) { |
| 271 | case 1: |
| 272 | tst_brkm(TCONF, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 273 | "unshare not supported in " |
| 274 | "kernel"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 275 | break; |
| 276 | default: |
| 277 | tst_brkm(TFAIL, cleanup, |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 278 | "unshare failed"); |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 279 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 280 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 281 | } |
| 282 | |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 283 | } |
| 284 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 285 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 286 | |
Garrett Cooper | 43088e1 | 2010-12-13 23:30:59 -0800 | [diff] [blame] | 287 | } |
subrata_modak | ad846c8 | 2009-05-29 12:32:43 +0000 | [diff] [blame] | 288 | cleanup(); |
| 289 | tst_exit(); |
| 290 | } |
subrata_modak | 4827e86 | 2009-08-25 07:39:15 +0000 | [diff] [blame] | 291 | #else |
| 292 | int main(void) |
| 293 | { |
Cyril Hrubis | 526fdf8 | 2014-12-04 14:35:01 +0100 | [diff] [blame] | 294 | tst_brkm(TCONF, NULL, "unshare is undefined."); |
subrata_modak | 4827e86 | 2009-08-25 07:39:15 +0000 | [diff] [blame] | 295 | } |
Garrett Cooper | 00d2a99 | 2011-02-15 22:47:34 -0800 | [diff] [blame] | 296 | #endif |