Lines Matching defs:sigio

94 static MALLOC_DEFINE(M_SIGIO, "sigio", "sigio structures");
196 struct mtx sigio_lock; /* mtx to protect pointers to sigio */
1069 sigiofree(struct sigio *sigio)
1071 crfree(sigio->sio_ucred);
1072 free(sigio, M_SIGIO);
1075 static struct sigio *
1076 funsetown_locked(struct sigio *sigio)
1083 if (sigio == NULL)
1085 *sigio->sio_myref = NULL;
1086 if (sigio->sio_pgid < 0) {
1087 pg = sigio->sio_pgrp;
1089 SLIST_REMOVE(&pg->pg_sigiolst, sigio, sigio, sio_pgsigio);
1092 p = sigio->sio_proc;
1094 SLIST_REMOVE(&p->p_sigiolst, sigio, sigio, sio_pgsigio);
1097 return (sigio);
1101 * If sigio is on the list associated with a process or process group,
1102 * disable signalling from the device, remove sigio from the list and
1103 * free sigio.
1106 funsetown(struct sigio **sigiop)
1108 struct sigio *sigio;
1115 sigio = funsetown_locked(*sigiop);
1117 if (sigio != NULL)
1118 sigiofree(sigio);
1122 * Free a list of sigio structures. The caller must ensure that new sigio
1132 struct sigio *sigio, *tmp;
1135 sigio = SLIST_FIRST(sigiolst);
1136 if (sigio == NULL)
1143 sigio = SLIST_FIRST(sigiolst);
1144 if (sigio == NULL) {
1152 if (sigio->sio_pgid < 0) {
1153 pg = sigio->sio_pgrp;
1156 } else /* if (sigio->sio_pgid > 0) */ {
1157 p = sigio->sio_proc;
1163 SLIST_FOREACH(sigio, sigiolst, sio_pgsigio) {
1164 *sigio->sio_myref = NULL;
1166 KASSERT(sigio->sio_pgid < 0,
1167 ("Proc sigio in pgrp sigio list"));
1168 KASSERT(sigio->sio_pgrp == pg,
1169 ("Bogus pgrp in sigio list"));
1171 KASSERT(sigio->sio_pgid > 0,
1172 ("Pgrp sigio in proc sigio list"));
1173 KASSERT(sigio->sio_proc == p,
1174 ("Bogus proc in sigio list"));
1184 SLIST_FOREACH_SAFE(sigio, sigiolst, sio_pgsigio, tmp)
1185 sigiofree(sigio);
1191 * After permission checking, add a sigio structure to the sigio list for
1195 fsetown(pid_t pgid, struct sigio **sigiop)
1199 struct sigio *osigio, *sigio;
1207 sigio = malloc(sizeof(struct sigio), M_SIGIO, M_WAITOK);
1208 sigio->sio_pgid = pgid;
1209 sigio->sio_ucred = crhold(curthread->td_ucred);
1210 sigio->sio_myref = sigiop;
1234 sigio->sio_proc = proc;
1235 SLIST_INSERT_HEAD(&proc->p_sigiolst, sigio,
1259 sigio->sio_pgrp = pgrp;
1260 SLIST_INSERT_HEAD(&pgrp->pg_sigiolst, sigio,
1268 *sigiop = sigio;
1279 fgetown(struct sigio **sigiop)
5179 mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF);