I made an attempt at adding pledge to pstree.
steve
$OpenBSD: patch-pstree_c,v 1.5 2015/05/22 13:45:30 schwarze Exp $
--- pstree.c.orig Wed May 13 05:24:47 2015
+++ pstree.c Wed Apr 20 22:21:07 2016
@@ -77,7 +77,7 @@ extern getargs(struct ProcInfo *, int, char *, int);
* (Net|Open|Free)BSD & Darwin merged by Ralf Meyer <ralf AT
thp.Uni-Duisburg.DE>
*/
# define HAS_PGID
-# define PSCMD "ps -axwwo user,pid,ppid,pgid,command"
+# define PSCMD "ps -kaxwwo user,pid,ppid,pgid,command"
# define PSFORMAT "%s %ld %ld %ld %[^\n]"
# define PSVARS P[i].name, &P[i].pid, &P[i].ppid, &P[i].pgid, P[i].cmd
# define PSVARSN 5
@@ -872,6 +872,11 @@ int main(int argc, char **argv) {
#ifdef ZOMBIES_HAVE_PID_0
FixZombies();
#endif
+
+ if (pledge("stdio getpw ioctl proc", NULL) == -1){
+ fprintf(stderr, "%s: pledge\n", Progname);
+ exit(1);
+ }
if (NProc == 0) {
fprintf(stderr, "%s: No processes read.\n", Progname);