summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_descrip.c26
-rw-r--r--sys/kern/kern_sig.c14
-rw-r--r--sys/kern/subr_log.c2
-rw-r--r--sys/kern/sys_pipe.c2
-rw-r--r--sys/kern/tty.c4
-rw-r--r--sys/kern/uipc_sockbuf.c21
-rw-r--r--sys/kern/uipc_socket.c2
-rw-r--r--sys/kern/uipc_socket2.c21
-rw-r--r--sys/net/bpf.c2
-rw-r--r--sys/net/if_tap.c2
-rw-r--r--sys/net/if_tun.c2
-rw-r--r--sys/net/rtsock.c4
-rw-r--r--sys/netinet/accf_data.c8
-rw-r--r--sys/netinet/accf_http.c8
-rw-r--r--sys/netinet/tcp_input.c6
-rw-r--r--sys/netinet/tcp_reass.c6
-rw-r--r--sys/netkey/keysock.c5
-rw-r--r--sys/sys/signalvar.h16
-rw-r--r--sys/sys/socketvar.h6
19 files changed, 42 insertions, 115 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 13b91ad..425cb39 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -63,6 +63,7 @@
#include <sys/event.h>
#include <sys/sx.h>
#include <sys/socketvar.h>
+#include <sys/signalvar.h>
#include <machine/limits.h>
@@ -113,7 +114,7 @@ struct filelist filehead; /* head of list of open files */
int nfiles; /* actual number of open files */
extern int cmask;
struct sx filelist_lock; /* sx to protect filelist */
-struct sx sigio_lock; /* sx to protect pointers to sigio */
+struct mtx sigio_lock; /* mtx to protect pointers to sigio */
/*
* System calls on descriptors.
@@ -536,14 +537,14 @@ void
funsetown(sigio)
struct sigio *sigio;
{
- int s;
- if (sigio == NULL)
+ SIGIO_LOCK();
+ if (sigio == NULL) {
+ SIGIO_UNLOCK();
return;
-
- s = splhigh();
+ }
*(sigio->sio_myref) = NULL;
- splx(s);
+ SIGIO_UNLOCK();
if ((sigio)->sio_pgid < 0) {
struct pgrp *pg = (sigio)->sio_pgrp;
PGRP_LOCK(pg);
@@ -566,7 +567,6 @@ void
funsetownlst(sigiolst)
struct sigiolst *sigiolst;
{
- int s;
struct sigio *sigio;
struct proc *p;
struct pgrp *pg;
@@ -591,9 +591,9 @@ funsetownlst(sigiolst)
}
while ((sigio = SLIST_FIRST(sigiolst)) != NULL) {
- s = splhigh();
+ SIGIO_LOCK();
*(sigio->sio_myref) = NULL;
- splx(s);
+ SIGIO_UNLOCK();
if (pg != NULL) {
KASSERT(sigio->sio_pgid < 0, ("Proc sigio in pgrp sigio list"));
KASSERT(sigio->sio_pgrp == pg, ("Bogus pgrp in sigio list"));
@@ -632,7 +632,7 @@ fsetown(pgid, sigiop)
struct proc *proc;
struct pgrp *pgrp;
struct sigio *sigio;
- int s, ret;
+ int ret;
if (pgid == 0) {
funsetown(*sigiop);
@@ -706,9 +706,9 @@ fsetown(pgid, sigiop)
PGRP_UNLOCK(pgrp);
}
sx_sunlock(&proctree_lock);
- s = splhigh();
+ SIGIO_LOCK();
*sigiop = sigio;
- splx(s);
+ SIGIO_UNLOCK();
return (0);
fail:
@@ -2187,5 +2187,5 @@ filelistinit(dummy)
NULL, NULL, UMA_ALIGN_PTR, 0);
sx_init(&filelist_lock, "filelist lock");
- sx_init(&sigio_lock, "sigio lock");
+ mtx_init(&sigio_lock, "sigio lock", NULL, MTX_DEF);
}
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index 16c6fed..4c1b683 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -2087,13 +2087,18 @@ nosys(td, args)
* stored credentials rather than those of the current process.
*/
void
-pgsigio(sigio, sig, checkctty)
- struct sigio *sigio;
+pgsigio(sigiop, sig, checkctty)
+ struct sigio **sigiop;
int sig, checkctty;
{
- if (sigio == NULL)
- return;
+ struct sigio *sigio;
+ SIGIO_LOCK();
+ sigio = *sigiop;
+ if (sigio == NULL) {
+ SIGIO_UNLOCK();
+ return;
+ }
if (sigio->sio_pgid > 0) {
PROC_LOCK(sigio->sio_proc);
if (CANSIGIO(sigio->sio_ucred, sigio->sio_proc->p_ucred))
@@ -2112,6 +2117,7 @@ pgsigio(sigio, sig, checkctty)
}
PGRP_UNLOCK(sigio->sio_pgrp);
}
+ SIGIO_UNLOCK();
}
static int
diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c
index b495a79..568b3fe 100644
--- a/sys/kern/subr_log.c
+++ b/sys/kern/subr_log.c
@@ -198,7 +198,7 @@ logtimeout(void *arg)
msgbuftrigger = 0;
selwakeup(&logsoftc.sc_selp);
if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL)
- pgsigio(logsoftc.sc_sigio, SIGIO, 0);
+ pgsigio(&logsoftc.sc_sigio, SIGIO, 0);
if (logsoftc.sc_state & LOG_RDWAIT) {
wakeup((caddr_t)msgbufp);
logsoftc.sc_state &= ~LOG_RDWAIT;
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index c671c94..d0682fa 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -429,7 +429,7 @@ pipeselwakeup(cpipe)
selwakeup(&cpipe->pipe_sel);
}
if ((cpipe->pipe_state & PIPE_ASYNC) && cpipe->pipe_sigio)
- pgsigio(cpipe->pipe_sigio, SIGIO, 0);
+ pgsigio(&cpipe->pipe_sigio, SIGIO, 0);
KNOTE(&cpipe->pipe_sel.si_note, 0);
}
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 6e4ca18..7b3459a 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -2289,7 +2289,7 @@ ttwakeup(tp)
if (SEL_WAITING(&tp->t_rsel))
selwakeup(&tp->t_rsel);
if (ISSET(tp->t_state, TS_ASYNC) && tp->t_sigio != NULL)
- pgsigio(tp->t_sigio, SIGIO, (tp->t_session != NULL));
+ pgsigio(&tp->t_sigio, SIGIO, (tp->t_session != NULL));
wakeup(TSA_HUP_OR_INPUT(tp));
KNOTE(&tp->t_rsel.si_note, 0);
}
@@ -2305,7 +2305,7 @@ ttwwakeup(tp)
if (SEL_WAITING(&tp->t_wsel) && tp->t_outq.c_cc <= tp->t_olowat)
selwakeup(&tp->t_wsel);
if (ISSET(tp->t_state, TS_ASYNC) && tp->t_sigio != NULL)
- pgsigio(tp->t_sigio, SIGIO, (tp->t_session != NULL));
+ pgsigio(&tp->t_sigio, SIGIO, (tp->t_session != NULL));
if (ISSET(tp->t_state, TS_BUSY | TS_SO_OCOMPLETE) ==
TS_SO_OCOMPLETE && tp->t_outq.c_cc == 0) {
CLR(tp->t_state, TS_SO_OCOMPLETE);
diff --git a/sys/kern/uipc_sockbuf.c b/sys/kern/uipc_sockbuf.c
index cb0a682..91cb57b 100644
--- a/sys/kern/uipc_sockbuf.c
+++ b/sys/kern/uipc_sockbuf.c
@@ -52,7 +52,6 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/stat.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -113,7 +112,6 @@ soisconnected_locked(so)
{
struct socket *head = so->so_head;
- SIGIO_ASSERT(SX_SLOCKED); /* XXX */
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
if (head && (so->so_state & SS_INCOMP)) {
@@ -122,9 +120,7 @@ soisconnected_locked(so)
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
so->so_rcv.sb_flags |= SB_UPCALL;
so->so_options &= ~SO_ACCEPTFILTER;
- SIGIO_SUNLOCK(); /* XXX */
so->so_upcall(so, so->so_upcallarg, 0);
- SIGIO_SLOCK();
return;
}
TAILQ_REMOVE(&head->so_incomp, so, so_list);
@@ -147,7 +143,6 @@ soisconnected(so)
{
struct socket *head = so->so_head;
- SIGIO_SLOCK();
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
if (head && (so->so_state & SS_INCOMP)) {
@@ -156,7 +151,6 @@ soisconnected(so)
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
so->so_rcv.sb_flags |= SB_UPCALL;
so->so_options &= ~SO_ACCEPTFILTER;
- SIGIO_SUNLOCK();
so->so_upcall(so, so->so_upcallarg, 0);
return;
}
@@ -173,7 +167,6 @@ soisconnected(so)
sorwakeup_locked(so);
sowwakeup_locked(so);
}
- SIGIO_SUNLOCK();
}
void
@@ -181,13 +174,11 @@ soisdisconnecting(so)
register struct socket *so;
{
- SIGIO_SLOCK();
so->so_state &= ~SS_ISCONNECTING;
so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE);
wakeup((caddr_t)&so->so_timeo);
sowwakeup_locked(so);
sorwakeup_locked(so);
- SIGIO_SUNLOCK();
}
void
@@ -195,7 +186,6 @@ soisdisconnected_locked(so)
register struct socket *so;
{
- SIGIO_ASSERT(SX_LOCKED);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED);
wakeup((caddr_t)&so->so_timeo);
@@ -208,9 +198,7 @@ soisdisconnected(so)
register struct socket *so;
{
- SIGIO_SLOCK();
soisdisconnected_locked(so);
- SIGIO_SUNLOCK();
}
/*
@@ -266,9 +254,7 @@ sonewconn(head, connstatus)
head->so_incqlen++;
}
if (connstatus) {
- SIGIO_SLOCK();
sorwakeup_locked(head);
- SIGIO_SUNLOCK();
wakeup((caddr_t)&head->so_timeo);
so->so_state |= connstatus;
}
@@ -290,10 +276,8 @@ socantsendmore(so)
struct socket *so;
{
- SIGIO_SLOCK();
so->so_state |= SS_CANTSENDMORE;
sowwakeup_locked(so);
- SIGIO_SUNLOCK();
}
void
@@ -301,10 +285,8 @@ socantrcvmore(so)
struct socket *so;
{
- SIGIO_SLOCK();
so->so_state |= SS_CANTRCVMORE;
sorwakeup_locked(so);
- SIGIO_SUNLOCK();
}
/*
@@ -353,7 +335,6 @@ sowakeup(so, sb)
register struct socket *so;
register struct sockbuf *sb;
{
- SIGIO_ASSERT(SX_LOCKED);
selwakeup(&sb->sb_sel);
sb->sb_flags &= ~SB_SEL;
@@ -362,7 +343,7 @@ sowakeup(so, sb)
wakeup((caddr_t)&sb->sb_cc);
}
if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL)
- pgsigio(so->so_sigio, SIGIO, 0);
+ pgsigio(&so->so_sigio, SIGIO, 0);
if (sb->sb_flags & SB_UPCALL)
(*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
if (sb->sb_flags & SB_AIO)
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 0e0fbd9..33f8a4d 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1527,7 +1527,7 @@ sohasoutofband(so)
register struct socket *so;
{
if (so->so_sigio != NULL)
- pgsigio(so->so_sigio, SIGURG, 0);
+ pgsigio(&so->so_sigio, SIGURG, 0);
selwakeup(&so->so_rcv.sb_sel);
}
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index cb0a682..91cb57b 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -52,7 +52,6 @@
#include <sys/socket.h>
#include <sys/socketvar.h>
#include <sys/stat.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -113,7 +112,6 @@ soisconnected_locked(so)
{
struct socket *head = so->so_head;
- SIGIO_ASSERT(SX_SLOCKED); /* XXX */
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
if (head && (so->so_state & SS_INCOMP)) {
@@ -122,9 +120,7 @@ soisconnected_locked(so)
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
so->so_rcv.sb_flags |= SB_UPCALL;
so->so_options &= ~SO_ACCEPTFILTER;
- SIGIO_SUNLOCK(); /* XXX */
so->so_upcall(so, so->so_upcallarg, 0);
- SIGIO_SLOCK();
return;
}
TAILQ_REMOVE(&head->so_incomp, so, so_list);
@@ -147,7 +143,6 @@ soisconnected(so)
{
struct socket *head = so->so_head;
- SIGIO_SLOCK();
so->so_state &= ~(SS_ISCONNECTING|SS_ISDISCONNECTING|SS_ISCONFIRMING);
so->so_state |= SS_ISCONNECTED;
if (head && (so->so_state & SS_INCOMP)) {
@@ -156,7 +151,6 @@ soisconnected(so)
so->so_upcallarg = head->so_accf->so_accept_filter_arg;
so->so_rcv.sb_flags |= SB_UPCALL;
so->so_options &= ~SO_ACCEPTFILTER;
- SIGIO_SUNLOCK();
so->so_upcall(so, so->so_upcallarg, 0);
return;
}
@@ -173,7 +167,6 @@ soisconnected(so)
sorwakeup_locked(so);
sowwakeup_locked(so);
}
- SIGIO_SUNLOCK();
}
void
@@ -181,13 +174,11 @@ soisdisconnecting(so)
register struct socket *so;
{
- SIGIO_SLOCK();
so->so_state &= ~SS_ISCONNECTING;
so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE);
wakeup((caddr_t)&so->so_timeo);
sowwakeup_locked(so);
sorwakeup_locked(so);
- SIGIO_SUNLOCK();
}
void
@@ -195,7 +186,6 @@ soisdisconnected_locked(so)
register struct socket *so;
{
- SIGIO_ASSERT(SX_LOCKED);
so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING);
so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED);
wakeup((caddr_t)&so->so_timeo);
@@ -208,9 +198,7 @@ soisdisconnected(so)
register struct socket *so;
{
- SIGIO_SLOCK();
soisdisconnected_locked(so);
- SIGIO_SUNLOCK();
}
/*
@@ -266,9 +254,7 @@ sonewconn(head, connstatus)
head->so_incqlen++;
}
if (connstatus) {
- SIGIO_SLOCK();
sorwakeup_locked(head);
- SIGIO_SUNLOCK();
wakeup((caddr_t)&head->so_timeo);
so->so_state |= connstatus;
}
@@ -290,10 +276,8 @@ socantsendmore(so)
struct socket *so;
{
- SIGIO_SLOCK();
so->so_state |= SS_CANTSENDMORE;
sowwakeup_locked(so);
- SIGIO_SUNLOCK();
}
void
@@ -301,10 +285,8 @@ socantrcvmore(so)
struct socket *so;
{
- SIGIO_SLOCK();
so->so_state |= SS_CANTRCVMORE;
sorwakeup_locked(so);
- SIGIO_SUNLOCK();
}
/*
@@ -353,7 +335,6 @@ sowakeup(so, sb)
register struct socket *so;
register struct sockbuf *sb;
{
- SIGIO_ASSERT(SX_LOCKED);
selwakeup(&sb->sb_sel);
sb->sb_flags &= ~SB_SEL;
@@ -362,7 +343,7 @@ sowakeup(so, sb)
wakeup((caddr_t)&sb->sb_cc);
}
if ((so->so_state & SS_ASYNC) && so->so_sigio != NULL)
- pgsigio(so->so_sigio, SIGIO, 0);
+ pgsigio(&so->so_sigio, SIGIO, 0);
if (sb->sb_flags & SB_UPCALL)
(*so->so_upcall)(so, so->so_upcallarg, M_DONTWAIT);
if (sb->sb_flags & SB_AIO)
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index 0077e51..325af54 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -511,7 +511,7 @@ bpf_wakeup(d)
}
wakeup((caddr_t)d);
if (d->bd_async && d->bd_sig && d->bd_sigio)
- pgsigio(d->bd_sigio, d->bd_sig, 0);
+ pgsigio(&d->bd_sigio, d->bd_sig, 0);
selwakeup(&d->bd_sel);
}
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index ad2ba05..45ce21f 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -626,7 +626,7 @@ tapifstart(ifp)
}
if ((tp->tap_flags & TAP_ASYNC) && (tp->tap_sigio != NULL))
- pgsigio(tp->tap_sigio, SIGIO, 0);
+ pgsigio(&tp->tap_sigio, SIGIO, 0);
selwakeup(&tp->tap_rsel);
ifp->if_opackets ++; /* obytes are counted in ether_output */
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index b6c7668..a6c89fb 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -223,7 +223,7 @@ tunstart(struct ifnet *ifp)
wakeup((caddr_t)tp);
}
if (tp->tun_flags & TUN_ASYNC && tp->tun_sigio)
- pgsigio(tp->tun_sigio, SIGIO, 0);
+ pgsigio(&tp->tun_sigio, SIGIO, 0);
selwakeup(&tp->tun_rsel);
}
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 11481fe..47031c2 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -39,7 +39,6 @@
#include <sys/domain.h>
#include <sys/kernel.h>
#include <sys/jail.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h>
@@ -47,7 +46,6 @@
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -149,10 +147,8 @@ rts_attach(struct socket *so, int proto, struct thread *td)
}
rp->rcb_faddr = &route_src;
route_cb.any_count++;
- SIGIO_SLOCK();
soisconnected_locked(so);
so->so_options |= SO_USELOOPBACK;
- SIGIO_SUNLOCK();
splx(s);
return 0;
}
diff --git a/sys/netinet/accf_data.c b/sys/netinet/accf_data.c
index dd710e6..46c92e3 100644
--- a/sys/netinet/accf_data.c
+++ b/sys/netinet/accf_data.c
@@ -30,11 +30,9 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/sysctl.h>
#include <sys/signalvar.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
/* accept filter that holds a socket until data arrives */
@@ -59,15 +57,11 @@ static void
sohasdata(struct socket *so, void *arg, int waitflag)
{
- SIGIO_SLOCK();
- if (!soreadable(so)) {
- SIGIO_SUNLOCK();
+ if (!soreadable(so))
return;
- }
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
soisconnected_locked(so);
- SIGIO_SUNLOCK();
return;
}
diff --git a/sys/netinet/accf_http.c b/sys/netinet/accf_http.c
index 3109174..4a3e17e 100644
--- a/sys/netinet/accf_http.c
+++ b/sys/netinet/accf_http.c
@@ -31,12 +31,10 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/mbuf.h>
#include <sys/signalvar.h>
#include <sys/sysctl.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
/* check for GET/HEAD */
static void sohashttpget(struct socket *so, void *arg, int waitflag);
@@ -203,11 +201,9 @@ sohashttpget(struct socket *so, void *arg, int waitflag)
fallout:
DPRINT("fallout");
- SIGIO_SLOCK();
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
soisconnected_locked(so);
- SIGIO_SUNLOCK();
return;
}
@@ -287,11 +283,9 @@ readmore:
fallout:
DPRINT("fallout");
- SIGIO_SLOCK();
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
soisconnected_locked(so);
- SIGIO_SUNLOCK();
return;
}
@@ -359,10 +353,8 @@ readmore:
return;
gotit:
- SIGIO_SLOCK();
so->so_upcall = NULL;
so->so_rcv.sb_flags &= ~SB_UPCALL;
soisconnected_locked(so);
- SIGIO_SUNLOCK();
return;
}
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
index 2a78e5e..b193327 100644
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -42,7 +42,6 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h> /* for proc0 declaration */
@@ -50,7 +49,6 @@
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
@@ -1845,14 +1843,10 @@ process_ACK:
* specification, but if we don't get a FIN
* we'll hang forever.
*/
- SIGIO_SLOCK();
if (so->so_state & SS_CANTRCVMORE) {
soisdisconnected_locked(so);
- SIGIO_SUNLOCK();
callout_reset(tp->tt_2msl, tcp_maxidle,
tcp_timer_2msl, tp);
- } else {
- SIGIO_SUNLOCK();
}
tp->t_state = TCPS_FIN_WAIT_2;
}
diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c
index 2a78e5e..b193327 100644
--- a/sys/netinet/tcp_reass.c
+++ b/sys/netinet/tcp_reass.c
@@ -42,7 +42,6 @@
#include <sys/param.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
#include <sys/proc.h> /* for proc0 declaration */
@@ -50,7 +49,6 @@
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/syslog.h>
#include <sys/systm.h>
@@ -1845,14 +1843,10 @@ process_ACK:
* specification, but if we don't get a FIN
* we'll hang forever.
*/
- SIGIO_SLOCK();
if (so->so_state & SS_CANTRCVMORE) {
soisdisconnected_locked(so);
- SIGIO_SUNLOCK();
callout_reset(tp->tt_2msl, tcp_maxidle,
tcp_timer_2msl, tp);
- } else {
- SIGIO_SUNLOCK();
}
tp->t_state = TCPS_FIN_WAIT_2;
}
diff --git a/sys/netkey/keysock.c b/sys/netkey/keysock.c
index 79e4831..68f1045 100644
--- a/sys/netkey/keysock.c
+++ b/sys/netkey/keysock.c
@@ -39,15 +39,12 @@
#include <sys/domain.h>
#include <sys/errno.h>
#include <sys/kernel.h>
-#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mbuf.h>
-#include <sys/mutex.h>
#include <sys/protosw.h>
#include <sys/signalvar.h>
#include <sys/socket.h>
#include <sys/socketvar.h>
-#include <sys/sx.h>
#include <sys/sysctl.h>
#include <sys/systm.h>
@@ -430,10 +427,8 @@ key_attach(struct socket *so, int proto, struct thread *td)
key_cb.any_count++;
kp->kp_raw.rcb_laddr = &key_src;
kp->kp_raw.rcb_faddr = &key_dst;
- SIGIO_SLOCK();
soisconnected_locked(so);
so->so_options |= SO_USELOOPBACK;
- SIGIO_SUNLOCK();
splx(s);
return 0;
diff --git a/sys/sys/signalvar.h b/sys/sys/signalvar.h
index b018252..cd61cff 100644
--- a/sys/sys/signalvar.h
+++ b/sys/sys/signalvar.h
@@ -216,20 +216,20 @@ struct pgrp;
struct thread;
struct proc;
struct sigio;
-struct sx;
+struct mtx;
extern int sugid_coredump; /* Sysctl variable kern.sugid_coredump */
-extern struct sx sigio_lock;
+extern struct mtx sigio_lock;
/*
* Lock the pointers for a sigio object in the underlying objects of
* a file descriptor.
*/
-#define SIGIO_SLOCK() sx_slock(&sigio_lock)
-#define SIGIO_XLOCK() sx_xlock(&sigio_lock)
-#define SIGIO_SUNLOCK() sx_sunlock(&sigio_lock)
-#define SIGIO_XUNLOCK() sx_xunlock(&sigio_lock)
-#define SIGIO_ASSERT(what) sx_assert(&sigio_lock, what)
+#define SIGIO_LOCK() mtx_lock(&sigio_lock)
+#define SIGIO_TRYLOCK() mtx_trylock(&sigio_lock)
+#define SIGIO_UNLOCK() mtx_unlock(&sigio_lock)
+#define SIGIO_LOCKED() mtx_owned(&sigio_lock)
+#define SIGIO_ASSERT(type) mtx_assert(&sigio_lock, type)
/*
* Machine-independent functions:
@@ -239,7 +239,7 @@ void execsigs(struct proc *p);
void gsignal(int pgid, int sig);
int issignal(struct proc *p);
void killproc(struct proc *p, char *why);
-void pgsigio(struct sigio *, int signum, int checkctty);
+void pgsigio(struct sigio **, int signum, int checkctty);
void pgsignal(struct pgrp *pgrp, int sig, int checkctty);
void postsig(int sig);
void psignal(struct proc *p, int sig);
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index 4b765aa..3a2f53c 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -283,27 +283,21 @@ struct xsocket {
} while(0)
#define sorwakeup_locked(so) do { \
- SIGIO_ASSERT(SX_SLOCKED); /* XXX */ \
if (sb_notify(&(so)->so_rcv)) \
sowakeup((so), &(so)->so_rcv); \
} while (0)
#define sorwakeup(so) do { \
- SIGIO_SLOCK(); \
sorwakeup_locked(so); \
- SIGIO_SUNLOCK(); \
} while (0)
#define sowwakeup_locked(so) do { \
- SIGIO_ASSERT(SX_SLOCKED); /* XXX */ \
if (sb_notify(&(so)->so_snd)) \
sowakeup((so), &(so)->so_snd); \
} while (0)
#define sowwakeup(so) do { \
- SIGIO_SLOCK(); \
sowwakeup_locked(so); \
- SIGIO_SUNLOCK(); \
} while (0)
#ifdef _KERNEL
OpenPOWER on IntegriCloud