summaryrefslogtreecommitdiffstats
path: root/usr.bin/pkill/pkill.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Use uid_from_user(3) and gid_from_group(3) in utilities thatmillert2018-09-161-7/+7
| | | | do repeated lookups. OK tb@
* - mark delim variable as const. it is a literal string;gsoares2016-10-101-20/+17
| | | | | | | | | | | - no need to declare main() prototype; - mark all functions as static; - add __dead marker to usage(), since it doesn't return; - zap extern *optarg/optind in main(), It is already done in unistd.h; - return from main instead of exit(3) that enables stack protector; - fix err() eval in pledge()s error path. OK millert@
* fix a regression spotted by chris@. the -f and -I arguments fetch processderaadt2015-10-111-5/+10
| | | | | | | arguments using kvm_getargs, after the pledge() has been made. someone brave should refactor this, hoisting the argument fetching to between kvm_getprocs() and pledge() - storing the argument data as neccessary. the current situation is also a race -- it fetches the data twice.
* pkill has to get all the getopt, getpwuid, libkvm stuff out of the wayderaadt2015-10-101-1/+6
| | | | | | first. it can pledge to "stdio" (pgrep case) or "stdio proc" (pkill case) before parsing and matching the expression. ok doug
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-161-3/+3
| | | | | | | | | possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
* calloc, from peter malonetedu2014-05-071-3/+2
|
* simpler prototype repairsderaadt2013-11-121-1/+3
|
* Stop merging the per-thread and per-process flags when reportingguenther2013-09-221-2/+2
| | | | | | | | them via sysctl(KERN_PROC). In struct kinfo_proc the per-process flags move to p_psflags, leaving the per-thread flags in p_flags. Flag descriptions in ps(1) updated to be less obtuse. discussed with matthew@ some time ago; ok jca@, manpage bits ok jmc@
* -I to confirm pkills. ok manytedu2013-06-031-27/+62
|
* properly handle the case where a process has disappeared in between grep'inghalex2012-12-121-12/+22
| | | | | | and printing it discussed with and ok millert@
* Missing "-q" in usage().ajacoutot2012-08-211-3/+3
| | | | ok espie@
* add -q "silent" option similar to grepespie2012-08-211-4/+10
| | | | okay ajacoutot@, guenther@
* make pkill -l print the proper processes also when the invert (-v)halex2012-07-101-7/+4
| | | | | | flag is passed ok lum@
* Remove a check made superfluous by the KERN_PROC_SHOW_THREADS flag.guenther2012-04-211-3/+1
| | | | | | This lets new binaries work (at least w/o the -H option) with old kernels. ok pirofti@ deraadt@
* Add per thread accounting, mainly for usage & friends.pirofti2012-04-121-1/+3
| | | | | | | | | | | | | | This expands the already bloated FILL_KPROC macro to take an extra parameter that indicates if the callee is a thread or a process. The userland bits are adjusted accordingly and ps(1) and top(1) now display per thread usage times when -H is used. Also pkill(1) had to be adjusted so that duplicates don't pop up. libkvm does basically the same thing as the kernel bits. Okay guenther@.
* Teach pgrep/pkill to only match processes, not threads. ok guenther@sthen2012-03-131-4/+7
|
* Remove unused variable. Added in 1.20 by me.lum2012-03-011-6/+2
|
* exit usage() with STATUS_BADUSAGE rather than STATUS_ERROR, per the man page;jmc2012-02-161-2/+2
| | | | | fix proposed by lum actually happened in netbsd -r1.16, some 6 years ago; ok lum
* avoid usage() warping onto the next line;jmc2012-02-151-3/+3
|
* restrict pkill/pgrep to the routing domain specified by -T; ok henning@, mpf@markus2012-02-091-5/+27
|
* Allow pkill to use the -l option. This displays which processes have beenlum2012-01-171-4/+8
| | | | | | | | signalled using the "Long" format, like pgrep. Original diff from FreeBSD, modified somewhat on tech@, with feedback from nicm@ Man page input from jmc@
* Switch back from KERN_PROC2/kinfo_proc2 to KERN_PROC/kinfo_proc nowguenther2011-04-101-12/+12
| | | | | | that we've got name we want for the API we want "ZAP!" deraadt@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-271-5/+1
| | | | | | | unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
* First pass at removing clauses 3 and 4 from NetBSD licenses.ray2008-06-261-9/+2
| | | | | | | | | Not sure what's more surprising: how long it took for NetBSD to catch up to the rest of the BSDs (including UCB), or the amount of code that NetBSD has claimed for itself without attributing to the actual authors. OK deraadt@
* Add add -o flag to pkill/pgrep like on Solaris and Linux.millert2008-02-071-11/+24
| | | | OK jmc@ henning@ oga@ mikeb@
* Use S_IS* macros insted of masking with S_IF* flags. The latter mayotto2006-09-191-3/+3
| | | | | have multiple bits set, which lead to surprising results. Spotted by Paul Stoeber, more to come. ok millert@ pedro@ jaredy@ djm@
* sort options and sync usage();jmc2005-07-161-4/+4
|
* Don't print an empty line when no match is found in pgrep mode.otto2005-05-201-3/+3
| | | | ok millert@ robert@
* handle snprintf return value overflow case; ok ottoderaadt2005-04-111-3/+5
|
* revert r1.9; this one needs more discussionrobert2005-03-271-10/+6
|
* add a -i option to ignore case distinctions in the process match;robert2005-03-271-6/+10
| | | | From: NetBSD; ok millert@
* Report non-existing user or groupname correctly. From David Brownleeotto2005-03-021-6/+4
| | | | <abs@netbsd>. ok millert@
* Fix -d option; it should print a newline at EOL, not the specified delimeter.millert2005-02-111-10/+14
| | | | Problem found and OK by robert@
* handle snprintf -1; otto okderaadt2004-12-291-3/+7
|
* Don't print a warning if kill(2) returns ESRCH since the process may havemillert2004-07-151-3/+3
| | | | | | died on its own in the time between when the process list was consulted and when we do the actual kill. This fixes an annoyance for privsep processes (and others) where when you kill one the others die by themselves.
* Skip SYSTEM and ourown proccess on every loop.mpech2004-07-151-7/+4
| | | | millert@, otto@
* When given multiple processes to kill, keep going if we are unable to killmillert2004-06-241-14/+20
| | | | | one (previously it would error out and not kill the remaining ones). OK deraadt@
* knfderaadt2004-03-121-6/+6
|
* Convert back to using kvm_getproc2() and friends now that libkvmmillert2004-01-071-54/+47
| | | | supports it.
* pkill/pgrep from NetBSD with changes to use kvm_getprocs(). Selectingmillert2004-01-061-0/+548
on session ID does not current work but that will change once the kernel supports the KERN_PROC2 sysctl and pkill/pgrep is modified to use kvm_getproc2(). OK deraadt@