Lines Matching defs:pgrp
132 * (an orphaned pgrp will lock the slot, a session will lock
133 * the pgrp with the same number.)
147 struct pgrp *pt_pgrp;
196 struct pgrp pgrp0 = {
259 static struct pgrp * pg_remove(pid_t);
261 static void orphanpg(struct pgrp *);
468 KERN_PROC_PGRP pgrp
487 struct pgrp *pg;
596 struct pgrp *pg;
602 * We keep the pgrp with the same id as the session in order to
603 * stop a process being given the same pid. Since the pgrp holds
604 * a reference to the session, it must be a 'zombie' pgrp by now.
616 kmem_free(pg, sizeof(struct pgrp));
630 struct pgrp *pgrp;
644 pgrp = p1->p_pgrp;
646 pgrp = pgrp_find(pg_id);
647 if (pgrp == NULL) {
652 session = pgrp->pg_session;
929 struct pgrp *
932 struct pgrp *pg;
954 struct pgrp *pgrp;
995 pgrp = pid_table[i].pt_pgrp;
1001 if (pgrp)
1002 pid = pgrp->pg_id;
1010 n_pt[pid & pt_size].pt_pgrp = pgrp;
1283 * If we are creating a new pgrp, the pgid should equal
1294 struct pgrp *new_pgrp, *pgrp;
1306 /* Check pgrp exists or can be created */
1307 pgrp = pid_table[pgid & pid_tbl_mask].pt_pgrp;
1308 if (pgrp != NULL && pgrp->pg_id != pgid)
1323 if (pgrp != NULL && pgrp->pg_session != p->p_session)
1331 /* ... setsid() cannot re-enter a pgrp */
1341 if (sess == NULL && p->p_pgrp == pgrp) {
1350 if (pgrp == NULL && pgid != pid)
1353 /* Can only create a session if creating pgrp */
1354 if (sess != NULL && pgrp != NULL)
1357 /* Check we allocated memory for a pgrp... */
1358 if (pgrp == NULL && new_pgrp == NULL)
1361 /* Don't attach to 'zombie' pgrp */
1362 if (pgrp != NULL && LIST_EMPTY(&pgrp->pg_members))
1368 if (pgrp == p->p_pgrp)
1374 if (pgrp == NULL) {
1375 pgrp = new_pgrp;
1391 pgrp->pg_session = sess;
1394 pgrp->pg_id = pgid;
1395 LIST_INIT(&pgrp->pg_members);
1398 panic("enterpgrp: pgrp table slot in use");
1402 pid_table[pgid & pid_tbl_mask].pt_pgrp = pgrp;
1403 pgrp->pg_jobc = 0;
1411 fixjobc(p, pgrp, 1);
1422 p->p_pgrp = pgrp;
1423 LIST_INSERT_HEAD(&pgrp->pg_members, p, p_pglist);
1457 struct pgrp *pgrp;
1463 pgrp = p->p_pgrp;
1468 if (LIST_EMPTY(&pgrp->pg_members)) {
1470 pg_delete(pgrp->pg_id);
1481 static struct pgrp *
1484 struct pgrp *pgrp;
1490 pgrp = pt->pt_pgrp;
1492 KASSERT(pgrp != NULL);
1493 KASSERT(pgrp->pg_id == pg_id);
1494 KASSERT(LIST_EMPTY(&pgrp->pg_members));
1499 /* Orphaned pgrp, put slot onto free list. */
1508 return pgrp;
1518 struct pgrp *pg;
1550 kmem_free(pg, sizeof(struct pgrp));
1555 * Adjust pgrp jobc counters when specified process changes process group.
1567 fixjobc(struct proc *p, struct pgrp *pgrp, int entering)
1569 struct pgrp *hispgrp;
1570 struct session *mysession = pgrp->pg_session;
1580 if (hispgrp != pgrp && hispgrp->pg_session == mysession) {
1582 pgrp->pg_jobc++;
1585 /* KASSERT(pgrp->pg_jobc > 0); */
1586 if (--pgrp->pg_jobc == 0)
1587 orphanpg(pgrp);
1598 if (hispgrp != pgrp && hispgrp->pg_session == mysession &&
1620 orphanpg(struct pgrp *pg)
1643 struct pgrp *pgrp;
1669 if ((pgrp = pt->pt_pgrp)) {
1671 pgrp->pg_session, pgrp->pg_session->s_sid,
1672 pgrp->pg_session->s_count,
1673 pgrp->pg_session->s_login);
1675 pgrp, pgrp->pg_id, pgrp->pg_jobc,
1676 LIST_FIRST(&pgrp->pg_members));
1677 LIST_FOREACH(p, &pgrp->pg_members, p_pglist) {
1678 db_printf("\t\tpid %d addr %p pgrp %p %s\n",