Make it possible to request nosys logging to console.

New kern.lognosys values are
1 - log to ctty
2 - log to console
3 - log to both.

Inspired by:	eugen
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2017-07-27 20:45:41 +00:00
parent df8257d71d
commit 7ceeb35bd8

View File

@ -3579,9 +3579,14 @@ nosys(struct thread *td, struct nosys_args *args)
PROC_LOCK(p);
tdsignal(td, SIGSYS);
PROC_UNLOCK(p);
if (kern_lognosys)
if (kern_lognosys == 1 || kern_lognosys == 3) {
uprintf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
if (kern_lognosys == 2 || kern_lognosys == 3) {
printf("pid %d comm %s: nosys %d\n", p->p_pid, p->p_comm,
td->td_sa.code);
}
return (ENOSYS);
}