Index: head/cddl/lib/libdtrace/io.d =================================================================== --- head/cddl/lib/libdtrace/io.d (revision 329187) +++ head/cddl/lib/libdtrace/io.d (revision 329188) @@ -1,109 +1,107 @@ /* * 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 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma D depends_on module kernel #pragma D depends_on provider io typedef struct devinfo { - int dev_major; /* major number */ - int dev_minor; /* minor number */ - int dev_instance; /* instance number */ - string dev_name; /* name of device */ - string dev_statname; /* name of device + instance/minor */ - string dev_pathname; /* pathname of device */ + int dev_major; /* major number */ + int dev_minor; /* minor number */ + int dev_instance; /* instance number */ + string dev_name; /* name of device */ + string dev_statname; /* name of device + instance/minor */ + string dev_pathname; /* pathname of device */ } devinfo_t; #pragma D binding "1.0" translator translator devinfo_t < struct devstat *D > { - dev_major = D->device_number; - dev_minor = D->unit_number; - dev_instance = 0; - dev_name = stringof(D->device_name); - dev_statname = stringof(D->device_name); - dev_pathname = stringof(D->device_name); + dev_major = D->device_number; + dev_minor = D->unit_number; + dev_instance = 0; + dev_name = stringof(D->device_name); + dev_statname = stringof(D->device_name); + dev_pathname = stringof(D->device_name); }; typedef struct bufinfo { - int b_flags; /* flags */ - long b_bcount; /* number of bytes */ - caddr_t b_addr; /* buffer address */ - uint64_t b_blkno; /* expanded block # on device */ - uint64_t b_lblkno; /* block # on device */ - size_t b_resid; /* # of bytes not transferred */ - size_t b_bufsize; /* size of allocated buffer */ -/* caddr_t b_iodone; I/O completion routine */ - int b_error; /* expanded error field */ -/* dev_t b_edev; extended device */ + int b_flags; /* flags */ + long b_bcount; /* number of bytes */ + caddr_t b_addr; /* buffer address */ + uint64_t b_blkno; /* expanded block # on device */ + uint64_t b_lblkno; /* block # on device */ + size_t b_resid; /* # of bytes not transferred */ + size_t b_bufsize; /* size of allocated buffer */ +/* caddr_t b_iodone; I/O completion routine */ + int b_error; /* expanded error field */ +/* dev_t b_edev; extended device */ } bufinfo_t; #pragma D binding "1.0" translator translator bufinfo_t < struct bio *B > { - b_flags = B->bio_flags; - b_bcount = B->bio_bcount; - b_addr = B->bio_data; - b_blkno = 0; - b_lblkno = 0; - b_resid = B->bio_resid; - b_bufsize = 0; /* XXX gnn */ - b_error = B->bio_error; + b_flags = B->bio_flags; + b_bcount = B->bio_bcount; + b_addr = B->bio_data; + b_blkno = 0; + b_lblkno = 0; + b_resid = B->bio_resid; + b_bufsize = 0; /* XXX gnn */ + b_error = B->bio_error; }; /* * The following inline constants can be used to examine fi_oflags when using * the fds[] array or a translated fileinfo_t. Note that the various open * flags behave as a bit-field *except* for O_RDONLY, O_WRONLY, and O_RDWR. * To test the open mode, you write code similar to that used with the fcntl(2) * F_GET[X]FL command, such as: if ((fi_oflags & O_ACCMODE) == O_WRONLY). */ inline int O_ACCMODE = 0x0003; #pragma D binding "1.1" O_ACCMODE inline int O_RDONLY = 0x0000; #pragma D binding "1.1" O_RDONLY inline int O_WRONLY = 0x0001; #pragma D binding "1.1" O_WRONLY inline int O_RDWR = 0x0002; #pragma D binding "1.1" O_RDWR inline int O_APPEND = 0x0008; #pragma D binding "1.1" O_APPEND inline int O_CREAT = 0x0200; #pragma D binding "1.1" O_CREAT inline int O_EXCL = 0x0800; #pragma D binding "1.1" O_EXCL inline int O_NOCTTY = 0x8000; #pragma D binding "1.1" O_NOCTTY inline int O_NONBLOCK = 0x0004; #pragma D binding "1.1" O_NONBLOCK inline int O_NDELAY = 0x0004; #pragma D binding "1.1" O_NDELAY inline int O_SYNC = 0x0080; #pragma D binding "1.1" O_SYNC inline int O_TRUNC = 0x0400; #pragma D binding "1.1" O_TRUNC - - Index: head/cddl/lib/libdtrace/ip.d =================================================================== --- head/cddl/lib/libdtrace/ip.d (revision 329187) +++ head/cddl/lib/libdtrace/ip.d (revision 329188) @@ -1,303 +1,303 @@ /* * 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 (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 Mark Johnston */ #pragma D depends_on module kernel #pragma D depends_on provider ip /* * pktinfo is where packet ID info can be made available for deeper * analysis if packet IDs become supported by the kernel in the future. * The pkt_addr member is currently always NULL. */ typedef struct pktinfo { uintptr_t pkt_addr; } pktinfo_t; /* * csinfo is where connection state info is made available. */ typedef uint32_t zoneid_t; typedef struct csinfo { uintptr_t cs_addr; uint64_t cs_cid; pid_t cs_pid; zoneid_t cs_zoneid; } csinfo_t; /* * ipinfo contains common IP info for both IPv4 and IPv6. */ typedef struct ipinfo { uint8_t ip_ver; /* IP version (4, 6) */ uint32_t ip_plength; /* payload length */ string ip_saddr; /* source address */ string ip_daddr; /* destination address */ } ipinfo_t; /* * ifinfo contains network interface info. */ typedef struct ifinfo { string if_name; /* interface name */ int8_t if_local; /* is delivered locally */ /*netstackid_t if_ipstack;*/ /* ipstack ID */ uintptr_t if_addr; /* pointer to raw ill_t */ } ifinfo_t; typedef uint32_t ipaddr_t; typedef struct { uint8_t ipha_version_and_hdr_length; uint8_t ipha_type_of_service; uint16_t ipha_length; uint16_t ipha_ident; uint16_t ipha_fragment_offset_and_flags; uint8_t ipha_ttl; uint8_t ipha_protocol; uint16_t ipha_hdr_checksum; ipaddr_t ipha_src; ipaddr_t ipha_dst; } ipha_t; /* * ipv4info is a translated version of the IPv4 header (with raw pointer). * These values are NULL if the packet is not IPv4. */ typedef struct ipv4info { uint8_t ipv4_ver; /* IP version (4) */ uint8_t ipv4_ihl; /* header length, bytes */ uint8_t ipv4_tos; /* type of service field */ uint16_t ipv4_length; /* length (header + payload) */ uint16_t ipv4_ident; /* identification */ uint8_t ipv4_flags; /* IP flags */ uint16_t ipv4_offset; /* fragment offset */ uint8_t ipv4_ttl; /* time to live */ uint8_t ipv4_protocol; /* next level protocol */ string ipv4_protostr; /* next level protocol, as a string */ uint16_t ipv4_checksum; /* header checksum */ ipaddr_t ipv4_src; /* source address */ ipaddr_t ipv4_dst; /* destination address */ string ipv4_saddr; /* source address, string */ string ipv4_daddr; /* destination address, string */ ipha_t *ipv4_hdr; /* pointer to raw header */ } ipv4info_t; /* * ipv6info is a translated version of the IPv6 header (with raw pointer). * These values are NULL if the packet is not IPv6. */ typedef struct in6_addr in6_addr_t; typedef struct ipv6info { uint8_t ipv6_ver; /* IP version (6) */ uint8_t ipv6_tclass; /* traffic class */ uint32_t ipv6_flow; /* flow label */ uint16_t ipv6_plen; /* payload length */ uint8_t ipv6_nexthdr; /* next header protocol */ string ipv6_nextstr; /* next header protocol, as a string */ uint8_t ipv6_hlim; /* hop limit */ in6_addr_t *ipv6_src; /* source address */ in6_addr_t *ipv6_dst; /* destination address */ string ipv6_saddr; /* source address, string */ string ipv6_daddr; /* destination address, string */ struct ip6_hdr *ipv6_hdr; /* pointer to raw header */ } ipv6info_t; #pragma D binding "1.5" IPPROTO_IP inline short IPPROTO_IP = 0; #pragma D binding "1.5" IPPROTO_ICMP inline short IPPROTO_ICMP = 1; #pragma D binding "1.5" IPPROTO_IGMP inline short IPPROTO_IGMP = 2; #pragma D binding "1.5" IPPROTO_IPV4 inline short IPPROTO_IPV4 = 4; #pragma D binding "1.5" IPPROTO_TCP inline short IPPROTO_TCP = 6; #pragma D binding "1.5" IPPROTO_UDP inline short IPPROTO_UDP = 17; #pragma D binding "1.5" IPPROTO_IPV6 inline short IPPROTO_IPV6 = 41; #pragma D binding "1.5" IPPROTO_ROUTING inline short IPPROTO_ROUTING = 43; #pragma D binding "1.5" IPPROTO_FRAGMENT inline short IPPROTO_FRAGMENT = 44; #pragma D binding "1.5" IPPROTO_RSVP inline short IPPROTO_RSVP = 46; #pragma D binding "1.5" IPPROTO_GRE inline short IPPROTO_GRE = 47; #pragma D binding "1.5" IPPROTO_ESP inline short IPPROTO_ESP = 50; #pragma D binding "1.5" IPPROTO_AH inline short IPPROTO_AH = 51; #pragma D binding "1.5" IPPROTO_MOBILE inline short IPPROTO_MOBILE = 55; #pragma D binding "1.5" IPPROTO_ICMPV6 inline short IPPROTO_ICMPV6 = 58; #pragma D binding "1.5" IPPROTO_DSTOPTS inline short IPPROTO_DSTOPTS = 60; #pragma D binding "1.5" IPPROTO_ETHERIP inline short IPPROTO_ETHERIP = 97; #pragma D binding "1.5" IPPROTO_PIM inline short IPPROTO_PIM = 103; #pragma D binding "1.5" IPPROTO_IPCOMP inline short IPPROTO_IPCOMP = 108; #pragma D binding "1.5" IPPROTO_SCTP inline short IPPROTO_SCTP = 132; #pragma D binding "1.5" IPPROTO_RAW inline short IPPROTO_RAW = 255; inline uint8_t INP_IPV4 = 0x01; inline uint8_t INP_IPV6 = 0x02; #pragma D binding "1.5" protocols inline string protocols[int proto] = proto == IPPROTO_IP ? "IP" : proto == IPPROTO_ICMP ? "ICMP" : proto == IPPROTO_IGMP ? "IGMP" : proto == IPPROTO_IPV4 ? "IPV4" : proto == IPPROTO_TCP ? "TCP" : proto == IPPROTO_UDP ? "UDP" : proto == IPPROTO_IPV6 ? "IPV6" : proto == IPPROTO_ROUTING ? "ROUTING" : proto == IPPROTO_FRAGMENT ? "FRAGMENT" : proto == IPPROTO_RSVP ? "RSVP" : proto == IPPROTO_GRE ? "GRE" : proto == IPPROTO_ESP ? "ESP" : proto == IPPROTO_AH ? "AH" : proto == IPPROTO_MOBILE ? "MOBILE" : proto == IPPROTO_ICMPV6 ? "ICMPV6" : proto == IPPROTO_DSTOPTS ? "DSTOPTS" : proto == IPPROTO_ETHERIP ? "ETHERIP" : proto == IPPROTO_PIM ? "PIM" : proto == IPPROTO_IPCOMP ? "IPCOMP" : proto == IPPROTO_SCTP ? "SCTP" : proto == IPPROTO_RAW ? "RAW" : ""; /* * This field is always NULL according to the current definition of the ip * probes. */ #pragma D binding "1.5" translator translator pktinfo_t < void *p > { pkt_addr = NULL; }; #pragma D binding "1.5" translator translator csinfo_t < void *p > { cs_addr = NULL; cs_cid = (uint64_t)p; cs_pid = 0; cs_zoneid = 0; }; #pragma D binding "1.6.3" translator translator csinfo_t < struct inpcb *p > { - cs_addr = NULL; - cs_cid = (uint64_t)p; - cs_pid = 0; /* XXX */ - cs_zoneid = 0; + cs_addr = NULL; + cs_cid = (uint64_t)p; + cs_pid = 0; /* XXX */ + cs_zoneid = 0; }; #pragma D binding "1.5" translator translator ipinfo_t < uint8_t *p > { ip_ver = p == NULL ? 0 : ((struct ip *)p)->ip_v; ip_plength = p == NULL ? 0 : ((struct ip *)p)->ip_v == 4 ? ntohs(((struct ip *)p)->ip_len) - (((struct ip *)p)->ip_hl << 2): ntohs(((struct ip6_hdr *)p)->ip6_ctlun.ip6_un1.ip6_un1_plen); ip_saddr = p == NULL ? 0 : ((struct ip *)p)->ip_v == 4 ? inet_ntoa(&((struct ip *)p)->ip_src.s_addr) : inet_ntoa6(&((struct ip6_hdr *)p)->ip6_src); ip_daddr = p == NULL ? 0 : ((struct ip *)p)->ip_v == 4 ? inet_ntoa(&((struct ip *)p)->ip_dst.s_addr) : inet_ntoa6(&((struct ip6_hdr *)p)->ip6_dst); }; #pragma D binding "1.13" translator translator ipinfo_t < struct mbuf *m > { ip_ver = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v; ip_plength = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v == 4 ? ntohs(((struct ip *)m->m_data)->ip_len) - (((struct ip *)m->m_data)->ip_hl << 2): ntohs(((struct ip6_hdr *)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen); ip_saddr = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v == 4 ? inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) : inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src); ip_daddr = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v == 4 ? inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) : inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst); }; #pragma D binding "1.5" IFF_LOOPBACK inline int IFF_LOOPBACK = 0x8; #pragma D binding "1.5" translator translator ifinfo_t < struct ifnet *p > { if_name = p->if_xname; if_local = (p->if_flags & IFF_LOOPBACK) == 0 ? 0 : 1; if_addr = (uintptr_t)p; }; #pragma D binding "1.5" translator translator ipv4info_t < struct ip *p > { ipv4_ver = p == NULL ? 0 : p->ip_v; ipv4_ihl = p == NULL ? 0 : p->ip_hl; ipv4_tos = p == NULL ? 0 : p->ip_tos; ipv4_length = p == NULL ? 0 : ntohs(p->ip_len); ipv4_ident = p == NULL ? 0 : ntohs(p->ip_id); ipv4_flags = p == NULL ? 0 : (ntohs(p->ip_off) & 0xe000) >> 8; ipv4_offset = p == NULL ? 0 : ntohs(p->ip_off) & 0x1fff; ipv4_ttl = p == NULL ? 0 : p->ip_ttl; ipv4_protocol = p == NULL ? 0 : p->ip_p; ipv4_protostr = p == NULL ? "" : protocols[p->ip_p]; ipv4_checksum = p == NULL ? 0 : ntohs(p->ip_sum); ipv4_src = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_src.s_addr); ipv4_dst = p == NULL ? 0 : (ipaddr_t)ntohl(p->ip_dst.s_addr); ipv4_saddr = p == NULL ? 0 : inet_ntoa(&p->ip_src.s_addr); ipv4_daddr = p == NULL ? 0 : inet_ntoa(&p->ip_dst.s_addr); ipv4_hdr = (ipha_t *)p; }; #pragma D binding "1.5" translator translator ipv6info_t < struct ip6_hdr *p > { ipv6_ver = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0xf0000000) >> 28; ipv6_tclass = p == NULL ? 0 : (ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x0ff00000) >> 20; ipv6_flow = p == NULL ? 0 : ntohl(p->ip6_ctlun.ip6_un1.ip6_un1_flow) & 0x000fffff; ipv6_plen = p == NULL ? 0 : ntohs(p->ip6_ctlun.ip6_un1.ip6_un1_plen); ipv6_nexthdr = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_nxt; ipv6_nextstr = p == NULL ? "" : protocols[p->ip6_ctlun.ip6_un1.ip6_un1_nxt]; ipv6_hlim = p == NULL ? 0 : p->ip6_ctlun.ip6_un1.ip6_un1_hlim; ipv6_src = p == NULL ? 0 : (in6_addr_t *)&p->ip6_src; ipv6_dst = p == NULL ? 0 : (in6_addr_t *)&p->ip6_dst; ipv6_saddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_src); ipv6_daddr = p == NULL ? 0 : inet_ntoa6(&p->ip6_dst); ipv6_hdr = p; }; Index: head/cddl/lib/libdtrace/libproc_compat.h =================================================================== --- head/cddl/lib/libdtrace/libproc_compat.h (revision 329187) +++ head/cddl/lib/libdtrace/libproc_compat.h (revision 329188) @@ -1,67 +1,67 @@ /* * Copyright (c) 2010 The FreeBSD Foundation * All rights reserved. * * This software was developed by Rui Paulo under sponsorship from the * FreeBSD Foundation. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ /* * Compatibility functions between Solaris libproc and FreeBSD libproc. * Functions sorted alphabetically. */ #define PR_LMID_EVERY 0 #define PGRAB_RDONLY PATTACH_RDONLY #define PGRAB_FORCE PATTACH_FORCE #define Psetrun(p, a1, a2) proc_continue((p)) #define Pxlookup_by_addr(p, a, n, s, sym, i) \ proc_addr2sym(p, a, n, s, sym) #define Pxlookup_by_name(p, l, s1, s2, sym, a) \ proc_name2sym(p, s1, s2, sym, a) #define Paddr_to_map proc_addr2map #define Pcreate_error strerror #define Pdelbkpt proc_bkptdel #define Pgrab_error strerror #define Plmid(p, a, l) (-1) #define Plmid_to_map(p, l, o) proc_name2map(p, o) #define Plookup_by_addr proc_addr2sym #define Pname_to_ctf(p, obj) (ctf_file_t *)proc_name2ctf(p, obj) #define Pname_to_map proc_name2map #define Pobject_iter proc_iter_objs #define Pobject_iter_resolved(p, f, arg) proc_iter_objs(p, f, arg) #define Pobjname proc_objname #define Pread proc_read #define Prd_agent proc_rdagent #define Prelease proc_detach #define Psetbkpt proc_bkptset #define Psetflags proc_setflags #define Pstate proc_state #define Psymbol_iter_by_addr proc_iter_symbyaddr #define Punsetflags proc_clearflags #define Pupdate_maps proc_rdagent #define Pupdate_syms proc_updatesyms #define Pxecbkpt proc_bkptexec Index: head/cddl/lib/libdtrace/psinfo.d =================================================================== --- head/cddl/lib/libdtrace/psinfo.d (revision 329187) +++ head/cddl/lib/libdtrace/psinfo.d (revision 329188) @@ -1,100 +1,99 @@ /* * 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. */ #pragma D depends_on module kernel 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 */ u_int pr_jailid; /* jail id */ } 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 = (T->p_args == 0) ? "" : memstr(T->p_args->ar_args, ' ', T->p_args->ar_length); pr_arglen = T->p_args->ar_length; pr_jailid = T->p_ucred->cr_prison->pr_id; }; 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 (curthread->td_proc); #pragma D attributes Stable/Stable/Common curpsinfo #pragma D binding "1.0" curpsinfo inline lwpsinfo_t *curlwpsinfo = xlate (curthread); #pragma D attributes Stable/Stable/Common curlwpsinfo #pragma D binding "1.0" curlwpsinfo - Index: head/cddl/lib/libdtrace/regs_x86.d =================================================================== --- head/cddl/lib/libdtrace/regs_x86.d (revision 329187) +++ head/cddl/lib/libdtrace/regs_x86.d (revision 329188) @@ -1,119 +1,118 @@ -/* +/* * 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 2009 Stacey Son sson@FreeBSD.org * * $FreeBSD$ */ /* * Copyright 2004 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ inline int R_GS = 0; #pragma D binding "1.0" R_GS inline int R_FS = 1; #pragma D binding "1.0" R_FS inline int R_ES = 2; #pragma D binding "1.0" R_ES inline int R_DS = 3; #pragma D binding "1.0" R_DS inline int R_EDI = 4; #pragma D binding "1.0" R_EDI inline int R_ESI = 5; #pragma D binding "1.0" R_ESI inline int R_EBP = 6; #pragma D binding "1.0" R_EBP inline int R_ESP = 7; #pragma D binding "1.0" R_ESP inline int R_EBX = 8; #pragma D binding "1.0" R_EBX inline int R_EDX = 9; #pragma D binding "1.0" R_EDX inline int R_ECX = 10; #pragma D binding "1.0" R_ECX inline int R_EAX = 11; #pragma D binding "1.0" R_EAX inline int R_TRAPNO = 12; #pragma D binding "1.0" R_TRAPNO inline int R_ERR = 13; #pragma D binding "1.0" R_ERR inline int R_EIP = 14; #pragma D binding "1.0" R_EIP inline int R_CS = 15; #pragma D binding "1.0" R_CS inline int R_EFL = 16; #pragma D binding "1.0" R_EFL inline int R_UESP = 17; #pragma D binding "1.0" R_UESP inline int R_SS = 18; #pragma D binding "1.0" R_SS inline int R_PC = R_EIP; #pragma D binding "1.0" R_PC inline int R_SP = R_UESP; #pragma D binding "1.0" R_SP inline int R_PS = R_EFL; #pragma D binding "1.0" R_PS inline int R_R0 = R_EAX; #pragma D binding "1.0" R_R0 inline int R_R1 = R_EBX; #pragma D binding "1.0" R_R1 inline int R_RSP = 18 + 1 + 20; #pragma D binding "1.0" R_RSP inline int R_RFL = 18 + 1 + 19; #pragma D binding "1.0" R_RFL inline int R_RIP = 18 + 1 + 17; #pragma D binding "1.0" R_RIP inline int R_RAX = 18 + 1 + 14; #pragma D binding "1.0" R_RAX inline int R_RCX = 18 + 1 + 13; #pragma D binding "1.0" R_RCX inline int R_RDX = 18 + 1 + 12; #pragma D binding "1.0" R_RDX inline int R_RBX = 18 + 1 + 11; #pragma D binding "1.0" R_RBX inline int R_RBP = 18 + 1 + 10; #pragma D binding "1.0" R_RBP inline int R_RSI = 18 + 1 + 9; #pragma D binding "1.0" R_RSI inline int R_RDI = 18 + 1 + 8; #pragma D binding "1.0" R_RDI inline int R_R8 = 18 + 1 + 7; #pragma D binding "1.0" R_R8 inline int R_R9 = 18 + 1 + 6; #pragma D binding "1.0" R_R9 inline int R_R10 = 18 + 1 + 5; #pragma D binding "1.0" R_R10 inline int R_R11 = 18 + 1 + 4; #pragma D binding "1.0" R_R11 inline int R_R12 = 18 + 1 + 3; #pragma D binding "1.0" R_R12 inline int R_R13 = 18 + 1 + 2; #pragma D binding "1.0" R_R13 inline int R_R14 = 18 + 1 + 1; #pragma D binding "1.0" R_R14 inline int R_R15 = 18 + 1 + 0; #pragma D binding "1.0" R_R15 - Index: head/cddl/lib/libdtrace/sched.d =================================================================== --- head/cddl/lib/libdtrace/sched.d (revision 329187) +++ head/cddl/lib/libdtrace/sched.d (revision 329188) @@ -1,84 +1,83 @@ /* * 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 D depends_on module kernel #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 (D->disp_cpu).cpu_id; cpu_pset = D->disp_cpu == NULL ? -1 : xlate (D->disp_cpu).cpu_pset; cpu_chip = D->disp_cpu == NULL ? -1 : xlate (D->disp_cpu).cpu_chip; cpu_lgrp = D->disp_cpu == NULL ? -1 : xlate (D->disp_cpu).cpu_lgrp; cpu_info = D->disp_cpu == NULL ? *((processor_info_t *)dtrace`dtrace_zero) : (processor_info_t)xlate (D->disp_cpu).cpu_info; }; inline cpuinfo_t *curcpu = xlate (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 - Index: head/cddl/lib/libdtrace/tcp.d =================================================================== --- head/cddl/lib/libdtrace/tcp.d (revision 329187) +++ head/cddl/lib/libdtrace/tcp.d (revision 329188) @@ -1,392 +1,392 @@ /* * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 Mark Johnston */ #pragma D depends_on library ip.d #pragma D depends_on module kernel #pragma D depends_on provider tcp /* * Convert a TCP state value to a string. */ #pragma D binding "1.6.3" TCPS_CLOSED inline int TCPS_CLOSED = 0; #pragma D binding "1.6.3" TCPS_LISTEN inline int TCPS_LISTEN = 1; #pragma D binding "1.6.3" TCPS_SYN_SENT inline int TCPS_SYN_SENT = 2; #pragma D binding "1.6.3" TCPS_SYN_RECEIVED inline int TCPS_SYN_RECEIVED = 3; #pragma D binding "1.6.3" TCPS_ESTABLISHED inline int TCPS_ESTABLISHED = 4; #pragma D binding "1.6.3" TCPS_CLOSE_WAIT inline int TCPS_CLOSE_WAIT = 5; #pragma D binding "1.6.3" TCPS_FIN_WAIT_1 inline int TCPS_FIN_WAIT_1 = 6; #pragma D binding "1.6.3" TCPS_CLOSING inline int TCPS_CLOSING = 7; #pragma D binding "1.6.3" TCPS_LAST_ACK inline int TCPS_LAST_ACK = 8; #pragma D binding "1.6.3" TCPS_FIN_WAIT_2 inline int TCPS_FIN_WAIT_2 = 9; #pragma D binding "1.6.3" TCPS_TIME_WAIT inline int TCPS_TIME_WAIT = 10; /* TCP segment flags. */ #pragma D binding "1.6.3" TH_FIN inline uint8_t TH_FIN = 0x01; #pragma D binding "1.6.3" TH_SYN inline uint8_t TH_SYN = 0x02; #pragma D binding "1.6.3" TH_RST inline uint8_t TH_RST = 0x04; #pragma D binding "1.6.3" TH_PUSH inline uint8_t TH_PUSH = 0x08; #pragma D binding "1.6.3" TH_ACK inline uint8_t TH_ACK = 0x10; #pragma D binding "1.6.3" TH_URG inline uint8_t TH_URG = 0x20; #pragma D binding "1.6.3" TH_ECE inline uint8_t TH_ECE = 0x40; #pragma D binding "1.6.3" TH_CWR inline uint8_t TH_CWR = 0x80; /* TCP connection state strings. */ #pragma D binding "1.6.3" tcp_state_string inline string tcp_state_string[int32_t state] = state == TCPS_CLOSED ? "state-closed" : state == TCPS_LISTEN ? "state-listen" : state == TCPS_SYN_SENT ? "state-syn-sent" : state == TCPS_SYN_RECEIVED ? "state-syn-received" : state == TCPS_ESTABLISHED ? "state-established" : state == TCPS_CLOSE_WAIT ? "state-close-wait" : state == TCPS_FIN_WAIT_1 ? "state-fin-wait-1" : state == TCPS_CLOSING ? "state-closing" : state == TCPS_LAST_ACK ? "state-last-ack" : state == TCPS_FIN_WAIT_2 ? "state-fin-wait-2" : state == TCPS_TIME_WAIT ? "state-time-wait" : ""; /* * tcpsinfo contains stable TCP details from tcp_t. */ typedef struct tcpsinfo { uintptr_t tcps_addr; int tcps_local; /* is delivered locally, boolean */ int tcps_active; /* active open (from here), boolean */ uint16_t tcps_lport; /* local port */ uint16_t tcps_rport; /* remote port */ string tcps_laddr; /* local address, as a string */ string tcps_raddr; /* remote address, as a string */ int32_t tcps_state; /* TCP state */ uint32_t tcps_iss; /* Initial sequence # sent */ uint32_t tcps_irs; /* Initial sequence # received */ uint32_t tcps_suna; /* sequence # sent but unacked */ uint32_t tcps_smax; /* highest sequence number sent */ uint32_t tcps_snxt; /* next sequence # to send */ uint32_t tcps_rack; /* sequence # we have acked */ uint32_t tcps_rnxt; /* next sequence # expected */ u_long tcps_swnd; /* send window size */ int32_t tcps_snd_ws; /* send window scaling */ uint32_t tcps_swl1; /* window update seg seq number */ uint32_t tcps_swl2; /* window update seg ack number */ uint32_t tcps_rup; /* receive urgent pointer */ uint32_t tcps_radv; /* advertised window */ u_long tcps_rwnd; /* receive window size */ int32_t tcps_rcv_ws; /* receive window scaling */ u_long tcps_cwnd; /* congestion window */ u_long tcps_cwnd_ssthresh; /* threshold for congestion avoidance */ - uint32_t tcps_srecover; /* for use in NewReno Fast Recovery */ + uint32_t tcps_srecover; /* for use in NewReno Fast Recovery */ uint32_t tcps_sack_fack; /* SACK sequence # we have acked */ uint32_t tcps_sack_snxt; /* next SACK seq # for retransmission */ uint32_t tcps_rto; /* round-trip timeout, msec */ uint32_t tcps_mss; /* max segment size */ int tcps_retransmit; /* retransmit send event, boolean */ int tcps_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ - int tcps_debug; /* socket has SO_DEBUG set */ - int tcps_cookie; /* expose the socket's SO_USER_COOKIE */ - int32_t tcps_dupacks; /* consecutive dup acks received */ - uint32_t tcps_rtttime; /* RTT measurement start time */ - uint32_t tcps_rtseq; /* sequence # being timed */ + int tcps_debug; /* socket has SO_DEBUG set */ + int tcps_cookie; /* expose the socket's SO_USER_COOKIE */ + int32_t tcps_dupacks; /* consecutive dup acks received */ + uint32_t tcps_rtttime; /* RTT measurement start time */ + uint32_t tcps_rtseq; /* sequence # being timed */ uint32_t tcps_ts_recent; /* timestamp echo data */ } tcpsinfo_t; /* * tcplsinfo provides the old tcp state for state changes. */ typedef struct tcplsinfo { int32_t tcps_state; /* previous TCP state */ } tcplsinfo_t; /* * tcpinfo is the TCP header fields. */ typedef struct tcpinfo { uint16_t tcp_sport; /* source port */ uint16_t tcp_dport; /* destination port */ uint32_t tcp_seq; /* sequence number */ uint32_t tcp_ack; /* acknowledgment number */ uint8_t tcp_offset; /* data offset, in bytes */ uint8_t tcp_flags; /* flags */ uint16_t tcp_window; /* window size */ uint16_t tcp_checksum; /* checksum */ uint16_t tcp_urgent; /* urgent data pointer */ struct tcphdr *tcp_hdr; /* raw TCP header */ } tcpinfo_t; /* * A clone of tcpinfo_t used to handle the fact that the TCP input path * overwrites some fields of the TCP header with their host-order equivalents. * Unfortunately, DTrace doesn't let us simply typedef a new name for struct * tcpinfo and define a separate translator for it. */ typedef struct tcpinfoh { uint16_t tcp_sport; /* source port */ uint16_t tcp_dport; /* destination port */ uint32_t tcp_seq; /* sequence number */ uint32_t tcp_ack; /* acknowledgment number */ uint8_t tcp_offset; /* data offset, in bytes */ uint8_t tcp_flags; /* flags */ uint16_t tcp_window; /* window size */ uint16_t tcp_checksum; /* checksum */ uint16_t tcp_urgent; /* urgent data pointer */ struct tcphdr *tcp_hdr; /* raw TCP header */ } tcpinfoh_t; #pragma D binding "1.6.3" translator translator csinfo_t < struct tcpcb *p > { cs_addr = NULL; cs_cid = (uint64_t)(p == NULL ? 0 : p->t_inpcb); cs_pid = 0; cs_zoneid = 0; }; #pragma D binding "1.6.3" translator translator tcpsinfo_t < struct tcpcb *p > { tcps_addr = (uintptr_t)p; tcps_local = -1; /* XXX */ tcps_active = -1; /* XXX */ tcps_lport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_lport); tcps_rport = p == NULL ? 0 : ntohs(p->t_inpcb->inp_inc.inc_ie.ie_fport); tcps_laddr = p == NULL ? 0 : p->t_inpcb->inp_vflag == INP_IPV4 ? inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) : inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependladdr.ie6_local); tcps_raddr = p == NULL ? 0 : p->t_inpcb->inp_vflag == INP_IPV4 ? inet_ntoa(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) : inet_ntoa6(&p->t_inpcb->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign); tcps_state = p == NULL ? -1 : p->t_state; tcps_iss = p == NULL ? 0 : p->iss; tcps_irs = p == NULL ? 0 : p->irs; tcps_suna = p == NULL ? 0 : p->snd_una; tcps_smax = p == NULL ? 0 : p->snd_max; tcps_snxt = p == NULL ? 0 : p->snd_nxt; tcps_rack = p == NULL ? 0 : p->last_ack_sent; tcps_rnxt = p == NULL ? 0 : p->rcv_nxt; - tcps_swnd = p == NULL ? -1 : p->snd_wnd; - tcps_snd_ws = p == NULL ? -1 : p->snd_scale; - tcps_swl1 = p == NULL ? -1 : p->snd_wl1; - tcps_swl2 = p == NULL ? -1 : p->snd_wl2; - tcps_radv = p == NULL ? -1 : p->rcv_adv; - tcps_rwnd = p == NULL ? -1 : p->rcv_wnd; - tcps_rup = p == NULL ? -1 : p->rcv_up; - tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale; - tcps_cwnd = p == NULL ? -1 : p->snd_cwnd; - tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; - tcps_srecover = p == NULL ? -1 : p->snd_recover; + tcps_swnd = p == NULL ? -1 : p->snd_wnd; + tcps_snd_ws = p == NULL ? -1 : p->snd_scale; + tcps_swl1 = p == NULL ? -1 : p->snd_wl1; + tcps_swl2 = p == NULL ? -1 : p->snd_wl2; + tcps_radv = p == NULL ? -1 : p->rcv_adv; + tcps_rwnd = p == NULL ? -1 : p->rcv_wnd; + tcps_rup = p == NULL ? -1 : p->rcv_up; + tcps_rcv_ws = p == NULL ? -1 : p->rcv_scale; + tcps_cwnd = p == NULL ? -1 : p->snd_cwnd; + tcps_cwnd_ssthresh = p == NULL ? -1 : p->snd_ssthresh; + tcps_srecover = p == NULL ? -1 : p->snd_recover; tcps_sack_fack = p == NULL ? 0 : p->snd_fack; tcps_sack_snxt = p == NULL ? 0 : p->sack_newdata; tcps_rto = p == NULL ? -1 : (p->t_rxtcur * 1000) / `hz; - tcps_mss = p == NULL ? -1 : p->t_maxseg; + tcps_mss = p == NULL ? -1 : p->t_maxseg; tcps_retransmit = p == NULL ? -1 : p->t_rxtshift > 0 ? 1 : 0; - tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ + tcps_srtt = p == NULL ? -1 : p->t_srtt; /* smoothed RTT in units of (TCP_RTT_SCALE*hz) */ tcps_debug = p == NULL ? 0 : p->t_inpcb->inp_socket->so_options & 1; tcps_cookie = p == NULL ? -1 : p->t_inpcb->inp_socket->so_user_cookie; - tcps_dupacks = p == NULL ? -1 : p->t_dupacks; - tcps_rtttime = p == NULL ? -1 : p->t_rtttime; - tcps_rtseq = p == NULL ? -1 : p->t_rtseq; - tcps_ts_recent = p == NULL ? -1 : p->ts_recent; + tcps_dupacks = p == NULL ? -1 : p->t_dupacks; + tcps_rtttime = p == NULL ? -1 : p->t_rtttime; + tcps_rtseq = p == NULL ? -1 : p->t_rtseq; + tcps_ts_recent = p == NULL ? -1 : p->ts_recent; }; #pragma D binding "1.6.3" translator translator tcpinfo_t < struct tcphdr *p > { tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); tcp_seq = p == NULL ? -1 : ntohl(p->th_seq); tcp_ack = p == NULL ? -1 : ntohl(p->th_ack); tcp_offset = p == NULL ? -1 : (p->th_off >> 2); tcp_flags = p == NULL ? 0 : p->th_flags; tcp_window = p == NULL ? 0 : ntohs(p->th_win); tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : ntohs(p->th_urp); tcp_hdr = (struct tcphdr *)p; }; /* * This translator differs from the one for tcpinfo_t in that the sequence * number, acknowledgement number, window size and urgent pointer are already * in host order and thus don't need to be converted. */ #pragma D binding "1.6.3" translator translator tcpinfoh_t < struct tcphdr *p > { tcp_sport = p == NULL ? 0 : ntohs(p->th_sport); tcp_dport = p == NULL ? 0 : ntohs(p->th_dport); tcp_seq = p == NULL ? -1 : p->th_seq; tcp_ack = p == NULL ? -1 : p->th_ack; tcp_offset = p == NULL ? -1 : (p->th_off >> 2); tcp_flags = p == NULL ? 0 : p->th_flags; tcp_window = p == NULL ? 0 : p->th_win; tcp_checksum = p == NULL ? 0 : ntohs(p->th_sum); tcp_urgent = p == NULL ? 0 : p->th_urp; tcp_hdr = (struct tcphdr *)p; }; #pragma D binding "1.6.3" translator translator tcplsinfo_t < int s > { tcps_state = s; }; /* Support for TCP debug */ #pragma D binding "1.12.1" TA_INPUT inline int TA_INPUT = 0; #pragma D binding "1.12.1" TA_OUTPUT inline int TA_OUTPUT = 1; #pragma D binding "1.12.1" TA_USER inline int TA_USER = 2; #pragma D binding "1.12.1" TA_RESPOND inline int TA_RESPOND = 3; #pragma D binding "1.12.1" TA_DROP inline int TA_DROP = 4; /* direction strings. */ #pragma D binding "1.12.1" tcpdebug_dir_string inline string tcpdebug_dir_string[uint8_t direction] = direction == TA_INPUT ? "input" : direction == TA_OUTPUT ? "output" : direction == TA_USER ? "user" : direction == TA_RESPOND ? "respond" : direction == TA_OUTPUT ? "drop" : "unknown" ; #pragma D binding "1.12.1" tcpflag_string inline string tcpflag_string[uint8_t flags] = flags & TH_FIN ? "FIN" : flags & TH_SYN ? "SYN" : flags & TH_RST ? "RST" : flags & TH_PUSH ? "PUSH" : flags & TH_ACK ? "ACK" : flags & TH_URG ? "URG" : flags & TH_ECE ? "ECE" : flags & TH_CWR ? "CWR" : "unknown" ; #pragma D binding "1.12.1" PRU_ATTACH inline int PRU_ATTACH = 0; #pragma D binding "1.12.1" PRU_DETACH inline int PRU_DETACH = 1; #pragma D binding "1.12.1" PRU_BIND inline int PRU_BIND = 2; #pragma D binding "1.12.1" PRU_LISTEN inline int PRU_LISTEN = 3; #pragma D binding "1.12.1" PRU_CONNECT inline int PRU_CONNECT = 4; #pragma D binding "1.12.1" PRU_ACCEPT -inline int PRU_ACCEPT = 5 ; +inline int PRU_ACCEPT = 5 ; #pragma D binding "1.12.1" PRU_DISCONNECT -inline int PRU_DISCONNECT= 6; +inline int PRU_DISCONNECT = 6; #pragma D binding "1.12.1" PRU_SHUTDOWN -inline int PRU_SHUTDOWN = 7; +inline int PRU_SHUTDOWN = 7; #pragma D binding "1.12.1" PRU_RCVD -inline int PRU_RCVD = 8; +inline int PRU_RCVD = 8; #pragma D binding "1.12.1" PRU_SEND -inline int PRU_SEND = 9; +inline int PRU_SEND = 9; #pragma D binding "1.12.1" PRU_ABORT -inline int PRU_ABORT = 10; +inline int PRU_ABORT = 10; #pragma D binding "1.12.1" PRU_CONTROL -inline int PRU_CONTROL = 11; +inline int PRU_CONTROL = 11; #pragma D binding "1.12.1" PRU_SENSE -inline int PRU_SENSE = 12; +inline int PRU_SENSE = 12; #pragma D binding "1.12.1" PRU_RCVOOB -inline int PRU_RCVOOB = 13; +inline int PRU_RCVOOB = 13; #pragma D binding "1.12.1" PRU_SENDOOB -inline int PRU_SENDOOB = 14; +inline int PRU_SENDOOB = 14; #pragma D binding "1.12.1" PRU_SOCKADDR -inline int PRU_SOCKADDR = 15; +inline int PRU_SOCKADDR = 15; #pragma D binding "1.12.1" PRU_PEERADDR -inline int PRU_PEERADDR = 16; +inline int PRU_PEERADDR = 16; #pragma D binding "1.12.1" PRU_CONNECT2 -inline int PRU_CONNECT2 = 17; +inline int PRU_CONNECT2 = 17; #pragma D binding "1.12.1" PRU_FASTTIMO -inline int PRU_FASTTIMO = 18; +inline int PRU_FASTTIMO = 18; #pragma D binding "1.12.1" PRU_SLOWTIMO -inline int PRU_SLOWTIMO = 19; +inline int PRU_SLOWTIMO = 19; #pragma D binding "1.12.1" PRU_PROTORCV -inline int PRU_PROTORCV = 20; +inline int PRU_PROTORCV = 20; #pragma D binding "1.12.1" PRU_PROTOSEND -inline int PRU_PROTOSEND = 21; +inline int PRU_PROTOSEND = 21; #pragma D binding "1.12.1" PRU_SEND_EOF -inline int PRU_SEND_EOF = 22; +inline int PRU_SEND_EOF = 22; #pragma D binding "1.12.1" PRU_SOSETLABEL -inline int PRU_SOSETLABEL = 23; +inline int PRU_SOSETLABEL = 23; #pragma D binding "1.12.1" PRU_CLOSE -inline int PRU_CLOSE = 24; +inline int PRU_CLOSE = 24; #pragma D binding "1.12.1" PRU_FLUSH -inline int PRU_FLUSH = 25; +inline int PRU_FLUSH = 25; #pragma D binding "1.12.1" prureq_string inline string prureq_string[uint8_t req] = - req == PRU_ATTACH ? "ATTACH" : - req == PRU_DETACH ? "DETACH" : - req == PRU_BIND ? "BIND" : - req == PRU_LISTEN ? "LISTEN" : - req == PRU_CONNECT ? "CONNECT" : - req == PRU_ACCEPT ? "ACCEPT" : - req == PRU_DISCONNECT ? "DISCONNECT" : - req == PRU_SHUTDOWN ? "SHUTDOWN" : - req == PRU_RCVD ? "RCVD" : - req == PRU_SEND ? "SEND" : - req == PRU_ABORT ? "ABORT" : - req == PRU_CONTROL ? "CONTROL" : - req == PRU_SENSE ? "SENSE" : - req == PRU_RCVOOB ? "RCVOOB" : - req == PRU_SENDOOB ? "SENDOOB" : - req == PRU_SOCKADDR ? "SOCKADDR" : - req == PRU_PEERADDR ? "PEERADDR" : - req == PRU_CONNECT2 ? "CONNECT2" : - req == PRU_FASTTIMO ? "FASTTIMO" : - req == PRU_SLOWTIMO ? "SLOWTIMO" : - req == PRU_PROTORCV ? "PROTORCV" : - req == PRU_PROTOSEND ? "PROTOSEND" : - req == PRU_SEND ? "SEND_EOF" : - req == PRU_SOSETLABEL ? "SOSETLABEL" : - req == PRU_CLOSE ? "CLOSE" : - req == PRU_FLUSH ? "FLUSE" : + req == PRU_ATTACH ? "ATTACH" : + req == PRU_DETACH ? "DETACH" : + req == PRU_BIND ? "BIND" : + req == PRU_LISTEN ? "LISTEN" : + req == PRU_CONNECT ? "CONNECT" : + req == PRU_ACCEPT ? "ACCEPT" : + req == PRU_DISCONNECT ? "DISCONNECT" : + req == PRU_SHUTDOWN ? "SHUTDOWN" : + req == PRU_RCVD ? "RCVD" : + req == PRU_SEND ? "SEND" : + req == PRU_ABORT ? "ABORT" : + req == PRU_CONTROL ? "CONTROL" : + req == PRU_SENSE ? "SENSE" : + req == PRU_RCVOOB ? "RCVOOB" : + req == PRU_SENDOOB ? "SENDOOB" : + req == PRU_SOCKADDR ? "SOCKADDR" : + req == PRU_PEERADDR ? "PEERADDR" : + req == PRU_CONNECT2 ? "CONNECT2" : + req == PRU_FASTTIMO ? "FASTTIMO" : + req == PRU_SLOWTIMO ? "SLOWTIMO" : + req == PRU_PROTORCV ? "PROTORCV" : + req == PRU_PROTOSEND ? "PROTOSEND" : + req == PRU_SEND ? "SEND_EOF" : + req == PRU_SOSETLABEL ? "SOSETLABEL" : + req == PRU_CLOSE ? "CLOSE" : + req == PRU_FLUSH ? "FLUSE" : "unknown" ; Index: head/cddl/lib/libdtrace/udp.d =================================================================== --- head/cddl/lib/libdtrace/udp.d (revision 329187) +++ head/cddl/lib/libdtrace/udp.d (revision 329188) @@ -1,76 +1,76 @@ /* * 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 (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2013 Mark Johnston */ #pragma D depends_on library ip.d #pragma D depends_on module kernel #pragma D depends_on provider udp /* * udpsinfo contains stable UDP details. */ typedef struct udpsinfo { uintptr_t udps_addr; uint16_t udps_lport; /* local port */ uint16_t udps_rport; /* remote port */ string udps_laddr; /* local address, as a string */ string udps_raddr; /* remote address, as a string */ } udpsinfo_t; /* * udpinfo is the UDP header fields. */ typedef struct udpinfo { uint16_t udp_sport; /* source port */ uint16_t udp_dport; /* destination port */ uint16_t udp_length; /* total length */ - uint16_t udp_checksum; /* headers + data checksum */ + uint16_t udp_checksum; /* headers + data checksum */ struct udphdr *udp_hdr; /* raw UDP header */ } udpinfo_t; #pragma D binding "1.6.3" translator translator udpsinfo_t < struct inpcb *p > { udps_addr = (uintptr_t)p; udps_lport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_lport); udps_rport = p == NULL ? 0 : ntohs(p->inp_inc.inc_ie.ie_fport); udps_laddr = p == NULL ? "" : p->inp_vflag == INP_IPV4 ? inet_ntoa(&p->inp_inc.inc_ie.ie_dependladdr.ie46_local.ia46_addr4.s_addr) : inet_ntoa6(&p->inp_inc.inc_ie.ie_dependladdr.ie6_local); udps_raddr = p == NULL ? "" : p->inp_vflag == INP_IPV4 ? inet_ntoa(&p->inp_inc.inc_ie.ie_dependfaddr.ie46_foreign.ia46_addr4.s_addr) : inet_ntoa6(&p->inp_inc.inc_ie.ie_dependfaddr.ie6_foreign); }; #pragma D binding "1.6.3" translator translator udpinfo_t < struct udphdr *p > { udp_sport = p == NULL ? 0 : ntohs(p->uh_sport); udp_dport = p == NULL ? 0 : ntohs(p->uh_dport); udp_length = p == NULL ? 0 : ntohs(p->uh_ulen); udp_checksum = p == NULL ? 0 : ntohs(p->uh_sum); udp_hdr = p; };