1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 26 #ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.14 */ 27 /* LINTLIBRARY */ 28 29 #include "unistd.h" 30 #include "sys/types.h" 31 #include "sys/stat.h" 32 #include "errno.h" 33 #include "fcntl.h" 34 #include "stdlib.h" 35 #include "string.h" 36 37 /** 38 ** Auto-restarting system calls: 39 **/ 40 41 int 42 #if defined(__STDC__) 43 _Access ( 44 char * s, 45 int i 46 ) 47 #else 48 _Access (s, i) 49 char * s; 50 int i; 51 #endif 52 { 53 register int n; 54 55 while ((n = access(s, i)) == -1 && errno == EINTR) 56 ; 57 return (n); 58 } 59 60 int 61 #if defined(__STDC__) 62 _Chdir ( 63 char * s 64 ) 65 #else 66 _Chdir (s) 67 char * s; 68 #endif 69 { 70 register int n; 71 72 while ((n = chdir(s)) == -1 && errno == EINTR) 73 ; 74 return (n); 75 } 76 77 int 78 #if defined(__STDC__) 79 _Chmod ( 80 char * s, 81 int i 82 ) 83 #else 84 _Chmod (s, i) 85 char * s; 86 int i; 87 #endif 88 { 89 register int n; 90 91 while ((n = chmod(s, i)) == -1 && errno == EINTR) 92 ; 93 return (n); 94 } 95 96 int 97 #if defined(__STDC__) 98 _Chown ( 99 char * s, 100 int i, 101 int j 102 ) 103 #else 104 _Chown (s, i, j) 105 char * s; 106 int i; 107 int j; 108 #endif 109 { 110 register int n; 111 112 while ((n = chown(s, i, j)) == -1 && errno == EINTR) 113 ; 114 return (n); 115 } 116 117 int 118 #if defined(__STDC__) 119 _Close ( 120 int i 121 ) 122 #else 123 _Close (i) 124 int i; 125 #endif 126 { 127 register int n; 128 129 while ((n = close(i)) == -1 && errno == EINTR) 130 ; 131 return (n); 132 } 133 134 int 135 #if defined(__STDC__) 136 _Creat ( 137 char * s, 138 int i 139 ) 140 #else 141 _Creat (s, i) 142 char * s; 143 int i; 144 #endif 145 { 146 register int n; 147 148 while ((n = creat(s, i)) == -1 && errno == EINTR) 149 ; 150 return (n); 151 } 152 153 int 154 #if defined(__STDC__) 155 _Fcntl ( 156 int i, 157 int j, 158 struct flock * k 159 ) 160 #else 161 _Fcntl (i, j, k) 162 int i; 163 int j; 164 struct flock * k; 165 #endif 166 { 167 register int n; 168 169 while ((n = fcntl(i, j, k)) == -1 && errno == EINTR) 170 ; 171 return (n); 172 } 173 174 int 175 #if defined(__STDC__) 176 _Fstat ( 177 int i, 178 struct stat * st 179 ) 180 #else 181 _Fstat (i, st) 182 int i; 183 struct stat * st; 184 #endif 185 { 186 register int n; 187 188 while ((n = fstat(i, st)) == -1 && errno == EINTR) 189 ; 190 return (n); 191 } 192 193 int 194 #if defined(__STDC__) 195 _Link ( 196 char * s1, 197 char * s2 198 ) 199 #else 200 _Link (s1, s2) 201 char * s1; 202 char * s2; 203 #endif 204 { 205 register int n; 206 207 while ((n = link(s1, s2)) == -1 && errno == EINTR) 208 ; 209 return (n); 210 } 211 212 int 213 #if defined(__STDC__) 214 _Lstat ( 215 char * s, 216 struct stat * st 217 ) 218 #else 219 _Lstat (s, st) 220 char * s; 221 struct stat * st; 222 #endif 223 { 224 register int n; 225 226 while ((n = lstat(s, st)) == -1 && errno == EINTR) 227 ; 228 return (n); 229 } 230 231 int 232 #if defined(__STDC__) 233 _Mknod ( 234 char * s, 235 int i, 236 int j 237 ) 238 #else 239 _Mknod (s, i, j) 240 char * s; 241 int i; 242 int j; 243 #endif 244 { 245 register int n; 246 247 while ((n = mknod(s, i, j)) == -1 && errno == EINTR) 248 ; 249 return (n); 250 } 251 252 int 253 #if defined(__STDC__) 254 _Open ( 255 char * s, 256 int i, 257 int j 258 ) 259 #else 260 _Open (s, i, j) 261 char * s; 262 int i; 263 int j; 264 #endif 265 { 266 register int n; 267 268 while ((n = open(s, i, j)) == -1 && errno == EINTR) 269 ; 270 return (n); 271 } 272 273 int 274 #if defined(__STDC__) 275 _Read ( 276 int i, 277 char * s, 278 unsigned int j 279 ) 280 #else 281 _Read (i, s, j) 282 int i; 283 char * s; 284 unsigned int j; 285 #endif 286 { 287 register int n; 288 289 while ((n = read(i, s, j)) == -1 && errno == EINTR) 290 ; 291 return (n); 292 } 293 294 int 295 #if defined(__STDC__) 296 _Readlink ( 297 char * s1, 298 char * s2, 299 unsigned int j 300 ) 301 #else 302 _Readlink (s1, s2, j) 303 char * s1; 304 char * s2; 305 unsigned int j; 306 #endif 307 { 308 register int n; 309 310 while ((n = readlink(s1, s2, j)) == -1 && errno == EINTR) 311 ; 312 return (n); 313 } 314 315 int 316 #if defined(__STDC__) 317 _Rename ( 318 char * s1, 319 char * s2 320 ) 321 #else 322 _Rename (s1, s2) 323 char * s1; 324 char * s2; 325 #endif 326 { 327 register int n; 328 329 while ((n = rename(s1, s2)) == -1 && errno == EINTR) 330 ; 331 return (n); 332 } 333 334 int 335 #if defined(__STDC__) 336 _Stat ( 337 char * s, 338 struct stat * st 339 ) 340 #else 341 _Stat (s, st) 342 char * s; 343 struct stat * st; 344 #endif 345 { 346 register int n; 347 348 while ((n = stat(s, st)) == -1 && errno == EINTR) 349 ; 350 return (n); 351 } 352 353 int 354 #if defined(__STDC__) 355 _Symlink ( 356 char * s1, 357 char * s2 358 ) 359 #else 360 _Symlink (s1, s2) 361 char * s1; 362 char * s2; 363 #endif 364 { 365 register int n; 366 367 while ((n = symlink(s1, s2)) == -1 && errno == EINTR) 368 ; 369 return (n); 370 } 371 372 int 373 #if defined(__STDC__) 374 _Unlink ( 375 char * s 376 ) 377 #else 378 _Unlink (s) 379 char * s; 380 #endif 381 { 382 register int n; 383 384 while ((n = unlink(s)) == -1 && errno == EINTR) 385 ; 386 return (n); 387 } 388 389 int 390 #if defined(__STDC__) 391 _Wait ( 392 int * i 393 ) 394 #else 395 _Wait (i) 396 int * i; 397 #endif 398 { 399 register int n; 400 401 while ((n = wait(i)) == -1 && errno == EINTR) 402 ; 403 return (n); 404 } 405 406 int 407 #if defined(__STDC__) 408 _Write ( 409 int i, 410 char * s, 411 unsigned int j 412 ) 413 #else 414 _Write (i, s, j) 415 int i; 416 char * s; 417 unsigned int j; 418 #endif 419 { 420 register int n; 421 422 while ((n = write(i, s, j)) == -1 && errno == EINTR) 423 ; 424 return (n); 425 } 426