X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=blobdiff_plain;f=trace%2Ftrace.c;h=b0005b8a8178dc4a738dd9c475d30ad7a731f43f;hp=c6f32d780fb4a7025fb7bbb26e11421c50e3e4d9;hb=890ac34c460fbb753bd4303b201d11aebd27a570;hpb=dfcfcca7baf2b22d8dac1a724bdb7dd9d52f4c05 diff --git a/trace/trace.c b/trace/trace.c index c6f32d7..b0005b8 100644 --- a/trace/trace.c +++ b/trace/trace.c @@ -14,9 +14,9 @@ #define _GNU_SOURCE #include #include +#include #include #include -#include #include #include #include @@ -42,6 +42,8 @@ # define EF_REG2 8 # endif #define reg_syscall_nr (EF_REG2 / 4) +#elif defined(__arm__) +#define reg_syscall_nr _offsetof(struct user, regs.uregs[7]) #else #error tracing is not supported on this architecture #endif @@ -51,7 +53,7 @@ } while (0) #define ERROR(fmt, ...) do { \ - syslog(0, "utrace: "fmt, ## __VA_ARGS__); \ + syslog(LOG_ERR, "utrace: "fmt, ## __VA_ARGS__); \ fprintf(stderr, "utrace: "fmt, ## __VA_ARGS__); \ } while (0) @@ -214,7 +216,8 @@ int main(int argc, char **argv, char **envp) uloop_done(); if (!json) - asprintf(&json, "/tmp/%s.%u.json", basename(*argv), child); + if (asprintf(&json, "/tmp/%s.%u.json", basename(*argv), child) < 0) + ERROR("failed to allocate output path: %s\n", strerror(errno)); print_syscalls(policy, json);