003 File Manager
Current Path:
/usr/src/contrib/capsicum-test
usr
/
src
/
contrib
/
capsicum-test
/
📁
..
📄
.gitignore
(235 B)
📄
CONTRIBUTING.md
(880 B)
📄
GNUmakefile
(2.22 KB)
📄
LICENSE
(1.4 KB)
📄
README.md
(2.7 KB)
📄
capability-fd-pair.cc
(5.52 KB)
📄
capability-fd.cc
(42.15 KB)
📄
capmode.cc
(19.24 KB)
📄
capsicum-freebsd.h
(1.97 KB)
📄
capsicum-linux.h
(1.17 KB)
📄
capsicum-rights.h
(2.86 KB)
📄
capsicum-test-main.cc
(4.23 KB)
📄
capsicum-test.cc
(2.63 KB)
📄
capsicum-test.h
(9.9 KB)
📄
capsicum.h
(4.49 KB)
📄
fcntl.cc
(14.48 KB)
📄
fexecve.cc
(6.08 KB)
📄
ioctl.cc
(6.93 KB)
📄
linux.cc
(48.75 KB)
📄
makefile
(1.59 KB)
📄
mini-me.c
(1.04 KB)
📄
mqueue.cc
(3.24 KB)
📄
openat.cc
(14.52 KB)
📄
overhead.cc
(1.28 KB)
📄
procdesc.cc
(26.95 KB)
📄
rename.cc
(1.59 KB)
📄
sctp.cc
(7.14 KB)
📄
select.cc
(4 KB)
📄
showrights
(4.81 KB)
📄
smoketest.c
(4.86 KB)
📄
socket.cc
(10.56 KB)
📄
syscalls.h
(8.36 KB)
📄
sysctl.cc
(403 B)
📄
waittest.c
(1 KB)
Editing: overhead.cc
#include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <time.h> #include <unistd.h> #include "capsicum.h" #include "syscalls.h" #include "capsicum-test.h" #ifdef HAVE_SYSCALL double RepeatSyscall(int count, int nr, long arg1, long arg2, long arg3) { const clock_t t0 = clock(); // or gettimeofday or whatever for (int ii = 0; ii < count; ii++) { syscall(nr, arg1, arg2, arg3); } const clock_t t1 = clock(); return (t1 - t0) / (double)CLOCKS_PER_SEC; } typedef int (*EntryFn)(void); double CompareSyscall(EntryFn entry_fn, int count, int nr, long arg1, long arg2, long arg3) { double bare = RepeatSyscall(count, nr, arg1, arg2, arg3); EXPECT_OK(entry_fn()); double capmode = RepeatSyscall(count, nr, arg1, arg2, arg3); if (verbose) fprintf(stderr, "%d iterations bare=%fs capmode=%fs ratio=%.2f%%\n", count, bare, capmode, 100.0*capmode/bare); if (bare==0.0) { if (capmode==0.0) return 1.0; return 999.0; } return capmode/bare; } FORK_TEST(Overhead, GetTid) { EXPECT_GT(10, CompareSyscall(&cap_enter, 10000, __NR_gettid, 0, 0, 0)); } FORK_TEST(Overhead, Seek) { int fd = open("/etc/passwd", O_RDONLY); EXPECT_GT(50, CompareSyscall(&cap_enter, 10000, __NR_lseek, fd, 0, SEEK_SET)); close(fd); } #endif
Upload File
Create Folder