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 | /* |
| 21 | * NAME |
| 22 | * writev04.c |
| 23 | * |
| 24 | * DESCRIPTION |
| 25 | * The testcases are written calling writev() with partially valid data |
| 26 | * to overwrite the contents, to write in the beginning and to write in |
| 27 | * the end of the file. This is same as writev03.c, but the length of |
| 28 | * buffer used here is 8192 bytes. |
| 29 | * |
| 30 | * USAGE: <for command-line> |
| 31 | * writev04 [-c n] [-e] [-i n] [-I x] [-P x] [-t] |
| 32 | * where, -c n : Run n copies concurrently. |
| 33 | * -e : Turn on errno logging. |
| 34 | * -i n : Execute test n times. |
| 35 | * -I x : Execute test for x seconds. |
| 36 | * -P x : Pause for x seconds between iterations. |
| 37 | * -t : Turn on syscall timing. |
| 38 | * |
| 39 | * History |
| 40 | * 07/2001 John George |
| 41 | * -Ported |
robbiew | 4644c7e | 2002-04-26 14:33:32 +0000 | [diff] [blame] | 42 | * 04/2002 wjhuie sigset cleanups |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 43 | * |
| 44 | * Restrictions |
| 45 | * NONE |
| 46 | */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 47 | #include <sys/types.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 48 | #include <sys/uio.h> |
robbiew | 3754997 | 2005-08-30 19:32:44 +0000 | [diff] [blame] | 49 | #include <sys/mman.h> |
| 50 | #include <unistd.h> |
| 51 | #include <signal.h> |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 52 | #include <fcntl.h> |
| 53 | #include <memory.h> |
| 54 | #include <errno.h> |
Garrett Cooper | e8530df | 2010-12-21 11:37:57 -0800 | [diff] [blame] | 55 | #include "test.h" |
| 56 | #include "usctest.h" |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 57 | |
| 58 | #define K_1 8192 |
| 59 | |
| 60 | #define NBUFS 4 |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 61 | #define CHUNK 64 /* single chunk */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 62 | #define MAX_IOVEC 4 |
| 63 | #define DATA_FILE "writev_data_file" |
| 64 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 65 | char buf1[K_1], buf2[K_1], buf3[K_1]; |
| 66 | char *bad_addr = 0; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 67 | |
| 68 | struct iovec wr_iovec[MAX_IOVEC] = { |
| 69 | /* testcase #1 */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 70 | {buf1 + (CHUNK * 6), CHUNK}, |
| 71 | {(caddr_t) - 1, CHUNK}, |
| 72 | {buf1 + (CHUNK * 8), CHUNK}, |
Cyril Hrubis | cf0d626 | 2014-09-23 14:03:31 +0200 | [diff] [blame] | 73 | {NULL, 0} |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 74 | }; |
| 75 | |
| 76 | /* 0 terminated list of expected errnos */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 77 | int exp_enos[] = { 0 }; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 78 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 79 | char name[K_1], f_name[K_1]; |
| 80 | int fd[2], in_sighandler; |
| 81 | char *buf_list[NBUFS]; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 82 | |
| 83 | char *TCID = "writev04"; |
| 84 | int TST_TOTAL = 1; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 85 | |
| 86 | void sighandler(int); |
| 87 | long l_seek(int, long, int); |
| 88 | void setup(void); |
| 89 | void cleanup(void); |
| 90 | int fail; |
| 91 | |
vapier | 6925ca3 | 2006-02-27 04:25:25 +0000 | [diff] [blame] | 92 | #if !defined(UCLINUX) |
| 93 | |
robbiew | 7d5c517 | 2003-03-27 22:54:57 +0000 | [diff] [blame] | 94 | int main(int argc, char **argv) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 95 | { |
Cyril Hrubis | 89af32a | 2012-10-24 16:39:11 +0200 | [diff] [blame] | 96 | int lc; |
Cyril Hrubis | 0b9589f | 2014-05-27 17:40:33 +0200 | [diff] [blame] | 97 | const char *msg; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 98 | |
| 99 | int nbytes; |
| 100 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 101 | if ((msg = parse_opts(argc, argv, NULL, NULL)) != NULL) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 102 | tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 103 | |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 104 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 105 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 106 | setup(); /* set "tstdir", and "testfile" vars */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 107 | |
| 108 | /* The following loop checks looping state if -i option given */ |
| 109 | for (lc = 0; TEST_LOOPING(lc); lc++) { |
| 110 | |
Caspar Zhang | d59a659 | 2013-03-07 14:59:12 +0800 | [diff] [blame] | 111 | /* reset tst_count in case we are looping */ |
| 112 | tst_count = 0; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 113 | |
| 114 | buf_list[0] = buf1; |
| 115 | buf_list[1] = buf2; |
| 116 | buf_list[2] = buf3; |
Garrett Cooper | 45e285d | 2010-11-22 12:19:25 -0800 | [diff] [blame] | 117 | buf_list[3] = NULL; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 118 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 119 | fd[1] = -1; /* Invalid file descriptor */ |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 120 | |
robbiew | 4c53b8f | 2003-04-04 16:46:57 +0000 | [diff] [blame] | 121 | if (signal(SIGTERM, sighandler) == SIG_ERR) { |
robbiew | 4644c7e | 2002-04-26 14:33:32 +0000 | [diff] [blame] | 122 | perror("signal"); |
| 123 | tst_resm(TFAIL, "signal() SIGTERM FAILED"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 124 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 125 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 126 | |
robbiew | 4c53b8f | 2003-04-04 16:46:57 +0000 | [diff] [blame] | 127 | if (signal(SIGPIPE, sighandler) == SIG_ERR) { |
robbiew | 4644c7e | 2002-04-26 14:33:32 +0000 | [diff] [blame] | 128 | perror("signal"); |
| 129 | tst_resm(TFAIL, "signal() SIGPIPE FAILED"); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 130 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 131 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 132 | |
| 133 | memset(buf_list[0], 0, K_1); |
| 134 | memset(buf_list[1], 0, K_1); |
| 135 | |
| 136 | if ((fd[0] = open(f_name, O_WRONLY | O_CREAT, 0666)) < 0) { |
| 137 | tst_resm(TFAIL, "open(2) failed: fname = %s, " |
| 138 | "errno = %d", f_name, errno); |
| 139 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 140 | } else { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 141 | if ((nbytes = write(fd[0], buf_list[1], K_1)) != K_1) { |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 142 | tst_resm(TFAIL, "write(2) failed: nbytes " |
| 143 | "= %d, errno = %d", nbytes, errno); |
| 144 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 145 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | if (close(fd[0]) < 0) { |
| 149 | tst_resm(TFAIL, "close failed: errno = %d", errno); |
| 150 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 151 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 152 | |
| 153 | if ((fd[0] = open(f_name, O_RDWR, 0666)) < 0) { |
Cyril Hrubis | 9fa8ad0 | 2014-12-16 13:20:49 +0100 | [diff] [blame^] | 154 | tst_brkm(TFAIL, cleanup, "open failed: fname = %s, errno = %d", |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 155 | f_name, errno); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 156 | } |
robbiew | 7d5c517 | 2003-03-27 22:54:57 +0000 | [diff] [blame] | 157 | //block1: |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 158 | tst_resm(TINFO, "Enter block 1"); |
| 159 | fail = 0; |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 160 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 161 | /* |
| 162 | * In this block we are trying to call writev() with |
| 163 | * partially valid data. This should return the valid number |
| 164 | * of bytes written in the vector. If it returns EFAULT, it |
| 165 | * is an error. And after returning the number of valid |
| 166 | * bytes written, the check should be made to verify the |
| 167 | * contents of the first valid write() scheduled. |
| 168 | */ |
| 169 | if (writev(fd[0], wr_iovec, 3) < 0) { |
| 170 | TEST_ERROR_LOG(errno); |
| 171 | fail = 1; |
| 172 | if (errno == EFAULT) { |
| 173 | tst_resm(TFAIL, "Got error EFAULT"); |
| 174 | } else { |
| 175 | tst_resm(TFAIL, "Received unexpected error: %d", |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 176 | errno); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 177 | } |
| 178 | } else { |
| 179 | l_seek(fd[0], 0, 0); |
| 180 | read(fd[0], buf_list[0], CHUNK); |
| 181 | if (memcmp(buf_list[0], buf_list[1], CHUNK) != 0) { |
| 182 | tst_resm(TFAIL, "writev overwrote the file"); |
| 183 | fail = 1; |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | if (fail) { |
| 188 | tst_resm(TINFO, "block 1 FAILED"); |
| 189 | } else { |
| 190 | tst_resm(TINFO, "block 1 PASSED"); |
| 191 | } |
| 192 | tst_resm(TINFO, "Exit block 1"); |
| 193 | |
robbiew | 7d5c517 | 2003-03-27 22:54:57 +0000 | [diff] [blame] | 194 | //block2: |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 195 | tst_resm(TINFO, "Enter block 2"); |
| 196 | fail = 0; |
| 197 | |
| 198 | /* |
| 199 | * In this block we are trying to over write the contents by |
| 200 | * calling writev() with partially valid data. It should |
| 201 | * return the valid number of bytes written but not EFAULT. |
| 202 | * Also the check should be made whether the initial write() |
| 203 | * scheduled is done correctly or not. |
| 204 | */ |
| 205 | l_seek(fd[0], 0, 0); |
| 206 | if (writev(fd[0], wr_iovec, 3) < 0) { |
| 207 | TEST_ERROR_LOG(errno); |
| 208 | fail = 1; |
| 209 | if (errno == EFAULT) { |
| 210 | tst_resm(TFAIL, "Got error EFAULT"); |
| 211 | } else { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 212 | tst_resm(TFAIL, "Received unexpected error: %d", |
| 213 | errno); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 214 | } |
| 215 | } else { |
| 216 | l_seek(fd[0], 0, 0); |
| 217 | read(fd[0], buf_list[0], CHUNK); |
| 218 | if (memcmp(buf_list[0], buf_list[1], CHUNK) != 0) { |
| 219 | tst_resm(TFAIL, "writev overwrote the file"); |
| 220 | fail = 1; |
| 221 | } |
| 222 | } |
| 223 | |
| 224 | if (fail) { |
| 225 | tst_resm(TINFO, "block 2 FAILED"); |
| 226 | } else { |
| 227 | tst_resm(TINFO, "block 2 PASSED"); |
| 228 | } |
| 229 | tst_resm(TINFO, "Exit block 2"); |
| 230 | |
robbiew | 7d5c517 | 2003-03-27 22:54:57 +0000 | [diff] [blame] | 231 | //block3: |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 232 | tst_resm(TINFO, "Enter block 3"); |
| 233 | fail = 0; |
| 234 | |
| 235 | /* |
| 236 | * In this block, we are trying to call writev() by going to |
| 237 | * some end position of the file. Here writev() is called |
| 238 | * with partially valid data, and this will return the |
| 239 | * number of valid bytes written and not EFAULT. Also, the |
| 240 | * check should be made whether the inital write() that is |
| 241 | * scheduled with valid data is done correctly. |
| 242 | */ |
| 243 | |
| 244 | l_seek(fd[0], 8192, 0); |
| 245 | if (writev(fd[0], wr_iovec, 3) < 0) { |
| 246 | TEST_ERROR_LOG(errno); |
| 247 | fail = 1; |
| 248 | if (errno == EFAULT) { |
| 249 | tst_resm(TFAIL, "Got error EFAULT"); |
| 250 | } else { |
| 251 | tst_resm(TFAIL, "Received unexpected error: %d", |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 252 | errno); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 253 | } |
| 254 | } else { |
| 255 | l_seek(fd[0], 0, 0); |
| 256 | read(fd[0], buf_list[0], CHUNK); |
| 257 | if (memcmp(buf_list[0], buf_list[1], CHUNK) != 0) { |
| 258 | tst_resm(TFAIL, "writev overwrote the file"); |
| 259 | fail = 1; |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | if (fail) { |
| 264 | tst_resm(TINFO, "block 3 FAILED"); |
| 265 | } else { |
| 266 | tst_resm(TINFO, "block 3 PASSED"); |
| 267 | } |
| 268 | tst_resm(TINFO, "Exit block 3"); |
| 269 | } |
subrata_modak | dad6e1a | 2007-10-30 10:46:58 +0000 | [diff] [blame] | 270 | close(fd[0]); |
| 271 | close(fd[1]); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 272 | cleanup(); |
Garrett Cooper | 2aca6fc | 2010-12-19 03:12:40 -0800 | [diff] [blame] | 273 | tst_exit(); |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 274 | } |
| 275 | |
vapier | 6925ca3 | 2006-02-27 04:25:25 +0000 | [diff] [blame] | 276 | #else |
| 277 | |
Mike Frysinger | c57fba5 | 2014-04-09 18:56:30 -0400 | [diff] [blame] | 278 | int main(void) |
vapier | 6925ca3 | 2006-02-27 04:25:25 +0000 | [diff] [blame] | 279 | { |
| 280 | tst_resm(TINFO, "test is not available on uClinux"); |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 281 | tst_exit(); |
vapier | 6925ca3 | 2006-02-27 04:25:25 +0000 | [diff] [blame] | 282 | } |
| 283 | |
| 284 | #endif /* if !defined(UCLINUX) */ |
| 285 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 286 | /* |
| 287 | * setup() |
| 288 | * performs all ONE TIME setup for this test |
| 289 | */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 290 | void setup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 291 | { |
Garrett Cooper | 2c28215 | 2010-12-16 00:55:50 -0800 | [diff] [blame] | 292 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 293 | tst_sig(FORK, DEF_HANDLER, cleanup); |
| 294 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 295 | TEST_EXP_ENOS(exp_enos); |
| 296 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 297 | TEST_PAUSE; |
| 298 | |
| 299 | /* Create a unique temporary directory and chdir() to it. */ |
| 300 | tst_tmpdir(); |
| 301 | |
| 302 | strcpy(name, DATA_FILE); |
| 303 | sprintf(f_name, "%s.%d", name, getpid()); |
subrata_modak | bdbaec5 | 2009-02-26 12:14:51 +0000 | [diff] [blame] | 304 | |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 305 | bad_addr = mmap(0, 1, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); |
| 306 | if (bad_addr == MAP_FAILED) { |
| 307 | tst_brkm(TBROK, cleanup, "mmap failed"); |
| 308 | } |
| 309 | wr_iovec[1].iov_base = bad_addr; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 310 | |
| 311 | } |
| 312 | |
| 313 | /* |
| 314 | * cleanup() |
| 315 | * performs all ONE TIME cleanup for this test at |
| 316 | * completion or premature exit |
| 317 | */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 318 | void cleanup(void) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 319 | { |
| 320 | /* |
| 321 | * print timing stats if that option was specified. |
| 322 | * print errno log if that option was specified. |
| 323 | */ |
| 324 | TEST_CLEANUP; |
| 325 | |
| 326 | if (unlink(f_name) < 0) { |
| 327 | tst_resm(TFAIL, "unlink Failed--file = %s, errno = %d", |
| 328 | f_name, errno); |
| 329 | } |
| 330 | tst_rmdir(); |
| 331 | |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | /* |
| 335 | * sighandler() |
| 336 | * Signal handler function for SIGTERM and SIGPIPE |
| 337 | */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 338 | void sighandler(int sig) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 339 | { |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 340 | switch (sig) { |
| 341 | case SIGTERM: |
| 342 | break; |
| 343 | case SIGPIPE: |
| 344 | ++in_sighandler; |
| 345 | return; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 346 | default: |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 347 | tst_resm(TFAIL, "sighandler() received invalid signal " |
| 348 | ": %d", sig); |
| 349 | break; |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 350 | } |
| 351 | |
| 352 | if ((unlink(f_name) < 0) && (errno != ENOENT)) { |
| 353 | tst_resm(TFAIL, "unlink Failed--file = %s, errno = %d", |
| 354 | f_name, errno); |
| 355 | cleanup(); |
Wanlong Gao | 354ebb4 | 2012-12-07 10:10:04 +0800 | [diff] [blame] | 356 | } |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 357 | exit(sig); |
| 358 | } |
| 359 | |
| 360 | /* |
| 361 | * l_seek() |
| 362 | * Wrap around for regular lseek function for giving error message |
| 363 | */ |
subrata_modak | 56207ce | 2009-03-23 13:35:39 +0000 | [diff] [blame] | 364 | long l_seek(int fdesc, long offset, int whence) |
plars | 865695b | 2001-08-27 22:15:12 +0000 | [diff] [blame] | 365 | { |
| 366 | if (lseek(fdesc, offset, whence) < 0) { |
| 367 | tst_resm(TFAIL, "lseek Failed : errno = %d", errno); |
| 368 | fail = 1; |
| 369 | } |
subrata_modak | 43337a3 | 2009-02-26 11:43:51 +0000 | [diff] [blame] | 370 | return 0; |
Chris Dearman | ec6edca | 2012-10-17 19:54:01 -0700 | [diff] [blame] | 371 | } |