summaryrefslogtreecommitdiffstats
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2013-09-19 18:53:42 +0000
committerjhb <jhb@FreeBSD.org>2013-09-19 18:53:42 +0000
commitd3ef75b6c79e9e6d642efa9c32a96524d7a5a5b7 (patch)
tree56c7a97f082d488a8b917c2d2d52956076373329 /usr.bin/truss
parent8ecfe4666e7be9cea4cf6c3ef929de2e8d286f41 (diff)
downloadFreeBSD-src-d3ef75b6c79e9e6d642efa9c32a96524d7a5a5b7.zip
FreeBSD-src-d3ef75b6c79e9e6d642efa9c32a96524d7a5a5b7.tar.gz
Extend the support for exempting processes from being killed when swap is
exhausted. - Add a new protect(1) command that can be used to set or revoke protection from arbitrary processes. Similar to ktrace it can apply a change to all existing descendants of a process as well as future descendants. - Add a new procctl(2) system call that provides a generic interface for control operations on processes (as opposed to the debugger-specific operations provided by ptrace(2)). procctl(2) uses a combination of idtype_t and an id to identify the set of processes on which to operate similar to wait6(). - Add a PROC_SPROTECT control operation to manage the protection status of a set of processes. MADV_PROTECT still works for backwards compatability. - Add a p_flag2 to struct proc (and a corresponding ki_flag2 to kinfo_proc) the first bit of which is used to track if P_PROTECT should be inherited by new child processes. Reviewed by: kib, jilles (earlier version) Approved by: re (delphij) MFC after: 1 month
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/syscall.h2
-rw-r--r--usr.bin/truss/syscalls.c10
2 files changed, 11 insertions, 1 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h
index ce7d2e9..b0d3461 100644
--- a/usr.bin/truss/syscall.h
+++ b/usr.bin/truss/syscall.h
@@ -40,7 +40,7 @@ enum Argtype { None = 1, Hex, Octal, Int, Name, Ptr, Stat, Ioctl, Quad,
Fd_set, Sigaction, Fcntl, Mprot, Mmapflags, Whence, Readlinkres,
Umtx, Sigset, Sigprocmask, Kevent, Sockdomain, Socktype, Open,
Fcntlflag, Rusage, BinString, Shutdown, Resource, Rlimit, Timeval2,
- Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype };
+ Pathconf, Rforkflags, ExitStatus, Waitoptions, Idtype, Procctl };
#define ARG_MASK 0xff
#define OUT 0x100
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index 5369dec..06c2511 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -41,6 +41,7 @@ static const char rcsid[] =
#include <sys/types.h>
#include <sys/mman.h>
+#include <sys/procctl.h>
#include <sys/ptrace.h>
#include <sys/socket.h>
#include <sys/time.h>
@@ -270,6 +271,8 @@ static struct syscall syscalls[] = {
{ .name = "wait6", .ret_type = 1, .nargs = 6,
.args = { { Idtype, 0 }, { Int, 1 }, { ExitStatus | OUT, 2 },
{ Waitoptions, 3 }, { Rusage | OUT, 4 }, { Ptr, 5 } } },
+ { .name = "procctl", .ret_type = 1, .nargs = 4,
+ .args = { { Idtype, 0 }, { Int, 1 }, { Procctl, 2 }, { Ptr, 3 } } },
{ .name = 0 },
};
@@ -399,6 +402,10 @@ static struct xlat idtype_arg[] = {
X(P_CTID) X(P_CPUID) X(P_PSETID) XEND
};
+static struct xlat procctl_arg[] = {
+ X(PROC_SPROTECT) XEND
+};
+
#undef X
#undef XEND
@@ -1198,6 +1205,9 @@ print_arg(struct syscall_args *sc, unsigned long *args, long retval,
case Idtype:
tmp = strdup(xlookup(idtype_arg, args[sc->offset]));
break;
+ case Procctl:
+ tmp = strdup(xlookup(procctl_arg, args[sc->offset]));
+ break;
default:
errx(1, "Invalid argument type %d\n", sc->type & ARG_MASK);
}
OpenPOWER on IntegriCloud