#include <sys/time.h>
#include "kernel_types.h"
-#include "mpers_type.h"
#include "gcc_compat.h"
+#include "macros.h"
+#include "mpers_type.h"
#include "sysent.h"
#ifndef HAVE_STRERROR
(offsetof(type, member) + sizeof(((type *)NULL)->member))
#endif
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]) + MUST_BE_ARRAY(a))
-
/* macros */
#ifndef MAX
# define MAX(a, b) (((a) > (b)) ? (a) : (b))
*
* Make sure that all entries in all syscallent.h files have nargs <= MAX_ARGS!
* linux/<ARCH>/syscallent*.h:
- * all have nargs <= 6 except mips o32 which has nargs <= 7.
+ * all have nargs <= 6 except mips o32 which has nargs <= 7.
*/
#ifndef MAX_ARGS
# ifdef LINUX_MIPSO32
struct timeval etime; /* Syscall entry time */
#ifdef USE_LIBUNWIND
- struct UPT_info* libunwind_ui;
- struct mmap_cache_t* mmap_cache;
+ struct UPT_info *libunwind_ui;
+ struct mmap_cache_t *mmap_cache;
unsigned int mmap_cache_size;
unsigned int mmap_cache_generation;
- struct queue_t* queue;
+ struct queue_t *queue;
#endif
};
extern const struct xlat at_flags[];
extern const struct xlat clocknames[];
extern const struct xlat dirent_types[];
+extern const struct xlat ethernet_protocols[];
extern const struct xlat evdev_abs[];
+extern const struct xlat inet_protocols[];
extern const struct xlat msg_flags[];
extern const struct xlat netlink_protocols[];
extern const struct xlat open_access_modes[];
extern unsigned max_strlen;
extern unsigned os_release;
#undef KERNEL_VERSION
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#define KERNEL_VERSION(a, b, c) (((a) << 16) + ((b) << 8) + (c))
void error_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
void perror_msg(const char *fmt, ...) ATTRIBUTE_FORMAT((printf, 1, 2));
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
void perror_msg_and_die(const char *fmt, ...)
ATTRIBUTE_FORMAT((printf, 1, 2)) ATTRIBUTE_NORETURN;
-void die_out_of_memory(void) ATTRIBUTE_NORETURN;
void *xmalloc(size_t size) ATTRIBUTE_MALLOC ATTRIBUTE_ALLOC_SIZE((1));
void *xcalloc(size_t nmemb, size_t size)
void *xreallocarray(void *ptr, size_t nmemb, size_t size)
ATTRIBUTE_ALLOC_SIZE((2, 3));
char *xstrdup(const char *str) ATTRIBUTE_MALLOC;
+char *xstrndup(const char *str, size_t n) ATTRIBUTE_MALLOC;
extern int read_int_from_file(const char *, int *);
}
extern int
-umoven(struct tcb *tcp, kernel_ulong_t addr, unsigned int len, void *laddr);
+umoven(struct tcb *, kernel_ulong_t addr, unsigned int len, void *laddr);
#define umove(pid, addr, objp) \
umoven((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int
-umoven_or_printaddr(struct tcb *tcp, kernel_ulong_t addr,
+umoven_or_printaddr(struct tcb *, kernel_ulong_t addr,
unsigned int len, void *laddr);
#define umove_or_printaddr(pid, addr, objp) \
umoven_or_printaddr((pid), (addr), sizeof(*(objp)), (void *) (objp))
extern int
-umoven_or_printaddr_ignore_syserror(struct tcb *tcp, kernel_ulong_t addr,
+umoven_or_printaddr_ignore_syserror(struct tcb *, kernel_ulong_t addr,
unsigned int len, void *laddr);
extern int
-umovestr(struct tcb *tcp, kernel_ulong_t addr, unsigned int len, char *laddr);
+umovestr(struct tcb *, kernel_ulong_t addr, unsigned int len, char *laddr);
extern int upeek(int pid, unsigned long, kernel_ulong_t *);
extern int upoke(int pid, unsigned long, kernel_ulong_t);
extern bool
-print_array(struct tcb *tcp,
+print_array(struct tcb *,
kernel_ulong_t start_addr,
size_t nmemb,
void *elem_buf,
extern const char *xlookup(const struct xlat *, const uint64_t);
extern const char *xlat_search(const struct xlat *, const size_t, const uint64_t);
+struct dyxlat;
+struct dyxlat *dyxlat_alloc(size_t nmemb);
+void dyxlat_free(struct dyxlat *);
+const struct xlat *dyxlat_get(const struct dyxlat *);
+void dyxlat_add_pair(struct dyxlat *, uint64_t val, const char *str, size_t len);
+
+const struct xlat *genl_families_xlat(void);
+
extern unsigned long get_pagesize(void);
extern int
string_to_uint_ex(const char *str, char **endptr,
#define STR_STRIP_PREFIX(str, prefix) \
str_strip_prefix_len((str), (prefix), sizeof(prefix) - 1)
-#define QUOTE_0_TERMINATED 0x01
-#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
-#define QUOTE_OMIT_TRAILING_0 0x08
-#define QUOTE_FORCE_HEX 0x10
+#define QUOTE_0_TERMINATED 0x01
+#define QUOTE_OMIT_LEADING_TRAILING_QUOTES 0x02
+#define QUOTE_OMIT_TRAILING_0 0x08
+#define QUOTE_FORCE_HEX 0x10
extern int string_quote(const char *, char *, unsigned int, unsigned int);
extern int print_quoted_string(const char *, unsigned int, unsigned int);
* b refers to the higher numbered u_arg
*/
#ifdef WORDS_BIGENDIAN
-# define ULONG_LONG(a,b) \
+# define ULONG_LONG(a, b) \
((unsigned long long)(unsigned)(b) | ((unsigned long long)(a)<<32))
#else
-# define ULONG_LONG(a,b) \
+# define ULONG_LONG(a, b) \
((unsigned long long)(unsigned)(a) | ((unsigned long long)(b)<<32))
#endif
extern int getllval(struct tcb *, unsigned long long *, int);
#define TIMESPEC_TEXT_BUFSIZE \
(sizeof(long long) * 3 * 2 + sizeof("{tv_sec=-, tv_nsec=}"))
extern void printfd(struct tcb *, int);
-extern void print_sockaddr(struct tcb *tcp, const void *, int);
+extern void print_sockaddr(struct tcb *, const void *sa, int len);
+extern bool
+print_inet_addr(int af, const void *addr, unsigned int len, const char *var_name);
extern const char *get_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern bool print_sockaddr_by_inode(struct tcb *, int fd, unsigned long inode);
extern void print_dirfd(struct tcb *, int);
print_seccomp_fprog(struct tcb *, kernel_ulong_t addr, unsigned short len);
struct strace_stat;
-extern void print_struct_stat(struct tcb *tcp, const struct strace_stat *const st);
+extern void print_struct_stat(struct tcb *, const struct strace_stat *const st);
struct strace_statfs;
#ifdef USE_LIBUNWIND
extern void unwind_init(void);
-extern void unwind_tcb_init(struct tcb *tcp);
-extern void unwind_tcb_fin(struct tcb *tcp);
-extern void unwind_cache_invalidate(struct tcb* tcp);
-extern void unwind_print_stacktrace(struct tcb* tcp);
-extern void unwind_capture_stacktrace(struct tcb* tcp);
+extern void unwind_tcb_init(struct tcb *);
+extern void unwind_tcb_fin(struct tcb *);
+extern void unwind_cache_invalidate(struct tcb *);
+extern void unwind_print_stacktrace(struct tcb *);
+extern void unwind_capture_stacktrace(struct tcb *);
#endif
static inline void
extern void print_timeval32_t(const timeval32_t *);
extern void printrusage32(struct tcb *, kernel_ulong_t);
-extern const char *sprint_timeval32(struct tcb *tcp, kernel_ulong_t);
-extern void print_timeval32(struct tcb *tcp, kernel_ulong_t);
-extern void print_timeval32_utimes(struct tcb *tcp, kernel_ulong_t);
-extern void print_itimerval32(struct tcb *tcp, kernel_ulong_t);
+extern const char *sprint_timeval32(struct tcb *, kernel_ulong_t addr);
+extern void print_timeval32(struct tcb *, kernel_ulong_t addr);
+extern void print_timeval32_utimes(struct tcb *, kernel_ulong_t addr);
+extern void print_itimerval32(struct tcb *, kernel_ulong_t addr);
#endif
#ifdef HAVE_STRUCT_USER_DESC