From owner-freebsd-bugs Wed Dec 15 7:50:10 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 2A331154EB for ; Wed, 15 Dec 1999 07:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id HAA72247; Wed, 15 Dec 1999 07:50:01 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from gallions-reach.inpharmatica.co.uk (gallions-reach.inpharmatica.co.uk [193.115.214.5]) by hub.freebsd.org (Postfix) with ESMTP id 8805D1539C for ; Wed, 15 Dec 1999 07:48:20 -0800 (PST) (envelope-from m.seaman@inpharmatica.co.uk) Received: from kings-cross.inpharmatica.co.uk (euston.inpharmatica.co.uk [193.115.214.6]) by gallions-reach.inpharmatica.co.uk (8.8.8/8.8.8) with ESMTP id PAA12442 for ; Wed, 15 Dec 1999 15:48:19 GMT (envelope-from m.seaman@inpharmatica.co.uk) Received: from b0.farm.inpharmatica.co.uk (root@b0.farm.inpharmatica.co.uk [192.168.121.110]) by kings-cross.inpharmatica.co.uk (8.9.3/8.9.3) with ESMTP id PAA22965 for ; Wed, 15 Dec 1999 15:48:19 GMT Received: (from matthew@localhost) by b0.farm.inpharmatica.co.uk (8.9.3/8.9.3) id PAA64079; Wed, 15 Dec 1999 15:48:18 GMT (envelope-from matthew@mailhost.inpharmatica.co.uk) Message-Id: <199912151548.PAA64079@b0.farm.inpharmatica.co.uk> Date: Wed, 15 Dec 1999 15:48:18 GMT From: m.seaman@inpharmatica.co.uk Reply-To: m.seaman@inpharmatica.co.uk To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: bin/15496: killall(1) limited to 16 character process names by procfs(5) Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 15496 >Category: bin >Synopsis: killall(1) limited to 16 character process names by procfs(5) >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: doc-bug >Submitter-Id: current-users >Arrival-Date: Wed Dec 15 07:50:00 PST 1999 >Closed-Date: >Last-Modified: >Originator: Matthew Seaman >Release: FreeBSD 3.4-RC alpha >Organization: Inpharmatica Ltd >Environment: FreeBSD 3.4-RC b0:/tmp:% uname -a FreeBSD b0.farm.inpharmatica.co.uk 3.4-RC FreeBSD 3.4-RC #0: Tue Dec 14 13:02:41 GMT 1999 root@b0.farm.inpharmatica.co.uk:/usr/src/sys/compile/FARM alpha >Description: killall(1) reads procfs /proc/${pid}/status entries to find the process names the user wants to kill. However, only the first 16 (MAXCOMLEN from /usr/include/sys/param.h) characters of the process name are available. Trying naively to killall(1) a process with a longer name is guarranteed to fail: instead the supplied name should be truncated to the first 16 characters. I'm not convinced that modifying procfs() to fix this somewhat obscure case is really going to be worthwhile. This should certainly be documented though. >How-To-Repeat: b0:/tmp:% cat foo.c #include int main (int argc, char *argv[]) { sleep(600); } b0:/tmp:% cc -o 1234567890123 foo.c b0:/tmp:% cp 1234567890123{,4} b0:/tmp:% cp 1234567890123{,45} b0:/tmp:% cp 1234567890123{,456} b0:/tmp:% cp 1234567890123{,4567} b0:/tmp:% ./12345678901234 & [4] 63828 b0:/tmp:% ./12345678901235 & [5] 63829 b0:/tmp:% ./123456789012345 & [6] 63830 b0:/tmp:% ./1234567890123456 & [7] 63831 b0:/tmp:% ./12345678901234567 & [8] 63832 b0:/tmp:% head /proc/{63826,63828,63830,63831,63832}/status ==> /proc/63826/status <== 1234567890123 63826 63513 63826 63513 5,2 ctty 945270683,3518 0,1030 0,6184 nanslp 1000 1000 1000,1000,1000,0,999,1018,994,993,997 ==> /proc/63828/status <== 12345678901234 63828 63513 63828 63513 5,2 ctty 945270704,936540 0,909 0,6369 nanslp 1000 1000 1000,1000,1000,0,999,1018,994,993,997 ==> /proc/63830/status <== 123456789012345 63830 63513 63830 63513 5,2 ctty 945270715,716412 0,3262 0,4349 nanslp 1000 1000 1000,1000,1000,0,999,1018,994,993,997 ==> /proc/63831/status <== 1234567890123456 63831 63513 63831 63513 5,2 ctty 945270719,857664 0,1879 0,5639 nanslp 1000 1000 1000,1000,1000,0,999,1018,994,993,997 ==> /proc/63832/status <== 1234567890123456 63832 63513 63832 63513 5,2 ctty 945270723,443053 0,2114 0,5287 nanslp 1000 1000 1000,1000,1000,0,999,1018,994,993,997 b0:/tmp:% killall 12345678901234567 No processes matching ``12345678901234567'' >Fix: --- killall.1 Tue Aug 31 10:08:27 1999 +++ /tmp/killall.1 Wed Dec 15 15:16:38 1999 @@ -52,6 +52,10 @@ .Nm that match the name .Ar procname . +Only the first 16 characters of the process name are available from +.Xr procfs 5 +for comparison: process names specified on the command line must be +truncated to this limit in order to match successfully. The super-user is allowed to kill any process. .Pp The options are as follows: >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message