summaryrefslogtreecommitdiff
path: root/src/sysent.h
Commit message (Collapse)AuthorAgeFilesLines
* Update copyright headersDmitry V. Levin2022-10-171-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* sysent: Provide proper function prototype to fix -Wdeprecated-non-prototypeMarvin Schmidt2022-10-071-1/+3
| | | | | | | | | | | | | | | | | | | | clang-15 emits an error because the `sys_func` function pointer of the sysent struct doesn't declare an argument list: > make[3]: Entering directory '/home/marv/devel/strace/src' > clang -DHAVE_CONFIG_H -I./linux/x86_64 -I./linux/x86_64 -I./linux/generic -I./linux/generic -I. -I. -I../bundled/linux/arch/x86/include/uapi -I../bundled/linux/include/uapi -DIN_STRACE=1 -I./bundled/linux/arch/x86/include/uapi -I./bundled/linux/include/uapi -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time -Wformat-security -Winit-self -Winitializer-overrides -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wundef -Wwrite-strings -Werror -Wall -g -ggdb3 -O0 -c -o libstrace_a-syscall.o `test -f 'syscall.c' || echo './'`syscall.c > syscall.c:670:65: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > int res = raw(tcp) ? printargs(tcp) : tcp_sysent(tcp)->sys_func(tcp); > ^ > syscall.c:815:39: error: passing arguments to a function without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype] > sys_res = tcp_sysent(tcp)->sys_func(tcp); > ^ > 2 errors generated. * src/sysent.h (struct tcb): Add forward declaration. (struct sysent): Use it to provide a proper prototype of sys_func field. Resolves: https://github.com/strace/strace/pull/225
* Load /proc/$pid/comm into struct tcbMasatake YAMATO2021-11-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for the forthcoming -Y/--decode-pids=comm option. Load the content of /proc/$pid/comm to `comm', a newly introduced member of struct tcb. The loading is done when A. a tcb is initialized, B. execve or execveat is called, and C. prctl(PR_SET_NAME,...) is called. Limitation: this change is not enough for handling the case that someone writes a value to /proc/$pid/comm directly. (e.g. running echo "foo" > /proc/$pid/comm) * src/defs.h (struct tcb): New member `comm'. (enum pid_decoding_flags): Add PID_DECODING_COMM as a new flag. (PROC_COMM_LEN): New macro. (maybe_load_task_comm): New function declaration. * src/strace.c (strip_trailing_newlines): New function. (load_task_comm): New function loading the contents of /proc/$pid/comm into struct tcb.comm. (maybe_load_pid_comm): New function. (alloctcb): Call it for initializing the `comm' member. * src/syscall.c: Include <linux/prctl.h>. (syscall_exiting_decode): Call maybe_load_task_comm(). * src/sysent.h (COMM_CHANGE): New macro. * src/sysent_shorthand_defs.h (CC): Likewise. * src/sysent_shorthand_undefs.h (CC): Undefine. * src/linux/32/syscallent.h: Add CC flag to syscalls changing /proc/$pid/comm. * linux/64/syscallent.h: Likewise. * linux/alpha/syscallent.h: Likewise. * linux/arm/syscallent.h: Likewise. * linux/avr32/syscallent.h: Likewise. * linux/bfin/syscallent.h: Likewise. * linux/hppa/syscallent.h: Likewise. * linux/i386/syscallent.h: Likewise. * linux/ia64/syscallent.h: Likewise. * linux/m68k/syscallent.h: Likewise. * linux/microblaze/syscallent.h: Likewise. * linux/mips/syscallent-n32.h: Likewise. * linux/mips/syscallent-n64.h: Likewise. * linux/mips/syscallent-o32.h: Likewise. * linux/powerpc/syscallent.h: Likewise. * linux/powerpc64/syscallent.h: Likewise. * linux/s390/syscallent.h: Likewise. * linux/s390x/syscallent.h: Likewise. * linux/sh/syscallent.h: Likewise. * linux/sh64/syscallent.h: Likewise. * linux/sparc/syscallent.h: Likewise. * linux/sparc64/syscallent.h: Likewise. * linux/x32/syscallent.h: Likewise. * linux/x86_64/syscallent.h: Likewise. * linux/xtensa/syscallent.h: Likewise. * src/filter_seccomp.c (traced_by_seccomp): Force tracing syscalls marked with `COMM_CHANGE' if `PID_DECODING_COMM' flag is set in `pid_decoding'. Signed-off-by: Masatake YAMATO <yamato@redhat.com> Co-authored-by: Dmitry V. Levin <ldv@strace.io>
* Update copyright headersDmitry V. Levin2021-02-161-1/+1
| | | | | Headers updated automatically using maint/update_copyright_years.sh script.
* Move source files into src subdirectoryDmitry V. Levin2021-02-031-0/+43
* src/Makefile.am: New file. * src/.gitignore: Likewise. * scno.am: Move into src subdirectory. * scno.head: Likewise. * strace-graph: Likewise. * strace-log-merge: Likewise. * linux/: Likewise. * types/: Likewise. * xlat/: Likewise. * *.awk: Likewise. * *.c: Likewise. * *.h: Likewise. * *.sh: Likewise. * .gitignore: Update. * Makefile.am: Update. * bootstrap: Update. * configure.ac: Update. * debian/rules: Update. * debian/strace-udeb.install: Update. * debian/strace.examples: Update. * debian/strace.install: Update. * debian/strace64.install: Update. * m4/gen_bpf_attr_m4.sh: Update. * m4/mpers.m4: Update. * tests/Makefile.am: Update. * tests/init.sh: Update. * tests/legacy_syscall_info.test: Update. * tests/strace-log-merge-error.test: Update. * tests/strace-log-merge-suffix.test: Update.