| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | .\" $NetBSD: ktrace.2,v 1.19 2016/03/19 17:05:36 dholland Exp $ | | 1 | .\" $NetBSD: ktrace.2,v 1.20 2016/03/19 17:15:13 dholland Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 1993 | | 3 | .\" Copyright (c) 1993 |
4 | .\" The Regents of the University of California. All rights reserved. | | 4 | .\" The Regents of the University of California. All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" Redistribution and use in source and binary forms, with or without | | 6 | .\" Redistribution and use in source and binary forms, with or without |
7 | .\" modification, are permitted provided that the following conditions | | 7 | .\" modification, are permitted provided that the following conditions |
8 | .\" are met: | | 8 | .\" are met: |
9 | .\" 1. Redistributions of source code must retain the above copyright | | 9 | .\" 1. Redistributions of source code must retain the above copyright |
10 | .\" notice, this list of conditions and the following disclaimer. | | 10 | .\" notice, this list of conditions and the following disclaimer. |
11 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 11 | .\" 2. Redistributions in binary form must reproduce the above copyright |
12 | .\" notice, this list of conditions and the following disclaimer in the | | 12 | .\" notice, this list of conditions and the following disclaimer in the |
13 | .\" documentation and/or other materials provided with the distribution. | | 13 | .\" documentation and/or other materials provided with the distribution. |
14 | .\" 3. Neither the name of the University nor the names of its contributors | | 14 | .\" 3. Neither the name of the University nor the names of its contributors |
| @@ -94,56 +94,60 @@ generate much output). | | | @@ -94,56 +94,60 @@ generate much output). |
94 | .It KTRFAC_PSIG Trace posted signals. | | 94 | .It KTRFAC_PSIG Trace posted signals. |
95 | .It KTRFAC_CSW Trace context switch points. | | 95 | .It KTRFAC_CSW Trace context switch points. |
96 | .It KTRFAC_EMUL Trace emulation changes. | | 96 | .It KTRFAC_EMUL Trace emulation changes. |
97 | .It KTRFAC_INHERIT Inherit tracing to future children. | | 97 | .It KTRFAC_INHERIT Inherit tracing to future children. |
98 | .El | | 98 | .El |
99 | .Pp | | 99 | .Pp |
100 | Each tracing event outputs a record composed of a generic header | | 100 | Each tracing event outputs a record composed of a generic header |
101 | followed by a trace point specific structure. | | 101 | followed by a trace point specific structure. |
102 | The generic header is: | | 102 | The generic header is: |
103 | .Bd -literal | | 103 | .Bd -literal |
104 | struct ktr_header { | | 104 | struct ktr_header { |
105 | int ktr_len; /* length of buf */ | | 105 | int ktr_len; /* length of buf */ |
106 | short ktr_type; /* trace record type */ | | 106 | short ktr_type; /* trace record type */ |
| | | 107 | short ktr_version; /* trace record version */ |
107 | pid_t ktr_pid; /* process id */ | | 108 | pid_t ktr_pid; /* process id */ |
108 | char ktr_comm[MAXCOMLEN+1]; /* command name */ | | 109 | char ktr_comm[MAXCOMLEN+1]; /* command name */ |
109 | struct timeval ktr_time; /* timestamp */ | | 110 | struct timespec ktr_time; /* timestamp */ |
110 | caddr_t ktr_buf; | | 111 | lwpid_t ktr_lid; |
111 | }; | | 112 | }; |
112 | .Ed | | 113 | .Ed |
113 | .Pp | | 114 | .Pp |
114 | The | | 115 | The |
115 | .Nm ktr_len | | 116 | .Nm ktr_len |
116 | field specifies the length of the | | 117 | field specifies the length of the data that follows this header. |
| | | 118 | The |
117 | .Nm ktr_type | | 119 | .Nm ktr_type |
118 | data that follows this header. | | 120 | and |
| | | 121 | .Nm ktr_version |
| | | 122 | fields (whose ordering in the structure depends on byte order) |
| | | 123 | specify the format of this data. |
119 | The | | 124 | The |
120 | .Nm ktr_pid | | 125 | .Nm ktr_pid , |
| | | 126 | .Nm ktr_lid , |
121 | and | | 127 | and |
122 | .Nm ktr_comm | | 128 | .Nm ktr_comm |
123 | fields specify the process and command generating the record. | | 129 | fields specify the process and command generating the record. |
124 | The | | 130 | The |
125 | .Nm ktr_time | | 131 | .Nm ktr_time |
126 | field gives the time (with microsecond resolution) | | 132 | field gives the time (with nanosecond resolution) |
127 | that the record was generated. | | 133 | that the record was generated. |
128 | The | | | |
129 | .Nm ktr_buf | | | |
130 | is an internal kernel pointer and is not useful. | | | |
131 | .Pp | | 134 | .Pp |
132 | The generic header is followed by | | 135 | The generic header is followed by |
133 | .Nm ktr_len | | 136 | .Nm ktr_len |
134 | bytes of a | | 137 | bytes of a |
135 | .Nm ktr_type | | 138 | .Nm ktr_type |
136 | record. | | 139 | record of version |
| | | 140 | .Nm ktr_version . |
137 | The type specific records are defined in the | | 141 | The type specific records are defined in the |
138 | .Pa \*[Lt]sys/ktrace.h\*[Gt] | | 142 | .Pa \*[Lt]sys/ktrace.h\*[Gt] |
139 | include file. | | 143 | include file. |
140 | .Sh RETURN VALUES | | 144 | .Sh RETURN VALUES |
141 | On successful completion a value of 0 is returned. | | 145 | On successful completion a value of 0 is returned. |
142 | Otherwise, a value of \-1 is returned and | | 146 | Otherwise, a value of \-1 is returned and |
143 | .Va errno | | 147 | .Va errno |
144 | is set to show the error. | | 148 | is set to show the error. |
145 | .Sh ERRORS | | 149 | .Sh ERRORS |
146 | .Fn ktrace | | 150 | .Fn ktrace |
147 | will fail if: | | 151 | will fail if: |
148 | .Bl -tag -width ENAMETOOLONGAA | | 152 | .Bl -tag -width ENAMETOOLONGAA |
149 | .It Bq Er ENOTDIR | | 153 | .It Bq Er ENOTDIR |