History log of /freebsd-current/bin/pkill/pkill.c
Revision Date Author Comments
# e043f372 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Automated cleanup of cdefs and other formatting

Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by: Netflix


# 1d386b48 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line .c pattern

Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/


# b61a5730 10-May-2023 Warner Losh <imp@FreeBSD.org>

spdx: The BSD-2-Clause-NetBSD identifier is obsolete, drop -NetBSD

The SPDX folks have obsoleted the BSD-2-Clause-NetBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with: pfg
MFC After: 3 days
Sponsored by: Netflix


# 3610bffd 20-Mar-2023 Kyle Evans <kevans@FreeBSD.org>

pkill: use an ARG_MAX size buffer for argument matching

Right now pkill/pgrep cut off at _POSIX2_LINE_MAX (2048), but argument
strings can be much larger (ARG_MAX is 256K/512K). Stop arbitrarily
cutting the search off at 2K, rather than documenting the limit.

Reviewed by: allanjude (earlier version), des
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38663


# 1de7b4b8 27-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

various: general adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 2-Clause license, however the tool I
was using misidentified many licenses so this was mostly a manual - error
prone - task.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

No functional change intended.


# cf182be5 24-Aug-2017 Lawrence Stewart <lstewart@FreeBSD.org>

Only emit the trailing new line added in r322613 when not operating in quiet
mode.

Reported by: pho
MFC after: 1 week
X-MFC-with: r322210


# 1e781c6f 17-Aug-2017 Lawrence Stewart <lstewart@FreeBSD.org>

The r322210 change to pgrep's PID delimiting behaviour causes pgrep's default
output to not include a trailing new line, which is a potential POLA violation
for existing consumers. Change pgrep to always emit a trailing new line on
completion of its output, regardless of the delimeter in use (which technically
is also a potential POLA violation for existing consumers that rely on the
pre-r322210 buggy behaviour, but a line has to be drawn somewhere).

PR: 221534
Submitted by: kdrakehp zoho com
Reported by: kdrakehp zoho com
MFC after: 1 week
X-MFC-with: r322210


# 27181846 07-Aug-2017 Lawrence Stewart <lstewart@FreeBSD.org>

pgrep naively appends the delimiter to all PIDs including the last
e.g. "pgrep -d, getty" outputs "1399,1386,1309,1308,1307,1306,1305,1302,"
Ensure the list is correctly delimited by suppressing the emission of the
delimiter after the final PID.

Reviewed by: imp, kib
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D8537


# db57c70a 09-Feb-2016 Konstantin Belousov <kib@FreeBSD.org>

Rename P_KTHREAD struct proc p_flag to P_KPROC.

I left as is an apparent bug in ntoskrnl_var.h:AT_PASSIVE_LEVEL()
definition.

Suggested by: jhb
Sponsored by: The FreeBSD Foundation


# c4f0631f 21-Aug-2015 Jamie Gritton <jamie@FreeBSD.org>

Make pkill/pgrep -j ARG take jname, not just jid.

PR: 201588
Submitted by: Daniel Shahaf <danielsh at apache.org>
MFC after: 3 days


# 03eea902 09-Nov-2013 Eitan Adler <eadler@FreeBSD.org>

pkill - Optimize pgrep -F

Ask for a specific process instead of pulling down all processes when
-F <pidfile> is specified. This is much much faster.

Obtained from: DragonflyBSD


# cc8f0608 04-Oct-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Remove useless check - ki_loginclass is an array; can't be NULL.

CID: 1006559
Approved by: re (kib)
MFC after: 2 weeks
Sponsored by: FreeBSD Foundation


# cc55ad3d 09-Aug-2013 Edward Tomasz Napierala <trasz@FreeBSD.org>

Add -c flag to pgrep(1) and pkill(1), to match login classes.

MFC after: 1 month


# 12dacf62 04-Feb-2011 Jilles Tjoelker <jilles@FreeBSD.org>

Make sys_signame upper case.

This matches the constants from <signal.h> with 'SIG' removed, which POSIX
requires kill and trap to accept and 'kill -l' to write.

