dmake: do not set MAKEFLAGS=k
[unleashed/tickless.git] / usr / src / cmd / vscan / vscand / vscan.d
blob62a88f23a84cd4f13d7d4c76fb5023beec472b30
1 #!/usr/sbin/dtrace -s
2 /*
3 * CDDL HEADER START
5 * The contents of this file are subject to the terms of the
6 * Common Development and Distribution License (the "License").
7 * You may not use this file except in compliance with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #pragma D option flowindent
34 *** vscan kernel pseudo driver ***
38 * vscan_svc.c
40 sdt:vscan::vscan-req-counts
42 printf("%s reql: %d, node: %d, taskq: %d",
43 stringof(arg0),
44 ((vscan_svc_counts_t *)arg1)->vsc_reql,
45 ((vscan_svc_counts_t *)arg1)->vsc_node,
46 ((vscan_svc_counts_t *)arg1)->vsc_tq);
49 sdt:vscan::vscan-svc-state-violation
51 printf("%d %s", arg0,
52 arg0 == 0 ? "UNCONFIG" :
53 arg0 == 1 ? "IDLE" :
54 arg0 == 2 ? "ENABLED" :
55 arg0 == 3 ? "DISABLED" : "UNKNOWN");
58 sdt:vscan::vscan-scan-timeout
60 printf("idx: %d, seqnum: %d - %s",
61 ((vscan_req_t *)arg0)->vsr_idx,
62 ((vscan_req_t *)arg0)->vsr_seqnum,
63 stringof(((vscan_req_t *)arg0)->vsr_vp->v_path));
66 sdt:vscan::vscan-scan-file
68 printf("%s (%s)", stringof(arg0), arg1 ? "async" : "sync");
71 sdt:vscan::vscan-exempt-filesize
73 printf("%s EXEMPT (%s)", stringof(arg0), arg1 ? "DENY" : "ALLOW");
76 sdt:vscan::vscan-type-match
78 printf("ext: %s matched: %s", stringof(arg0), stringof(arg1));
81 sdt:vscan::vscan-exempt-filetype
83 printf("%s EXEMPT", stringof(arg0));
86 sdt:vscan::vscan-getattr
88 printf("%s, m: %d, q: %d, scanstamp: %s",
89 stringof(((vscan_svc_node_t *)arg0)->vsn_req->vsr_vp->v_path),
90 ((vscan_svc_node_t *)arg0)->vsn_modified,
91 ((vscan_svc_node_t *)arg0)->vsn_quarantined,
92 stringof(((vscan_svc_node_t *)arg0)->vsn_scanstamp));
95 sdt:vscan::vscan-setattr
97 /* XAT_AV_QUARANTINED */
98 printf("%s", (arg1 & 0x400) == 0 ? "" :
99 ((vscan_svc_node_t *)arg0)->vsn_quarantined ? "q: 1, " : "q: 0, ");
101 /* XAT_AV_MODIFIED */
102 printf("%s", (arg1 & 0x800) == 0 ? "" :
103 ((vscan_svc_node_t *)arg0)->vsn_modified ? "m: 1, " : "m: 0, ");
105 /* XAT_AV_SCANSTAMP */
106 printf("%s", (arg1 & 0x1000) == 0 ? "" : "scanstamp: ");
107 printf("%s", (arg1 & 0x1000) == 0 ? "" :
108 stringof(((vscan_svc_node_t *)arg0)->vsn_scanstamp));
112 sdt:vscan::vscan-mtime-changed
114 printf("%s",
115 stringof(((vscan_svc_node_t *)arg0)->vsn_req->vsr_vp->v_path));
119 sdt:vscan::vscan-result
121 printf("idx: %d, seqnum: %d, VS_STATUS_%s - VS_ACCESS_%s",
122 arg0, arg1,
123 arg2 == 0 ? "UNDEFINED" :
124 arg2 == 1 ? "NO_SCAN" :
125 arg2 == 2 ? "ERROR" :
126 arg2 == 3 ? "CLEAN" :
127 arg2 == 4 ? "INFECTED" :
128 arg2 == 5 ? "SCANNING" : "XXX unknown",
129 arg3 == 0 ? "UNDEFINED" :
130 arg3 == 1 ? "ALLOW" : "DENY");
133 /* insert request into request list */
134 fbt:vscan:vscan_svc_reql_insert:entry
136 printf("%s", stringof(args[0]->v_path));
138 fbt:vscan:vscan_svc_reql_insert:return
139 /args[1] != 0/
141 printf("seqnum %d %s", args[1]->vsr_seqnum,
142 stringof(args[1]->vsr_vp->v_path));
144 fbt:vscan:vscan_svc_reql_insert:return
145 /args[1] == 0/
147 printf("request list full");
149 /* insert request into scan table */
150 fbt:vscan:vscan_svc_insert_req:entry
152 printf("seqnum: %d - %s",
153 args[0]->vsr_seqnum, stringof(args[0]->vsr_vp->v_path));
155 fbt:vscan:vscan_svc_insert_req:return
157 printf("idx: %d", args[1]);
159 /* remove request from request list and scan table and delete it*/
160 fbt:vscan:vscan_svc_delete_req:entry
162 printf("idx: %d, seqnum: %d - %s",
163 args[0]->vsr_idx, args[0]->vsr_seqnum,
164 stringof(args[0]->vsr_vp->v_path));
167 fbt:vscan:vscan_svc_delete_req:return,
168 fbt:vscan:vscan_svc_reql_handler:entry,
169 fbt:vscan:vscan_svc_reql_handler:return
173 fbt:vscan:vscan_svc_taskq_callback:entry,
174 fbt:vscan:vscan_svc_do_scan:entry
176 printf("idx: %d, seqnum: %d - %s",
177 ((vscan_req_t *)(args[0]))->vsr_idx,
178 ((vscan_req_t *)(args[0]))->vsr_seqnum,
179 stringof(((vscan_req_t *)(args[0]))->vsr_vp->v_path));
181 fbt:vscan:vscan_svc_scan_complete:entry
183 printf("idx: %d, seqnum: %d, state: %s - %s",
184 args[0]->vsr_idx, args[0]->vsr_seqnum,
185 args[0]->vsr_state == 0 ? "INIT" :
186 args[0]->vsr_state == 1 ? "QUEUED" :
187 args[0]->vsr_state == 2 ? "IN_PROGRESS" :
188 args[0]->vsr_state == 3 ? "SCANNING" :
189 args[0]->vsr_state == 4 ? "ASYNC_COMPLETE" :
190 args[0]->vsr_state == 5 ? "COMPLETE" : "UNKNOWN",
191 stringof(args[0]->vsr_vp->v_path));
194 fbt:vscan:vscan_svc_taskq_callback:return,
195 fbt:vscan:vscan_svc_do_scan:return,
196 fbt:vscan:vscan_svc_scan_complete:return
200 sdt:vscan::vscan-abort
202 printf("idx: %d, seqnum: %d - %s",
203 ((vscan_req_t *)(arg0))->vsr_idx,
204 ((vscan_req_t *)(arg0))->vsr_seqnum,
205 stringof(((vscan_req_t *)(arg0))->vsr_vp->v_path));
208 fbt:vscan:vscan_svc_enable:entry,
209 fbt:vscan:vscan_svc_enable:return,
210 fbt:vscan:vscan_svc_disable:entry,
211 fbt:vscan:vscan_svc_disable:return,
212 fbt:vscan:vscan_svc_configure:entry,
213 fbt:vscan:vscan_svc_configure:return
218 * vscan_door.c
220 fbt:vscan:vscan_door_open:entry,
221 fbt:vscan:vscan_door_open:return,
222 fbt:vscan:vscan_door_close:entry,
223 fbt:vscan:vscan_door_close:return
227 fbt:vscan:vscan_door_scan_file:entry
229 printf("idx: %d, seqnum: %d - %s",
230 args[0]->vsr_idx, args[0]->vsr_seqnum, args[0]->vsr_path);
232 fbt:vscan:vscan_door_scan_file:return
234 printf("VS_STATUS_%s",
235 args[1] == 0 ? "UNDEFINED" :
236 args[1] == 1 ? "NO_SCAN" :
237 args[1] == 2 ? "ERROR" :
238 args[1] == 3 ? "CLEAN" :
239 args[1] == 4 ? "INFECTED" :
240 args[1] == 5 ? "SCANNING" : "XXX unknown");
245 * vscan_drv.c
247 sdt:vscan::vscan-drv-state-violation
249 printf("%d %s", arg0,
250 arg0 == 0 ? "UNCONFIG" :
251 arg0 == 1 ? "IDLE" :
252 arg0 == 2 ? "CONNECTED" :
253 arg0 == 3 ? "ENABLED" :
254 arg0 == 4 ? "DELAYED_DISABLE" : "UNKNOWN");
257 sdt:vscan::vscan-minor-node
259 printf("vscan%d %s", arg0, arg1 != 0 ? "created" : "error");
262 /* unprivileged vscan driver access attempt */
263 sdt:vscan::vscan-priv
264 /arg0 != 0/
266 printf("vscan driver access attempt by unprivileged process");
269 /* daemon-driver synchronization */
270 sdt:vscan::vscan-reconnect
274 fbt:vscan:vscan_drv_open:entry
275 / *(int *)args[0] == 0/
277 printf("vscan daemon attach");
280 fbt:vscan:vscan_drv_close:entry
281 / (int)args[0] == 0/
283 printf("vscan daemon detach");
286 fbt:vscan:vscan_drv_ioctl:entry
287 / (int)args[0] == 0/
289 printf("vscan daemon ioctl %d %s", args[1],
290 args[1] == 1 ? "ENABLE" :
291 args[1] == 2 ? "DISABLE" :
292 args[1] == 3 ? "CONFIG" :
293 args[1] == 4 ? "RESULT" :
294 args[1] == 5 ? "MAX FILES" : "unknown");
297 fbt:vscan:vscan_drv_delayed_disable:entry,
298 fbt:vscan:vscan_drv_delayed_disable:return,
299 fbt:vscan:vscan_drv_attach:entry,
300 fbt:vscan:vscan_drv_detach:entry
304 fbt:vscan:vscan_drv_attach:return,
305 fbt:vscan:vscan_drv_detach:return
307 printf("%s", args[1] ? "DDI_FAILURE" : "DDI_SUCCESS");
310 fbt:vscan:vscan_drv_in_use:return
312 printf("%s", args[1] ? "TRUE" : "FALSE");
316 /* file access */
319 fbt:vscan:vscan_drv_open:entry
320 / *(int *)args[0] != 0/
322 printf("%d", *(int *)args[0]);
325 fbt:vscan:vscan_drv_close:entry,
326 fbt:vscan:vscan_drv_read:entry
327 / (int)args[0] != 0/
329 printf("%d", (int)args[0]);
335 *** vscan daemon - vscand ***
338 pid$target::vs_svc_init:entry
340 printf("Max concurrent scan requests from kernel: %d", arg1);
343 pid$target::vs_svc_init:return
348 pid$target::vs_door_scan_req:entry,
349 pid$target::vs_svc_scan_file:entry,
350 pid$target::vs_svc_queue_scan_req:entry,
351 pid$target::vs_svc_async_scan:entry,
352 pid$target::vs_eng_scanstamp_current:entry,
353 pid$target::vs_icap_scan_file:entry
357 pid$target::vs_svc_queue_scan_req:return,
358 pid$target::vs_svc_async_scan:return
362 pid$target::vs_svc_scan_file:return
364 printf("VS_STATUS_%s",
365 arg1 == 0 ? "UNDEFINED" :
366 arg1 == 1 ? "NO_SCAN" :
367 arg1 == 2 ? "ERROR" :
368 arg1 == 3 ? "CLEAN" :
369 arg1 == 4 ? "INFECTED" :
370 arg1 == 5 ? "SCANNING" : "XXX unknown");
373 pid$target::vs_eng_scanstamp_current:return
375 printf("%sCURRENT", arg1 == 0 ? "NOT " : "");
378 pid$target::vs_icap_scan_file:return
380 printf("%d VS_RESULT_%s", (int)arg1,
381 (int)arg1 == 0 ? "UNDEFINED" :
382 (int)arg1 == 1 ? "CLEAN" :
383 (int)arg1 == 2 ? "CLEANED" :
384 (int)arg1 == 3 ? "FORBIDDEN" : "(SE)_ERROR");
387 pid$target::vs_stats_set:entry
389 printf("%s", (arg0 == 1) ? "CLEAN" :
390 (arg0 == 2) ? "CLEANED" :
391 (arg0 == 3) ? "QUARANTINE" : "ERROR");
394 pid$target::vs_stats_set:return
398 /* get engine connection */
399 pid$target::vs_eng_get:entry,
400 pid$target::vs_eng_connect:entry,
401 pid$target::vs_eng_release:entry,
402 pid$target::vs_eng_release:return
405 pid$target::vs_eng_get:return,
406 pid$target::vs_eng_connect:return
408 printf("%s", arg1 == 0 ? "success" : "error");
411 /* engine errors */
412 pid$target::vs_eng_set_error:entry
413 / arg1 == 1 /
415 printf("scan engine error");
418 /* configuration */
419 pid$target::vscand_cfg_init:entry,
420 pid$target::vscand_cfg_fini:entry,
421 pid$target::vscand_cfg_init:return,
422 pid$target::vscand_cfg_fini:return,
423 pid$target::vscand_cfg_handler:entry,
424 pid$target::vscand_cfg_handler:return
428 pid$target::vscand_dtrace_gen:entry
430 printf("maxsize: %s action: %s\n",
431 copyinstr(arg0), (arg1 == 1) ? "allow" : "deny");
432 printf("types: %s\n", copyinstr(arg2));
433 printf("log: %s\n", copyinstr(arg3));
435 pid$target::vscand_dtrace_eng:entry
437 printf("\n%s %s \nhost: %s \nport: %d \nmax connections: %d\n",
438 copyinstr(arg0), (arg1 == 1) ? "enabled" : "disabled",
439 copyinstr(arg2), arg3, arg4);
444 /* shutdown */
445 pid$target::vscand_sig_handler:entry
447 printf("received signal %d", arg0);
449 pid$target::vscand_sig_handler:return,
450 pid$target::vscand_fini:entry,
451 pid$target::vscand_fini:return,
452 pid$target::vscand_kernel_disable:entry,
453 pid$target::vscand_kernel_disable:return,
454 pid$target::vscand_kernel_unbind:entry,
455 pid$target::vscand_kernel_unbind:return,
456 pid$target::vscand_kernel_result:entry,
457 pid$target::vscand_kernel_result:return,
458 pid$target::vs_svc_terminate:entry,
459 pid$target::vs_svc_terminate:return,
460 pid$target::vs_eng_fini:entry,
461 pid$target::vs_eng_fini:return,
462 pid$target::vs_eng_close_connections:entry,
463 pid$target::vs_eng_close_connections:return
467 /* vs_icap.c */
469 /* trace entry and exit (inc status) */
470 pid$target::vs_icap_option_request:entry,
471 pid$target::vs_icap_send_option_req:entry,
472 pid$target::vs_icap_read_option_resp:entry,
473 pid$target::vs_icap_respmod_request:entry,
474 pid$target::vs_icap_may_preview:entry,
475 pid$target::vs_icap_send_preview:entry,
476 pid$target::vs_icap_send_respmod_hdr:entry,
477 pid$target::vs_icap_read_respmod_resp:entry
481 pid$target::vs_icap_option_request:return,
482 pid$target::vs_icap_send_option_req:return,
483 pid$target::vs_icap_read_option_resp:return,
484 pid$target::vs_icap_respmod_request:return,
485 pid$target::vs_icap_send_preview:return,
486 pid$target::vs_icap_send_respmod_hdr:return,
487 pid$target::vs_icap_read_respmod_resp:return
489 printf("%s", (int)arg1 < 0 ? "error" : "success");
492 pid$target::vs_icap_may_preview:return
494 printf("TRANSFER %s", arg1 == 1 ? "PREVIEW" : "COMPLETE");
497 /* trace failures only - these functions return -1 on failure */
498 pid$target::vs_icap_read_resp_code:return,
499 pid$target::vs_icap_read_hdr:return,
500 pid$target::vs_icap_send_termination:return,
501 pid$target::vs_icap_write:return,
502 pid$target::vs_icap_set_scan_result:return,
503 pid$target::vs_icap_read_encap_hdr:return,
504 pid$target::vs_icap_read_encap_data:return,
505 pid$target::vs_icap_read_resp_body:return,
506 pid$target::vs_icap_read_body_chunk:return,
507 pid$target::vs_icap_read:return,
508 pid$target::vs_icap_readline:return,
509 pid$target::vs_icap_send_chunk:return,
510 pid$target::gethostname:return
511 /(int)arg1 == -1/
513 printf("error");
516 /* trace failures only - these functions return 1 on success */
517 pid$target::vs_icap_opt_value:return,
518 pid$target::vs_icap_opt_ext:return,
519 pid$target::vs_icap_resp_infection:return,
520 pid$target::vs_icap_resp_virus_id:return,
521 pid$target::vs_icap_resp_violations:return,
522 pid$target::vs_icap_resp_violation_rec:return,
523 pid$target::vs_icap_resp_istag:return,
524 pid$target::vs_icap_resp_encap:return
525 /arg1 != 1/
527 printf("error");
530 pid$target::write:return,
531 pid$target::read:return,
532 pid$target::open:return,
533 pid$target::calloc:return
534 /arg1 <= 0/
536 printf("error");
539 pid$target::recv:return,