sigio
int sigio; /* must process signature */
ctx->sigio = 1;
if (ctx->sigio == 1) {
if (ctx->sigio == 0) {
if (ctx->sigio && !sig_out(b))
ctx->sigio = 1;
ctx->sigio = 0;
ctx->sigio = 0;
#define fasync_struct sigio *
struct sigio *f_sigio;
struct sigio *async; /* Processes waiting for SIGIO */
struct sigio *buf_sigio; /* Processes waiting for SIGIO */
struct sigio * ec_sigio;
if (priv->async == true && priv->sigio != NULL)
pgsigio(&priv->sigio, SIGIO, 0);
funsetown(&priv->sigio);
priv->sigio = NULL;
struct sigio *sigio;
*(int *)arg = fgetown(&priv->sigio);
res = fsetown(*(int *)arg, &priv->sigio);
static struct sigio *sysmouse_sigio;
sigiofree(struct sigio *sigio)
crfree(sigio->sio_ucred);
free(sigio, M_SIGIO);
static struct sigio *
funsetown_locked(struct sigio *sigio)
if (sigio == NULL)
*sigio->sio_myref = NULL;
if (sigio->sio_pgid < 0) {
pg = sigio->sio_pgrp;
SLIST_REMOVE(&pg->pg_sigiolst, sigio, sigio, sio_pgsigio);
p = sigio->sio_proc;
SLIST_REMOVE(&p->p_sigiolst, sigio, sigio, sio_pgsigio);
return (sigio);
funsetown(struct sigio **sigiop)
struct sigio *sigio;
sigio = funsetown_locked(*sigiop);
if (sigio != NULL)
sigiofree(sigio);
struct sigio *sigio, *tmp;
sigio = SLIST_FIRST(sigiolst);
if (sigio == NULL)
sigio = SLIST_FIRST(sigiolst);
if (sigio == NULL) {
if (sigio->sio_pgid < 0) {
pg = sigio->sio_pgrp;
p = sigio->sio_proc;
SLIST_FOREACH(sigio, sigiolst, sio_pgsigio) {
*sigio->sio_myref = NULL;
KASSERT(sigio->sio_pgid < 0,
KASSERT(sigio->sio_pgrp == pg,
KASSERT(sigio->sio_pgid > 0,
KASSERT(sigio->sio_proc == p,
SLIST_FOREACH_SAFE(sigio, sigiolst, sio_pgsigio, tmp)
sigiofree(sigio);
fsetown(pid_t pgid, struct sigio **sigiop)
struct sigio *osigio, *sigio;
sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK);
sigio->sio_pgid = pgid;
sigio->sio_ucred = crhold(curthread->td_ucred);
sigio->sio_myref = sigiop;
sigio->sio_proc = proc;
SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio,
sigio->sio_pgrp = pgrp;
SLIST_INSERT_HEAD(&pgrp->pg_sigiolst, sigio,
*sigiop = sigio;
fgetown(struct sigio **sigiop)
funsetown(&devsoftc.sigio);
return fsetown(*(int *)data, &devsoftc.sigio);
*(int *)data = fgetown(&devsoftc.sigio);
if (devsoftc.async && devsoftc.sigio != NULL)
pgsigio(&devsoftc.sigio, SIGIO, 0);
struct sigio *sigio;
pgsigio(struct sigio **sigiop, int sig, int checkctty)
struct sigio *sigio;
sigio = *sigiop;
if (sigio == NULL) {
if (sigio->sio_pgid > 0) {
PROC_LOCK(sigio->sio_proc);
if (CANSIGIO(sigio->sio_ucred, sigio->sio_proc->p_ucred))
kern_psignal(sigio->sio_proc, sig);
PROC_UNLOCK(sigio->sio_proc);
} else if (sigio->sio_pgid < 0) {
PGRP_LOCK(sigio->sio_pgrp);
LIST_FOREACH(p, &sigio->sio_pgrp->pg_members, p_pglist) {
CANSIGIO(sigio->sio_ucred, p->p_ucred) &&
PGRP_UNLOCK(sigio->sio_pgrp);
struct sigio *sc_sigio; /* information for async I/O */
struct sigio * bd_sigio; /* information for async I/O */
struct sigio *tun_sigio; /* async I/O info */
struct sigio *ap_sigio;
struct sigio *kq_sigio;
struct sigio *pipe_sigio; /* information for async I/O */
struct sigio;
SLIST_ENTRY(sigio) sio_pgsigio; /* (pg) sigio's for process or group */
struct sigio **sio_myref; /* (c) location of the pointer that holds
SLIST_HEAD(sigiolst, sigio);
pid_t fgetown(struct sigio **sigiop);
int fsetown(pid_t pgid, struct sigio **sigiop);
void funsetown(struct sigio **sigiop);
struct sigio;
void pgsigio(struct sigio **sigiop, int sig, int checkctty);
struct sigio *so_sigio; /* [sg] information for async I/O or
struct sigio *t_sigio; /* (t) Asynchronous I/O. */
if (sigio == 1) {
sigio = 0;
static volatile sig_atomic_t sigio = 0;
sigio = 1;