• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /freebsd-13-stable/sys/dev/filemon/

Lines Matching defs:filemon

44 static void filemon_output_event(struct filemon *filemon, const char *fmt, ...)
52 filemon_output(struct filemon *filemon, char *msg, size_t len)
58 if (filemon->fp == NULL)
71 if (filemon->fp->f_type == DTYPE_VNODE)
74 error = fo_write(filemon->fp, &auio, filemon->cred, 0, curthread);
75 if (error != 0 && filemon->error == 0)
76 filemon->error = error;
80 filemon_output_event(struct filemon *filemon, const char *fmt, ...)
86 len = vsnprintf(filemon->msgbufr, sizeof(filemon->msgbufr), fmt, ap);
89 if (len >= sizeof(filemon->msgbufr))
90 len = sizeof(filemon->msgbufr) - 1;
91 filemon_output(filemon, filemon->msgbufr, len);
98 struct filemon *filemon;
101 if ((filemon = filemon_proc_get(curproc)) != NULL) {
102 if ((error = copyinstr(uap->path, filemon->fname1,
103 sizeof(filemon->fname1), NULL)) != 0) {
104 filemon->error = error;
108 filemon_output_event(filemon, "C %d %s\n",
109 curproc->p_pid, filemon->fname1);
111 filemon_drop(filemon);
122 struct filemon *filemon;
124 if ((filemon = filemon_proc_get(p)) != NULL) {
125 filemon_output_event(filemon, "E %d %s\n",
132 priv_check_cred(filemon->cred, PRIV_DEBUG_DIFFCRED) != 0) {
138 KASSERT(p->p_filemon == filemon,
140 " filemon %p", __func__, p, filemon));
146 filemon_drop(filemon);
156 struct filemon *filemon;
160 if ((filemon = filemon_proc_get(curproc)) != NULL) {
165 if ((error = copyinstr(upath, filemon->fname1,
166 sizeof(filemon->fname1), NULL)) != 0) {
167 filemon->error = error;
171 if (filemon->fname1[0] != '/' && fd != AT_FDCWD) {
180 filemon_output_event(filemon, "A %d %s\n",
181 curproc->p_pid, filemon->fname1);
198 filemon_output_event(filemon, "R %d %s%s%s\n",
200 atpath[0] != '\0' ? "/" : "", filemon->fname1);
203 filemon_output_event(filemon, "%c %d %s%s%s\n",
206 atpath[0] != '\0' ? "/" : "", filemon->fname1);
208 filemon_drop(filemon);
241 struct filemon *filemon;
244 if ((filemon = filemon_proc_get(curproc)) != NULL) {
245 if (((error = copyinstr(uap->from, filemon->fname1,
246 sizeof(filemon->fname1), NULL)) != 0) ||
247 ((error = copyinstr(uap->to, filemon->fname2,
248 sizeof(filemon->fname2), NULL)) != 0)) {
249 filemon->error = error;
253 filemon_output_event(filemon, "M %d '%s' '%s'\n",
254 curproc->p_pid, filemon->fname1, filemon->fname2);
256 filemon_drop(filemon);
267 struct filemon *filemon;
270 if ((filemon = filemon_proc_get(curproc)) != NULL) {
271 if (((error = copyinstr(upath1, filemon->fname1,
272 sizeof(filemon->fname1), NULL)) != 0) ||
273 ((error = copyinstr(upath2, filemon->fname2,
274 sizeof(filemon->fname2), NULL)) != 0)) {
275 filemon->error = error;
279 filemon_output_event(filemon, "L %d '%s' '%s'\n",
280 curproc->p_pid, filemon->fname1, filemon->fname2);
282 filemon_drop(filemon);
322 struct filemon *filemon;
324 if ((filemon = filemon_proc_get(p)) != NULL) {
325 filemon_output_event(filemon, "X %d %d %d\n",
331 * filemon lock.
333 KASSERT(p->p_filemon == NULL || p->p_filemon == filemon,
335 "filemon %p or NULL", __func__, p, filemon));
336 if (p->p_filemon == filemon)
339 filemon_drop(filemon);
347 struct filemon *filemon;
350 if ((filemon = filemon_proc_get(curproc)) != NULL) {
351 if ((error = copyinstr(uap->path, filemon->fname1,
352 sizeof(filemon->fname1), NULL)) != 0) {
353 filemon->error = error;
357 filemon_output_event(filemon, "D %d %s\n",
358 curproc->p_pid, filemon->fname1);
360 filemon_drop(filemon);
371 struct filemon *filemon;
373 if ((filemon = filemon_proc_get(p1)) != NULL) {
374 filemon_output_event(filemon, "F %d %d\n",
381 * filemon lock. Only inherit if the parent is still traced by
382 * this filemon.
384 if (p1->p_filemon == filemon) {
388 * filemon.
391 p2->p_filemon = filemon_acquire(filemon);
392 ++filemon->proccnt;
397 filemon_drop(filemon);