Symbol: filemon
sys/dev/filemon/filemon.c
101
if (filemon != NULL)
sys/dev/filemon/filemon.c
102
refcount_acquire(&filemon->refcnt);
sys/dev/filemon/filemon.c
103
return (filemon);
sys/dev/filemon/filemon.c
110
filemon_release(struct filemon *filemon)
sys/dev/filemon/filemon.c
113
if (refcount_release(&filemon->refcnt) == 0)
sys/dev/filemon/filemon.c
120
sx_assert(&filemon->lock, SA_UNLOCKED);
sys/dev/filemon/filemon.c
122
if (filemon->cred != NULL)
sys/dev/filemon/filemon.c
123
crfree(filemon->cred);
sys/dev/filemon/filemon.c
124
sx_destroy(&filemon->lock);
sys/dev/filemon/filemon.c
125
free(filemon, M_FILEMON);
sys/dev/filemon/filemon.c
132
static struct filemon *
sys/dev/filemon/filemon.c
135
struct filemon *filemon;
sys/dev/filemon/filemon.c
140
filemon = filemon_acquire(p->p_filemon);
sys/dev/filemon/filemon.c
143
if (filemon == NULL)
sys/dev/filemon/filemon.c
149
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
150
return (filemon);
sys/dev/filemon/filemon.c
157
struct filemon *filemon;
sys/dev/filemon/filemon.c
163
filemon = p->p_filemon;
sys/dev/filemon/filemon.c
165
--filemon->proccnt;
sys/dev/filemon/filemon.c
172
KASSERT(filemon->refcnt > 1, ("%s: proc %p dropping filemon %p "
sys/dev/filemon/filemon.c
173
"with last reference", __func__, p, filemon));
sys/dev/filemon/filemon.c
174
filemon_release(filemon);
sys/dev/filemon/filemon.c
179
filemon_drop(struct filemon *filemon)
sys/dev/filemon/filemon.c
182
sx_xunlock(&filemon->lock);
sys/dev/filemon/filemon.c
183
filemon_release(filemon);
sys/dev/filemon/filemon.c
189
filemon_write_header(struct filemon *filemon)
sys/dev/filemon/filemon.c
196
len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr),
sys/dev/filemon/filemon.c
200
if (len < sizeof(filemon->msgbufr))
sys/dev/filemon/filemon.c
201
filemon_output(filemon, filemon->msgbufr, len);
sys/dev/filemon/filemon.c
208
filemon_untrack_processes(struct filemon *filemon)
sys/dev/filemon/filemon.c
212
sx_assert(&filemon->lock, SA_XLOCKED);
sys/dev/filemon/filemon.c
215
if (filemon->proccnt == 0)
sys/dev/filemon/filemon.c
231
if (p->p_filemon == filemon)
sys/dev/filemon/filemon.c
241
KASSERT(filemon->refcnt > 0, ("%s: filemon %p should have "
sys/dev/filemon/filemon.c
242
"references still.", __func__, filemon));
sys/dev/filemon/filemon.c
243
KASSERT(filemon->proccnt == 0, ("%s: filemon %p should not have "
sys/dev/filemon/filemon.c
244
"attached procs still.", __func__, filemon));
sys/dev/filemon/filemon.c
251
filemon_close_log(struct filemon *filemon)
sys/dev/filemon/filemon.c
257
sx_assert(&filemon->lock, SA_XLOCKED);
sys/dev/filemon/filemon.c
258
if (filemon->fp == NULL)
sys/dev/filemon/filemon.c
263
len = snprintf(filemon->msgbufr,
sys/dev/filemon/filemon.c
264
sizeof(filemon->msgbufr),
sys/dev/filemon/filemon.c
268
if (len < sizeof(filemon->msgbufr))
sys/dev/filemon/filemon.c
269
filemon_output(filemon, filemon->msgbufr, len);
sys/dev/filemon/filemon.c
270
fp = filemon->fp;
sys/dev/filemon/filemon.c
271
filemon->fp = NULL;
sys/dev/filemon/filemon.c
273
sx_xunlock(&filemon->lock);
sys/dev/filemon/filemon.c
275
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
285
struct filemon *filemon = data;
sys/dev/filemon/filemon.c
287
if (filemon == NULL)
sys/dev/filemon/filemon.c
290
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
294
filemon_untrack_processes(filemon);
sys/dev/filemon/filemon.c
295
filemon_close_log(filemon);
sys/dev/filemon/filemon.c
296
filemon_drop(filemon);
sys/dev/filemon/filemon.c
301
filemon_attach_proc(struct filemon *filemon, struct proc *p)
sys/dev/filemon/filemon.c
303
struct filemon *filemon2;
sys/dev/filemon/filemon.c
305
sx_assert(&filemon->lock, SA_XLOCKED);
sys/dev/filemon/filemon.c
309
__func__, filemon, p));
sys/dev/filemon/filemon.c
312
__func__, filemon, p));
sys/dev/filemon/filemon.c
314
if (p->p_filemon == filemon)
sys/dev/filemon/filemon.c
331
sx_xunlock(&filemon->lock);
sys/dev/filemon/filemon.c
338
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
349
p->p_filemon = filemon_acquire(filemon);
sys/dev/filemon/filemon.c
350
++filemon->proccnt;
sys/dev/filemon/filemon.c
359
struct filemon *filemon;
sys/dev/filemon/filemon.c
364
if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0)
sys/dev/filemon/filemon.c
367
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
372
if (filemon->fp != NULL) {
sys/dev/filemon/filemon.c
388
filemon->fp = fp;
sys/dev/filemon/filemon.c
390
filemon_write_header(filemon);
sys/dev/filemon/filemon.c
397
filemon_untrack_processes(filemon);
sys/dev/filemon/filemon.c
402
KASSERT(p->p_filemon != filemon,
sys/dev/filemon/filemon.c
404
__func__, p, filemon));
sys/dev/filemon/filemon.c
405
error = filemon_attach_proc(filemon, p);
sys/dev/filemon/filemon.c
415
sx_xunlock(&filemon->lock);
sys/dev/filemon/filemon.c
424
struct filemon *filemon;
sys/dev/filemon/filemon.c
426
filemon = malloc(sizeof(*filemon), M_FILEMON,
sys/dev/filemon/filemon.c
428
sx_init(&filemon->lock, "filemon");
sys/dev/filemon/filemon.c
429
refcount_init(&filemon->refcnt, 1);
sys/dev/filemon/filemon.c
430
filemon->cred = crhold(td->td_ucred);
sys/dev/filemon/filemon.c
432
error = devfs_set_cdevpriv(filemon, filemon_dtr);
sys/dev/filemon/filemon.c
434
filemon_release(filemon);
sys/dev/filemon/filemon.c
444
struct filemon *filemon;
sys/dev/filemon/filemon.c
447
if ((error = devfs_get_cdevpriv((void **) &filemon)) != 0)
sys/dev/filemon/filemon.c
450
sx_xlock(&filemon->lock);
sys/dev/filemon/filemon.c
451
filemon_close_log(filemon);
sys/dev/filemon/filemon.c
452
error = filemon->error;
sys/dev/filemon/filemon.c
453
sx_xunlock(&filemon->lock);
sys/dev/filemon/filemon.c
518
DEV_MODULE(filemon, filemon_modevent, NULL);
sys/dev/filemon/filemon.c
519
MODULE_VERSION(filemon, 1);
sys/dev/filemon/filemon.c
95
static void filemon_output(struct filemon *filemon, char *msg, size_t len);
sys/dev/filemon/filemon.c
97
static __inline struct filemon *
sys/dev/filemon/filemon.c
98
filemon_acquire(struct filemon *filemon)
sys/dev/filemon/filemon_wrapper.c
100
sizeof(filemon->fname1), NULL)) != 0) {
sys/dev/filemon/filemon_wrapper.c
101
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
105
filemon_output_event(filemon, "C %d %s\n",
sys/dev/filemon/filemon_wrapper.c
106
curproc->p_pid, filemon->fname1);
sys/dev/filemon/filemon_wrapper.c
108
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
119
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
121
if ((filemon = filemon_proc_get(p)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
122
filemon_output_event(filemon, "E %d %s\n",
sys/dev/filemon/filemon_wrapper.c
129
priv_check_cred(filemon->cred, PRIV_DEBUG_DIFFCRED) != 0) {
sys/dev/filemon/filemon_wrapper.c
135
KASSERT(p->p_filemon == filemon,
sys/dev/filemon/filemon_wrapper.c
137
" filemon %p", __func__, p, filemon));
sys/dev/filemon/filemon_wrapper.c
143
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
153
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
157
if ((filemon = filemon_proc_get(curproc)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
162
if ((error = copyinstr(upath, filemon->fname1,
sys/dev/filemon/filemon_wrapper.c
163
sizeof(filemon->fname1), NULL)) != 0) {
sys/dev/filemon/filemon_wrapper.c
164
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
168
if (filemon->fname1[0] != '/' && fd != AT_FDCWD) {
sys/dev/filemon/filemon_wrapper.c
177
filemon_output_event(filemon, "A %d %s\n",
sys/dev/filemon/filemon_wrapper.c
178
curproc->p_pid, filemon->fname1);
sys/dev/filemon/filemon_wrapper.c
195
filemon_output_event(filemon, "R %d %s%s%s\n",
sys/dev/filemon/filemon_wrapper.c
197
atpath[0] != '\0' ? "/" : "", filemon->fname1);
sys/dev/filemon/filemon_wrapper.c
200
filemon_output_event(filemon, "%c %d %s%s%s\n",
sys/dev/filemon/filemon_wrapper.c
203
atpath[0] != '\0' ? "/" : "", filemon->fname1);
sys/dev/filemon/filemon_wrapper.c
205
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
238
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
241
if ((filemon = filemon_proc_get(curproc)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
242
if (((error = copyinstr(uap->from, filemon->fname1,
sys/dev/filemon/filemon_wrapper.c
243
sizeof(filemon->fname1), NULL)) != 0) ||
sys/dev/filemon/filemon_wrapper.c
244
((error = copyinstr(uap->to, filemon->fname2,
sys/dev/filemon/filemon_wrapper.c
245
sizeof(filemon->fname2), NULL)) != 0)) {
sys/dev/filemon/filemon_wrapper.c
246
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
250
filemon_output_event(filemon, "M %d '%s' '%s'\n",
sys/dev/filemon/filemon_wrapper.c
251
curproc->p_pid, filemon->fname1, filemon->fname2);
sys/dev/filemon/filemon_wrapper.c
253
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
264
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
267
if ((filemon = filemon_proc_get(curproc)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
268
if (((error = copyinstr(upath1, filemon->fname1,
sys/dev/filemon/filemon_wrapper.c
269
sizeof(filemon->fname1), NULL)) != 0) ||
sys/dev/filemon/filemon_wrapper.c
270
((error = copyinstr(upath2, filemon->fname2,
sys/dev/filemon/filemon_wrapper.c
271
sizeof(filemon->fname2), NULL)) != 0)) {
sys/dev/filemon/filemon_wrapper.c
272
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
276
filemon_output_event(filemon, "L %d '%s' '%s'\n",
sys/dev/filemon/filemon_wrapper.c
277
curproc->p_pid, filemon->fname1, filemon->fname2);
sys/dev/filemon/filemon_wrapper.c
279
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
319
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
321
if ((filemon = filemon_proc_get(p)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
322
filemon_output_event(filemon, "X %d %d %d\n",
sys/dev/filemon/filemon_wrapper.c
330
KASSERT(p->p_filemon == NULL || p->p_filemon == filemon,
sys/dev/filemon/filemon_wrapper.c
332
"filemon %p or NULL", __func__, p, filemon));
sys/dev/filemon/filemon_wrapper.c
333
if (p->p_filemon == filemon)
sys/dev/filemon/filemon_wrapper.c
336
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
344
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
347
if ((filemon = filemon_proc_get(curproc)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
348
if ((error = copyinstr(uap->path, filemon->fname1,
sys/dev/filemon/filemon_wrapper.c
349
sizeof(filemon->fname1), NULL)) != 0) {
sys/dev/filemon/filemon_wrapper.c
350
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
354
filemon_output_event(filemon, "D %d %s\n",
sys/dev/filemon/filemon_wrapper.c
355
curproc->p_pid, filemon->fname1);
sys/dev/filemon/filemon_wrapper.c
357
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
368
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
370
if ((filemon = filemon_proc_get(p1)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
371
filemon_output_event(filemon, "F %d %d\n",
sys/dev/filemon/filemon_wrapper.c
381
if (p1->p_filemon == filemon) {
sys/dev/filemon/filemon_wrapper.c
388
p2->p_filemon = filemon_acquire(filemon);
sys/dev/filemon/filemon_wrapper.c
389
++filemon->proccnt;
sys/dev/filemon/filemon_wrapper.c
394
filemon_drop(filemon);
sys/dev/filemon/filemon_wrapper.c
41
static void filemon_output_event(struct filemon *filemon, const char *fmt, ...)
sys/dev/filemon/filemon_wrapper.c
49
filemon_output(struct filemon *filemon, char *msg, size_t len)
sys/dev/filemon/filemon_wrapper.c
55
if (filemon->fp == NULL)
sys/dev/filemon/filemon_wrapper.c
68
if (filemon->fp->f_type == DTYPE_VNODE)
sys/dev/filemon/filemon_wrapper.c
71
error = fo_write(filemon->fp, &auio, filemon->cred, 0, curthread);
sys/dev/filemon/filemon_wrapper.c
72
if (error != 0 && filemon->error == 0)
sys/dev/filemon/filemon_wrapper.c
73
filemon->error = error;
sys/dev/filemon/filemon_wrapper.c
77
filemon_output_event(struct filemon *filemon, const char *fmt, ...)
sys/dev/filemon/filemon_wrapper.c
83
len = vsnprintf(filemon->msgbufr, sizeof(filemon->msgbufr), fmt, ap);
sys/dev/filemon/filemon_wrapper.c
86
if (len >= sizeof(filemon->msgbufr))
sys/dev/filemon/filemon_wrapper.c
87
len = sizeof(filemon->msgbufr) - 1;
sys/dev/filemon/filemon_wrapper.c
88
filemon_output(filemon, filemon->msgbufr, len);
sys/dev/filemon/filemon_wrapper.c
95
struct filemon *filemon;
sys/dev/filemon/filemon_wrapper.c
98
if ((filemon = filemon_proc_get(curproc)) != NULL) {
sys/dev/filemon/filemon_wrapper.c
99
if ((error = copyinstr(uap->path, filemon->fname1,
sys/sys/proc.h
177
struct filemon;
sys/sys/proc.h
724
struct filemon *p_filemon; /* (c) filemon-specific data. */