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@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
This commit is contained in:
parent
7af2abed6a
commit
9d3ecb7e62
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=350043
@ -82,6 +82,8 @@ generated by a particular process.
|
|||||||
process name.
|
process name.
|
||||||
.It Em \&%P
|
.It Em \&%P
|
||||||
processes PID.
|
processes PID.
|
||||||
|
.It Em \&%S
|
||||||
|
signal during core.
|
||||||
.It Em \&%U
|
.It Em \&%U
|
||||||
process UID.
|
process UID.
|
||||||
.El
|
.El
|
||||||
|
@ -3433,7 +3433,7 @@ corefile_open_last(struct thread *td, char *name, int indexpos,
|
|||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
|
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 sbuf sb;
|
||||||
struct nameidata nd;
|
struct nameidata nd;
|
||||||
@ -3482,6 +3482,9 @@ corefile_open(const char *comm, uid_t uid, pid_t pid, struct thread *td,
|
|||||||
case 'P': /* process id */
|
case 'P': /* process id */
|
||||||
sbuf_printf(&sb, "%u", pid);
|
sbuf_printf(&sb, "%u", pid);
|
||||||
break;
|
break;
|
||||||
|
case 'S': /* signal number */
|
||||||
|
sbuf_printf(&sb, "%i", signum);
|
||||||
|
break;
|
||||||
case 'U': /* user id */
|
case 'U': /* user id */
|
||||||
sbuf_printf(&sb, "%u", uid);
|
sbuf_printf(&sb, "%u", uid);
|
||||||
break;
|
break;
|
||||||
@ -3599,7 +3602,7 @@ coredump(struct thread *td)
|
|||||||
PROC_UNLOCK(p);
|
PROC_UNLOCK(p);
|
||||||
|
|
||||||
error = corefile_open(p->p_comm, cred->cr_uid, p->p_pid, td,
|
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)
|
if (error != 0)
|
||||||
return (error);
|
return (error);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user