PERFORCE change 174284 for review
Robert Watson
rwatson at FreeBSD.org
Wed Feb 3 22:30:00 UTC 2010
http://p4web.freebsd.org/chv.cgi?CH=174284
Change 174284 by rwatson at rwatson_vimage_client on 2010/02/03 22:29:44
Micro-benchmarks for chroot() and setuid().
Affected files ...
.. //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#14 edit
Differences ...
==== //depot/projects/trustedbsd/capabilities/src/tools/tools/syscall_timing/syscall_timing.c#14 (text+ko) ====
@@ -565,6 +565,38 @@
benchmark_stop();
}
+void
+test_chroot(int num)
+{
+ int i;
+
+ if (chroot("/") < 0)
+ err(-1, "test_chroot: chroot");
+ benchmark_start();
+ for (i = 0; i < num; i++) {
+ if (chroot("/") < 0)
+ err(-1, "test_chroot: chroot");
+ }
+ benchmark_stop();
+}
+
+void
+test_setuid(int num)
+{
+ uid_t uid;
+ int i;
+
+ uid = getuid();
+ if (setuid(uid) < 0)
+ err(-1, "test_setuid: setuid");
+ benchmark_start();
+ for (i = 0; i < num; i++) {
+ if (setuid(uid) < 0)
+ err(-1, "test_setuid: setuid");
+ }
+ benchmark_stop();
+}
+
/*
* A bit like sandbox, in that a process is forked, IPC ping-pong is done,
* but with none of the sandboxing goo.
@@ -773,6 +805,8 @@
{ "fork_exec", test_fork_exec },
{ "vfork_exec", test_vfork_exec },
{ "pdfork_exec", test_pdfork_exec },
+ { "chroot", test_chroot },
+ { "setuid", test_setuid },
{ "pingpong", test_pingpong },
{ "sandbox", test_sandbox },
};
More information about the p4-projects
mailing list