Date: Fri, 6 Sep 2002 10:57:09 +0900 (JST) From: Masayuki FUKUI <fukui@sonic.nm.fujitsu.co.jp> To: FreeBSD-gnats-submit@FreeBSD.org Cc: fukui@sonic.nm.fujitsu.co.jp Subject: bin/42464: [PATCH] killall(1) : Add support for jailed processes in the host environment Message-ID: <200209060157.g861v9Me001791@tpx24.pssys.flab.fujitsu.co.jp>
next in thread | raw e-mail | index | archive | help
>Number: 42464 >Category: bin >Synopsis: [PATCH] killall(1) : Add support for jailed processes in the host environment >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Sep 05 19:00:12 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Masayuki FUKUI >Release: FreeBSD 5.0-CURRENT i386 >Organization: >Environment: System: FreeBSD tpx24 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Fri Aug 16 09:41:46 JST 2002 root@tpx24:/usr/src/sys/i386/compile/tpx24 i386 >Description: killall(1) cannot select jailed processes in the host environment. I made patch that adds support for jailed processes to killall(1). This patch adds the following two options. -h : Exclude jailed processes. -j : Include jailed processes only. (The mistake is found in man page of killall(1). It is written, -h & -? for usage. However, those options are not used.) >How-To-Repeat: >Fix: I'm sorry, because I am not good at English, man page cannot be corrected. --- patch begins here --- --- usr.bin/killall.c.orig Sun Jun 30 14:25:01 2002 +++ usr.bin/killall.c Thu Sep 5 00:47:16 2002 @@ -52,7 +52,7 @@ usage(void) { - fprintf(stderr, "usage: %s [-l] [-v] [-m] [-sig] [-u user] [-t tty] [-c cmd] [cmd]...\n", prog); + fprintf(stderr, "usage: %s [-l] [-v] [-m] [-h] [-j] [-sig] [-u user] [-t tty] [-c cmd] [cmd]...\n", prog); fprintf(stderr, "At least one option or argument to specify processes must be given.\n"); exit(1); } @@ -115,6 +115,8 @@ int dflag = 0; int mflag = 0; int zflag = 0; + int hflag = 0; + int jflag = 0; uid_t uid = 0; dev_t tdev = 0; char thiscmd[MAXCOMLEN + 1]; @@ -182,6 +184,12 @@ case 'z': zflag++; break; + case 'h': + hflag++; + break; + case 'j': + jflag++; + break; default: if (isalpha(**av)) { if (strncasecmp(*av, "sig", 3) == 0) @@ -292,6 +300,10 @@ for (i = 0; i < nprocs; i++) { if ((procs[i].ki_stat & SZOMB) == SZOMB && !zflag) + continue; + if (hflag && (procs[i].ki_flag & P_JAILED) == P_JAILED) + continue; + if (jflag && (procs[i].ki_flag & P_JAILED) != P_JAILED) continue; thispid = procs[i].ki_pid; strncpy(thiscmd, procs[i].ki_comm, MAXCOMLEN); --- patch ends here --- >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209060157.g861v9Me001791>