'kill -l', 'trap', 'trap -l' output is now upper case.

In Turkish locales, signal names with an upper case 'I' are now accepted,
while signal names with a lower case 'i' are no longer accepted, and the
output of 'killall -l' now contains proper capital 'I' without dot instead
of a dotted capital 'I'.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 3ba0e470 20-Jun-2010 Brian Somers <brian@FreeBSD.org>

Recognise the -l switch with pkill - list kill command(s) used.

PR: 143558
Submitted by: eitanadlerlist at gmail dot com
MFC after: 3 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 696e61a4 02-Mar-2010 Joel Dahl <joel@FreeBSD.org>

The NetBSD Foundation has granted permission to remove clause 3 and 4 from
their software.

Approved by: pjd
Obtained from: NetBSD


# b9d3fd67 18-Feb-2010 Rebecca Cran <brucec@FreeBSD.org>

MFC r203688:

Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This allows
the -M option to be used without specifying -N.

PR: bin/138146
Approved by: rrs (mentor)


# 7b0706f6 12-Feb-2010 Pawel Jakub Dawidek <pjd@FreeBSD.org>

- Implement -q option for pgrep(1).
- Add regression test to test -q option.


# c08dcaf1 08-Feb-2010 Rebecca Cran <brucec@FreeBSD.org>

Initialize the execfile argument to NULL instead of _PATH_DEVNULL. This allows the -M option to be used without specifying -N.

PR: bin/138146
Approved by: rrs (mentor)
MFC after: 3 days


# e2b36efd 29-Jan-2010 Antoine Brodin <antoine@FreeBSD.org>

MFC r201145 to stable/8:
(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR: 137213
Submitted by: Eygene Ryabinkin (initial version)


# 2a546db8 04-Jan-2010 David E. O'Brien <obrien@FreeBSD.org>

Committed the wrong version in r201484. This time really fix the "-t"
functionality. Per the regression tests (pgrep-t.t & pkill-t.t), "-t"
should accept "v1", which means a plain number should be accepted for
UNIX98-style PTY's.


# 39a60cbc 04-Jan-2010 David E. O'Brien <obrien@FreeBSD.org>

Fix the "-t" functionality. Per the regression tests (pgrep-t.t & pkill-t.t),
"-t" should accept "v1", which means a plain number should be accepted for
UNIX98-style PTY's.


# 13e403fd 28-Dec-2009 Antoine Brodin <antoine@FreeBSD.org>

(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR: 137213
Submitted by: Eygene Ryabinkin (initial version)
MFC after: 1 month


# 0a091aeb 16-May-2009 Brian Somers <brian@FreeBSD.org>

When finding processes, ignore ourself and our ancestors. It is almost
always surprising when you kill a 'sh -c ...' ancestor or when you kill
yourself when using -f.

Add a -a switch for backwards compatibility.

MFC after: 3 weeks


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 18aa158f 30-Sep-2008 Ed Schouten <ed@FreeBSD.org>

Improve the `pkill -t' handling, which I changed in my previous commit.

In my previous commit I disabled pkill(1)'s automatic prepending of the
"tty" string when `pkill -t' was being used. Re-enable it and stat()
both possible device names when called.

Requested by: jhb, rwatson (MFC)
MFC after: 1 month


# eb948eac 28-Sep-2008 Ed Schouten <ed@FreeBSD.org>

Don't automatically prepend the "tty" prefix to `pkill -t' arguments.

Because we now enforce UNIX98-style PTY's, we now use a lot of TTY's
that don't have the traditional /dev/ttyXX naming scheme. pkill(1)'s -t
flag automatically prepended the word "tty" to each TTY that was passed
on the command line. This meant that `pkill -t pts/0' was actually
converted to /dev/ttypts/0. Disable this broken behaviour for now.

Reported by: erwin


# 21be3b31 31-Aug-2008 Yaroslav Tykhiy <ytykhiy@gmail.com>

pkill(1) first appeared in /usr/bin, but later it was moved to /bin
for the convenience of rc.d. Now it has happily lived there for quite
a while. So move the pkill(1) source files from usr.bin to bin, too.

Approved by: gad