Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1 | /* |
| 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 | |
Wichert Akkerman | b859bea | 1999-04-18 22:50:50 +0000 | [diff] [blame] | 32 | #ifdef linux |
| 33 | #include <features.h> |
| 34 | #endif |
| 35 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 36 | #ifdef HAVE_CONFIG_H |
| 37 | #include "config.h" |
| 38 | #endif |
| 39 | |
| 40 | /* configuration section */ |
| 41 | #ifndef MAX_QUALS |
| 42 | #define MAX_QUALS 1024 /* maximum number of syscalls, signals, etc. */ |
| 43 | #endif |
| 44 | #ifndef MAX_PROCS |
| 45 | #define MAX_PROCS 32 /* maximum number of processes tracable */ |
| 46 | #endif |
| 47 | #ifndef DEFAULT_STRLEN |
| 48 | #define DEFAULT_STRLEN 32 /* default maximum # of bytes printed in |
| 49 | `printstr', change with `-s' switch */ |
| 50 | #endif |
| 51 | #ifndef DEFAULT_ACOLUMN |
| 52 | #define DEFAULT_ACOLUMN 40 /* default alignment column for results */ |
| 53 | #endif |
| 54 | #ifndef MAX_ARGS |
| 55 | #define MAX_ARGS 32 /* maximum number of args to a syscall */ |
| 56 | #endif |
| 57 | #ifndef DEFAULT_SORTBY |
| 58 | #define DEFAULT_SORTBY "time" /* default sorting method for call profiling */ |
| 59 | #endif |
| 60 | |
| 61 | #include <sys/types.h> |
| 62 | #include <unistd.h> |
| 63 | #include <stdlib.h> |
| 64 | #include <stdio.h> |
| 65 | #include <ctype.h> |
| 66 | #include <string.h> |
| 67 | #include <sys/time.h> |
| 68 | #include <errno.h> |
| 69 | |
| 70 | #ifdef STDC_HEADERS |
| 71 | #include <stddef.h> |
| 72 | #endif /* STDC_HEADERS */ |
| 73 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 74 | #if defined(LINUX) |
| 75 | # if defined(SPARC) |
| 76 | # define LINUXSPARC |
| 77 | # endif |
| 78 | # if defined(ALPHA) |
| 79 | # define LINUX_64BIT |
| 80 | # endif |
| 81 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 82 | |
| 83 | #ifdef SVR4 |
| 84 | #include <sys/procfs.h> |
Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 85 | #ifdef HAVE_MP_PROCFS |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 86 | #include <sys/uio.h> |
| 87 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 88 | #else /* !SVR4 */ |
| 89 | #if defined(LINUXSPARC) && defined(__GLIBC__) |
| 90 | #include <sys/ptrace.h> |
| 91 | #else |
| 92 | /* Work around awkward prototype in ptrace.h. */ |
| 93 | #define ptrace xptrace |
| 94 | #include <sys/ptrace.h> |
| 95 | #undef ptrace |
| 96 | #ifdef POWERPC |
| 97 | #define __KERNEL__ |
| 98 | #include <asm/ptrace.h> |
| 99 | #undef __KERNEL__ |
| 100 | /* TEMP */ |
| 101 | #define UESP PT_R1 |
| 102 | #define EIP PT_NIP |
| 103 | #define EAX PT_R3 |
| 104 | #define ORIG_EAX PT_ORIG_R3 |
| 105 | #endif |
| 106 | #ifdef __STDC__ |
| 107 | #ifdef LINUX |
| 108 | extern long ptrace(int, int, char *, long); |
| 109 | #else /* !LINUX */ |
| 110 | extern int ptrace(int, int, char *, int, ...); |
| 111 | #endif /* !LINUX */ |
| 112 | #else /* !__STDC__ */ |
| 113 | extern int ptrace(); |
| 114 | #endif /* !__STDC__ */ |
| 115 | #endif /* !LINUXSPARC */ |
| 116 | #endif /* !SVR4 */ |
| 117 | |
| 118 | #ifdef LINUX |
Wichert Akkerman | b859bea | 1999-04-18 22:50:50 +0000 | [diff] [blame] | 119 | #if !defined(__GLIBC__) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 120 | #define PTRACE_PEEKUSER PTRACE_PEEKUSR |
| 121 | #define PTRACE_POKEUSER PTRACE_POKEUSR |
| 122 | #endif |
| 123 | #ifdef ALPHA |
Wichert Akkerman | f90da01 | 1999-10-31 21:15:38 +0000 | [diff] [blame] | 124 | # define REG_R0 0 |
| 125 | # define REG_A0 16 |
| 126 | # define REG_A3 19 |
| 127 | # define REG_FP 30 |
| 128 | # define REG_PC 64 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 129 | #endif /* ALPHA */ |
Wichert Akkerman | f90da01 | 1999-10-31 21:15:38 +0000 | [diff] [blame] | 130 | #ifdef MIPS |
| 131 | # define REG_V0 2 |
| 132 | # define REG_A0 4 |
| 133 | # define REG_A3 7 |
| 134 | # define REG_SP 29 |
| 135 | # define REG_EPC 64 |
| 136 | #endif /* MIPS */ |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 137 | #endif /* LINUX */ |
| 138 | |
| 139 | #define SUPPORTED_PERSONALITIES 1 |
| 140 | #define DEFAULT_PERSONALITY 0 |
| 141 | |
| 142 | #ifdef LINUXSPARC |
| 143 | #include <linux/a.out.h> |
| 144 | #include <asm/psr.h> |
| 145 | #undef SUPPORTED_PERSONALITIES |
Wichert Akkerman | b859bea | 1999-04-18 22:50:50 +0000 | [diff] [blame] | 146 | #define SUPPORTED_PERSONALITIES 2 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 147 | #endif /* LINUXSPARC */ |
| 148 | |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 149 | |
| 150 | #ifdef SVR4 |
Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 151 | #ifdef HAVE_MP_PROCFS |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 152 | extern int mp_ioctl (int f, int c, void *a, int s); |
| 153 | #define IOCTL(f,c,a) mp_ioctl (f, c, a, sizeof *a) |
| 154 | #define IOCTL_STATUS(t) \ |
| 155 | pread (t->pfd_stat, &t->status, sizeof t->status, 0) |
| 156 | #define IOCTL_WSTOP(t) \ |
| 157 | (IOCTL (t->pfd, PCWSTOP, NULL) < 0 ? -1 : \ |
| 158 | IOCTL_STATUS (t)) |
| 159 | #define PR_WHY pr_lwp.pr_why |
| 160 | #define PR_WHAT pr_lwp.pr_what |
| 161 | #define PR_REG pr_lwp.pr_context.uc_mcontext.gregs |
| 162 | #define PR_FLAGS pr_lwp.pr_flags |
| 163 | #define PIOCSTIP PCSTOP |
| 164 | #define PIOCSET PCSET |
| 165 | #define PIOCRESET PCRESET |
| 166 | #define PIOCSTRACE PCSTRACE |
| 167 | #define PIOCSFAULT PCSFAULT |
| 168 | #define PIOCWSTOP PCWSTOP |
| 169 | #define PIOCSTOP PCSTOP |
| 170 | #define PIOCSENTRY PCSENTRY |
| 171 | #define PIOCSEXIT PCSEXIT |
| 172 | #define PIOCRUN PCRUN |
| 173 | #else |
| 174 | #define IOCTL ioctl |
| 175 | #define IOCTL_STATUS(t) ioctl (t->pfd, PIOCSTATUS, &t->status) |
| 176 | #define IOCTL_WSTOP(t) ioctl (t->pfd, PIOCWSTOP, &t->status) |
| 177 | #define PR_WHY pr_why |
| 178 | #define PR_WHAT pr_what |
| 179 | #define PR_REG pr_reg |
| 180 | #define PR_FLAGS pr_flags |
| 181 | #endif |
| 182 | #endif |
| 183 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 184 | /* Trace Control Block */ |
| 185 | struct tcb { |
| 186 | short flags; /* See below for TCB_ values */ |
| 187 | int pid; /* Process Id of this entry */ |
| 188 | long scno; /* System call number */ |
| 189 | int u_nargs; /* System call arguments */ |
| 190 | long u_arg[MAX_ARGS]; /* System call arguments */ |
| 191 | int u_error; /* Error code */ |
| 192 | long u_rval; /* (first) return value */ |
| 193 | FILE *outf; /* Output file for this process */ |
| 194 | char *auxstr; /* Auxiliary info from syscall (see RVAL_STR) */ |
| 195 | struct timeval stime; /* System time usage as of last process wait */ |
| 196 | struct timeval dtime; /* Delta for system time usage */ |
| 197 | struct timeval etime; /* Syscall entry time */ |
| 198 | /* Support for tracing forked processes */ |
| 199 | struct tcb *parent; /* Parent of this process */ |
| 200 | int nchildren; /* # of traced children */ |
| 201 | int waitpid; /* pid(s) this process is waiting for */ |
| 202 | /* (1st arg of wait4()) */ |
| 203 | long baddr; /* `Breakpoint' address */ |
| 204 | long inst[2]; /* Instructions on above */ |
| 205 | int pfd; /* proc file descriptor */ |
| 206 | #ifdef SVR4 |
Wichert Akkerman | ea78f0f | 1999-11-29 15:34:02 +0000 | [diff] [blame] | 207 | #ifdef HAVE_MP_PROCFS |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 208 | int pfd_stat; |
| 209 | int pfd_as; |
| 210 | pstatus_t status; |
| 211 | #else |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 212 | prstatus_t status; /* procfs status structure */ |
| 213 | #endif |
Wichert Akkerman | 9ce1a63 | 1999-08-29 23:15:07 +0000 | [diff] [blame] | 214 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 215 | }; |
| 216 | |
| 217 | /* TCB flags */ |
| 218 | #define TCB_STARTUP 00001 /* We have just begun ptracing this process */ |
| 219 | #define TCB_INUSE 00002 /* This table entry is in use */ |
| 220 | #define TCB_INSYSCALL 00004 /* A system call is in progress */ |
| 221 | #define TCB_ATTACHED 00010 /* Process is not our own child */ |
| 222 | #define TCB_EXITING 00020 /* As far as we know, this process is exiting */ |
| 223 | #define TCB_SUSPENDED 00040 /* Process has done a wait(4), that can |
| 224 | not be allowed to complete just now */ |
| 225 | #define TCB_BPTSET 00100 /* "Breakpoint" set after fork(2) */ |
| 226 | #define TCB_SIGTRAPPED 00200 /* Process wanted to block SIGTRAP */ |
| 227 | #define TCB_FOLLOWFORK 00400 /* Process should have forks followed */ |
| 228 | #define TCB_REPRINT 01000 /* We should reprint this syscall on exit */ |
| 229 | #ifdef LINUX |
| 230 | #if defined(ALPHA) || defined(SPARC) || defined(POWERPC) |
| 231 | #define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */ |
| 232 | #endif /* ALPHA */ |
| 233 | #endif /* LINUX */ |
| 234 | |
| 235 | /* qualifier flags */ |
| 236 | #define QUAL_TRACE 0001 /* this system call should be traced */ |
| 237 | #define QUAL_ABBREV 0002 /* abbreviate the structures of this syscall */ |
| 238 | #define QUAL_VERBOSE 0004 /* decode the structures of this syscall */ |
| 239 | #define QUAL_RAW 0010 /* print all args in hex for this syscall */ |
| 240 | #define QUAL_SIGNAL 0020 /* report events with this signal */ |
| 241 | #define QUAL_FAULT 0040 /* report events with this fault */ |
| 242 | #define QUAL_READ 0100 /* dump data read on this file descriptor */ |
| 243 | #define QUAL_WRITE 0200 /* dump data written to this file descriptor */ |
| 244 | |
| 245 | #define entering(tcp) (!((tcp)->flags & TCB_INSYSCALL)) |
| 246 | #define exiting(tcp) ((tcp)->flags & TCB_INSYSCALL) |
| 247 | #define syserror(tcp) ((tcp)->u_error != 0) |
| 248 | #define verbose(tcp) (qual_flags[(tcp)->scno] & QUAL_VERBOSE) |
| 249 | #define abbrev(tcp) (qual_flags[(tcp)->scno] & QUAL_ABBREV) |
| 250 | #define waiting_parent(tcp) \ |
| 251 | (tcp->parent && \ |
| 252 | (tcp->parent->flags & TCB_SUSPENDED) && \ |
| 253 | (tcp->parent->waitpid <= 0 || tcp->parent->waitpid == tcp->pid)) |
| 254 | |
| 255 | struct xlat { |
| 256 | int val; |
| 257 | char *str; |
| 258 | }; |
| 259 | |
| 260 | /* Format of syscall return values */ |
| 261 | #define RVAL_DECIMAL 000 /* decimal format */ |
| 262 | #define RVAL_HEX 001 /* hex format */ |
| 263 | #define RVAL_OCTAL 002 /* octal format */ |
| 264 | #define RVAL_UDECIMAL 003 /* unsigned decimal format */ |
| 265 | #define RVAL_MASK 007 /* mask for these values */ |
| 266 | |
| 267 | #define RVAL_STR 010 /* Print `auxstr' field after return val */ |
| 268 | #define RVAL_NONE 020 /* Print nothing */ |
| 269 | |
| 270 | #ifndef offsetof |
| 271 | #define offsetof(type, member) (((char *) &(((type *) NULL)->member)) - \ |
| 272 | ((char *) (type *) NULL)) |
| 273 | #endif /* !offsetof */ |
| 274 | |
| 275 | /* get offset of member within a user struct */ |
| 276 | #define uoff(member) offsetof(struct user, member) |
| 277 | |
| 278 | #define TRACE_FILE 001 /* Trace file-related syscalls. */ |
| 279 | #define TRACE_IPC 002 /* Trace IPC-related syscalls. */ |
| 280 | #define TRACE_NETWORK 004 /* Trace network-related syscalls. */ |
| 281 | #define TRACE_PROCESS 010 /* Trace process-related syscalls. */ |
| 282 | #define TRACE_SIGNAL 020 /* Trace signal-related syscalls. */ |
| 283 | |
| 284 | extern struct tcb tcbtab[]; |
| 285 | extern int qual_flags[]; |
| 286 | extern int debug, followfork, followvfork; |
| 287 | extern int rflag, tflag, dtime, cflag, xflag, qflag; |
| 288 | extern int acolumn; |
| 289 | extern char *outfname; |
| 290 | extern int nprocs; |
| 291 | extern int max_strlen; |
| 292 | extern struct tcb *tcp_last; |
| 293 | |
| 294 | #ifdef __STDC__ |
| 295 | #define P(args) args |
| 296 | #else |
| 297 | #define P(args) () |
| 298 | #endif |
| 299 | |
| 300 | extern int set_personality P((int personality)); |
| 301 | extern char *xlookup P((struct xlat *, int)); |
| 302 | extern struct tcb *alloctcb P((int)); |
| 303 | extern void droptcb P((struct tcb *)); |
| 304 | |
| 305 | extern void set_sortby P((char *)); |
| 306 | extern void set_overhead P((int)); |
| 307 | extern void qualify P((char *)); |
| 308 | extern void newoutf P((struct tcb *)); |
| 309 | extern int trace_syscall P((struct tcb *)); |
| 310 | extern void printxval P((struct xlat *, int, char *)); |
| 311 | extern int printargs P((struct tcb *)); |
| 312 | extern int addflags P((struct xlat *, int)); |
| 313 | extern int printflags P((struct xlat *, int)); |
| 314 | extern int umoven P((struct tcb *, long, int, char *)); |
| 315 | extern int umovestr P((struct tcb *, long, int, char *)); |
| 316 | extern int upeek P((int, long, long *)); |
| 317 | extern void dumpstr P((struct tcb *, long, int)); |
| 318 | extern void string_quote P((char *str)); |
| 319 | extern void printstr P((struct tcb *, long, int)); |
| 320 | extern void printnum P((struct tcb *, long, char *)); |
| 321 | extern void printpath P((struct tcb *, long)); |
| 322 | extern void printpathn P((struct tcb *, long, int)); |
| 323 | extern void printtv P((struct tcb *, long)); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 324 | extern void printsock P((struct tcb *, long, int)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 325 | extern void printrusage P((struct tcb *, long)); |
| 326 | extern int clearbpt P((struct tcb *)); |
| 327 | extern int setbpt P((struct tcb *)); |
| 328 | extern int sigishandled P((struct tcb *, int)); |
| 329 | extern void printcall P((struct tcb *)); |
Nate Sammons | ce780fc | 1999-03-29 23:23:13 +0000 | [diff] [blame] | 330 | extern char *signame P((int)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 331 | extern void printsignal P((int)); |
| 332 | extern void printleader P((struct tcb *)); |
| 333 | extern void printtrailer P((struct tcb *)); |
| 334 | extern void tabto P((int)); |
| 335 | extern void call_summary P((FILE *)); |
| 336 | extern void fake_execve P((struct tcb *, char *, char *[], char *[])); |
Wichert Akkerman | 221f54f | 1999-11-18 17:26:45 +0000 | [diff] [blame] | 337 | extern void printtv32 P((struct tcb*, long)); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 338 | |
Wichert Akkerman | 7a0b649 | 1999-12-23 15:08:17 +0000 | [diff] [blame^] | 339 | #ifdef LINUX |
| 340 | extern int internal_clone P((struct tcb *)); |
| 341 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 342 | extern int internal_fork P((struct tcb *)); |
| 343 | extern int internal_exec P((struct tcb *)); |
| 344 | extern int internal_wait P((struct tcb *)); |
| 345 | extern int internal_exit P((struct tcb *)); |
| 346 | |
| 347 | extern char *ioctl_lookup P((long)); |
| 348 | extern int ioctl_decode P((struct tcb *, long, long)); |
| 349 | extern int term_ioctl P((struct tcb *, long, long)); |
| 350 | extern int sock_ioctl P((struct tcb *, long, long)); |
| 351 | extern int proc_ioctl P((struct tcb *, int, int)); |
| 352 | extern int stream_ioctl P((struct tcb *, int, int)); |
| 353 | |
| 354 | extern void tv_tv P((struct timeval *, int, int)); |
| 355 | extern int tv_nz P((struct timeval *)); |
| 356 | extern int tv_cmp P((struct timeval *, struct timeval *)); |
| 357 | extern double tv_float P((struct timeval *)); |
| 358 | extern void tv_add P((struct timeval *, struct timeval *, struct timeval *)); |
| 359 | extern void tv_sub P((struct timeval *, struct timeval *, struct timeval *)); |
| 360 | extern void tv_mul P((struct timeval *, struct timeval *, int)); |
| 361 | extern void tv_div P((struct timeval *, struct timeval *, int)); |
| 362 | |
| 363 | #ifdef SUNOS4 |
| 364 | extern int fixvfork P((struct tcb *)); |
| 365 | #endif |
| 366 | #if !(defined(LINUX) && !defined(SPARC)) |
| 367 | extern long getrval2 P((struct tcb *)); |
| 368 | #endif |
| 369 | #ifdef SVR4 |
| 370 | extern int proc_open P((struct tcb *tcp, int attaching)); |
| 371 | #endif |
| 372 | |
| 373 | #define umove(pid, addr, objp) \ |
| 374 | umoven((pid), (addr), sizeof *(objp), (char *) (objp)) |
| 375 | |
| 376 | #ifdef __STDC__ |
| 377 | #ifdef __GNUC__ |
| 378 | extern void tprintf(const char *fmt, ...) |
| 379 | __attribute__ ((format (printf, 1, 2))); |
| 380 | #else |
| 381 | extern void tprintf(const char *fmt, ...); |
| 382 | #endif |
| 383 | #else |
| 384 | extern void tprintf(); |
| 385 | #endif |
| 386 | |
| 387 | #ifndef HAVE_STRERROR |
| 388 | const char *strerror P((int)); |
| 389 | #endif |
| 390 | #ifndef HAVE_STRSIGNAL |
| 391 | const char *strsignal P((int)); |
| 392 | #endif |
| 393 | |
| 394 | extern int current_personality; |
| 395 | |
| 396 | struct sysent { |
| 397 | int nargs; |
| 398 | int sys_flags; |
| 399 | int (*sys_func)(); |
| 400 | char *sys_name; |
| 401 | }; |
| 402 | |
| 403 | extern struct sysent *sysent; |
| 404 | extern int nsyscalls; |
| 405 | |
| 406 | extern char **errnoent; |
| 407 | extern int nerrnos; |
| 408 | |
| 409 | struct ioctlent { |
| 410 | char *doth; |
| 411 | char *symbol; |
| 412 | unsigned long code; |
| 413 | }; |
| 414 | |
| 415 | extern struct ioctlent *ioctlent; |
| 416 | extern int nioctlent; |
| 417 | |
| 418 | extern char **signalent; |
| 419 | extern int nsignals; |
| 420 | |
| 421 | extern struct ioctlent *ioctlent; |
| 422 | extern int nioctlents; |
| 423 | extern char **signalent; |
| 424 | extern int nsignals; |
| 425 | |
| 426 | extern struct ioctlent ioctlent0[]; |
| 427 | extern int nioctlents0; |
| 428 | extern char *signalent0[]; |
| 429 | extern int nsignals0; |
| 430 | |
| 431 | #if SUPPORTED_PERSONALITIES >= 2 |
| 432 | extern struct ioctlent ioctlent1[]; |
| 433 | extern int nioctlents1; |
| 434 | extern char *signalent1[]; |
| 435 | extern int nsignals1; |
| 436 | #endif /* SUPPORTED_PERSONALITIES >= 2 */ |
| 437 | |
| 438 | #if SUPPORTED_PERSONALITIES >= 3 |
| 439 | extern struct ioctlent ioctlent2[]; |
| 440 | extern int nioctlents2; |
| 441 | extern char *signalent2[]; |
| 442 | extern int nsignals2; |
| 443 | #endif /* SUPPORTED_PERSONALITIES >= 3 */ |