blob: 63a7ccea8e9571286952905973b0c2fb0976e467 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
2 * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3 * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
9 * are met:
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 * derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * $Id$
30 */
31
32#include "defs.h"
33
34#include <dirent.h>
35
Wichert Akkerman8bc6cfd1999-04-21 15:57:38 +000036#ifdef linux
Wichert Akkermand4d8e921999-04-18 23:30:29 +000037# include <asm/stat.h>
38# define stat libc_stat
39# include <sys/stat.h>
40# undef stat
Wichert Akkermand4d8e921999-04-18 23:30:29 +000041#else
42# include <sys/stat.h>
Wichert Akkerman328c5e71999-04-16 00:21:26 +000043#endif
Wichert Akkermand4d8e921999-04-18 23:30:29 +000044
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000045#include <fcntl.h>
46
47#ifdef SVR4
48# include <sys/cred.h>
49#endif /* SVR4 */
50
51#include <sys/vfs.h>
52
53#ifdef MAJOR_IN_SYSMACROS
54#include <sys/sysmacros.h>
55#endif
56
57#ifdef MAJOR_IN_MKDEV
58#include <sys/mkdev.h>
59#endif
60
61#ifdef HAVE_SYS_ASYNCH_H
62#include <sys/asynch.h>
63#endif
64
65#ifdef SUNOS4
66#include <ustat.h>
67#endif
68
69/*
70 * This is a really dirty trick but it should always work. Traditional
71 * Unix says r/w/rw are 0/1/2, so we make them true flags 1/2/3 by
72 * adding 1. Just remember to add 1 to any arg decoded with openmodes.
73 */
74struct xlat openmodes[] = {
75 { O_RDWR+1, "O_RDWR" },
76 { O_RDONLY+1, "O_RDONLY" },
77 { O_WRONLY+1, "O_WRONLY" },
78 { O_NONBLOCK, "O_NONBLOCK" },
79 { O_APPEND, "O_APPEND" },
80 { O_CREAT, "O_CREAT" },
81 { O_TRUNC, "O_TRUNC" },
82 { O_EXCL, "O_EXCL" },
83 { O_NOCTTY, "O_NOCTTY" },
84#ifdef O_SYNC
85 { O_SYNC, "O_SYNC" },
86#endif
87#ifdef O_ASYNC
88 { O_ASYNC, "O_ASYNC" },
89#endif
90#ifdef O_DSYNC
91 { O_DSYNC, "O_DSYNC" },
92#endif
93#ifdef O_RSYNC
94 { O_RSYNC, "O_RSYNC" },
95#endif
96#ifdef O_NDELAY
97 { O_NDELAY, "O_NDELAY" },
98#endif
99#ifdef O_PRIV
100 { O_PRIV, "O_PRIV" },
101#endif
102#ifdef O_DIRECT
103 { O_DIRECT, "O_DIRECT" },
104#endif
105#ifdef O_LARGEFILE
106 { O_LARGEFILE, "O_LARGEFILE" },
107#endif
108#ifdef O_DIRECTORY
109 { O_DIRECTORY, "O_DIRECTORY" },
110#endif
111
112#ifdef FNDELAY
113 { FNDELAY, "FNDELAY" },
114#endif
115#ifdef FAPPEND
116 { FAPPEND, "FAPPEND" },
117#endif
118#ifdef FMARK
119 { FMARK, "FMARK" },
120#endif
121#ifdef FDEFER
122 { FDEFER, "FDEFER" },
123#endif
124#ifdef FASYNC
125 { FASYNC, "FASYNC" },
126#endif
127#ifdef FSHLOCK
128 { FSHLOCK, "FSHLOCK" },
129#endif
130#ifdef FEXLOCK
131 { FEXLOCK, "FEXLOCK" },
132#endif
133#ifdef FCREAT
134 { FCREAT, "FCREAT" },
135#endif
136#ifdef FTRUNC
137 { FTRUNC, "FTRUNC" },
138#endif
139#ifdef FEXCL
140 { FEXCL, "FEXCL" },
141#endif
142#ifdef FNBIO
143 { FNBIO, "FNBIO" },
144#endif
145#ifdef FSYNC
146 { FSYNC, "FSYNC" },
147#endif
148#ifdef FNOCTTY
149 { FNOCTTY, "FNOCTTY" },
150#endif
151 { 0, NULL },
152};
153
154int
155sys_open(tcp)
156struct tcb *tcp;
157{
158 if (entering(tcp)) {
159 printpath(tcp, tcp->u_arg[0]);
160 tprintf(", ");
161 /* flags */
162 printflags(openmodes, tcp->u_arg[1] + 1);
163 if (tcp->u_arg[1] & O_CREAT) {
164 /* mode */
165 tprintf(", %#lo", tcp->u_arg[2]);
166 }
167 }
168 return 0;
169}
170
171#ifdef LINUXSPARC
172struct xlat openmodessol[] = {
173 { 0, "O_RDWR" },
174 { 1, "O_RDONLY" },
175 { 2, "O_WRONLY" },
176 { 0x80, "O_NONBLOCK" },
177 { 8, "O_APPEND" },
178 { 0x100, "O_CREAT" },
179 { 0x200, "O_TRUNC" },
180 { 0x400, "O_EXCL" },
181 { 0x800, "O_NOCTTY" },
182 { 0x10, "O_SYNC" },
183 { 0x40, "O_DSYNC" },
184 { 0x8000, "O_RSYNC" },
185 { 4, "O_NDELAY" },
186 { 0x1000, "O_PRIV" },
187 { 0, NULL },
188};
189
190int
191solaris_open(tcp)
192struct tcb *tcp;
193{
194 if (entering(tcp)) {
195 printpath(tcp, tcp->u_arg[0]);
196 tprintf(", ");
197 /* flags */
198 printflags(openmodessol, tcp->u_arg[1] + 1);
199 if (tcp->u_arg[1] & 0x100) {
200 /* mode */
201 tprintf(", %#lo", tcp->u_arg[2]);
202 }
203 }
204 return 0;
205}
206
207#endif
208
209int
210sys_creat(tcp)
211struct tcb *tcp;
212{
213 if (entering(tcp)) {
214 printpath(tcp, tcp->u_arg[0]);
215 tprintf(", %#lo", tcp->u_arg[1]);
216 }
217 return 0;
218}
219
220static struct xlat access_flags[] = {
221 { F_OK, "F_OK", },
222 { R_OK, "R_OK" },
223 { W_OK, "W_OK" },
224 { X_OK, "X_OK" },
225#ifdef EFF_ONLY_OK
226 { EFF_ONLY_OK, "EFF_ONLY_OK" },
227#endif
228#ifdef EX_OK
229 { EX_OK, "EX_OK" },
230#endif
231 { 0, NULL },
232};
233
234int
235sys_access(tcp)
236struct tcb *tcp;
237{
238 if (entering(tcp)) {
239 printpath(tcp, tcp->u_arg[0]);
240 tprintf(", ");
241 printflags(access_flags, tcp->u_arg[1]);
242 }
243 return 0;
244}
245
246int
247sys_umask(tcp)
248struct tcb *tcp;
249{
250 if (entering(tcp)) {
251 tprintf("%#lo", tcp->u_arg[0]);
252 }
253 return RVAL_OCTAL;
254}
255
256static struct xlat whence[] = {
257 { SEEK_SET, "SEEK_SET" },
258 { SEEK_CUR, "SEEK_CUR" },
259 { SEEK_END, "SEEK_END" },
260 { 0, NULL },
261};
262
263int
264sys_lseek(tcp)
265struct tcb *tcp;
266{
267 if (entering(tcp)) {
268 tprintf("%ld, ", tcp->u_arg[0]);
269 if (tcp->u_arg[2] == SEEK_SET)
270 tprintf("%lu, ", tcp->u_arg[1]);
271 else
272 tprintf("%ld, ", tcp->u_arg[1]);
273 printxval(whence, tcp->u_arg[2], "SEEK_???");
274 }
275 return RVAL_UDECIMAL;
276}
277
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000278#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000279int
280sys_llseek (tcp)
281struct tcb *tcp;
282{
283 if (entering(tcp)) {
284 if (tcp->u_arg[4] == SEEK_SET)
285 tprintf("%ld, %llu, ", tcp->u_arg[0],
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000286 (((long long int) tcp->u_arg[1]) << 32
287 | (unsigned long long) tcp->u_arg[2]));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000288 else
289 tprintf("%ld, %lld, ", tcp->u_arg[0],
290 (((long long int) tcp->u_arg[1]) << 32
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000291 | (unsigned long long) tcp->u_arg[2]));
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000292 }
293 else {
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000294 long long int off;
295 if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000296 tprintf("%#lx, ", tcp->u_arg[3]);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000297 else
298 tprintf("[%llu], ", off);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000299 printxval(whence, tcp->u_arg[4], "SEEK_???");
300 }
301 return 0;
302}
303#endif
304
305int
306sys_truncate(tcp)
307struct tcb *tcp;
308{
309 if (entering(tcp)) {
310 printpath(tcp, tcp->u_arg[0]);
311 tprintf(", %lu", tcp->u_arg[1]);
312 }
313 return 0;
314}
315
316int
317sys_ftruncate(tcp)
318struct tcb *tcp;
319{
320 if (entering(tcp)) {
321 tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]);
322 }
323 return 0;
324}
325
326/* several stats */
327
328static struct xlat modetypes[] = {
329 { S_IFREG, "S_IFREG" },
330 { S_IFSOCK, "S_IFSOCK" },
331 { S_IFIFO, "S_IFIFO" },
332 { S_IFLNK, "S_IFLNK" },
333 { S_IFDIR, "S_IFDIR" },
334 { S_IFBLK, "S_IFBLK" },
335 { S_IFCHR, "S_IFCHR" },
336 { 0, NULL },
337};
338
339static char *
340sprintmode(mode)
341int mode;
342{
343 static char buf[64];
344 char *s;
345
346 if ((mode & S_IFMT) == 0)
347 s = "";
348 else if ((s = xlookup(modetypes, mode & S_IFMT)) == NULL) {
349 sprintf(buf, "%#o", mode);
350 return buf;
351 }
352 sprintf(buf, "%s%s%s%s", s,
353 (mode & S_ISUID) ? "|S_ISUID" : "",
354 (mode & S_ISGID) ? "|S_ISGID" : "",
355 (mode & S_ISVTX) ? "|S_ISVTX" : "");
356 mode &= ~(S_IFMT|S_ISUID|S_ISGID|S_ISVTX);
357 if (mode)
358 sprintf(buf + strlen(buf), "|%#o", mode);
359 s = (*buf == '|') ? buf + 1 : buf;
360 return *s ? s : "0";
361}
362
363static char *
364sprinttime(t)
365time_t t;
366{
367 struct tm *tmp;
368 static char buf[32];
369
370 if (t == 0) {
371 sprintf(buf, "0");
372 return buf;
373 }
374 tmp = localtime(&t);
375 sprintf(buf, "%02d/%02d/%02d-%02d:%02d:%02d",
376 tmp->tm_year, tmp->tm_mon + 1, tmp->tm_mday,
377 tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
378 return buf;
379}
380
381#ifdef LINUXSPARC
382typedef struct {
383 int tv_sec;
384 int tv_nsec;
385} timestruct_t;
386
387struct solstat {
388 unsigned st_dev;
389 int st_pad1[3]; /* network id */
390 unsigned st_ino;
391 unsigned st_mode;
392 unsigned st_nlink;
393 unsigned st_uid;
394 unsigned st_gid;
395 unsigned st_rdev;
396 int st_pad2[2];
397 int st_size;
398 int st_pad3; /* st_size, off_t expansion */
399 timestruct_t st_atime;
400 timestruct_t st_mtime;
401 timestruct_t st_ctime;
402 int st_blksize;
403 int st_blocks;
404 char st_fstype[16];
405 int st_pad4[8]; /* expansion area */
406};
407
408static void
409printstatsol(tcp, addr)
410struct tcb *tcp;
411int addr;
412{
413 struct solstat statbuf;
414
415 if (!addr) {
416 tprintf("NULL");
417 return;
418 }
419 if (syserror(tcp) || !verbose(tcp)) {
420 tprintf("%#x", addr);
421 return;
422 }
423 if (umove(tcp, addr, &statbuf) < 0) {
424 tprintf("{...}");
425 return;
426 }
427 if (!abbrev(tcp)) {
428 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
429 (unsigned long) ((statbuf.st_dev >> 18) & 0x3fff),
430 (unsigned long) (statbuf.st_dev & 0x3ffff),
431 (unsigned long) statbuf.st_ino,
432 sprintmode(statbuf.st_mode));
433 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
434 (unsigned long) statbuf.st_nlink,
435 (unsigned long) statbuf.st_uid,
436 (unsigned long) statbuf.st_gid);
437 tprintf("st_blksize=%lu, ", (unsigned long) statbuf.st_blksize);
438 tprintf("st_blocks=%lu, ", (unsigned long) statbuf.st_blocks);
439 }
440 else
441 tprintf("{st_mode=%s, ", sprintmode(statbuf.st_mode));
442 switch (statbuf.st_mode & S_IFMT) {
443 case S_IFCHR: case S_IFBLK:
444 tprintf("st_rdev=makedev(%lu, %lu), ",
445 (unsigned long) ((statbuf.st_rdev >> 18) & 0x3fff),
446 (unsigned long) (statbuf.st_rdev & 0x3ffff));
447 break;
448 default:
449 tprintf("st_size=%u, ", statbuf.st_size);
450 break;
451 }
452 if (!abbrev(tcp)) {
453 tprintf("st_atime=%s, ", sprinttime(statbuf.st_atime));
454 tprintf("st_mtime=%s, ", sprinttime(statbuf.st_mtime));
455 tprintf("st_ctime=%s}", sprinttime(statbuf.st_ctime));
456 }
457 else
458 tprintf("...}");
459}
Wichert Akkermanb859bea1999-04-18 22:50:50 +0000460#endif /* LINUXSPARC */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000461
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000462static void
463realprintstat(tcp, statbuf)
464struct tcb *tcp;
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000465struct stat *statbuf;
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000466{
467 if (!abbrev(tcp)) {
468 tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ",
469 (unsigned long) major(statbuf->st_dev),
470 (unsigned long) minor(statbuf->st_dev),
471 (unsigned long) statbuf->st_ino,
472 sprintmode(statbuf->st_mode));
473 tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ",
474 (unsigned long) statbuf->st_nlink,
475 (unsigned long) statbuf->st_uid,
476 (unsigned long) statbuf->st_gid);
477#ifdef HAVE_ST_BLKSIZE
478 tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize);
479#endif /* HAVE_ST_BLKSIZE */
480#ifdef HAVE_ST_BLOCKS
481 tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks);
482#endif /* HAVE_ST_BLOCKS */
483 }
484 else
485 tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode));
486 switch (statbuf->st_mode & S_IFMT) {
487 case S_IFCHR: case S_IFBLK:
488#ifdef HAVE_ST_RDEV
489 tprintf("st_rdev=makedev(%lu, %lu), ",
490 (unsigned long) major(statbuf->st_rdev),
491 (unsigned long) minor(statbuf->st_rdev));
492#else /* !HAVE_ST_RDEV */
493 tprintf("st_size=makedev(%lu, %lu), ",
494 (unsigned long) major(statbuf->st_size),
495 (unsigned long) minor(statbuf->st_size));
496#endif /* !HAVE_ST_RDEV */
497 break;
498 default:
499 tprintf("st_size=%lu, ", statbuf->st_size);
500 break;
501 }
502 if (!abbrev(tcp)) {
503 tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime));
504 tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime));
505 tprintf("st_ctime=%s}", sprinttime(statbuf->st_ctime));
506 }
507 else
508 tprintf("...}");
509}
510
Nate Sammons771a6ff1999-04-05 22:39:31 +0000511
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000512static void
513printstat(tcp, addr)
514struct tcb *tcp;
515int addr;
516{
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000517 struct stat statbuf;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000518
519#ifdef LINUXSPARC
520 if (current_personality == 1) {
521 printstatsol(tcp, addr);
522 return;
523 }
524#endif /* LINUXSPARC */
525
526 if (!addr) {
527 tprintf("NULL");
528 return;
529 }
530 if (syserror(tcp) || !verbose(tcp)) {
531 tprintf("%#x", addr);
532 return;
533 }
534 if (umove(tcp, addr, &statbuf) < 0) {
535 tprintf("{...}");
536 return;
537 }
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000538
539 realprintstat(tcp, &statbuf);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000540}
541
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000542#ifdef linux
543static void
544convertoldstat(oldbuf, newbuf)
Wichert Akkerman25d0c4f1999-04-18 19:35:42 +0000545const struct __old_kernel_stat *oldbuf;
546struct stat *newbuf;
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000547{
548 newbuf->st_dev=oldbuf->st_dev;
549 newbuf->st_ino=oldbuf->st_ino;
550 newbuf->st_mode=oldbuf->st_mode;
551 newbuf->st_nlink=oldbuf->st_nlink;
552 newbuf->st_uid=oldbuf->st_uid;
553 newbuf->st_gid=oldbuf->st_gid;
554 newbuf->st_rdev=oldbuf->st_rdev;
555 newbuf->st_size=oldbuf->st_size;
556 newbuf->st_atime=oldbuf->st_atime;
557 newbuf->st_mtime=oldbuf->st_mtime;
558 newbuf->st_ctime=oldbuf->st_ctime;
559 newbuf->st_blksize=0; /* not supported in old_stat */
560 newbuf->st_blocks=0; /* not supported in old_stat */
561}
562#endif
563
564
565#ifdef linux
566static void
567printoldstat(tcp, addr)
568struct tcb *tcp;
569int addr;
570{
Wichert Akkerman25d0c4f1999-04-18 19:35:42 +0000571 struct __old_kernel_stat statbuf;
572 struct stat newstatbuf;
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000573
574#ifdef LINUXSPARC
575 if (current_personality == 1) {
576 printstatsol(tcp, addr);
577 return;
578 }
579#endif /* LINUXSPARC */
580
581 if (!addr) {
582 tprintf("NULL");
583 return;
584 }
585 if (syserror(tcp) || !verbose(tcp)) {
586 tprintf("%#x", addr);
587 return;
588 }
589 if (umove(tcp, addr, &statbuf) < 0) {
590 tprintf("{...}");
591 return;
592 }
593
594 convertoldstat(&statbuf, &newstatbuf);
595 realprintstat(tcp, &newstatbuf);
596}
597#endif
598
599
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000600int
601sys_stat(tcp)
602struct tcb *tcp;
603{
604 if (entering(tcp)) {
605 printpath(tcp, tcp->u_arg[0]);
606 tprintf(", ");
607 } else {
608 printstat(tcp, tcp->u_arg[1]);
609 }
610 return 0;
611}
612
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000613#ifdef linux
614int
615sys_oldstat(tcp)
616struct tcb *tcp;
617{
618 if (entering(tcp)) {
619 printpath(tcp, tcp->u_arg[0]);
620 tprintf(", ");
621 } else {
622 printoldstat(tcp, tcp->u_arg[1]);
623 }
624 return 0;
625}
626#endif
627
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000628int
629sys_fstat(tcp)
630struct tcb *tcp;
631{
632 if (entering(tcp))
633 tprintf("%ld, ", tcp->u_arg[0]);
634 else {
635 printstat(tcp, tcp->u_arg[1]);
636 }
637 return 0;
638}
639
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000640#ifdef linux
641int
642sys_oldfstat(tcp)
643struct tcb *tcp;
644{
645 if (entering(tcp))
646 tprintf("%ld, ", tcp->u_arg[0]);
647 else {
648 printoldstat(tcp, tcp->u_arg[1]);
649 }
650 return 0;
651}
652#endif
653
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000654int
655sys_lstat(tcp)
656struct tcb *tcp;
657{
658 if (entering(tcp)) {
659 printpath(tcp, tcp->u_arg[0]);
660 tprintf(", ");
661 } else {
662 printstat(tcp, tcp->u_arg[1]);
663 }
664 return 0;
665}
666
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000667#ifdef linux
668int
669sys_oldlstat(tcp)
670struct tcb *tcp;
671{
672 if (entering(tcp)) {
673 printpath(tcp, tcp->u_arg[0]);
674 tprintf(", ");
675 } else {
676 printoldstat(tcp, tcp->u_arg[1]);
677 }
678 return 0;
679}
680#endif
681
682
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000683#if defined(SVR4) || defined(LINUXSPARC)
684
685int
686sys_xstat(tcp)
687struct tcb *tcp;
688{
689 if (entering(tcp)) {
690 tprintf("%ld, ", tcp->u_arg[0]);
691 printpath(tcp, tcp->u_arg[1]);
692 tprintf(", ");
693 } else {
694 printstat(tcp, tcp->u_arg[2]);
695 }
696 return 0;
697}
698
699int
700sys_fxstat(tcp)
701struct tcb *tcp;
702{
703 if (entering(tcp))
704 tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]);
705 else {
706 printstat(tcp, tcp->u_arg[2]);
707 }
708 return 0;
709}
710
711int
712sys_lxstat(tcp)
713struct tcb *tcp;
714{
715 if (entering(tcp)) {
716 tprintf("%ld, ", tcp->u_arg[0]);
717 printpath(tcp, tcp->u_arg[1]);
718 tprintf(", ");
719 } else {
720 printstat(tcp, tcp->u_arg[2]);
721 }
722 return 0;
723}
724
725int
726sys_xmknod(tcp)
727struct tcb *tcp;
728{
729 int mode = tcp->u_arg[2];
730
731 if (entering(tcp)) {
732 tprintf("%ld, ", tcp->u_arg[0]);
733 printpath(tcp, tcp->u_arg[1]);
734 tprintf(", %s", sprintmode(mode));
735 switch (mode & S_IFMT) {
736 case S_IFCHR: case S_IFBLK:
737#ifdef LINUXSPARC
738 tprintf(", makedev(%lu, %lu)",
739 (unsigned long) ((tcp->u_arg[3] >> 18) & 0x3fff),
740 (unsigned long) (tcp->u_arg[3] & 0x3ffff));
741#else
742 tprintf(", makedev(%lu, %lu)",
743 (unsigned long) major(tcp->u_arg[3]),
744 (unsigned long) minor(tcp->u_arg[3]));
745#endif
746 break;
747 default:
748 break;
749 }
750 }
751 return 0;
752}
753
754#endif /* SVR4 || LINUXSPARC */
755
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000756#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000757
758static struct xlat fsmagic[] = {
759 { 0xef51, "EXT2_OLD_SUPER_MAGIC" },
760 { 0xef53, "EXT2_SUPER_MAGIC" },
761 { 0x137d, "EXT_SUPER_MAGIC" },
762 { 0x9660, "ISOFS_SUPER_MAGIC" },
763 { 0x137f, "MINIX_SUPER_MAGIC" },
764 { 0x138f, "MINIX_SUPER_MAGIC2" },
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000765 { 0x2468, "MINIX2_SUPER_MAGIC" },
766 { 0x2478, "MINIX2_SUPER_MAGIC2" },
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000767 { 0x4d44, "MSDOS_SUPER_MAGIC" },
768 { 0x6969, "NFS_SUPER_MAGIC" },
769 { 0x9fa0, "PROC_SUPER_MAGIC" },
770 { 0x012fd16d, "XIAFS_SUPER_MAGIC" },
771 { 0, NULL },
772};
773
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000774#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000775
776#ifndef SVR4
777
778static char *
779sprintfstype(magic)
780int magic;
781{
782 static char buf[32];
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000783#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000784 char *s;
785
786 s = xlookup(fsmagic, magic);
787 if (s) {
788 sprintf(buf, "\"%s\"", s);
789 return buf;
790 }
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000791#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000792 sprintf(buf, "%#x", magic);
793 return buf;
794}
795
796static void
797printstatfs(tcp, addr)
798struct tcb *tcp;
799long addr;
800{
801 struct statfs statbuf;
802
803 if (syserror(tcp) || !verbose(tcp)) {
804 tprintf("%#lx", addr);
805 return;
806 }
807 if (umove(tcp, addr, &statbuf) < 0) {
808 tprintf("{...}");
809 return;
810 }
811#ifdef ALPHA
812
813 tprintf("{f_type=%s, f_fbsize=%u, f_blocks=%u, f_bfree=%u, ",
814 sprintfstype(statbuf.f_type),
815 statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000816 tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_namelen=%u",
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000817 statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, statbuf.f_namelen);
818#else /* !ALPHA */
819 tprintf("{f_type=%s, f_bsize=%lu, f_blocks=%lu, f_bfree=%lu, ",
820 sprintfstype(statbuf.f_type),
Nate Sammons5c74d201999-04-06 01:37:51 +0000821 (unsigned long)statbuf.f_bsize,
822 (unsigned long)statbuf.f_blocks,
823 (unsigned long)statbuf.f_bfree);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000824 tprintf("f_files=%lu, f_ffree=%lu",
Nate Sammons5c74d201999-04-06 01:37:51 +0000825 (unsigned long)statbuf.f_files,
826 (unsigned long)statbuf.f_ffree);
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000827#ifdef linux
Wichert Akkerman2e2553a1999-05-09 00:29:58 +0000828 tprintf(", f_namelen=%lu", (unsigned long)statbuf.f_namelen);
Wichert Akkerman328c5e71999-04-16 00:21:26 +0000829#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000830#endif /* !ALPHA */
831 tprintf("}");
832}
833
834int
835sys_statfs(tcp)
836struct tcb *tcp;
837{
838 if (entering(tcp)) {
839 printpath(tcp, tcp->u_arg[0]);
840 tprintf(", ");
841 } else {
842 printstatfs(tcp, tcp->u_arg[1]);
843 }
844 return 0;
845}
846
847int
848sys_fstatfs(tcp)
849struct tcb *tcp;
850{
851 if (entering(tcp)) {
852 tprintf("%lu, ", tcp->u_arg[0]);
853 } else {
854 printstatfs(tcp, tcp->u_arg[1]);
855 }
856 return 0;
857}
858
Wichert Akkermana0f36c61999-04-16 14:01:34 +0000859#if defined(linux) && defined(__alpha)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000860
861int
862osf_statfs(tcp)
863struct tcb *tcp;
864{
865 if (entering(tcp)) {
866 printpath(tcp, tcp->u_arg[0]);
867 tprintf(", ");
868 } else {
869 printstatfs(tcp, tcp->u_arg[1]);
870 tprintf(", %lu", tcp->u_arg[2]);
871 }
872 return 0;
873}
874
875int
876osf_fstatfs(tcp)
877struct tcb *tcp;
878{
879 if (entering(tcp)) {
880 tprintf("%lu, ", tcp->u_arg[0]);
881 } else {
882 printstatfs(tcp, tcp->u_arg[1]);
883 tprintf(", %lu", tcp->u_arg[2]);
884 }
885 return 0;
886}
Wichert Akkermana0f36c61999-04-16 14:01:34 +0000887#endif /* linux && __alpha */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000888
889#endif /* !SVR4 */
890
891#ifdef SUNOS4
892
893int
894sys_ustat(tcp)
895struct tcb *tcp;
896{
897 struct ustat statbuf;
898
899 if (entering(tcp)) {
900 tprintf("makedev(%lu, %lu), ",
901 (long) major(tcp->u_arg[0]),
902 (long) minor(tcp->u_arg[0]));
903 }
904 else {
905 if (syserror(tcp) || !verbose(tcp))
906 tprintf("%#lx", tcp->u_arg[1]);
907 else if (umove(tcp, tcp->u_arg[1], &statbuf) < 0)
908 tprintf("{...}");
909 else {
910 tprintf("{f_tfree=%lu, f_tinode=%lu, ",
911 statbuf.f_tfree, statbuf.f_tinode);
912 tprintf("f_fname=\"%.*s\", ",
913 (int) sizeof(statbuf.f_fname),
914 statbuf.f_fname);
915 tprintf("f_fpack=\"%.*s\"}",
916 (int) sizeof(statbuf.f_fpack),
917 statbuf.f_fpack);
918 }
919 }
920 return 0;
921}
922
923#endif /* SUNOS4 */
924
925/* directory */
926int
927sys_chdir(tcp)
928struct tcb *tcp;
929{
930 if (entering(tcp)) {
931 printpath(tcp, tcp->u_arg[0]);
932 }
933 return 0;
934}
935
936int
937sys_mkdir(tcp)
938struct tcb *tcp;
939{
940 if (entering(tcp)) {
941 printpath(tcp, tcp->u_arg[0]);
942 tprintf(", %#lo", tcp->u_arg[1]);
943 }
944 return 0;
945}
946
947int
948sys_rmdir(tcp)
949struct tcb *tcp;
950{
951 if (entering(tcp)) {
952 printpath(tcp, tcp->u_arg[0]);
953 }
954 return 0;
955}
956
957int
958sys_fchdir(tcp)
959struct tcb *tcp;
960{
961 if (entering(tcp)) {
962 tprintf("%ld", tcp->u_arg[0]);
963 }
964 return 0;
965}
966
967int
968sys_chroot(tcp)
969struct tcb *tcp;
970{
971 if (entering(tcp)) {
972 printpath(tcp, tcp->u_arg[0]);
973 }
974 return 0;
975}
976
977int
978sys_fchroot(tcp)
979struct tcb *tcp;
980{
981 if (entering(tcp)) {
982 tprintf("%ld", tcp->u_arg[0]);
983 }
984 return 0;
985}
986
987int
988sys_link(tcp)
989struct tcb *tcp;
990{
991 if (entering(tcp)) {
992 printpath(tcp, tcp->u_arg[0]);
993 tprintf(", ");
994 printpath(tcp, tcp->u_arg[1]);
995 }
996 return 0;
997}
998
999int
1000sys_unlink(tcp)
1001struct tcb *tcp;
1002{
1003 if (entering(tcp)) {
1004 printpath(tcp, tcp->u_arg[0]);
1005 }
1006 return 0;
1007}
1008
1009int
1010sys_symlink(tcp)
1011struct tcb *tcp;
1012{
1013 if (entering(tcp)) {
1014 printpath(tcp, tcp->u_arg[0]);
1015 tprintf(", ");
1016 printpath(tcp, tcp->u_arg[1]);
1017 }
1018 return 0;
1019}
1020
1021int
1022sys_readlink(tcp)
1023struct tcb *tcp;
1024{
1025 if (entering(tcp)) {
1026 printpath(tcp, tcp->u_arg[0]);
1027 tprintf(", ");
1028 } else {
1029 if (syserror(tcp))
1030 tprintf("%#lx", tcp->u_arg[1]);
1031 else
1032 printpathn(tcp, tcp->u_arg[1], tcp->u_rval);
1033 tprintf(", %lu", tcp->u_arg[2]);
1034 }
1035 return 0;
1036}
1037
1038int
1039sys_rename(tcp)
1040struct tcb *tcp;
1041{
1042 if (entering(tcp)) {
1043 printpath(tcp, tcp->u_arg[0]);
1044 tprintf(", ");
1045 printpath(tcp, tcp->u_arg[1]);
1046 }
1047 return 0;
1048}
1049
1050int
1051sys_chown(tcp)
1052struct tcb *tcp;
1053{
1054 if (entering(tcp)) {
1055 printpath(tcp, tcp->u_arg[0]);
1056 tprintf(", %lu, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1057 }
1058 return 0;
1059}
1060
1061int
1062sys_fchown(tcp)
1063struct tcb *tcp;
1064{
1065 if (entering(tcp)) {
1066 tprintf("%ld, %lu, %lu",
1067 tcp->u_arg[0], tcp->u_arg[1], tcp->u_arg[2]);
1068 }
1069 return 0;
1070}
1071
1072int
1073sys_chmod(tcp)
1074struct tcb *tcp;
1075{
1076 if (entering(tcp)) {
1077 printpath(tcp, tcp->u_arg[0]);
1078 tprintf(", %#lo", tcp->u_arg[1]);
1079 }
1080 return 0;
1081}
1082
1083int
1084sys_fchmod(tcp)
1085struct tcb *tcp;
1086{
1087 if (entering(tcp)) {
1088 tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]);
1089 }
1090 return 0;
1091}
1092
1093int
1094sys_utimes(tcp)
1095struct tcb *tcp;
1096{
1097 if (entering(tcp)) {
1098 printpath(tcp, tcp->u_arg[0]);
1099 tprintf(", ");
1100 printtv(tcp, tcp->u_arg[1]);
1101 }
1102 return 0;
1103}
1104
1105int
1106sys_utime(tcp)
1107struct tcb *tcp;
1108{
1109 long ut[2];
1110
1111 if (entering(tcp)) {
1112 printpath(tcp, tcp->u_arg[0]);
1113 tprintf(", ");
1114 if (!tcp->u_arg[1])
1115 tprintf("NULL");
1116 else if (!verbose(tcp))
1117 tprintf("%#lx", tcp->u_arg[1]);
1118 else if (umoven(tcp, tcp->u_arg[1], sizeof ut,
1119 (char *) ut) < 0)
1120 tprintf("[?, ?]");
1121 else {
1122 tprintf("[%s,", sprinttime(ut[0]));
1123 tprintf(" %s]", sprinttime(ut[1]));
1124 }
1125 }
1126 return 0;
1127}
1128
1129int
1130sys_mknod(tcp)
1131struct tcb *tcp;
1132{
1133 int mode = tcp->u_arg[1];
1134
1135 if (entering(tcp)) {
1136 printpath(tcp, tcp->u_arg[0]);
1137 tprintf(", %s", sprintmode(mode));
1138 switch (mode & S_IFMT) {
1139 case S_IFCHR: case S_IFBLK:
1140#ifdef LINUXSPARC
1141 if (current_personality == 1)
1142 tprintf(", makedev(%lu, %lu)",
1143 (unsigned long) ((tcp->u_arg[2] >> 18) & 0x3fff),
1144 (unsigned long) (tcp->u_arg[2] & 0x3ffff));
1145 else
1146#endif
1147 tprintf(", makedev(%lu, %lu)",
1148 (unsigned long) major(tcp->u_arg[2]),
1149 (unsigned long) minor(tcp->u_arg[2]));
1150 break;
1151 default:
1152 break;
1153 }
1154 }
1155 return 0;
1156}
1157
1158int
1159sys_mkfifo(tcp)
1160struct tcb *tcp;
1161{
1162 if (entering(tcp)) {
1163 printpath(tcp, tcp->u_arg[0]);
1164 tprintf(", %#lo", tcp->u_arg[1]);
1165 }
1166 return 0;
1167}
1168
1169int
1170sys_fsync(tcp)
1171struct tcb *tcp;
1172{
1173 if (entering(tcp)) {
1174 tprintf("%ld", tcp->u_arg[0]);
1175 }
1176 return 0;
1177}
1178
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001179#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001180
1181static void
1182printdir(tcp, addr)
1183struct tcb *tcp;
1184long addr;
1185{
1186 struct dirent d;
1187
1188 if (!verbose(tcp)) {
1189 tprintf("%#lx", addr);
1190 return;
1191 }
1192 if (umove(tcp, addr, &d) < 0) {
1193 tprintf("{...}");
1194 return;
1195 }
1196 tprintf("{d_ino=%ld, ", (unsigned long) d.d_ino);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001197 tprintf("d_name=");
1198 printpathn(tcp, (long) ((struct dirent *) addr)->d_name, d.d_reclen);
1199 tprintf("}");
1200}
1201
1202int
1203sys_readdir(tcp)
1204struct tcb *tcp;
1205{
1206 if (entering(tcp)) {
1207 tprintf("%lu, ", tcp->u_arg[0]);
1208 } else {
1209 if (syserror(tcp) || tcp->u_rval == 0 || !verbose(tcp))
1210 tprintf("%#lx", tcp->u_arg[1]);
1211 else
1212 printdir(tcp, tcp->u_arg[1]);
1213 /* Not much point in printing this out, it is always 1. */
1214 if (tcp->u_arg[2] != 1)
1215 tprintf(", %lu", tcp->u_arg[2]);
1216 }
1217 return 0;
1218}
1219
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001220#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001221
1222int
1223sys_getdents(tcp)
1224struct tcb *tcp;
1225{
1226 int i, len, dents = 0;
1227 char *buf;
1228
1229 if (entering(tcp)) {
1230 tprintf("%lu, ", tcp->u_arg[0]);
1231 return 0;
1232 }
1233 if (syserror(tcp) || !verbose(tcp)) {
1234 tprintf("%#lx, %lu", tcp->u_arg[1], tcp->u_arg[2]);
1235 return 0;
1236 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001237 len = tcp->u_rval;
1238 if ((buf = malloc(len)) == NULL) {
1239 tprintf("out of memory\n");
1240 return 0;
1241 }
1242 if (umoven(tcp, tcp->u_arg[1], len, buf) < 0) {
1243 tprintf("{...}, %lu", tcp->u_arg[2]);
1244 free(buf);
1245 return 0;
1246 }
1247 if (!abbrev(tcp))
1248 tprintf("{");
1249 for (i = 0; i < len;) {
1250 struct dirent *d = (struct dirent *) &buf[i];
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001251#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001252 if (!abbrev(tcp)) {
1253 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1254 i ? " " : "", d->d_ino, d->d_off);
1255 tprintf("d_reclen=%u, d_name=\"%s\"}",
1256 d->d_reclen, d->d_name);
1257 }
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001258#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001259#ifdef SVR4
1260 if (!abbrev(tcp)) {
1261 tprintf("%s{d_ino=%lu, d_off=%lu, ",
1262 i ? " " : "", d->d_ino, d->d_off);
1263 tprintf("d_reclen=%u, d_name=\"%s\"}",
1264 d->d_reclen, d->d_name);
1265 }
1266#endif /* SVR4 */
1267#ifdef SUNOS4
1268 if (!abbrev(tcp)) {
1269 tprintf("%s{d_off=%lu, d_fileno=%lu, d_reclen=%u, ",
1270 i ? " " : "", d->d_off, d->d_fileno,
1271 d->d_reclen);
1272 tprintf("d_namlen=%u, d_name=\"%.*s\"}",
1273 d->d_namlen, d->d_namlen, d->d_name);
1274 }
1275#endif /* SUNOS4 */
1276 i += d->d_reclen;
1277 dents++;
1278 }
1279 if (!abbrev(tcp))
1280 tprintf("}");
1281 else
1282 tprintf("/* %u entries */", dents);
1283 tprintf(", %lu", tcp->u_arg[2]);
1284 free(buf);
1285 return 0;
1286}
1287
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001288#ifdef linux
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001289
1290int
1291sys_getcwd(tcp)
1292struct tcb *tcp;
1293{
1294 if (exiting(tcp)) {
1295 if (syserror(tcp))
1296 tprintf("%#lx", tcp->u_arg[0]);
1297 else
Wichert Akkerman2e2553a1999-05-09 00:29:58 +00001298 printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001299 tprintf(", %lu", tcp->u_arg[1]);
1300 }
1301 return 0;
1302}
Wichert Akkerman328c5e71999-04-16 00:21:26 +00001303#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001304
1305#ifdef HAVE_SYS_ASYNCH_H
1306
1307int
1308sys_aioread(tcp)
1309struct tcb *tcp;
1310{
1311 struct aio_result_t res;
1312
1313 if (entering(tcp)) {
1314 tprintf("%lu, ", tcp->u_arg[0]);
1315 } else {
1316 if (syserror(tcp))
1317 tprintf("%#lx", tcp->u_arg[1]);
1318 else
1319 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1320 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1321 printxval(whence, tcp->u_arg[4], "L_???");
1322 if (syserror(tcp) || tcp->u_arg[5] == 0
1323 || umove(tcp, tcp->u_arg[5], &res) < 0)
1324 tprintf(", %#lx", tcp->u_arg[5]);
1325 else
1326 tprintf(", {aio_return %d aio_errno %d}",
1327 res.aio_return, res.aio_errno);
1328 }
1329 return 0;
1330}
1331
1332int
1333sys_aiowrite(tcp)
1334struct tcb *tcp;
1335{
1336 struct aio_result_t res;
1337
1338 if (entering(tcp)) {
1339 tprintf("%lu, ", tcp->u_arg[0]);
1340 printstr(tcp, tcp->u_arg[1], tcp->u_arg[2]);
1341 tprintf(", %lu, %lu, ", tcp->u_arg[2], tcp->u_arg[3]);
1342 printxval(whence, tcp->u_arg[4], "L_???");
1343 }
1344 else {
1345 if (tcp->u_arg[5] == 0)
1346 tprintf(", NULL");
1347 else if (syserror(tcp)
1348 || umove(tcp, tcp->u_arg[5], &res) < 0)
1349 tprintf(", %#lx", tcp->u_arg[5]);
1350 else
1351 tprintf(", {aio_return %d aio_errno %d}",
1352 res.aio_return, res.aio_errno);
1353 }
1354 return 0;
1355}
1356
1357int
1358sys_aiowait(tcp)
1359struct tcb *tcp;
1360{
1361 if (entering(tcp))
1362 printtv(tcp, tcp->u_arg[0]);
1363 return 0;
1364}
1365
1366int
1367sys_aiocancel(tcp)
1368struct tcb *tcp;
1369{
1370 struct aio_result_t res;
1371
1372 if (exiting(tcp)) {
1373 if (tcp->u_arg[0] == 0)
1374 tprintf("NULL");
1375 else if (syserror(tcp)
1376 || umove(tcp, tcp->u_arg[0], &res) < 0)
1377 tprintf("%#lx", tcp->u_arg[0]);
1378 else
1379 tprintf("{aio_return %d aio_errno %d}",
1380 res.aio_return, res.aio_errno);
1381 }
1382 return 0;
1383}
1384
1385#endif /* HAVE_SYS_ASYNCH_H */