diff options
author | John Birrell <jb@FreeBSD.org> | 2008-05-22 04:26:42 +0000 |
---|---|---|
committer | John Birrell <jb@FreeBSD.org> | 2008-05-22 04:26:42 +0000 |
commit | ebe86aacbec3ee6283865bae78f6a78fe683e165 (patch) | |
tree | 7f4ef68af1cd84b6a341618eb121c92de40c2262 /cddl | |
parent | 0cb540ce616a6da4636de4b6ab6964648705e36d (diff) | |
download | src-ebe86aacbec3ee6283865bae78f6a78fe683e165.tar.gz src-ebe86aacbec3ee6283865bae78f6a78fe683e165.zip |
Notes
Diffstat (limited to 'cddl')
-rw-r--r-- | cddl/lib/Makefile | 5 | ||||
-rw-r--r-- | cddl/lib/drti/Makefile | 23 | ||||
-rw-r--r-- | cddl/lib/libctf/Makefile | 34 | ||||
-rw-r--r-- | cddl/lib/libdtrace/Makefile | 97 | ||||
-rw-r--r-- | cddl/lib/libdtrace/errno.d | 228 | ||||
-rw-r--r-- | cddl/lib/libdtrace/net.d | 43 | ||||
-rw-r--r-- | cddl/lib/libdtrace/nfs.d | 96 | ||||
-rw-r--r-- | cddl/lib/libdtrace/psinfo.d | 95 | ||||
-rw-r--r-- | cddl/lib/libdtrace/sched.d | 86 | ||||
-rw-r--r-- | cddl/lib/libdtrace/signal.d | 101 | ||||
-rw-r--r-- | cddl/lib/libdtrace/unistd.d | 56 |
11 files changed, 863 insertions, 1 deletions
diff --git a/cddl/lib/Makefile b/cddl/lib/Makefile index 33e28876fb8d..5e995f4b60f4 100644 --- a/cddl/lib/Makefile +++ b/cddl/lib/Makefile @@ -2,7 +2,10 @@ .include <bsd.own.mk> -SUBDIR= libavl \ +SUBDIR= drti \ + libavl \ + libctf \ + libdtrace \ libnvpair \ libumem \ libuutil \ diff --git a/cddl/lib/drti/Makefile b/cddl/lib/drti/Makefile new file mode 100644 index 000000000000..4be57a54b2c4 --- /dev/null +++ b/cddl/lib/drti/Makefile @@ -0,0 +1,23 @@ +# $FreeBSD$ + +.include "../../Makefile.inc" + +.PATH: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common + +SRCS= drti.c +FILES= ${SRCS:R:S/$/.o/g} +FILESOWN= ${LIBOWN} +FILESGRP= ${LIBGRP} +FILESMODE= ${LIBMODE} +FILESDIR= ${LIBDIR}/dtrace +WARNS?= 6 +CLEANFILES= ${FILES} + +CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \ + -I${.CURDIR}/../../../cddl/compat/opensolaris/include \ + -I${OPENSOLARIS_USR_DISTDIR}/head \ + -I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \ + -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \ + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common + +.include <bsd.prog.mk> diff --git a/cddl/lib/libctf/Makefile b/cddl/lib/libctf/Makefile new file mode 100644 index 000000000000..b3d3b039ddda --- /dev/null +++ b/cddl/lib/libctf/Makefile @@ -0,0 +1,34 @@ +# $FreeBSD$ + +.include "../../Makefile.inc" + +LIB= ctf +SHLIB_MAJOR= 1 + +SRCS= ctf_create.c \ + ctf_decl.c \ + ctf_error.c \ + ctf_hash.c \ + ctf_labels.c \ + ctf_lib.c \ + ctf_lookup.c \ + ctf_open.c \ + ctf_subr.c \ + ctf_types.c \ + ctf_util.c + +.PATH: ${OPENSOLARIS_USR_DISTDIR}/common/ctf +.PATH: ${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common +.PATH: ${OPENSOLARIS_SYS_DISTDIR}/common/ctf + +CFLAGS+= -DCTF_OLD_VERSIONS + +CFLAGS+= -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \ + -I${.CURDIR}/../../../cddl/compat/opensolaris/include \ + -I${OPENSOLARIS_USR_DISTDIR}/head \ + -I${OPENSOLARIS_USR_DISTDIR}/common/ctf \ + -I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \ + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common + +.include <bsd.lib.mk> + diff --git a/cddl/lib/libdtrace/Makefile b/cddl/lib/libdtrace/Makefile new file mode 100644 index 000000000000..9ffdaed124b7 --- /dev/null +++ b/cddl/lib/libdtrace/Makefile @@ -0,0 +1,97 @@ +# $FreeBSD$ + +.include "../../Makefile.inc" + +LIB= dtrace +SHLIB_MAJOR= 1 + +WARNS= 1 + +SRCS= dt_aggregate.c \ + dt_as.c \ + dt_buf.c \ + dt_cc.c \ + dt_cg.c \ + dt_consume.c \ + dt_decl.c \ + dt_dis.c \ + dt_dof.c \ + dt_error.c \ + dt_errtags.c \ + dt_grammar.y \ + dt_handle.c \ + dt_ident.c \ + dt_inttab.c \ + dt_lex.l \ + dt_link.c \ + dt_list.c \ + dt_map.c \ + dt_module.c \ + dt_names.c \ + dt_open.c \ + dt_options.c \ + dt_parser.c \ + dt_pcb.c \ + dt_pid.c \ + dt_pragma.c \ + dt_printf.c \ + dt_proc.c \ + dt_program.c \ + dt_provider.c \ + dt_regset.c \ + dt_string.c \ + dt_strtab.c \ + dt_subr.c \ + dt_work.c \ + dt_xlator.c \ + gmatch.c + +DSRCS= errno.d \ + psinfo.d \ + signal.d \ + unistd.d + +.PATH: ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common +.PATH: ${OPENSOLARIS_USR_DISTDIR}/lib/libgen/common + +CFLAGS+= -I${.OBJDIR} \ + -I${.CURDIR}/../../../sys/cddl/compat/opensolaris \ + -I${.CURDIR}/../../../cddl/compat/opensolaris/include \ + -I${OPENSOLARIS_USR_DISTDIR}/head \ + -I${OPENSOLARIS_USR_DISTDIR}/lib/libctf/common \ + -I${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common \ + -I${OPENSOLARIS_SYS_DISTDIR}/uts/common + +#CFLAGS+= -DYYDEBUG + +.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "amd64" +CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel +.elif ${MACHINE_ARCH} == "sparc64" +CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/sparc +.else +# temporary hack +CFLAGS+= -I${OPENSOLARIS_SYS_DISTDIR}/uts/intel +.endif + +LFLAGS+=-l + +YFLAGS+=-d + +CLEANFILES= dt_errtags.c dt_names.c + +dt_errtags.c: + sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mkerrtags.sh < ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/dt_errtags.h > dt_errtags.c + +dt_names.c: + sh ${OPENSOLARIS_USR_DISTDIR}/lib/libdtrace/common/mknames.sh < ${OPENSOLARIS_SYS_DISTDIR}/uts/common/sys/dtrace.h > dt_names.c + +beforedepend: dt_errtags.c dt_names.c + +beforeinstall: +.if exists(${DESTDIR}/usr/lib/dtrace) +.for file in ${DSRCS} + ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} ${.CURDIR}/${file} ${DESTDIR}/usr/lib/dtrace +.endfor +.endif + +.include <bsd.lib.mk> diff --git a/cddl/lib/libdtrace/errno.d b/cddl/lib/libdtrace/errno.d new file mode 100644 index 000000000000..b9a25e029f10 --- /dev/null +++ b/cddl/lib/libdtrace/errno.d @@ -0,0 +1,228 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +inline int EPERM = 1; +#pragma D binding "1.0" EPERM +inline int ENOENT = 2; +#pragma D binding "1.0" ENOENT +inline int ESRCH = 3; +#pragma D binding "1.0" ESRCH +inline int EINTR = 4; +#pragma D binding "1.0" EINTR +inline int EIO = 5; +#pragma D binding "1.0" EIO +inline int ENXIO = 6; +#pragma D binding "1.0" ENXIO +inline int E2BIG = 7; +#pragma D binding "1.0" E2BIG +inline int ENOEXEC = 8; +#pragma D binding "1.0" ENOEXEC +inline int EBADF = 9; +#pragma D binding "1.0" EBADF +inline int ECHILD = 10; +#pragma D binding "1.0" ECHILD +inline int EDEADLK = 11; +#pragma D binding "1.0" EDEADLK +inline int ENOMEM = 12; +#pragma D binding "1.0" ENOMEM +inline int EACCES = 13; +#pragma D binding "1.0" EACCES +inline int EFAULT = 14; +#pragma D binding "1.0" EFAULT +inline int ENOTBLK = 15; +#pragma D binding "1.0" ENOTBLK +inline int EBUSY = 16; +#pragma D binding "1.0" EBUSY +inline int EEXIST = 17; +#pragma D binding "1.0" EEXIST +inline int EXDEV = 18; +#pragma D binding "1.0" EXDEV +inline int ENODEV = 19; +#pragma D binding "1.0" ENODEV +inline int ENOTDIR = 20; +#pragma D binding "1.0" ENOTDIR +inline int EISDIR = 21; +#pragma D binding "1.0" EISDIR +inline int EINVAL = 22; +#pragma D binding "1.0" EINVAL +inline int ENFILE = 23; +#pragma D binding "1.0" ENFILE +inline int EMFILE = 24; +#pragma D binding "1.0" EMFILE +inline int ENOTTY = 25; +#pragma D binding "1.0" ENOTTY +inline int ETXTBSY = 26; +#pragma D binding "1.0" ETXTBSY +inline int EFBIG = 27; +#pragma D binding "1.0" EFBIG +inline int ENOSPC = 28; +#pragma D binding "1.0" ENOSPC +inline int ESPIPE = 29; +#pragma D binding "1.0" ESPIPE +inline int EROFS = 30; +#pragma D binding "1.0" EROFS +inline int EMLINK = 31; +#pragma D binding "1.0" EMLINK +inline int EPIPE = 32; +#pragma D binding "1.0" EPIPE +inline int EDOM = 33; +#pragma D binding "1.0" EDOM +inline int ERANGE = 34; +#pragma D binding "1.0" ERANGE +inline int EAGAIN = 35; +#pragma D binding "1.0" EAGAIN +inline int EWOULDBLOCK = EAGAIN; +#pragma D binding "1.0" EWOULDBLOCK +inline int EINPROGRESS = 36; +#pragma D binding "1.0" EINPROGRESS +inline int EALREADY = 37; +#pragma D binding "1.0" EALREADY +inline int ENOTSOCK = 38; +#pragma D binding "1.0" ENOTSOCK +inline int EDESTADDRREQ = 39; +#pragma D binding "1.0" EDESTADDRREQ +inline int EMSGSIZE = 40; +#pragma D binding "1.0" EMSGSIZE +inline int EPROTOTYPE = 41; +#pragma D binding "1.0" EPROTOTYPE +inline int ENOPROTOOPT = 42; +#pragma D binding "1.0" ENOPROTOOPT +inline int EPROTONOSUPPORT = 43; +#pragma D binding "1.0" EPROTONOSUPPORT +inline int ESOCKTNOSUPPORT = 44; +#pragma D binding "1.0" ESOCKTNOSUPPORT +inline int EOPNOTSUPP = 45; +#pragma D binding "1.0" EOPNOTSUPP +inline int ENOTSUP = EOPNOTSUPP; +#pragma D binding "1.0" ENOTSUP +inline int EPFNOSUPPORT = 46; +#pragma D binding "1.0" EPFNOSUPPORT +inline int EAFNOSUPPORT = 47; +#pragma D binding "1.0" EAFNOSUPPORT +inline int EADDRINUSE = 48; +#pragma D binding "1.0" EADDRINUSE +inline int EADDRNOTAVAIL = 49; +#pragma D binding "1.0" EADDRNOTAVAIL +inline int ENETDOWN = 50; +#pragma D binding "1.0" ENETDOWN +inline int ENETUNREACH = 51; +#pragma D binding "1.0" ENETUNREACH +inline int ENETRESET = 52; +#pragma D binding "1.0" ENETRESET +inline int ECONNABORTED = 53; +#pragma D binding "1.0" ECONNABORTED +inline int ECONNRESET = 54; +#pragma D binding "1.0" ECONNRESET +inline int ENOBUFS = 55; +#pragma D binding "1.0" ENOBUFS +inline int EISCONN = 56; +#pragma D binding "1.0" EISCONN +inline int ENOTCONN = 57; +#pragma D binding "1.0" ENOTCONN +inline int ESHUTDOWN = 58; +#pragma D binding "1.0" ESHUTDOWN +inline int ETOOMANYREFS = 59; +#pragma D binding "1.0" ETOOMANYREFS +inline int ETIMEDOUT = 60; +#pragma D binding "1.0" ETIMEDOUT +inline int ECONNREFUSED = 61; +#pragma D binding "1.0" ECONNREFUSED +inline int ELOOP = 62; +#pragma D binding "1.0" ELOOP +inline int ENAMETOOLONG = 63; +#pragma D binding "1.0" ENAMETOOLONG +inline int EHOSTDOWN = 64; +#pragma D binding "1.0" EHOSTDOWN +inline int EHOSTUNREACH = 65; +#pragma D binding "1.0" EHOSTUNREACH +inline int ENOTEMPTY = 66; +#pragma D binding "1.0" ENOTEMPTY +inline int EPROCLIM = 67; +#pragma D binding "1.0" EPROCLIM +inline int EUSERS = 68; +#pragma D binding "1.0" EUSERS +inline int EDQUOT = 69; +#pragma D binding "1.0" EDQUOT +inline int ESTALE = 70; +#pragma D binding "1.0" ESTALE +inline int EREMOTE = 71; +#pragma D binding "1.0" EREMOTE +inline int EBADRPC = 72; +#pragma D binding "1.0" EBADRPC +inline int ERPCMISMATCH = 73; +#pragma D binding "1.0" ERPCMISMATCH +inline int EPROGUNAVAIL = 74; +#pragma D binding "1.0" EPROGUNAVAIL +inline int EPROGMISMATCH = 75; +#pragma D binding "1.0" EPROGMISMATCH +inline int EPROCUNAVAIL = 76; +#pragma D binding "1.0" EPROCUNAVAIL +inline int ENOLCK = 77; +#pragma D binding "1.0" ENOLCK +inline int ENOSYS = 78; +#pragma D binding "1.0" ENOSYS +inline int EFTYPE = 79; +#pragma D binding "1.0" EFTYPE +inline int EAUTH = 80; +#pragma D binding "1.0" EAUTH +inline int ENEEDAUTH = 81; +#pragma D binding "1.0" ENEEDAUTH +inline int EIDRM = 82; +#pragma D binding "1.0" EIDRM +inline int ENOMSG = 83; +#pragma D binding "1.0" ENOMSG +inline int EOVERFLOW = 84; +#pragma D binding "1.0" EOVERFLOW +inline int ECANCELED = 85; +#pragma D binding "1.0" ECANCELED +inline int EILSEQ = 86; +#pragma D binding "1.0" EILSEQ +inline int ENOATTR = 87; +#pragma D binding "1.0" ENOATTR +inline int EDOOFUS = 88; +#pragma D binding "1.0" EDOOFUS +inline int EBADMSG = 89; +#pragma D binding "1.0" EBADMSG +inline int EMULTIHOP = 90; +#pragma D binding "1.0" EMULTIHOP +inline int ENOLINK = 91; +#pragma D binding "1.0" ENOLINK +inline int EPROTO = 92; +#pragma D binding "1.0" EPROTO +inline int ELAST = 92; +#pragma D binding "1.0" ELAST +inline int ERESTART = -1; +#pragma D binding "1.0" ERESTART +inline int EJUSTRETURN = -2; +#pragma D binding "1.0" EJUSTRETURN +inline int ENOIOCTL = -3; +#pragma D binding "1.0" ENOIOCTL +inline int EDIRIOCTL = -4; +#pragma D binding "1.0" EDIRIOCTL diff --git a/cddl/lib/libdtrace/net.d b/cddl/lib/libdtrace/net.d new file mode 100644 index 000000000000..ee22c8ffb0cc --- /dev/null +++ b/cddl/lib/libdtrace/net.d @@ -0,0 +1,43 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * The conninfo_t structure should be used by all application protocal + * providers as the first arguments to indicate some basic information + * about the connection. This structure may be augmented to accomodate + * the particularities of additional protocols in the future. + */ +typedef struct conninfo { + string ci_local; /* local host address */ + string ci_remote; /* remote host address */ + string ci_protocol; /* protocol (ipv4, ipv6, etc) */ +} conninfo_t; diff --git a/cddl/lib/libdtrace/nfs.d b/cddl/lib/libdtrace/nfs.d new file mode 100644 index 000000000000..0f936c4afc2f --- /dev/null +++ b/cddl/lib/libdtrace/nfs.d @@ -0,0 +1,96 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ + +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#pragma D depends_on library ip.d +#pragma D depends_on library net.d +#pragma D depends_on module genunix + +typedef struct nfsv4opinfo { + uint64_t noi_xid; /* unique transation ID */ + cred_t *noi_cred; /* credentials for operation */ + string noi_curpath; /* current file handle path (if any) */ +} nfsv4opinfo_t; + +typedef struct nfsv4cbinfo { + string nci_curpath; /* current file handle path (if any) */ +} nfsv4cbinfo_t; + +#pragma D binding "1.5" translator +translator conninfo_t < struct svc_req *P > { + ci_protocol = P->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : + P->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : + "<unknown>"; + + ci_local = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); + + ci_remote = inet_ntoa6(&((conn_t *)P->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); +}; + +#pragma D binding "1.5" translator +translator conninfo_t < struct compound_state *P > { + ci_protocol = P->req->rq_xprt->xp_master->xp_netid == "tcp" ? "ipv4" : + P->req->rq_xprt->xp_master->xp_netid == "tcp6" ? "ipv6" : + "<unknown>"; + + ci_local = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_laddr); + + ci_remote = inet_ntoa6(&((conn_t *)P->req->rq_xprt->xp_xpc. + xpc_wq->q_next->q_ptr)->connua_v6addr.connua_faddr); +}; + +#pragma D binding "1.5" translator +translator nfsv4opinfo_t < struct compound_state *P > { + noi_xid = P->req->rq_xprt->xp_xid; + noi_cred = P->basecr; + noi_curpath = (P->vp == NULL) ? "<unknown>" : P->vp->v_path; +}; + +#pragma D binding "1.5" translator +translator conninfo_t < rfs4_client_t *P > { + ci_protocol = (P->cl_addr.ss_family == AF_INET) ? "ipv4" : "ipv6"; + + ci_local = "<unknown>"; + + ci_remote = (P->cl_addr.ss_family == AF_INET) ? + inet_ntoa((ipaddr_t *) + &((struct sockaddr_in *)&P->cl_addr)->sin_addr) : + inet_ntoa6(&((struct sockaddr_in6 *)&P->cl_addr)->sin6_addr); +}; + +#pragma D binding "1.5" translator +translator nfsv4cbinfo_t < rfs4_deleg_state_t *P > { + nci_curpath = (P->finfo->vp == NULL) ? "<unknown>" : + P->finfo->vp->v_path; +}; diff --git a/cddl/lib/libdtrace/psinfo.d b/cddl/lib/libdtrace/psinfo.d new file mode 100644 index 000000000000..437481dcff96 --- /dev/null +++ b/cddl/lib/libdtrace/psinfo.d @@ -0,0 +1,95 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ +/* + * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +typedef struct psinfo { + int pr_nlwp; /* number of threads */ + pid_t pr_pid; /* unique process id */ + pid_t pr_ppid; /* process id of parent */ + pid_t pr_pgid; /* pid of process group leader */ + pid_t pr_sid; /* session id */ + uid_t pr_uid; /* real user id */ + uid_t pr_euid; /* effective user id */ + gid_t pr_gid; /* real group id */ + gid_t pr_egid; /* effective group id */ + uintptr_t + pr_addr; /* address of process */ + string pr_psargs; /* process arguments */ + u_int pr_arglen; /* process argument length */ +} psinfo_t; + +#pragma D binding "1.0" translator +translator psinfo_t < struct proc *T > { + pr_nlwp = T->p_numthreads; + pr_pid = T->p_pid; + pr_ppid = (T->p_pptr == 0) ? 0 : T->p_pptr->p_pid; + pr_pgid = (T->p_leader == 0) ? 0 : T->p_leader->p_pid; + pr_sid = (T->p_pgrp == 0) ? 0 : ((T->p_pgrp->pg_session == 0) ? 0 : T->p_pgrp->pg_session->s_sid); + pr_uid = T->p_ucred->cr_ruid; + pr_euid = T->p_ucred->cr_uid; + pr_gid = T->p_ucred->cr_rgid; + pr_egid = T->p_ucred->cr_groups[0]; + pr_addr = 0; + pr_psargs = stringof(T->p_args->ar_args); + pr_arglen = T->p_args->ar_length; +}; + +typedef struct lwpsinfo { + id_t pr_lwpid; /* thread ID. */ + int pr_flag; /* thread flags. */ + int pr_pri; /* thread priority. */ + char pr_state; /* numeric lwp state */ + char pr_sname; /* printable character for pr_state */ + short pr_syscall; /* system call number (if in syscall) */ + uintptr_t + pr_addr; /* internal address of lwp */ + uintptr_t + pr_wchan; /* sleep address */ +} lwpsinfo_t; + +#pragma D binding "1.0" translator +translator lwpsinfo_t < struct thread *T > { + pr_lwpid = T->td_tid; + pr_pri = T->td_priority; + pr_flag = T->td_flags; + pr_state = 0; /* XXX */ + pr_sname = '?'; /* XXX */ + pr_syscall = 0; /* XXX */ + pr_addr = (uintptr_t)T; + pr_wchan = (uintptr_t)T->td_wchan; +}; + +inline psinfo_t *curpsinfo = xlate <psinfo_t *> (curthread->td_proc); +#pragma D attributes Stable/Stable/Common curpsinfo +#pragma D binding "1.0" curpsinfo + +inline lwpsinfo_t *curlwpsinfo = xlate <lwpsinfo_t *> (curthread); +#pragma D attributes Stable/Stable/Common curlwpsinfo +#pragma D binding "1.0" curlwpsinfo + diff --git a/cddl/lib/libdtrace/sched.d b/cddl/lib/libdtrace/sched.d new file mode 100644 index 000000000000..d91d3c5318f0 --- /dev/null +++ b/cddl/lib/libdtrace/sched.d @@ -0,0 +1,86 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2006-2008 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#pragma ident "%Z%%M% %I% %E% SMI" + +#pragma D depends_on module unix +#pragma D depends_on provider sched + +struct cpuinfo { + processorid_t cpu_id; /* CPU identifier */ + psetid_t cpu_pset; /* processor set identifier */ + chipid_t cpu_chip; /* chip identifier */ + lgrp_id_t cpu_lgrp; /* locality group identifer */ + processor_info_t cpu_info; /* CPU information */ +}; + +typedef struct cpuinfo cpuinfo_t; + +translator cpuinfo_t < cpu_t *C > { + cpu_id = C->cpu_id; + cpu_pset = C->cpu_part->cp_id; + cpu_chip = C->cpu_physid->cpu_chipid; + cpu_lgrp = C->cpu_lpl->lpl_lgrpid; + cpu_info = (processor_info_t)C->cpu_type_info; +}; + +translator cpuinfo_t < disp_t *D > { + cpu_id = D->disp_cpu == NULL ? -1 : + xlate <cpuinfo_t> (D->disp_cpu).cpu_id; + cpu_pset = D->disp_cpu == NULL ? -1 : + xlate <cpuinfo_t> (D->disp_cpu).cpu_pset; + cpu_chip = D->disp_cpu == NULL ? -1 : + xlate <cpuinfo_t> (D->disp_cpu).cpu_chip; + cpu_lgrp = D->disp_cpu == NULL ? -1 : + xlate <cpuinfo_t> (D->disp_cpu).cpu_lgrp; + cpu_info = D->disp_cpu == NULL ? + *((processor_info_t *)dtrace`dtrace_zero) : + (processor_info_t)xlate <cpuinfo_t> (D->disp_cpu).cpu_info; +}; + +inline cpuinfo_t *curcpu = xlate <cpuinfo_t *> (curthread->t_cpu); +#pragma D attributes Stable/Stable/Common curcpu +#pragma D binding "1.0" curcpu + +inline processorid_t cpu = curcpu->cpu_id; +#pragma D attributes Stable/Stable/Common cpu +#pragma D binding "1.0" cpu + +inline psetid_t pset = curcpu->cpu_pset; +#pragma D attributes Stable/Stable/Common pset +#pragma D binding "1.0" pset + +inline chipid_t chip = curcpu->cpu_chip; +#pragma D attributes Stable/Stable/Common chip +#pragma D binding "1.0" chip + +inline lgrp_id_t lgrp = curcpu->cpu_lgrp; +#pragma D attributes Stable/Stable/Common lgrp +#pragma D binding "1.0" lgrp + diff --git a/cddl/lib/libdtrace/signal.d b/cddl/lib/libdtrace/signal.d new file mode 100644 index 000000000000..5a4c2f6b5dc5 --- /dev/null +++ b/cddl/lib/libdtrace/signal.d @@ -0,0 +1,101 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License, Version 1.0 only + * (the "License"). You may not use this file except in compliance + * with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * Portions Copyright 2008 John Birrell jb@freebsd.org + * + * $FreeBSD$ + */ + +inline int SIGHUP = 1; +#pragma D binding "1.0" SIGHUP +inline int SIGINT = 2; +#pragma D binding "1.0" SIGINT +inline int SIGQUIT = 3; +#pragma D binding "1.0" SIGQUIT +inline int SIGILL = 4; +#pragma D binding "1.0" SIGILL +inline int SIGTRAP = 5; +#pragma D binding "1.0" SIGTRAP +inline int SIGABRT = 6; +#pragma D binding "1.0" SIGABRT +inline int SIGEMT = 7; +#pragma D binding "1.0" SIGEMT +inline int SIGFPE = 8; +#pragma D binding "1.0" SIGFPE +inline int SIGKILL = 9; +#pragma D binding "1.0" SIGKILL +inline int SIGBUS = 10; +#pragma D binding "1.0" SIGBUS +inline int SIGSEGV = 11; +#pragma D binding "1.0" SIGSEGV +inline int SIGSYS = 12; +#pragma D binding "1.0" SIGSYS +inline int SIGPIPE = 13; +#pragma D binding "1.0" SIGPIPE +inline int SIGALRM = 14; +#pragma D binding "1.0" SIGALRM +inline int SIGTERM = 15; +#pragma D binding "1.0" SIGTERM +inline int SIGURG = 16; +#pragma D binding "1.0" SIGURG +inline int SIGSTOP = 17; +#pragma D binding "1.0" SIGSTOP +inline int SIGTSTP = 18; +#pragma D binding "1.0" SIGTSTP +inline int SIGCONT = 19; +#pragma D binding "1.0" SIGCONT +inline int SIGCHLD = 20; +#pragma D binding "1.0" SIGCHLD +inline int SIGTTIN = 21; +#pragma D binding "1.0" SIGTTIN +inline int SIGTTOU = 22; +#pragma D binding "1.0" SIGTTOU +inline int SIGIO = 23; +#pragma D binding "1.0" SIGIO +inline int SIGXCPU = 24; +#pragma D binding "1.0" SIGXCPU +inline int SIGXFSZ = 25; +#pragma D binding "1.0" SIGXFSZ +inline int SIGVTALRM = 26; +#pragma D binding "1.0" SIGVTALRM +inline int SIGPROF = 27; +#pragma D binding "1.0" SIGPROF +inline int SIGWINCH = 28; +#pragma D binding "1.0" SIGWINCH +inline int SIGINFO = 29; +#pragma D binding "1.0" SIGINFO +inline int SIGUSR1 = 30; +#pragma D binding "1.0" SIGUSR1 +inline int SIGUSR2 = 31; +#pragma D binding "1.0" SIGUSR2 + +inline int CLD_EXITED = 1; +#pragma D binding "1.0" CLD_EXITED +inline int CLD_KILLED = 2; +#pragma D binding "1.0" CLD_KILLED +inline int CLD_DUMPED = 3; +#pragma D binding "1.0" CLD_DUMPED +inline int CLD_TRAPPED = 4; +#pragma D binding "1.0" CLD_TRAPPED +inline int CLD_STOPPED = 5; +#pragma D binding "1.0" CLD_STOPPED +inline int CLD_CONTINUED = 6; +#pragma D binding "1.0" CLD_CONTINUED diff --git a/cddl/lib/libdtrace/unistd.d b/cddl/lib/libdtrace/unistd.d new file mode 100644 index 000000000000..1ceffef2b215 --- /dev/null +++ b/cddl/lib/libdtrace/unistd.d @@ -0,0 +1,56 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + * + * $FreeBSD$ + */ +/* + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +inline int DTRACEFLT_UNKNOWN = 0; /* Unknown fault */ +#pragma D binding "1.0" DTRACEFLT_UNKNOWN + +inline int DTRACEFLT_BADADDR = 1; /* Bad address */ +#pragma D binding "1.0" DTRACEFLT_BADADDR + +inline int DTRACEFLT_BADALIGN = 2; /* Bad alignment */ +#pragma D binding "1.0" DTRACEFLT_BADALIGN + +inline int DTRACEFLT_ILLOP = 3; /* Illegal operation */ +#pragma D binding "1.0" DTRACEFLT_ILLOP + +inline int DTRACEFLT_DIVZERO = 4; /* Divide-by-zero */ +#pragma D binding "1.0" DTRACEFLT_DIVZERO + +inline int DTRACEFLT_NOSCRATCH = 5; /* Out of scratch space */ +#pragma D binding "1.0" DTRACEFLT_NOSCRATCH + +inline int DTRACEFLT_KPRIV = 6; /* Illegal kernel access */ +#pragma D binding "1.0" DTRACEFLT_KPRIV + +inline int DTRACEFLT_UPRIV = 7; /* Illegal user access */ +#pragma D binding "1.0" DTRACEFLT_UPRIV + +inline int DTRACEFLT_TUPOFLOW = 8; /* Tuple stack overflow */ +#pragma D binding "1.0" DTRACEFLT_TUPOFLOW + +inline int DTRACEFLT_BADSTACK = 9; /* Bad stack */ +#pragma D binding "1.4.1" DTRACEFLT_BADSTACK |