From a09da298590e8c11ebafa37f79e0046814665237 Mon Sep 17 00:00:00 2001 From: tanimura Date: Sat, 23 Feb 2002 11:12:57 +0000 Subject: Lock struct pgrp, session and sigio. New locks are: - pgrpsess_lock which locks the whole pgrps and sessions, - pg_mtx which protects the pgrp members, and - s_mtx which protects the session members. Please refer to sys/proc.h for the coverage of these locks. Changes on the pgrp/session interface: - pgfind() needs the pgrpsess_lock held. - The caller of enterpgrp() is responsible to allocate a new pgrp and session. - Call enterthispgrp() in order to enter an existing pgrp. - pgsignal() requires a pgrp lock held. Reviewed by: jhb, alfred Tested on: cvsup.jp.FreeBSD.org (which is a quad-CPU machine running -current) --- sys/net/if_sl.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'sys/net/if_sl.c') diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c index 228f396..c2e0e17 100644 --- a/sys/net/if_sl.c +++ b/sys/net/if_sl.c @@ -83,6 +83,7 @@ #include #include #include +#include #include #include @@ -1076,9 +1077,13 @@ sl_keepalive(chan) struct sl_softc *sc = chan; if (sc->sc_keepalive) { - if (sc->sc_flags & SC_KEEPALIVE) - pgsignal (sc->sc_ttyp->t_pgrp, SIGURG, 1); - else + if (sc->sc_flags & SC_KEEPALIVE) { + if (sc->sc_ttyp->t_pgrp != NULL) { + PGRP_LOCK(sc->sc_ttyp->t_pgrp); + pgsignal (sc->sc_ttyp->t_pgrp, SIGURG, 1); + PGRP_UNLOCK(sc->sc_ttyp->t_pgrp); + } + } else sc->sc_flags |= SC_KEEPALIVE; sc->sc_kahandle = timeout(sl_keepalive, sc, sc->sc_keepalive); } else { -- cgit v1.1