MCPcopy Create free account
hub / github.com/F-Stack/f-stack / uprintf

Function uprintf

freebsd/kern/subr_prf.c:169–215  ·  view source on GitHub ↗

* Uprintf prints to the controlling terminal for the current process. */

Source from the content-addressed store, hash-verified

167 * Uprintf prints to the controlling terminal for the current process.
168 */
169int
170uprintf(const char *fmt, ...)
171{
172 va_list ap;
173 struct putchar_arg pca;
174 struct proc *p;
175 struct thread *td;
176 int retval;
177
178 td = curthread;
179 if (TD_IS_IDLETHREAD(td))
180 return (0);
181
182 if (td->td_proc == initproc) {
183 /* Produce output when we fail to load /sbin/init: */
184 va_start(ap, fmt);
185 retval = vprintf(fmt, ap);
186 va_end(ap);
187 return (retval);
188 }
189
190 sx_slock(&proctree_lock);
191 p = td->td_proc;
192 PROC_LOCK(p);
193 if ((p->p_flag & P_CONTROLT) == 0) {
194 PROC_UNLOCK(p);
195 sx_sunlock(&proctree_lock);
196 return (0);
197 }
198 SESS_LOCK(p->p_session);
199 pca.tty = p->p_session->s_ttyp;
200 SESS_UNLOCK(p->p_session);
201 PROC_UNLOCK(p);
202 if (pca.tty == NULL) {
203 sx_sunlock(&proctree_lock);
204 return (0);
205 }
206 pca.flags = TOTTY;
207 pca.p_bufr = NULL;
208 va_start(ap, fmt);
209 tty_lock(pca.tty);
210 sx_sunlock(&proctree_lock);
211 retval = kvprintf(fmt, putchar, &pca, 10, ap);
212 tty_unlock(pca.tty);
213 va_end(ap);
214 return (retval);
215}
216
217/*
218 * tprintf and vtprintf print on the controlling terminal associated with the

Callers 15

krping_readFunction · 0.85
krping_writeFunction · 0.85
init_siftrFunction · 0.85
trapFunction · 0.85
vm86_emulateFunction · 0.85
freebsd4_sigreturnFunction · 0.85
sys_sigreturnFunction · 0.85
efi_time_sysctl_handlerFunction · 0.85
trapFunction · 0.85
sys_sigreturnFunction · 0.85
freebsd32_sigreturnFunction · 0.85

Calls 2

vprintfFunction · 0.70
kvprintfFunction · 0.70

Tested by

no test coverage detected