CVS commit: src/external/cddl/osnet/dev/systrace
Module Name:src Committed By: kamil Date: Wed Jun 6 17:47:10 UTC 2018 Modified Files: src/external/cddl/osnet/dev/systrace: systrace.c Log Message: Correct compilation of osnet/dev/systrace/systrace.c under Clang Mark arguments to dtrace_probe_lookup() with __UNCONST(). The proper fix constifying it causes pollution of const in too many files. This could be done with -W flags, but they are incompatible between compilers. This is a step forward functional MKLLVM=yes HAVE_LLVM=yes build. Sponsored by To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/cddl/osnet/dev/systrace/systrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/systrace/systrace.c diff -u src/external/cddl/osnet/dev/systrace/systrace.c:1.10 src/external/cddl/osnet/dev/systrace/systrace.c:1.11 --- src/external/cddl/osnet/dev/systrace/systrace.c:1.10 Mon May 28 21:05:04 2018 +++ src/external/cddl/osnet/dev/systrace/systrace.c Wed Jun 6 17:47:10 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.10 2018/05/28 21:05:04 chs Exp $ */ +/* $NetBSD: systrace.c,v 1.11 2018/06/06 17:47:10 kamil Exp $ */ /* * CDDL HEADER START @@ -356,7 +356,7 @@ systrace_provide(void *arg, dtrace_probe #else const char *name = ALTSYSCALLNAMES[i] ? ALTSYSCALLNAMES[i] : SYSCALLNAMES[i]; - if (dtrace_probe_lookup(systrace_id, NULL, name, "entry") != 0) + if (dtrace_probe_lookup(systrace_id, NULL, __UNCONST(name), __UNCONST("entry")) != 0) continue; (void) dtrace_probe_create(systrace_id, NULL,
CVS commit: src/external/cddl/osnet/dev/systrace
Module Name:src Committed By: christos Date: Thu Sep 24 14:26:44 UTC 2015 Modified Files: src/external/cddl/osnet/dev/systrace: systrace.c Log Message: use the alternate syscall names if available To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/cddl/osnet/dev/systrace/systrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/systrace/systrace.c diff -u src/external/cddl/osnet/dev/systrace/systrace.c:1.7 src/external/cddl/osnet/dev/systrace/systrace.c:1.8 --- src/external/cddl/osnet/dev/systrace/systrace.c:1.7 Tue Mar 10 08:17:50 2015 +++ src/external/cddl/osnet/dev/systrace/systrace.c Thu Sep 24 10:26:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.7 2015/03/10 12:17:50 christos Exp $ */ +/* $NetBSD: systrace.c,v 1.8 2015/09/24 14:26:44 christos Exp $ */ /* * CDDL HEADER START @@ -63,19 +63,23 @@ #ifndef NATIVE extern const char * const CONCAT(emulname,_syscallnames)[]; +extern const char * const CONCAT(alt,CONCAT(emulname,_syscallnames))[]; extern struct sysent CONCAT(emulname,_sysent)[]; #define MODNAME CONCAT(dtrace_syscall_,emulname) #define MODDEP "dtrace_syscall,compat_" STRING(emulname) #define MAXSYSCALL CONCAT(EMULNAME,_SYS_MAXSYSCALL) #define SYSCALLNAMES CONCAT(emulname,_syscallnames) +#define ALTSYSCALLNAMES CONCAT(alt,CONCAT(emulname,_syscallnames)) #define SYSENT CONCAT(emulname,_sysent) #define PROVNAME STRING(emulname) "_syscall" #else extern const char * const syscallnames[]; +extern const char * const altsyscallnames[]; #define MODNAME dtrace_syscall #define MODDEP "dtrace" #define MAXSYSCALL SYS_MAXSYSCALL #define SYSCALLNAMES syscallnames +#define ALTSYSCALLNAMES altsyscallnames #define SYSENT sysent #define PROVNAME "syscall" #endif @@ -181,15 +185,16 @@ systrace_provide(void *arg, const dtrace return; for (i = 0; i < MAXSYSCALL; i++) { - if (dtrace_probe_lookup(systrace_id, NULL, - SYSCALLNAMES[i], "entry") != 0) + const char *name = ALTSYSCALLNAMES[i] ? ALTSYSCALLNAMES[i] : + SYSCALLNAMES[i]; + if (dtrace_probe_lookup(systrace_id, NULL, name, "entry") != 0) continue; (void) dtrace_probe_create(systrace_id, NULL, - SYSCALLNAMES[i], "entry", SYSTRACE_ARTIFICIAL_FRAMES, + name, "entry", SYSTRACE_ARTIFICIAL_FRAMES, (void *)(intptr_t)SYSTRACE_ENTRY(i)); (void) dtrace_probe_create(systrace_id, NULL, - SYSCALLNAMES[i], "return", SYSTRACE_ARTIFICIAL_FRAMES, + name, "return", SYSTRACE_ARTIFICIAL_FRAMES, (void *)(intptr_t)SYSTRACE_RETURN(i)); } }
CVS commit: src/external/cddl/osnet/dev/systrace
Module Name:src Committed By: christos Date: Tue Mar 10 12:17:50 UTC 2015 Modified Files: src/external/cddl/osnet/dev/systrace: systrace.c Log Message: fix reversed test. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/external/cddl/osnet/dev/systrace/systrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/systrace/systrace.c diff -u src/external/cddl/osnet/dev/systrace/systrace.c:1.6 src/external/cddl/osnet/dev/systrace/systrace.c:1.7 --- src/external/cddl/osnet/dev/systrace/systrace.c:1.6 Sat Mar 7 12:47:09 2015 +++ src/external/cddl/osnet/dev/systrace/systrace.c Tue Mar 10 08:17:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.6 2015/03/07 17:47:09 christos Exp $ */ +/* $NetBSD: systrace.c,v 1.7 2015/03/10 12:17:50 christos Exp $ */ /* * CDDL HEADER START @@ -142,7 +142,7 @@ systrace_probe(uint32_t id, register_t s uintptr_t uargs[SYS_MAXSYSARGS + 3]; memset(uargs, 0, sizeof(uargs)); - if (ret) { + if (ret == NULL) { /* entry syscall, convert params */ systrace_args(sysnum, params, uargs, n_args); } else {
CVS commit: src/external/cddl/osnet/dev/systrace
Module Name:src Committed By: christos Date: Sat Mar 7 15:14:09 UTC 2015 Modified Files: src/external/cddl/osnet/dev/systrace: systrace.c Log Message: - cleanup FreeBSD ifdefs - remove unused code - adjust to NetBSD struct emul and types. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/dev/systrace/systrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/systrace/systrace.c diff -u src/external/cddl/osnet/dev/systrace/systrace.c:1.4 src/external/cddl/osnet/dev/systrace/systrace.c:1.5 --- src/external/cddl/osnet/dev/systrace/systrace.c:1.4 Sun Jan 12 12:49:30 2014 +++ src/external/cddl/osnet/dev/systrace/systrace.c Sat Mar 7 10:14:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.4 2014/01/12 17:49:30 riz Exp $ */ +/* $NetBSD: systrace.c,v 1.5 2015/03/07 15:14:09 christos Exp $ */ /* * CDDL HEADER START @@ -38,9 +38,6 @@ #include sys/cpuvar.h #include sys/fcntl.h #include sys/filio.h -#ifdef __FreeBSD__ -#include sys/kdb.h -#endif #include sys/kernel.h #include sys/kmem.h #include sys/kthread.h @@ -53,44 +50,40 @@ #include sys/poll.h #include sys/proc.h #include sys/selinfo.h -#ifdef __FreeBSD__ -#include sys/smp.h -#include sys/sysproto.h -#include sys/sysent.h -#endif #include sys/syscallargs.h #include sys/uio.h #include sys/unistd.h #include sys/dtrace.h -#ifdef LINUX_SYSTRACE -#include linux.h -#include linux_syscall.h -#include linux_proto.h -#include linux_syscallnames.c -#include linux_systrace.c -extern struct sysent linux_sysent[]; -#define DEVNAME dtrace/linsystrace -#define PROVNAME linsyscall -#define MAXSYSCALL LINUX_SYS_MAXSYSCALL -#define SYSCALLNAMES linux_syscallnames -#define SYSENT linux_sysent +#include emultrace.h + +#define CONCAT(x,y) __CONCAT(x,y) +#define STRING(s) __STRING(s) + +#ifndef NATIVE +extern const char * const CONCAT(emulname,_syscallnames)[]; +extern struct sysent CONCAT(emulname,_sysent)[]; +#define MODNAME CONCAT(dtrace_syscall_,emulname) +#define MODDEP dtrace_syscall,compat_ STRING(emulname) +#define MAXSYSCALL CONCAT(EMULNAME,_SYS_MAXSYSCALL) +#define SYSCALLNAMES CONCAT(emulname,_syscallnames) +#define SYSENT CONCAT(emulname,_sysent) +#define PROVNAME STRING(emulname) _syscall #else -/* - * The syscall arguments are processed into a DTrace argument array - * using a generated function. See sys/kern/makesyscalls.sh. - */ -#include sys/syscall.h -#include kern/systrace_args.c extern const char * const syscallnames[]; -#define DEVNAME dtrace/systrace -#define PROVNAME syscall +#define MODNAME dtrace_syscall +#define MODDEP dtrace #define MAXSYSCALL SYS_MAXSYSCALL #define SYSCALLNAMES syscallnames #define SYSENT sysent +#define PROVNAME syscall #endif +#define MODCMD CONCAT(MODNAME,_modcmd) +#define EMUL CONCAT(emul_,emulname) +extern struct emul EMUL; + #define SYSTRACE_ARTIFICIAL_FRAMES 1 #define SYSTRACE_SHIFT 16 @@ -103,9 +96,6 @@ extern const char * const syscallnames[] #error 1 SYSTRACE_SHIFT must exceed number of system calls #endif -#ifdef __FreeBSD__ -static d_open_t systrace_open; -#endif static int systrace_unload(void); static void systrace_getargdesc(void *, dtrace_id_t, void *, dtrace_argdesc_t *); static void systrace_provide(void *, const dtrace_probedesc_t *); @@ -114,23 +104,6 @@ static int systrace_enable(void *, dtrac static void systrace_disable(void *, dtrace_id_t, void *); static void systrace_load(void *); -#ifdef __FreeBSD__ -static struct cdevsw systrace_cdevsw = { - .d_version = D_VERSION, - .d_open = systrace_open, -#ifdef LINUX_SYSTRACE - .d_name = linsystrace, -#else - .d_name = systrace, -#endif -}; -#endif - -static union { - const char * const *p_constnames; - char **pp_syscallnames; -} uglyhack = { SYSCALLNAMES }; - static dtrace_pattr_t systrace_attr = { { DTRACE_STABILITY_EVOLVING, DTRACE_STABILITY_EVOLVING, DTRACE_CLASS_COMMON }, { DTRACE_STABILITY_PRIVATE, DTRACE_STABILITY_PRIVATE, DTRACE_CLASS_UNKNOWN }, @@ -152,12 +125,8 @@ static dtrace_pops_t systrace_pops = { systrace_destroy }; -#ifdef __FreeBSD__ -static struct cdev *systrace_cdev; -#endif static dtrace_provider_id_t systrace_id; -#if !defined(LINUX_SYSTRACE) /* * Probe callback function. * @@ -166,48 +135,40 @@ static dtrace_provider_id_t systrace_id; * compat syscall from something like Linux. */ static void -systrace_probe(u_int32_t id, int sysnum, struct sysent *se, void *params) +systrace_probe(uint32_t id, register_t sysnum, const struct sysent *se, +const void *params, const register_t *ret, int error) { - int n_args = 0; - union systrace_probe_args_un uargs[SYS_MAXSYSARGS]; + size_t n_args = 0; + uintptr_t uargs[SYS_MAXSYSARGS]; - /* - * Check if this syscall has an argument conversion function - * registered. - */ - if (se-sy_systrace_args_func != NULL) - /* - * Convert the
CVS commit: src/external/cddl/osnet/dev/systrace
Module Name:src Committed By: christos Date: Sat Mar 7 17:47:09 UTC 2015 Modified Files: src/external/cddl/osnet/dev/systrace: systrace.c Log Message: we have space for 2 more arguments so use it. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/external/cddl/osnet/dev/systrace/systrace.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/cddl/osnet/dev/systrace/systrace.c diff -u src/external/cddl/osnet/dev/systrace/systrace.c:1.5 src/external/cddl/osnet/dev/systrace/systrace.c:1.6 --- src/external/cddl/osnet/dev/systrace/systrace.c:1.5 Sat Mar 7 10:14:09 2015 +++ src/external/cddl/osnet/dev/systrace/systrace.c Sat Mar 7 12:47:09 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: systrace.c,v 1.5 2015/03/07 15:14:09 christos Exp $ */ +/* $NetBSD: systrace.c,v 1.6 2015/03/07 17:47:09 christos Exp $ */ /* * CDDL HEADER START @@ -139,17 +139,18 @@ systrace_probe(uint32_t id, register_t s const void *params, const register_t *ret, int error) { size_t n_args = 0; - uintptr_t uargs[SYS_MAXSYSARGS]; + uintptr_t uargs[SYS_MAXSYSARGS + 3]; memset(uargs, 0, sizeof(uargs)); - if (params) { + if (ret) { /* entry syscall, convert params */ systrace_args(sysnum, params, uargs, n_args); } else { - /* return syscall, set values (XXX: errno?) */ + /* return syscall, set values and params: */ uargs[0] = ret[0]; uargs[1] = ret[1]; uargs[2] = error; + systrace_args(sysnum, params, uargs + 3, n_args); } /* Process the probe using the converted argments. */ /* XXX: fix for more arguments! */