-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfileinfo_t.d
executable file
·111 lines (95 loc) · 2.92 KB
/
fileinfo_t.d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/sbin/dtrace -s
/* Copied from http://forums.freebsd.org/showthread.php?t=32649 */
#pragma D option quiet
#pragma D option switchrate=10hz
#pragma D option dynvarsize=16m
#pragma D option bufsize=8m
syscall:freebsd:pread:entry
{
this->fp = curthread->td_proc->p_fd->fd_ofiles[arg0];
this->vp = this->fp != 0 ? this->fp->f_vnode : 0;
this->ts = vtimestamp;
@c = count();
}
syscall:freebsd:pread:entry
/this->vp/
{
this->ncp = &(this->vp->v_cache_dst) != NULL ?
this->vp->v_cache_dst.tqh_first : 0;
this->fi_name = this->ncp ? (this->ncp->nc_name != 0 ?
stringof(this->ncp->nc_name) : "<unknown>") : "<unknown>";
this->mount = this->vp->v_mount; /* ptr to vfs we are in */
this->fi_fs = this->mount != 0 ? stringof(this->mount->mnt_stat.f_fstypename)
: "<unknown>"; /* filesystem */
this->fi_mount = this->mount != 0 ? stringof(this->mount->mnt_stat.f_mntonname)
: "<unknown>";
}
syscall:freebsd:pread:entry
/* A short cut */
/this->vp == 0 || this->fi_fs == "devfs" || this->fi_fs == 0 ||
this->fi_fs == "<unknown>" || this->fi_name == "<unknown>"/
{
this->ncp = 0;
}
syscall:freebsd:pread:entry
/this->ncp/
{
this->dvp = this->ncp->nc_dvp != NULL ?
(&(this->ncp->nc_dvp->v_cache_dst) != NULL ?
this->ncp->nc_dvp->v_cache_dst.tqh_first : 0) : 0;
self->name[1] = this->dvp != 0 ? (this->dvp->nc_name != 0 ?
stringof(this->dvp->nc_name) : "<unknown>") : "<unknown>";
}
syscall:freebsd:pread:entry
/self->name[1] == "<unknown>" || this->fi_fs == "devfs" ||
this->fi_fs == 0 || this->fi_fs == "<unknown>" || self->name[1] == "/"
|| self->name[1] == 0/
{
this->dvp = 0;
}
syscall:freebsd:pread:entry
/this->dvp/
{
this->dvp = this->dvp->nc_dvp != NULL ? (&(this->dvp->nc_dvp->v_cache_dst) != NULL
? this->dvp->nc_dvp->v_cache_dst.tqh_first : 0) : 0;
self->name[2] = this->dvp != 0 ? (this->dvp->nc_name != 0 ?
stringof(this->dvp->nc_name) : "\0") : "\0";
}
syscall:freebsd:pread:entry
/this->dvp/
{
this->dvp = this->dvp->nc_dvp != NULL ? (&(this->dvp->nc_dvp->v_cache_dst) != NULL
? this->dvp->nc_dvp->v_cache_dst.tqh_first : 0) : 0;
self->name[3] = this->dvp != 0 ? (this->dvp->nc_name != 0 ?
stringof(this->dvp->nc_name) : "\0") : "\0";
}
syscall:freebsd:pread:entry
/this->fi_mount/
{
printf("%s/", this->fi_mount);
}
syscall:freebsd:pread:entry
/self->name[3]/
{
printf("%s/", self->name[3]);
}
syscall:freebsd:pread:entry
/self->name[2]/
{
printf("%s/", self->name[2]);
}
syscall:freebsd:pread:entry
/self->name[1]/
{
printf("%s/%s\n", self->name[1], this->fi_name);
}
syscall:freebsd:pread:entry
{
self->name[1] = 0;
self->name[2] = 0;
self->name[3] = 0;
}
tick-10s
{
exit(0);
}