Lines Matching defs:filemon

42 static void filemon_output_event(struct filemon *filemon, const char *fmt, ...)
50 filemon_output(struct filemon *filemon, char *msg, size_t len)
56 if (filemon->fp == NULL)
69 if (filemon->fp->f_type == DTYPE_VNODE)
72 error = fo_write(filemon->fp, &auio, filemon->cred, 0, curthread);
73 if (error != 0 && filemon->error == 0)
74 filemon->error = error;
78 filemon_output_event(struct filemon *filemon, const char *fmt, ...)
84 len = vsnprintf(filemon->msgbufr, sizeof(filemon->msgbufr), fmt, ap);
87 if (len >= sizeof(filemon->msgbufr))
88 len = sizeof(filemon->msgbufr) - 1;
89 filemon_output(filemon, filemon->msgbufr, len);
96 struct filemon *filemon;
99 if ((filemon = filemon_proc_get(curproc)) != NULL) {
100 if ((error = copyinstr(uap->path, filemon->fname1,
101 sizeof(filemon->fname1), NULL)) != 0) {
102 filemon->error = error;
106 filemon_output_event(filemon, "C %d %s\n",
107 curproc->p_pid, filemon->fname1);
109 filemon_drop(filemon);
120 struct filemon *filemon;
122 if ((filemon = filemon_proc_get(p)) != NULL) {
123 filemon_output_event(filemon, "E %d %s\n",
130 priv_check_cred(filemon->cred, PRIV_DEBUG_DIFFCRED) != 0) {
136 KASSERT(p->p_filemon == filemon,
138 " filemon %p", __func__, p, filemon));
144 filemon_drop(filemon);
154 struct filemon *filemon;
158 if ((filemon = filemon_proc_get(curproc)) != NULL) {
163 if ((error = copyinstr(upath, filemon->fname1,
164 sizeof(filemon->fname1), NULL)) != 0) {
165 filemon->error = error;
169 if (filemon->fname1[0] != '/' && fd != AT_FDCWD) {
178 filemon_output_event(filemon, "A %d %s\n",
179 curproc->p_pid, filemon->fname1);
196 filemon_output_event(filemon, "R %d %s%s%s\n",
198 atpath[0] != '\0' ? "/" : "", filemon->fname1);
201 filemon_output_event(filemon, "%c %d %s%s%s\n",
204 atpath[0] != '\0' ? "/" : "", filemon->fname1);
206 filemon_drop(filemon);
239 struct filemon *filemon;
242 if ((filemon = filemon_proc_get(curproc)) != NULL) {
243 if (((error = copyinstr(uap->from, filemon->fname1,
244 sizeof(filemon->fname1), NULL)) != 0) ||
245 ((error = copyinstr(uap->to, filemon->fname2,
246 sizeof(filemon->fname2), NULL)) != 0)) {
247 filemon->error = error;
251 filemon_output_event(filemon, "M %d '%s' '%s'\n",
252 curproc->p_pid, filemon->fname1, filemon->fname2);
254 filemon_drop(filemon);
265 struct filemon *filemon;
268 if ((filemon = filemon_proc_get(curproc)) != NULL) {
269 if (((error = copyinstr(upath1, filemon->fname1,
270 sizeof(filemon->fname1), NULL)) != 0) ||
271 ((error = copyinstr(upath2, filemon->fname2,
272 sizeof(filemon->fname2), NULL)) != 0)) {
273 filemon->error = error;
277 filemon_output_event(filemon, "L %d '%s' '%s'\n",
278 curproc->p_pid, filemon->fname1, filemon->fname2);
280 filemon_drop(filemon);
320 struct filemon *filemon;
322 if ((filemon = filemon_proc_get(p)) != NULL) {
323 filemon_output_event(filemon, "X %d %d %d\n",
329 * filemon lock.
331 KASSERT(p->p_filemon == NULL || p->p_filemon == filemon,
333 "filemon %p or NULL", __func__, p, filemon));
334 if (p->p_filemon == filemon)
337 filemon_drop(filemon);
345 struct filemon *filemon;
348 if ((filemon = filemon_proc_get(curproc)) != NULL) {
349 if ((error = copyinstr(uap->path, filemon->fname1,
350 sizeof(filemon->fname1), NULL)) != 0) {
351 filemon->error = error;
355 filemon_output_event(filemon, "D %d %s\n",
356 curproc->p_pid, filemon->fname1);
358 filemon_drop(filemon);
369 struct filemon *filemon;
371 if ((filemon = filemon_proc_get(p1)) != NULL) {
372 filemon_output_event(filemon, "F %d %d\n",
379 * filemon lock. Only inherit if the parent is still traced by
380 * this filemon.
382 if (p1->p_filemon == filemon) {
386 * filemon.
389 p2->p_filemon = filemon_acquire(filemon);
390 ++filemon->proccnt;
395 filemon_drop(filemon);