xref: /xnu-10063.121.3/bsd/dev/dtrace/scripts/socket.d (revision 2c2f96dc2b9a4408a43d3150ae9c105355ca3daa)
1*2c2f96dcSApple OSS Distributions /*
2*2c2f96dcSApple OSS Distributions  * Copyright (c) 2013 Apple Computer, Inc.  All Rights Reserved.
3*2c2f96dcSApple OSS Distributions  *
4*2c2f96dcSApple OSS Distributions  * @APPLE_LICENSE_HEADER_START@
5*2c2f96dcSApple OSS Distributions  *
6*2c2f96dcSApple OSS Distributions  * This file contains Original Code and/or Modifications of Original Code
7*2c2f96dcSApple OSS Distributions  * as defined in and that are subject to the Apple Public Source License
8*2c2f96dcSApple OSS Distributions  * Version 2.0 (the 'License'). You may not use this file except in
9*2c2f96dcSApple OSS Distributions  * compliance with the License. Please obtain a copy of the License at
10*2c2f96dcSApple OSS Distributions  * http://www.opensource.apple.com/apsl/ and read it before using this
11*2c2f96dcSApple OSS Distributions  * file.
12*2c2f96dcSApple OSS Distributions  *
13*2c2f96dcSApple OSS Distributions  * The Original Code and all software distributed under the License are
14*2c2f96dcSApple OSS Distributions  * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15*2c2f96dcSApple OSS Distributions  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16*2c2f96dcSApple OSS Distributions  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17*2c2f96dcSApple OSS Distributions  * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18*2c2f96dcSApple OSS Distributions  * Please see the License for the specific language governing rights and
19*2c2f96dcSApple OSS Distributions  * limitations under the License.
20*2c2f96dcSApple OSS Distributions  *
21*2c2f96dcSApple OSS Distributions  * @APPLE_LICENSE_HEADER_END@
22*2c2f96dcSApple OSS Distributions  */
23*2c2f96dcSApple OSS Distributions 
24*2c2f96dcSApple OSS Distributions #pragma D depends_on library darwin.d
25*2c2f96dcSApple OSS Distributions #pragma D depends_on module mach_kernel
26*2c2f96dcSApple OSS Distributions 
27*2c2f96dcSApple OSS Distributions typedef struct socketbuf {
28*2c2f96dcSApple OSS Distributions 	uint32_t	cc;
29*2c2f96dcSApple OSS Distributions 	uint32_t	hiwat;
30*2c2f96dcSApple OSS Distributions 	uint32_t	lowat;
31*2c2f96dcSApple OSS Distributions 	uint32_t	mbcnt;
32*2c2f96dcSApple OSS Distributions 	uint32_t	mbmax;
33*2c2f96dcSApple OSS Distributions 	uint32_t	flags;
34*2c2f96dcSApple OSS Distributions 	struct sockbuf	*sockbuf;
35*2c2f96dcSApple OSS Distributions } socketbuf_t;
36*2c2f96dcSApple OSS Distributions 
37*2c2f96dcSApple OSS Distributions translator socketbuf_t < struct sockbuf *T > {
38*2c2f96dcSApple OSS Distributions 	cc	= T->sb_cc;
39*2c2f96dcSApple OSS Distributions 	hiwat	= T->sb_hiwat;
40*2c2f96dcSApple OSS Distributions 	lowat	= T->sb_lowat;
41*2c2f96dcSApple OSS Distributions 	mbcnt	= T->sb_mbcnt;
42*2c2f96dcSApple OSS Distributions 	mbmax	= T->sb_mbmax;
43*2c2f96dcSApple OSS Distributions 	flags	= T->sb_flags;
44*2c2f96dcSApple OSS Distributions 	sockbuf = T;
45*2c2f96dcSApple OSS Distributions };
46*2c2f96dcSApple OSS Distributions 
47*2c2f96dcSApple OSS Distributions typedef struct socketinfo {
48*2c2f96dcSApple OSS Distributions 	int		zone;
49*2c2f96dcSApple OSS Distributions 	short		type;
50*2c2f96dcSApple OSS Distributions 	uint32_t	options;
51*2c2f96dcSApple OSS Distributions 	short		linger;
52*2c2f96dcSApple OSS Distributions 	short		state;
53*2c2f96dcSApple OSS Distributions 	short		qlen;
54*2c2f96dcSApple OSS Distributions 	short		incqlen;
55*2c2f96dcSApple OSS Distributions 	short		qlimit;
56*2c2f96dcSApple OSS Distributions 	short		error;
57*2c2f96dcSApple OSS Distributions 	uint32_t	flags;
58*2c2f96dcSApple OSS Distributions 	int		traffic_class;
59*2c2f96dcSApple OSS Distributions 	struct socket	*socket;
60*2c2f96dcSApple OSS Distributions } socketinfo_t;
61*2c2f96dcSApple OSS Distributions 
62*2c2f96dcSApple OSS Distributions translator socketinfo_t < struct socket *T > {
63*2c2f96dcSApple OSS Distributions 	zone		= T->so_zone;
64*2c2f96dcSApple OSS Distributions 	type		= T->so_type;
65*2c2f96dcSApple OSS Distributions 	options		= T->so_options;
66*2c2f96dcSApple OSS Distributions 	linger		= T->so_linger;
67*2c2f96dcSApple OSS Distributions 	state		= T->so_state;
68*2c2f96dcSApple OSS Distributions 	qlen		= T->so_qlen;
69*2c2f96dcSApple OSS Distributions 	incqlen		= T->so_incqlen;
70*2c2f96dcSApple OSS Distributions 	qlimit		= T->so_qlimit;
71*2c2f96dcSApple OSS Distributions 	error		= T->so_error;
72*2c2f96dcSApple OSS Distributions 	flags		= T->so_flags;
73*2c2f96dcSApple OSS Distributions 	traffic_class	= T->so_traffic_class;
74*2c2f96dcSApple OSS Distributions 	socket		= T;
75*2c2f96dcSApple OSS Distributions };
76*2c2f96dcSApple OSS Distributions 
77*2c2f96dcSApple OSS Distributions 
78