2 * Copyright (c) 2011, David E. O'Brien.
3 * Copyright (c) 2009-2011, Juniper Networks, Inc.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY JUNIPER NETWORKS AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL JUNIPER NETWORKS OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 #include <sys/cdefs.h>
29 __FBSDID("$FreeBSD$");
33 #include "opt_compat.h"
35 #if __FreeBSD_version > 800032
36 #define FILEMON_HAS_LINKAT
39 #if __FreeBSD_version < 900044 /* r225617 (2011-09-16) failed to bump
40 __FreeBSD_version. This really should
41 be based on "900045". "900044" is r225469
42 (2011-09-10) so this code is broken for
43 9-CURRENT September 10th-16th. */
44 #define sys_chdir chdir
45 #define sys_execve execve
49 #define sys_rename rename
51 #define sys_symlink symlink
52 #define sys_unlink unlink
53 #define sys_vfork vfork
54 #define sys_sys_exit sys_exit
55 #ifdef FILEMON_HAS_LINKAT
56 #define sys_linkat linkat
58 #endif /* __FreeBSD_version */
61 filemon_output(struct filemon *filemon, char *msg, size_t len)
66 if (filemon->fp == NULL)
74 auio.uio_segflg = UIO_SYSSPACE;
75 auio.uio_rw = UIO_WRITE;
76 auio.uio_td = curthread;
77 auio.uio_offset = (off_t) -1;
81 fo_write(filemon->fp, &auio, curthread->td_ucred, 0, curthread);
84 static struct filemon *
85 filemon_pid_check(struct proc *p)
87 struct filemon *filemon;
89 sx_slock(&proctree_lock);
90 while (p != initproc) {
91 TAILQ_FOREACH(filemon, &filemons_inuse, link) {
92 if (p->p_pid == filemon->pid) {
93 sx_sunlock(&proctree_lock);
97 p = proc_realparent(p);
99 sx_sunlock(&proctree_lock);
104 filemon_comment(struct filemon *filemon)
109 /* Load timestamp before locking. Less accurate but less contention. */
112 /* Grab a read lock on the filemon inuse list. */
115 /* Lock the found filemon structure. */
116 filemon_filemon_lock(filemon);
118 len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr),
119 "# filemon version %d\n# Target pid %d\n# Start %ju.%06ju\nV %d\n",
120 FILEMON_VERSION, curproc->p_pid, (uintmax_t)now.tv_sec,
121 (uintmax_t)now.tv_usec, FILEMON_VERSION);
123 filemon_output(filemon, filemon->msgbufr, len);
125 /* Unlock the found filemon structure. */
126 filemon_filemon_unlock(filemon);
128 /* Release the read lock. */
129 filemon_unlock_read();
133 filemon_wrapper_chdir(struct thread *td, struct chdir_args *uap)
138 struct filemon *filemon;
140 if ((ret = sys_chdir(td, uap)) == 0) {
141 /* Grab a read lock on the filemon inuse list. */
144 if ((filemon = filemon_pid_check(curproc)) != NULL) {
145 /* Lock the found filemon structure. */
146 filemon_filemon_lock(filemon);
148 copyinstr(uap->path, filemon->fname1,
149 sizeof(filemon->fname1), &done);
151 len = snprintf(filemon->msgbufr,
152 sizeof(filemon->msgbufr), "C %d %s\n",
153 curproc->p_pid, filemon->fname1);
155 filemon_output(filemon, filemon->msgbufr, len);
157 /* Unlock the found filemon structure. */
158 filemon_filemon_unlock(filemon);
161 /* Release the read lock. */
162 filemon_unlock_read();
169 filemon_wrapper_execve(struct thread *td, struct execve_args *uap)
171 char fname[MAXPATHLEN];
175 struct filemon *filemon;
177 copyinstr(uap->fname, fname, sizeof(fname), &done);
179 if ((ret = sys_execve(td, uap)) == 0) {
180 /* Grab a read lock on the filemon inuse list. */
183 if ((filemon = filemon_pid_check(curproc)) != NULL) {
184 /* Lock the found filemon structure. */
185 filemon_filemon_lock(filemon);
187 len = snprintf(filemon->msgbufr,
188 sizeof(filemon->msgbufr), "E %d %s\n",
189 curproc->p_pid, fname);
191 filemon_output(filemon, filemon->msgbufr, len);
193 /* Unlock the found filemon structure. */
194 filemon_filemon_unlock(filemon);
197 /* Release the read lock. */
198 filemon_unlock_read();
204 #if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
206 filemon_wrapper_freebsd32_execve(struct thread *td,
207 struct freebsd32_execve_args *uap)
209 char fname[MAXPATHLEN];
213 struct filemon *filemon;
215 copyinstr(uap->fname, fname, sizeof(fname), &done);
217 if ((ret = freebsd32_execve(td, uap)) == 0) {
218 /* Grab a read lock on the filemon inuse list. */
221 if ((filemon = filemon_pid_check(curproc)) != NULL) {
222 /* Lock the found filemon structure. */
223 filemon_filemon_lock(filemon);
225 len = snprintf(filemon->msgbufr,
226 sizeof(filemon->msgbufr), "E %d %s\n",
227 curproc->p_pid, fname);
229 filemon_output(filemon, filemon->msgbufr, len);
231 /* Unlock the found filemon structure. */
232 filemon_filemon_unlock(filemon);
235 /* Release the read lock. */
236 filemon_unlock_read();
244 filemon_wrapper_fork(struct thread *td, struct fork_args *uap)
248 struct filemon *filemon;
250 if ((ret = sys_fork(td, uap)) == 0) {
251 /* Grab a read lock on the filemon inuse list. */
254 if ((filemon = filemon_pid_check(curproc)) != NULL) {
255 /* Lock the found filemon structure. */
256 filemon_filemon_lock(filemon);
258 len = snprintf(filemon->msgbufr,
259 sizeof(filemon->msgbufr), "F %d %ld\n",
260 curproc->p_pid, (long)curthread->td_retval[0]);
262 filemon_output(filemon, filemon->msgbufr, len);
264 /* Unlock the found filemon structure. */
265 filemon_filemon_unlock(filemon);
268 /* Release the read lock. */
269 filemon_unlock_read();
276 filemon_wrapper_open(struct thread *td, struct open_args *uap)
281 struct filemon *filemon;
283 if ((ret = sys_open(td, uap)) == 0) {
284 /* Grab a read lock on the filemon inuse list. */
287 if ((filemon = filemon_pid_check(curproc)) != NULL) {
288 /* Lock the found filemon structure. */
289 filemon_filemon_lock(filemon);
291 copyinstr(uap->path, filemon->fname1,
292 sizeof(filemon->fname1), &done);
294 if (uap->flags & O_RDWR) {
296 * We'll get the W record below, but need
297 * to also output an R to distingish from
300 len = snprintf(filemon->msgbufr,
301 sizeof(filemon->msgbufr), "R %d %s\n",
302 curproc->p_pid, filemon->fname1);
303 filemon_output(filemon, filemon->msgbufr, len);
307 len = snprintf(filemon->msgbufr,
308 sizeof(filemon->msgbufr), "%c %d %s\n",
309 (uap->flags & O_ACCMODE) ? 'W':'R',
310 curproc->p_pid, filemon->fname1);
311 filemon_output(filemon, filemon->msgbufr, len);
313 /* Unlock the found filemon structure. */
314 filemon_filemon_unlock(filemon);
317 /* Release the read lock. */
318 filemon_unlock_read();
325 filemon_wrapper_openat(struct thread *td, struct openat_args *uap)
330 struct filemon *filemon;
332 if ((ret = sys_openat(td, uap)) == 0) {
333 /* Grab a read lock on the filemon inuse list. */
336 if ((filemon = filemon_pid_check(curproc)) != NULL) {
337 /* Lock the found filemon structure. */
338 filemon_filemon_lock(filemon);
340 copyinstr(uap->path, filemon->fname1,
341 sizeof(filemon->fname1), &done);
343 filemon->fname2[0] = '\0';
344 if (filemon->fname1[0] != '/' && uap->fd != AT_FDCWD) {
346 * rats - we cannot do too much about this.
347 * the trace should show a dir we read
348 * recently.. output an A record as a clue
349 * until we can do better.
351 len = snprintf(filemon->msgbufr,
352 sizeof(filemon->msgbufr), "A %d %s\n",
353 curproc->p_pid, filemon->fname1);
354 filemon_output(filemon, filemon->msgbufr, len);
356 if (uap->flag & O_RDWR) {
358 * We'll get the W record below, but need
359 * to also output an R to distingish from
362 len = snprintf(filemon->msgbufr,
363 sizeof(filemon->msgbufr), "R %d %s%s\n",
364 curproc->p_pid, filemon->fname2, filemon->fname1);
365 filemon_output(filemon, filemon->msgbufr, len);
369 len = snprintf(filemon->msgbufr,
370 sizeof(filemon->msgbufr), "%c %d %s%s\n",
371 (uap->flag & O_ACCMODE) ? 'W':'R',
372 curproc->p_pid, filemon->fname2, filemon->fname1);
373 filemon_output(filemon, filemon->msgbufr, len);
375 /* Unlock the found filemon structure. */
376 filemon_filemon_unlock(filemon);
379 /* Release the read lock. */
380 filemon_unlock_read();
387 filemon_wrapper_rename(struct thread *td, struct rename_args *uap)
392 struct filemon *filemon;
394 if ((ret = sys_rename(td, uap)) == 0) {
395 /* Grab a read lock on the filemon inuse list. */
398 if ((filemon = filemon_pid_check(curproc)) != NULL) {
399 /* Lock the found filemon structure. */
400 filemon_filemon_lock(filemon);
402 copyinstr(uap->from, filemon->fname1,
403 sizeof(filemon->fname1), &done);
404 copyinstr(uap->to, filemon->fname2,
405 sizeof(filemon->fname2), &done);
407 len = snprintf(filemon->msgbufr,
408 sizeof(filemon->msgbufr), "M %d '%s' '%s'\n",
409 curproc->p_pid, filemon->fname1, filemon->fname2);
411 filemon_output(filemon, filemon->msgbufr, len);
413 /* Unlock the found filemon structure. */
414 filemon_filemon_unlock(filemon);
417 /* Release the read lock. */
418 filemon_unlock_read();
425 filemon_wrapper_link(struct thread *td, struct link_args *uap)
430 struct filemon *filemon;
432 if ((ret = sys_link(td, uap)) == 0) {
433 /* Grab a read lock on the filemon inuse list. */
436 if ((filemon = filemon_pid_check(curproc)) != NULL) {
437 /* Lock the found filemon structure. */
438 filemon_filemon_lock(filemon);
440 copyinstr(uap->path, filemon->fname1,
441 sizeof(filemon->fname1), &done);
442 copyinstr(uap->link, filemon->fname2,
443 sizeof(filemon->fname2), &done);
445 len = snprintf(filemon->msgbufr,
446 sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
447 curproc->p_pid, filemon->fname1, filemon->fname2);
449 filemon_output(filemon, filemon->msgbufr, len);
451 /* Unlock the found filemon structure. */
452 filemon_filemon_unlock(filemon);
455 /* Release the read lock. */
456 filemon_unlock_read();
463 filemon_wrapper_symlink(struct thread *td, struct symlink_args *uap)
468 struct filemon *filemon;
470 if ((ret = sys_symlink(td, uap)) == 0) {
471 /* Grab a read lock on the filemon inuse list. */
474 if ((filemon = filemon_pid_check(curproc)) != NULL) {
475 /* Lock the found filemon structure. */
476 filemon_filemon_lock(filemon);
478 copyinstr(uap->path, filemon->fname1,
479 sizeof(filemon->fname1), &done);
480 copyinstr(uap->link, filemon->fname2,
481 sizeof(filemon->fname2), &done);
483 len = snprintf(filemon->msgbufr,
484 sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
485 curproc->p_pid, filemon->fname1, filemon->fname2);
487 filemon_output(filemon, filemon->msgbufr, len);
489 /* Unlock the found filemon structure. */
490 filemon_filemon_unlock(filemon);
493 /* Release the read lock. */
494 filemon_unlock_read();
500 #ifdef FILEMON_HAS_LINKAT
502 filemon_wrapper_linkat(struct thread *td, struct linkat_args *uap)
507 struct filemon *filemon;
509 if ((ret = sys_linkat(td, uap)) == 0) {
510 /* Grab a read lock on the filemon inuse list. */
513 if ((filemon = filemon_pid_check(curproc)) != NULL) {
514 /* Lock the found filemon structure. */
515 filemon_filemon_lock(filemon);
517 copyinstr(uap->path1, filemon->fname1,
518 sizeof(filemon->fname1), &done);
519 copyinstr(uap->path2, filemon->fname2,
520 sizeof(filemon->fname2), &done);
522 len = snprintf(filemon->msgbufr,
523 sizeof(filemon->msgbufr), "L %d '%s' '%s'\n",
524 curproc->p_pid, filemon->fname1, filemon->fname2);
526 filemon_output(filemon, filemon->msgbufr, len);
528 /* Unlock the found filemon structure. */
529 filemon_filemon_unlock(filemon);
532 /* Release the read lock. */
533 filemon_unlock_read();
541 filemon_wrapper_stat(struct thread *td, struct stat_args *uap)
546 struct filemon *filemon;
548 if ((ret = sys_stat(td, uap)) == 0) {
549 /* Grab a read lock on the filemon inuse list. */
552 if ((filemon = filemon_pid_check(curproc)) != NULL) {
553 /* Lock the found filemon structure. */
554 filemon_filemon_lock(filemon);
556 copyinstr(uap->path, filemon->fname1,
557 sizeof(filemon->fname1), &done);
559 len = snprintf(filemon->msgbufr,
560 sizeof(filemon->msgbufr), "S %d %s\n",
561 curproc->p_pid, filemon->fname1);
563 filemon_output(filemon, filemon->msgbufr, len);
565 /* Unlock the found filemon structure. */
566 filemon_filemon_unlock(filemon);
569 /* Release the read lock. */
570 filemon_unlock_read();
576 #if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
578 filemon_wrapper_freebsd32_stat(struct thread *td,
579 struct freebsd32_stat_args *uap)
584 struct filemon *filemon;
586 if ((ret = freebsd32_stat(td, uap)) == 0) {
587 /* Grab a read lock on the filemon inuse list. */
590 if ((filemon = filemon_pid_check(curproc)) != NULL) {
591 /* Lock the found filemon structure. */
592 filemon_filemon_lock(filemon);
594 copyinstr(uap->path, filemon->fname1,
595 sizeof(filemon->fname1), &done);
597 len = snprintf(filemon->msgbufr,
598 sizeof(filemon->msgbufr), "S %d %s\n",
599 curproc->p_pid, filemon->fname1);
601 filemon_output(filemon, filemon->msgbufr, len);
603 /* Unlock the found filemon structure. */
604 filemon_filemon_unlock(filemon);
607 /* Release the read lock. */
608 filemon_unlock_read();
616 filemon_wrapper_sys_exit(struct thread *td, struct sys_exit_args *uap)
619 struct filemon *filemon;
622 /* Get timestamp before locking. */
625 /* Grab a read lock on the filemon inuse list. */
628 if ((filemon = filemon_pid_check(curproc)) != NULL) {
629 /* Lock the found filemon structure. */
630 filemon_filemon_lock(filemon);
632 len = snprintf(filemon->msgbufr, sizeof(filemon->msgbufr),
633 "X %d %d\n", curproc->p_pid, uap->rval);
635 filemon_output(filemon, filemon->msgbufr, len);
637 /* Check if the monitored process is about to exit. */
638 if (filemon->pid == curproc->p_pid) {
639 len = snprintf(filemon->msgbufr,
640 sizeof(filemon->msgbufr),
641 "# Stop %ju.%06ju\n# Bye bye\n",
642 (uintmax_t)now.tv_sec, (uintmax_t)now.tv_usec);
644 filemon_output(filemon, filemon->msgbufr, len);
648 /* Unlock the found filemon structure. */
649 filemon_filemon_unlock(filemon);
652 /* Release the read lock. */
653 filemon_unlock_read();
655 sys_sys_exit(td, uap);
659 filemon_wrapper_unlink(struct thread *td, struct unlink_args *uap)
664 struct filemon *filemon;
666 if ((ret = sys_unlink(td, uap)) == 0) {
667 /* Grab a read lock on the filemon inuse list. */
670 if ((filemon = filemon_pid_check(curproc)) != NULL) {
671 /* Lock the found filemon structure. */
672 filemon_filemon_lock(filemon);
674 copyinstr(uap->path, filemon->fname1,
675 sizeof(filemon->fname1), &done);
677 len = snprintf(filemon->msgbufr,
678 sizeof(filemon->msgbufr), "D %d %s\n",
679 curproc->p_pid, filemon->fname1);
681 filemon_output(filemon, filemon->msgbufr, len);
683 /* Unlock the found filemon structure. */
684 filemon_filemon_unlock(filemon);
687 /* Release the read lock. */
688 filemon_unlock_read();
695 filemon_wrapper_vfork(struct thread *td, struct vfork_args *uap)
699 struct filemon *filemon;
701 if ((ret = sys_vfork(td, uap)) == 0) {
702 /* Grab a read lock on the filemon inuse list. */
705 if ((filemon = filemon_pid_check(curproc)) != NULL) {
706 /* Lock the found filemon structure. */
707 filemon_filemon_lock(filemon);
709 len = snprintf(filemon->msgbufr,
710 sizeof(filemon->msgbufr), "F %d %ld\n",
711 curproc->p_pid, (long)curthread->td_retval[0]);
713 filemon_output(filemon, filemon->msgbufr, len);
715 /* Unlock the found filemon structure. */
716 filemon_filemon_unlock(filemon);
719 /* Release the read lock. */
720 filemon_unlock_read();
727 filemon_wrapper_install(void)
729 #if defined(__LP64__)
730 struct sysent *sv_table = elf64_freebsd_sysvec.sv_table;
732 struct sysent *sv_table = elf32_freebsd_sysvec.sv_table;
735 sv_table[SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir;
736 sv_table[SYS_exit].sy_call = (sy_call_t *) filemon_wrapper_sys_exit;
737 sv_table[SYS_execve].sy_call = (sy_call_t *) filemon_wrapper_execve;
738 sv_table[SYS_fork].sy_call = (sy_call_t *) filemon_wrapper_fork;
739 sv_table[SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open;
740 sv_table[SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat;
741 sv_table[SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename;
742 sv_table[SYS_stat].sy_call = (sy_call_t *) filemon_wrapper_stat;
743 sv_table[SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink;
744 sv_table[SYS_vfork].sy_call = (sy_call_t *) filemon_wrapper_vfork;
745 sv_table[SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link;
746 sv_table[SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink;
747 #ifdef FILEMON_HAS_LINKAT
748 sv_table[SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat;
751 #if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
752 sv_table = ia32_freebsd_sysvec.sv_table;
754 sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *) filemon_wrapper_chdir;
755 sv_table[FREEBSD32_SYS_exit].sy_call = (sy_call_t *) filemon_wrapper_sys_exit;
756 sv_table[FREEBSD32_SYS_freebsd32_execve].sy_call = (sy_call_t *) filemon_wrapper_freebsd32_execve;
757 sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *) filemon_wrapper_fork;
758 sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *) filemon_wrapper_open;
759 sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *) filemon_wrapper_openat;
760 sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *) filemon_wrapper_rename;
761 sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *) filemon_wrapper_freebsd32_stat;
762 sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *) filemon_wrapper_unlink;
763 sv_table[FREEBSD32_SYS_vfork].sy_call = (sy_call_t *) filemon_wrapper_vfork;
764 sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *) filemon_wrapper_link;
765 sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *) filemon_wrapper_symlink;
766 #ifdef FILEMON_HAS_LINKAT
767 sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *) filemon_wrapper_linkat;
769 #endif /* COMPAT_ARCH32 */
773 filemon_wrapper_deinstall(void)
775 #if defined(__LP64__)
776 struct sysent *sv_table = elf64_freebsd_sysvec.sv_table;
778 struct sysent *sv_table = elf32_freebsd_sysvec.sv_table;
781 sv_table[SYS_chdir].sy_call = (sy_call_t *)sys_chdir;
782 sv_table[SYS_exit].sy_call = (sy_call_t *)sys_sys_exit;
783 sv_table[SYS_execve].sy_call = (sy_call_t *)sys_execve;
784 sv_table[SYS_fork].sy_call = (sy_call_t *)sys_fork;
785 sv_table[SYS_open].sy_call = (sy_call_t *)sys_open;
786 sv_table[SYS_openat].sy_call = (sy_call_t *)sys_openat;
787 sv_table[SYS_rename].sy_call = (sy_call_t *)sys_rename;
788 sv_table[SYS_stat].sy_call = (sy_call_t *)sys_stat;
789 sv_table[SYS_unlink].sy_call = (sy_call_t *)sys_unlink;
790 sv_table[SYS_vfork].sy_call = (sy_call_t *)sys_vfork;
791 sv_table[SYS_link].sy_call = (sy_call_t *)sys_link;
792 sv_table[SYS_symlink].sy_call = (sy_call_t *)sys_symlink;
793 #ifdef FILEMON_HAS_LINKAT
794 sv_table[SYS_linkat].sy_call = (sy_call_t *)sys_linkat;
797 #if defined(COMPAT_IA32) || defined(COMPAT_FREEBSD32) || defined(COMPAT_ARCH32)
798 sv_table = ia32_freebsd_sysvec.sv_table;
800 sv_table[FREEBSD32_SYS_chdir].sy_call = (sy_call_t *)sys_chdir;
801 sv_table[FREEBSD32_SYS_exit].sy_call = (sy_call_t *)sys_sys_exit;
802 sv_table[FREEBSD32_SYS_freebsd32_execve].sy_call = (sy_call_t *)freebsd32_execve;
803 sv_table[FREEBSD32_SYS_fork].sy_call = (sy_call_t *)sys_fork;
804 sv_table[FREEBSD32_SYS_open].sy_call = (sy_call_t *)sys_open;
805 sv_table[FREEBSD32_SYS_openat].sy_call = (sy_call_t *)sys_openat;
806 sv_table[FREEBSD32_SYS_rename].sy_call = (sy_call_t *)sys_rename;
807 sv_table[FREEBSD32_SYS_freebsd32_stat].sy_call = (sy_call_t *)freebsd32_stat;
808 sv_table[FREEBSD32_SYS_unlink].sy_call = (sy_call_t *)sys_unlink;
809 sv_table[FREEBSD32_SYS_vfork].sy_call = (sy_call_t *)sys_vfork;
810 sv_table[FREEBSD32_SYS_link].sy_call = (sy_call_t *)sys_link;
811 sv_table[FREEBSD32_SYS_symlink].sy_call = (sy_call_t *)sys_symlink;
812 #ifdef FILEMON_HAS_LINKAT
813 sv_table[FREEBSD32_SYS_linkat].sy_call = (sy_call_t *)sys_linkat;
815 #endif /* COMPAT_ARCH32 */