svn commit: r350043 - in head: share/man/man5 sys/kern
Eric van Gyzen
vangyzen at FreeBSD.org
Tue Jul 16 15:51:10 UTC 2019
Author: vangyzen
Date: Tue Jul 16 15:51:09 2019
New Revision: 350043
URL: https://svnweb.freebsd.org/changeset/base/350043
Log:
Adds signal number format to kern.corefile
Add format capability to core file names to include signal
that generated the core. This can help various validation workflows
where all cores should not be considered equally (SIGQUIT is often
intentional and not an error unlike SIGSEGV or SIGBUS)
Submitted by: David Leimbach (leimy2k at gmail.com)
Reviewed by: markj
MFC after: 1 week
Relnotes: sysctl kern.corefile can now include the signal number
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D20970
Modified:
head/share/man/man5/core.5
head/sys/kern/kern_sig.c
Modified: head/share/man/man5/core.5
==============================================================================
--- head/share/man/man5/core.5 Tue Jul 16 15:49:43 2019 (r350042)
+++ head/share/man/man5/core.5 Tue Jul 16 15:51:09 2019 (r350043)
@@ -82,6 +82,8 @@ generated by a particular process.
process name.
.It Em \&%P
processes PID.
+.It Em \&%S
+signal during core.
.It Em \&%U
process UID.
.El
Modified: head/sys/kern/kern_sig.c
==============================================================================
--- head/sys/kern/kern_sig.c Tue Jul 16 15:49:43 2019 (r350042)
+++ head/sys/kern/kern_sig.c Tue Jul 16 15:51:09 2019 (r350043)
@@ -3433,7 +3433,7 @@ corefile_open_last(struct thread *td, char *name, int
*/
static int
corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
- int compress, struct vnode **vpp, char **namep)
+ int compress, int signum, struct vnode **vpp, char **namep)
{
struct sbuf sb;
struct nameidata nd;
@@ -3482,6 +3482,9 @@ corefile_open(const char *comm, uid_t uid, pid_t pid,
case 'P': /* process id */
sbuf_printf(&sb, "%u", pid);
break;
+ case 'S': /* signal number */
+ sbuf_printf(&sb, "%i", signum);
+ break;
case 'U': /* user id */
sbuf_printf(&sb, "%u", uid);
break;
@@ -3599,7 +3602,7 @@ coredump(struct thread *td)
PROC_UNLOCK(p);
error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td,
- compress_user_cores, &vp, &name);
+ compress_user_cores, p->p_sig, &vp, &name);
if (error != 0)
return (error);
More information about the svn-src-head
mailing list