plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * |
| 3 | * Copyright (c) International Business Machines Corp., 2001 |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation; either version 2 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See |
| 13 | * the GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
Wanlong Gao | 4548c6c | 2012-10-19 18:03:36 +0800 | [diff] [blame] | 17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 18 | */ |
| 19 | |
| 20 | /* |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 21 | * Testcase to check the basic functionality of the setrlimit system call. |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 22 | * Use the different commands like RLIMIT_NOFILE, RLIMIT_CORE, |
| 23 | * RLIMIT_FSIZE, and, RLIMIT_NOFILE, and test for different test |
| 24 | * conditions. |
| 25 | * |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 26 | * 07/2001 Ported by Wayne Boyer |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 27 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 28 | |
plars | 74948ad | 2002-11-14 16:16:14 +0000 | [diff] [blame] | 29 | #include <sys/types.h> |
Garrett Cooper | bacc849 | 2011-01-14 00:36:17 -0800 | [diff] [blame] | 30 | #include <sys/resource.h> |
plars | 74948ad | 2002-11-14 16:16:14 +0000 | [diff] [blame] | 31 | #include <sys/stat.h> |
Garrett Cooper | bacc849 | 2011-01-14 00:36:17 -0800 | [diff] [blame] | 32 | #include <sys/time.h> |
| 33 | #include <sys/wait.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 34 | #include <errno.h> |
Garrett Cooper | bacc849 | 2011-01-14 00:36:17 -0800 | [diff] [blame] | 35 | #include <fcntl.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 36 | #include <stdlib.h> |
Garrett Cooper | bacc849 | 2011-01-14 00:36:17 -0800 | [diff] [blame] | 37 | #include <unistd.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 38 | #include "test.h" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 39 | |
| 40 | char *TCID = "setrlimit01"; |
| 41 | int TST_TOTAL = 1; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 42 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 43 | static void setup(void); |
| 44 | static void cleanup(void); |
| 45 | static void test1(void); |
| 46 | static void test2(void); |
| 47 | static void test3(void); |
| 48 | static void test4(void); |
| 49 | static void sighandler(int); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 50 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 51 | static char filename[40] = ""; |
| 52 | static struct rlimit save_rlim, rlim, rlim1; |
| 53 | static int nofiles, fd, bytes, i, status; |
| 54 | static char *buf = "abcdefghijklmnopqrstuvwxyz"; |
| 55 | static pid_t pid; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 56 | |
plars | 74948ad | 2002-11-14 16:16:14 +0000 | [diff] [blame] | 57 | int main(int ac, char **av) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 58 | { |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 59 | int lc; |
Cyril Hrubis | 0b9589f | 2014-05-27 17:40:33 +0200 | [diff] [blame] | 60 | const char *msg; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 61 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 62 | msg = parse_opts(ac, av, NULL, NULL); |
| 63 | if (msg != NULL) |
Garrett Cooper | 60fa801 | 2010-11-22 13:50:58 -0800 | [diff] [blame] | 64 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 65 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 66 | setup(); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 67 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 68 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 69 | tst_count = 0; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 70 | |
| 71 | test1(); |
| 72 | test2(); |
| 73 | test3(); |
| 74 | /* reset saved conditions */ |
| 75 | if ((setrlimit(RLIMIT_NPROC, &save_rlim)) == -1) { |
| 76 | tst_brkm(TBROK, cleanup, "setrlimit failed to reset " |
| 77 | "RLIMIT_NPROC, errno = %d", errno); |
| 78 | } |
| 79 | test4(); |
| 80 | } |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 81 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 82 | cleanup(); |
Garrett Cooper | 1e6f5a6 | 2010-12-19 09:58:10 -0800 | [diff] [blame] | 83 | tst_exit(); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 84 | } |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 85 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 86 | /* |
| 87 | * test1 - Test for RLIMIT_NOFILE |
| 88 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 89 | static void test1(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 90 | { |
| 91 | rlim.rlim_cur = 100; |
| 92 | rlim.rlim_max = 100; |
| 93 | |
| 94 | TEST(setrlimit(RLIMIT_NOFILE, &rlim)); |
| 95 | |
| 96 | if (TEST_RETURN == -1) { |
| 97 | tst_resm(TFAIL, "setrlimit failed to set " |
| 98 | "RLIMIT_NOFILE, errno = %d", errno); |
| 99 | return; |
| 100 | } |
| 101 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 102 | nofiles = getdtablesize(); |
| 103 | |
| 104 | if (nofiles != 100) { |
| 105 | tst_resm(TFAIL, "setrlimit failed, expected " |
| 106 | "100, got %d", nofiles); |
| 107 | return; |
| 108 | } |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 109 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 110 | tst_resm(TPASS, "RLIMIT_NOFILE functionality is correct"); |
| 111 | } |
| 112 | |
| 113 | /* |
| 114 | * test2 - Test for RLIMIT_FSIZE |
| 115 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 116 | static void test2(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 117 | { |
| 118 | /* |
| 119 | * Since we would be altering the filesize in the child, |
| 120 | * we need to "sync", ie. fflush the parent's write buffers |
| 121 | * here. This is because the child will inherit the parent's |
| 122 | * write buffer, and while exitting it would try to fflush it. |
| 123 | * Since its filesize is truncated to only 10 bytes, the |
| 124 | * fflush attempt would fail, and the child would exit with |
| 125 | * an wired value! So, it is essential to fflush the parent's |
| 126 | * write buffer HERE |
| 127 | */ |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 128 | int pipefd[2]; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 129 | fflush(stdout); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 130 | if (pipe(pipefd) == -1) |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 131 | tst_brkm(TBROK | TERRNO, NULL, "pipe creation failed"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 132 | |
| 133 | /* |
| 134 | * Spawn a child process, and reduce the filesize to |
| 135 | * 10 by calling setrlimit(). We can't do this in the |
| 136 | * parent, because the parent needs a bigger filesize as its |
| 137 | * output will be saved to the logfile (instead of stdout) |
| 138 | * when the testcase (parent) is run from the driver. |
| 139 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 140 | pid = FORK_OR_VFORK(); |
| 141 | if (pid == -1) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 142 | tst_brkm(TBROK, cleanup, "fork() failed"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 143 | |
| 144 | if (pid == 0) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 145 | close(pipefd[0]); /* close unused read end */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 146 | rlim.rlim_cur = 10; |
| 147 | rlim.rlim_max = 10; |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 148 | if ((setrlimit(RLIMIT_FSIZE, &rlim)) == -1) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 149 | exit(1); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 150 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 151 | fd = creat(filename, 0644); |
| 152 | if (fd < 0) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 153 | exit(2); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 154 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 155 | bytes = write(fd, buf, 26); |
| 156 | if (bytes != 10) { |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 157 | if (write(pipefd[1], &bytes, sizeof(bytes)) |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 158 | < sizeof(bytes)) { |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 159 | perror("child: write to pipe failed"); |
| 160 | } |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 161 | close(pipefd[1]); /* EOF */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 162 | exit(3); |
| 163 | } |
| 164 | exit(0); /* success */ |
| 165 | } |
| 166 | |
| 167 | /* parent */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 168 | if (waitpid(pid, &status, 0) == -1) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 169 | tst_brkm(TBROK, cleanup, "waitpid() failed"); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 170 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 171 | switch (WEXITSTATUS(status)) { |
| 172 | case 0: |
| 173 | tst_resm(TPASS, "RLIMIT_FSIZE test PASSED"); |
| 174 | break; |
| 175 | case 1: |
| 176 | tst_resm(TFAIL, "setrlimit failed to set " |
| 177 | "RLIMIT_FSIZE, errno = %d", errno); |
| 178 | break; |
| 179 | case 2: |
| 180 | tst_resm(TFAIL, "creating testfile failed"); |
| 181 | break; |
| 182 | case 3: |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 183 | close(pipefd[1]); /* close unused write end */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 184 | if (read(pipefd[0], &bytes, sizeof(bytes)) < sizeof(bytes)) |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 185 | tst_resm(TFAIL, "parent: reading pipe failed"); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 186 | |
Subrata Modak | 99b7a68 | 2010-08-24 16:30:06 +0530 | [diff] [blame] | 187 | close(pipefd[0]); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 188 | tst_resm(TFAIL, "setrlimit failed, expected " |
| 189 | "10 got %d", bytes); |
| 190 | break; |
| 191 | default: |
| 192 | tst_resm(TFAIL, "child returned bad exit status"); |
| 193 | } |
| 194 | } |
| 195 | |
| 196 | /* |
| 197 | * test3 - Test for RLIMIT_NPROC |
| 198 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 199 | static void test3(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 200 | { |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 201 | if (getrlimit(RLIMIT_NPROC, &save_rlim) < 0) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 202 | tst_brkm(TBROK, cleanup, "getrlimit failed, errno: %d", errno); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 203 | |
| 204 | rlim.rlim_cur = 10; |
| 205 | rlim.rlim_max = 10; |
| 206 | |
| 207 | TEST(setrlimit(RLIMIT_NPROC, &rlim)); |
| 208 | |
| 209 | if (TEST_RETURN == -1) { |
| 210 | tst_resm(TFAIL, "setrlimit failed to set " |
| 211 | "RLIMIT_NPROC, errno = %d", errno); |
| 212 | return; |
| 213 | } |
| 214 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 215 | if ((getrlimit(RLIMIT_NPROC, &rlim1)) == -1) { |
| 216 | tst_brkm(TBROK, cleanup, "getrlimit failed to get " |
| 217 | "values for RLIMIT_NPROC, errno = %d", errno); |
| 218 | } |
| 219 | |
| 220 | if ((rlim1.rlim_cur != 10) && (rlim1.rlim_max != 10)) { |
| 221 | tst_resm(TFAIL, "setrlimit did not set the proc " |
| 222 | "limit correctly"); |
| 223 | return; |
| 224 | } |
| 225 | |
| 226 | for (i = 0; i < 20; i++) { |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 227 | pid = FORK_OR_VFORK(); |
| 228 | if (pid == -1) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 229 | if (errno != EAGAIN) { |
| 230 | tst_resm(TWARN, "Expected EAGAIN got %d", |
| 231 | errno); |
| 232 | } |
| 233 | } else if (pid == 0) { |
| 234 | exit(0); |
| 235 | } |
| 236 | } |
| 237 | waitpid(pid, &status, 0); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 238 | if (WEXITSTATUS(status) != 0) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 239 | tst_resm(TFAIL, "RLIMIT_NPROC functionality is not correct"); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 240 | else |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 241 | tst_resm(TPASS, "RLIMIT_NPROC functionality is correct"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | /* |
vapier | 65e67ea | 2006-11-03 08:13:38 +0000 | [diff] [blame] | 245 | * test4() - Test for RLIMIT_CORE by forking a child and |
| 246 | * having it cause a segfault |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 247 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 248 | static void test4(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 249 | { |
| 250 | rlim.rlim_cur = 10; |
| 251 | rlim.rlim_max = 10; |
| 252 | |
| 253 | TEST(setrlimit(RLIMIT_CORE, &rlim)); |
| 254 | |
| 255 | if (TEST_RETURN == -1) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 256 | tst_resm(TFAIL | TERRNO, "setrlimit failed to set RLIMIT_CORE"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 257 | return; |
| 258 | } |
| 259 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 260 | pid = FORK_OR_VFORK(); |
| 261 | if (pid == -1) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 262 | tst_brkm(TBROK, cleanup, "fork() failed"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 263 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 264 | if (pid == 0) { /* child */ |
vapier | 65e67ea | 2006-11-03 08:13:38 +0000 | [diff] [blame] | 265 | char *testbuf = NULL; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 266 | strcpy(testbuf, "abcd"); |
| 267 | exit(0); |
| 268 | } |
| 269 | wait(&status); |
| 270 | |
| 271 | if (access("core", F_OK) == 0) { |
Garrett Cooper | 5262667 | 2010-12-20 15:03:21 -0800 | [diff] [blame] | 272 | tst_resm(TFAIL, "core dump dumped unexpectedly"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 273 | return; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 274 | } else if (errno != ENOENT) { |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 275 | tst_resm(TFAIL | TERRNO, "access failed unexpectedly"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 276 | return; |
| 277 | } |
| 278 | |
| 279 | tst_resm(TPASS, "RLIMIT_CORE functionality is correct"); |
| 280 | } |
| 281 | |
| 282 | /* |
| 283 | * sighandler() - catch sigsegv when generated by child in test #4 |
| 284 | */ |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 285 | static void sighandler(int sig) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 286 | { |
Wanlong Gao | 55a7a5e | 2013-12-20 16:14:37 +0800 | [diff] [blame] | 287 | if (sig != SIGSEGV && sig != SIGXFSZ && sig != SIGTERM) |
Garrett Cooper | 5262667 | 2010-12-20 15:03:21 -0800 | [diff] [blame] | 288 | tst_brkm(TBROK, NULL, "caught unexpected signal: %d", sig); |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 289 | |
Salvatore Cro | aeaf793 | 2011-11-22 09:34:48 +0100 | [diff] [blame] | 290 | _exit(0); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 291 | } |
| 292 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 293 | static void setup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 294 | { |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 295 | tst_require_root(NULL); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 296 | |
| 297 | umask(0); |
| 298 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 299 | tst_sig(FORK, sighandler, cleanup); |
| 300 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 301 | TEST_PAUSE; |
| 302 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 303 | tst_tmpdir(); |
| 304 | |
| 305 | sprintf(filename, "setrlimit1.%d", getpid()); |
| 306 | } |
| 307 | |
Wanlong Gao | 58c67c6 | 2013-12-20 16:08:55 +0800 | [diff] [blame] | 308 | static void cleanup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 309 | { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 310 | unlink(filename); |
| 311 | tst_rmdir(); |
Garrett Cooper | 5262667 | 2010-12-20 15:03:21 -0800 | [diff] [blame] | 312 | } |