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

Function sigqueue_get

freebsd/kern/kern_sig.c:308–349  ·  view source on GitHub ↗

* Get a signal's ksiginfo. * Return: * 0 - signal not found * others - signal number */

Source from the content-addressed store, hash-verified

306 * others - signal number
307 */
308static int
309sigqueue_get(sigqueue_t *sq, int signo, ksiginfo_t *si)
310{
311 struct proc *p = sq->sq_proc;
312 struct ksiginfo *ksi, *next;
313 int count = 0;
314
315 KASSERT(sq->sq_flags & SQ_INIT, ("sigqueue not inited"));
316
317 if (!SIGISMEMBER(sq->sq_signals, signo))
318 return (0);
319
320 if (SIGISMEMBER(sq->sq_ptrace, signo)) {
321 count++;
322 SIGDELSET(sq->sq_ptrace, signo);
323 si->ksi_flags |= KSI_PTRACE;
324 }
325 if (SIGISMEMBER(sq->sq_kill, signo)) {
326 count++;
327 if (count == 1)
328 SIGDELSET(sq->sq_kill, signo);
329 }
330
331 TAILQ_FOREACH_SAFE(ksi, &sq->sq_list, ksi_link, next) {
332 if (ksi->ksi_signo == signo) {
333 if (count == 0) {
334 TAILQ_REMOVE(&sq->sq_list, ksi, ksi_link);
335 ksi->ksi_sigq = NULL;
336 ksiginfo_copy(ksi, si);
337 if (ksiginfo_tryfree(ksi) && p != NULL)
338 p->p_pendingcnt--;
339 }
340 if (++count > 1)
341 break;
342 }
343 }
344
345 if (count <= 1)
346 SIGDELSET(sq->sq_signals, signo);
347 si->ksi_signo = signo;
348 return (signo);
349}
350
351void
352sigqueue_take(ksiginfo_t *ksi)

Callers 3

kern_sigtimedwaitFunction · 0.85
issignalFunction · 0.85
postsigFunction · 0.85

Calls 2

ksiginfo_copyFunction · 0.85
ksiginfo_tryfreeFunction · 0.85

Tested by

no test coverage detected