]> granicus.if.org Git - strace/blobdiff - defs.h
Fix decoding of file descriptors
[strace] / defs.h
diff --git a/defs.h b/defs.h
index 29274f029d02521e5b5470e7746ebf817eb1c030..7271280ca2046617ac81ab084c676bc45af20281 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -246,6 +246,13 @@ extern int ptrace(int, int, char *, int, ...);
 #define PERSONALITY1_WORDSIZE 4
 #endif
 
+#ifdef POWERPC64
+#undef SUPPORTED_PERSONALITIES
+#define SUPPORTED_PERSONALITIES 2
+#define PERSONALITY0_WORDSIZE 8
+#define PERSONALITY1_WORDSIZE 4
+#endif
+
 #ifdef SVR4
 #ifdef HAVE_MP_PROCFS
 extern int mp_ioctl (int f, int c, void *a, int s);
@@ -301,6 +308,34 @@ extern int mp_ioctl (int f, int c, void *a, int s);
 #define PR_FAULTED      S_CORE
 #endif
 
+#ifdef LINUX
+# ifndef PTRACE_SETOPTIONS
+#  define PTRACE_SETOPTIONS    0x4200
+# endif
+# ifndef PTRACE_GETEVENTMSG
+#  define PTRACE_GETEVENTMSG   0x4201
+# endif
+# ifndef PTRACE_O_TRACEFORK
+#  define PTRACE_O_TRACEFORK   0x00000002
+# endif
+# ifndef PTRACE_O_TRACEVFORK
+#  define PTRACE_O_TRACEVFORK  0x00000004
+# endif
+# ifndef PTRACE_O_TRACECLONE
+#  define PTRACE_O_TRACECLONE  0x00000008
+# endif
+
+# ifndef PTRACE_EVENT_FORK
+#  define PTRACE_EVENT_FORK    1
+# endif
+# ifndef PTRACE_EVENT_VFORK
+#  define PTRACE_EVENT_VFORK   2
+# endif
+# ifndef PTRACE_EVENT_CLONE
+#  define PTRACE_EVENT_CLONE   3
+# endif
+#endif /* LINUX */
+
 /* Trace Control Block */
 struct tcb {
        short flags;            /* See below for TCB_ values */
@@ -329,7 +364,6 @@ struct tcb {
        int nzombies;           /* # of formerly traced children now dead */
 #ifdef LINUX
        int nclone_threads;     /* # of nchildren with CLONE_THREAD */
-       int nclone_detached;    /* # of nchildren with CLONE_DETACHED */
        int nclone_waiting;     /* clone threads in wait4 (TCB_SUSPENDED) */
 #endif
                                /* (1st arg of wait4()) */
@@ -372,10 +406,9 @@ struct tcb {
 # if defined(ALPHA) || defined(AVR32) || defined(SPARC) || defined(SPARC64) \
   || defined(POWERPC) || defined(IA64) || defined(HPPA) \
   || defined(SH) || defined(SH64) || defined(S390) || defined(S390X) \
-  || defined(ARM) || defined(MIPS) || defined(BFIN)
+  || defined(ARM) || defined(MIPS) || defined(BFIN) || defined(TILE)
 #  define TCB_WAITEXECVE 02000 /* ignore SIGTRAP after exceve */
 # endif
-# define TCB_CLONE_DETACHED 04000 /* CLONE_DETACHED set in creating syscall */
 # define TCB_CLONE_THREAD  010000 /* CLONE_THREAD set in creating syscall */
 # define TCB_GROUP_EXITING 020000 /* TCB_EXITING was exit_group, not _exit */
 # include <sys/syscall.h>
@@ -419,7 +452,7 @@ struct tcb {
 
 struct xlat {
        int val;
-       char *str;
+       const char *str;
 };
 
 extern const struct xlat open_mode_flags[];
@@ -455,11 +488,20 @@ extern const struct xlat open_access_modes[];
 #define TRACE_PROCESS  010     /* Trace process-related syscalls. */
 #define TRACE_SIGNAL   020     /* Trace signal-related syscalls. */
 #define TRACE_DESC     040     /* Trace file descriptor-related syscalls. */
+#define SYSCALL_NEVER_FAILS    0100    /* Syscall is always successful. */
+
+typedef enum {
+       CFLAG_NONE = 0,
+       CFLAG_ONLY_STATS,
+       CFLAG_BOTH
+} cflag_t;
 
 extern struct tcb **tcbtab;
 extern int *qual_flags;
 extern int debug, followfork;
-extern int dtime, cflag, xflag, qflag;
+extern unsigned int ptrace_setoptions;
+extern int dtime, xflag, qflag;
+extern cflag_t cflag;
 extern int acolumn;
 extern unsigned int nprocs, tcbtabsize;
 extern int max_strlen;
@@ -476,13 +518,14 @@ extern void expand_tcbtab(void);
 
 #define alloctcb(pid)  alloc_tcb((pid), 1)
 
-extern void set_sortby(char *);
+extern void set_sortby(const char *);
 extern void set_overhead(int);
-extern void qualify(char *);
+extern void qualify(const char *);
 extern int get_scno(struct tcb *);
 extern long known_scno(struct tcb *);
 extern long do_ptrace(int request, struct tcb *tcp, void *addr, void *data);
 extern int ptrace_restart(int request, struct tcb *tcp, int sig);
+extern int force_result(struct tcb *, int, long);
 extern int trace_syscall(struct tcb *);
 extern int count_syscall(struct tcb *, struct timeval *);
 extern void printxval(const struct xlat *, int, const char *);
@@ -496,8 +539,8 @@ extern int upeek(struct tcb *, long, long *);
 extern void dumpiov(struct tcb *, int, long);
 extern void dumpstr(struct tcb *, long, int);
 extern void printstr(struct tcb *, long, int);
-extern void printnum(struct tcb *, long, char *);
-extern void printnum_int(struct tcb *, long, char *);
+extern void printnum(struct tcb *, long, const char *);
+extern void printnum_int(struct tcb *, long, const char *);
 extern void printpath(struct tcb *, long);
 extern void printpathn(struct tcb *, long, int);
 extern void printtv_bitness(struct tcb *, long, enum bitness_t, int);
@@ -507,6 +550,7 @@ extern void sprint_timespec(char *, struct tcb *, long);
 #ifdef HAVE_SIGINFO_T
 extern void printsiginfo(siginfo_t *, int);
 #endif
+extern void printfd(struct tcb *, int);
 extern void printsock(struct tcb *, long, int);
 extern void print_sock_optmgmt(struct tcb *, long, int);
 extern void printrusage(struct tcb *, long);
@@ -532,6 +576,9 @@ extern int internal_fork(struct tcb *);
 extern int internal_exec(struct tcb *);
 extern int internal_wait(struct tcb *, int);
 extern int internal_exit(struct tcb *);
+#ifdef LINUX
+extern int handle_new_child(struct tcb *, int, int);
+#endif
 
 extern const struct ioctlent *ioctl_lookup(long);
 extern const struct ioctlent *ioctl_next_match(const struct ioctlent *);
@@ -543,6 +590,7 @@ extern int stream_ioctl(struct tcb *, int, int);
 #ifdef LINUX
 extern int rtc_ioctl(struct tcb *, long, long);
 extern int scsi_ioctl(struct tcb *, long, long);
+extern int block_ioctl(struct tcb *, long, long);
 #endif
 
 extern int tv_nz(struct timeval *);
@@ -556,7 +604,8 @@ extern void tv_div(struct timeval *, struct timeval *, int);
 #ifdef SUNOS4
 extern int fixvfork(struct tcb *);
 #endif
-#if !(defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(IA64))
+#if !(defined(LINUX) && !defined(SPARC) && !defined(SPARC64) && !defined(IA64) \
+       && !defined(SH))
 extern long getrval2(struct tcb *);
 #endif
 #ifdef USE_PROCFS
@@ -571,12 +620,11 @@ extern int proc_open(struct tcb *tcp, int attaching);
 #define printtv_special(tcp, addr)     \
        printtv_bitness((tcp), (addr), BITNESS_CURRENT, 1)
 
-#ifdef __GNUC__
 extern void tprintf(const char *fmt, ...)
-       __attribute__ ((format (printf, 1, 2)));
-#else
-extern void tprintf(const char *fmt, ...);
+#ifdef __GNUC__
+       __attribute__ ((format (printf, 1, 2)))
 #endif
+       ;
 
 #ifndef HAVE_STRERROR
 const char *strerror(int);