Emit uprintf() output for initproc if there is no controlling terminal

This patch helped me debug why /sbin/init was not being loaded after
making changes to the image activator in CheriBSD.

Reviewed By:	jhb (earlier version), kib
Differential Revision: https://reviews.freebsd.org/D28121
This commit is contained in:
Alex Richardson 2021-01-20 09:54:46 +00:00
parent db4b5a16a3
commit 7e99c034f7

View File

@ -179,6 +179,14 @@ uprintf(const char *fmt, ...)
if (TD_IS_IDLETHREAD(td))
return (0);
if (td->td_proc == initproc) {
/* Produce output when we fail to load /sbin/init: */
va_start(ap, fmt);
retval = vprintf(fmt, ap);
va_end(ap);
return (retval);
}
sx_slock(&proctree_lock);
p = td->td_proc;
PROC_LOCK(p);