Back out the following revisions on behalf of core:
sys/sys/lwp.h: revision 1.228 sys/sys/pipe.h: revision 1.40 sys/kern/uipc_socket.c: revision 1.306 sys/kern/kern_sleepq.c: revision 1.84 sys/rump/librump/rumpkern/locks_up.c: revision 1.13 sys/kern/sys_pipe.c: revision 1.165 usr.bin/fstat/fstat.c: revision 1.119 sys/rump/librump/rumpkern/locks.c: revision 1.87 sys/ddb/db_xxx.c: revision 1.78 sys/ddb/db_command.c: revision 1.187 sys/sys/condvar.h: revision 1.18 sys/ddb/db_interface.h: revision 1.42 sys/sys/socketvar.h: revision 1.166 sys/kern/uipc_syscalls.c: revision 1.209 sys/kern/kern_condvar.c: revision 1.60 Add cv_fdrestart() [...] Use cv_fdrestart() to implement fo_restart. Simplify/streamline pipes a little bit [...] This changes have caused regressions and need to be debugged. The cv_fdrestart() addition needs more discussion.
This commit is contained in:
parent
63162a40fe
commit
3007f1403a
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_command.c,v 1.189 2023/10/15 10:27:33 riastradh Exp $ */
|
||||
/* $NetBSD: db_command.c,v 1.190 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996, 1997, 1998, 1999, 2002, 2009, 2019
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.189 2023/10/15 10:27:33 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_command.c,v 1.190 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_aio.h"
|
||||
|
@ -301,8 +301,6 @@ static const struct db_command db_show_cmds[] = {
|
|||
0 ,"List all used memory pages.",NULL,NULL) },
|
||||
{ DDB_ADD_CMD("panic", db_show_panic, 0,
|
||||
"Print the current panic string",NULL,NULL) },
|
||||
{ DDB_ADD_CMD("pipe", db_show_pipe,
|
||||
0 ,"Show the contents of a pipe.",NULL,NULL) },
|
||||
{ DDB_ADD_CMD("pool", db_pool_print_cmd, 0,
|
||||
"Print the pool at address.", "[/clp] address",NULL) },
|
||||
/* added from all sub cmds */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_interface.h,v 1.42 2023/10/13 19:07:08 ad Exp $ */
|
||||
/* $NetBSD: db_interface.h,v 1.43 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1995, 2023 The NetBSD Foundation, Inc.
|
||||
|
@ -86,9 +86,6 @@ void db_show_sleepq(db_expr_t, bool, db_expr_t, const char *);
|
|||
/* kern/kern_condvar.c */
|
||||
void db_show_condvar(db_expr_t, bool, db_expr_t, const char *);
|
||||
|
||||
/* kern/sys_pipe.c */
|
||||
void db_show_pipe(db_expr_t, bool, db_expr_t, const char *);
|
||||
|
||||
/* kern/sys_select.c */
|
||||
void db_show_selinfo(db_expr_t, bool, db_expr_t, const char *);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: db_xxx.c,v 1.79 2023/10/15 10:40:52 martin Exp $ */
|
||||
/* $NetBSD: db_xxx.c,v 1.80 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1982, 1986, 1989, 1991, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.79 2023/10/15 10:40:52 martin Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.80 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_kgdb.h"
|
||||
|
@ -72,7 +72,6 @@ __KERNEL_RCSID(0, "$NetBSD: db_xxx.c,v 1.79 2023/10/15 10:40:52 martin Exp $");
|
|||
#include <sys/condvar.h>
|
||||
#include <sys/sleepq.h>
|
||||
#include <sys/selinfo.h>
|
||||
#include <sys/pipe.h>
|
||||
|
||||
#include <ddb/ddb.h>
|
||||
#include <ddb/db_user.h>
|
||||
|
@ -366,51 +365,6 @@ db_show_sleepq(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
|
|||
db_printf("\n");
|
||||
}
|
||||
|
||||
void
|
||||
db_show_pipe(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
|
||||
{
|
||||
struct pipe pipe, *ppipe = (struct pipe *)(uintptr_t)addr;
|
||||
|
||||
db_read_bytes(addr, sizeof(pipe), (char *)&pipe);
|
||||
|
||||
db_printf("pipe_lock\t\t%p\n", pipe.pipe_lock);
|
||||
|
||||
db_printf("pipe_read\t\t");
|
||||
db_show_condvar((db_addr_t)&ppipe->pipe_read, false, 0, modif);
|
||||
|
||||
db_printf("pipe_write\t\t");
|
||||
db_show_condvar((db_addr_t)&ppipe->pipe_write, false, 0, modif);
|
||||
|
||||
db_printf("pipe_busy\t\t");
|
||||
db_show_condvar((db_addr_t)&ppipe->pipe_busy, false, 0, modif);
|
||||
|
||||
db_printf("pipe_buffer.cnt\t\t%ld\n", (long)pipe.pipe_buffer.cnt);
|
||||
db_printf("pipe_buffer.in\t\t%d\n", pipe.pipe_buffer.in);
|
||||
db_printf("pipe_buffer.out\t\t%d\n", pipe.pipe_buffer.out);
|
||||
db_printf("pipe_buffer.size\t%ld\n", (long)pipe.pipe_buffer.size);
|
||||
db_printf("pipe_buffer.buffer\t%p\n", pipe.pipe_buffer.buffer);
|
||||
|
||||
db_printf("pipe_wrsel\t\t");
|
||||
db_show_selinfo((db_addr_t)&ppipe->pipe_wrsel, false, 0, modif);
|
||||
db_printf("pipe_rdsel\t\t");
|
||||
db_show_selinfo((db_addr_t)&ppipe->pipe_rdsel, false, 0, modif);
|
||||
|
||||
db_printf("pipe_atime\t\t");
|
||||
db_print_timespec(&pipe.pipe_atime);
|
||||
|
||||
db_printf("\npipe_mtime\t\t");
|
||||
db_print_timespec(&pipe.pipe_mtime);
|
||||
|
||||
db_printf("\npipe_btime\t\t");
|
||||
db_print_timespec(&pipe.pipe_btime);
|
||||
|
||||
db_printf("\npipe_kmem\t\t%lx\n", (long)pipe.pipe_kmem);
|
||||
db_printf("pipe_owner\t\t%p\n", pipe.pipe_owner);
|
||||
db_printf("pipe_wrpgid\t\t%d\n", pipe.pipe_wrpgid);
|
||||
db_printf("pipe_rdpgid\t\t%d\n", pipe.pipe_rdpgid);
|
||||
db_printf("pipe_state\t\t%#08x\n", pipe.pipe_state);
|
||||
}
|
||||
|
||||
void
|
||||
db_show_selinfo(db_expr_t addr, bool haddr, db_expr_t count, const char *modif)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_condvar.c,v 1.62 2023/10/15 10:28:00 riastradh Exp $ */
|
||||
/* $NetBSD: kern_condvar.c,v 1.63 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008, 2019, 2020, 2023
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.62 2023/10/15 10:28:00 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_condvar.c,v 1.63 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
|
@ -544,43 +544,6 @@ cv_wakeup_all(kcondvar_t *cv)
|
|||
mutex_spin_exit(mp);
|
||||
}
|
||||
|
||||
/*
|
||||
* cv_fdrestart:
|
||||
*
|
||||
* Like cv_broadcast(), but make any LWPs that share the same file
|
||||
* descriptor table as the caller return ERESTART when resuming. Used
|
||||
* to dislodge LWPs waiting for I/O that prevent a file descriptor from
|
||||
* being closed, without upsetting access to the file (not descriptor)
|
||||
* made from another direction. Rarely used thus no fast path
|
||||
* provided.
|
||||
*/
|
||||
void
|
||||
cv_fdrestart(kcondvar_t *cv)
|
||||
{
|
||||
sleepq_t *sq;
|
||||
kmutex_t *mp;
|
||||
lwp_t *l;
|
||||
|
||||
KASSERT(cv_is_valid(cv));
|
||||
|
||||
if (LIST_EMPTY(CV_SLEEPQ(cv)))
|
||||
return;
|
||||
|
||||
mp = sleepq_hashlock(cv);
|
||||
sq = CV_SLEEPQ(cv);
|
||||
while ((l = LIST_FIRST(sq)) != NULL) {
|
||||
KASSERT(l->l_sleepq == sq);
|
||||
KASSERT(l->l_mutex == mp);
|
||||
KASSERT(l->l_wchan == cv);
|
||||
/* l_fd stable at this point so no special locking needed. */
|
||||
if (l->l_fd == curlwp->l_fd) {
|
||||
l->l_flag |= LW_RESTART;
|
||||
sleepq_remove(sq, l, false);
|
||||
}
|
||||
}
|
||||
mutex_spin_exit(mp);
|
||||
}
|
||||
|
||||
/*
|
||||
* cv_has_waiters:
|
||||
*
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: kern_sleepq.c,v 1.86 2023/10/15 10:29:02 riastradh Exp $ */
|
||||
/* $NetBSD: kern_sleepq.c,v 1.87 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008, 2009, 2019, 2020, 2023
|
||||
|
@ -36,7 +36,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.86 2023/10/15 10:29:02 riastradh Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: kern_sleepq.c,v 1.87 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
|
@ -343,7 +343,7 @@ sleepq_uncatch(lwp_t *l)
|
|||
int
|
||||
sleepq_block(int timo, bool catch_p, syncobj_t *syncobj, int nlocks)
|
||||
{
|
||||
const int mask = LW_CANCELLED|LW_WEXIT|LW_WCORE|LW_PENDSIG|LW_RESTART;
|
||||
const int mask = LW_CANCELLED|LW_WEXIT|LW_WCORE|LW_PENDSIG;
|
||||
int error = 0, sig, flag;
|
||||
struct proc *p;
|
||||
lwp_t *l = curlwp;
|
||||
|
@ -360,20 +360,16 @@ sleepq_block(int timo, bool catch_p, syncobj_t *syncobj, int nlocks)
|
|||
* while we are sleeping. It is independent from LW_SINTR because
|
||||
* we don't want to leave LW_SINTR set when the LWP is not asleep.
|
||||
*/
|
||||
flag = l->l_flag;
|
||||
if (catch_p) {
|
||||
if ((flag & mask) != 0) {
|
||||
if ((flag & (LW_CANCELLED|LW_WEXIT|LW_WCORE)) != 0) {
|
||||
l->l_flag = flag & ~LW_CANCELLED;
|
||||
error = EINTR;
|
||||
early = true;
|
||||
} else if ((flag & LW_PENDSIG) != 0 &&
|
||||
sigispending(l, 0))
|
||||
early = true;
|
||||
}
|
||||
l->l_flag = (flag | LW_CATCHINTR) & ~LW_RESTART;
|
||||
if ((l->l_flag & (LW_CANCELLED|LW_WEXIT|LW_WCORE)) != 0) {
|
||||
l->l_flag &= ~LW_CANCELLED;
|
||||
error = EINTR;
|
||||
early = true;
|
||||
} else if ((l->l_flag & LW_PENDSIG) != 0 && sigispending(l, 0))
|
||||
early = true;
|
||||
l->l_flag |= LW_CATCHINTR;
|
||||
} else
|
||||
l->l_flag = flag & ~(LW_CATCHINTR | LW_RESTART);
|
||||
l->l_flag &= ~LW_CATCHINTR;
|
||||
|
||||
if (early) {
|
||||
/* lwp_unsleep() will release the lock */
|
||||
|
@ -441,8 +437,7 @@ sleepq_block(int timo, bool catch_p, syncobj_t *syncobj, int nlocks)
|
|||
(sig = issignal(l)) != 0)
|
||||
error = sleepq_sigtoerror(l, sig);
|
||||
mutex_exit(p->p_lock);
|
||||
} else if ((flag & LW_RESTART) != 0)
|
||||
error = ERESTART;
|
||||
}
|
||||
}
|
||||
|
||||
ktrcsw(0, 0, syncobj);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_socket.c,v 1.306 2023/10/13 18:50:39 ad Exp $ */
|
||||
/* $NetBSD: uipc_socket.c,v 1.307 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2002, 2007, 2008, 2009, 2023 The NetBSD Foundation, Inc.
|
||||
|
@ -71,7 +71,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.306 2023/10/13 18:50:39 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.307 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_compat_netbsd.h"
|
||||
|
@ -895,6 +895,7 @@ sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
|
|||
struct mbuf **mp, *m;
|
||||
long space, len, resid, clen, mlen;
|
||||
int error, s, dontroute, atomic;
|
||||
short wakeup_state = 0;
|
||||
|
||||
clen = 0;
|
||||
|
||||
|
@ -967,11 +968,17 @@ sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
|
|||
goto release;
|
||||
}
|
||||
sbunlock(&so->so_snd);
|
||||
if (wakeup_state & SS_RESTARTSYS) {
|
||||
error = ERESTART;
|
||||
goto out;
|
||||
}
|
||||
error = sbwait(&so->so_snd);
|
||||
if (error)
|
||||
goto out;
|
||||
wakeup_state = so->so_state;
|
||||
goto restart;
|
||||
}
|
||||
wakeup_state = 0;
|
||||
mp = ⊤
|
||||
space -= clen;
|
||||
do {
|
||||
|
@ -1153,6 +1160,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
|
|||
struct mbuf *nextrecord;
|
||||
int mbuf_removed = 0;
|
||||
const struct domain *dom;
|
||||
short wakeup_state = 0;
|
||||
|
||||
pr = so->so_proto;
|
||||
atomic = pr->pr_flags & PR_ATOMIC;
|
||||
|
@ -1263,12 +1271,16 @@ restart:
|
|||
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 1");
|
||||
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 1");
|
||||
sbunlock(&so->so_rcv);
|
||||
error = sbwait(&so->so_rcv);
|
||||
if (wakeup_state & SS_RESTARTSYS)
|
||||
error = ERESTART;
|
||||
else
|
||||
error = sbwait(&so->so_rcv);
|
||||
if (error != 0) {
|
||||
sounlock(so);
|
||||
splx(s);
|
||||
return error;
|
||||
}
|
||||
wakeup_state = so->so_state;
|
||||
goto restart;
|
||||
}
|
||||
|
||||
|
@ -1445,6 +1457,7 @@ dontblock:
|
|||
#endif
|
||||
|
||||
so->so_state &= ~SS_RCVATMARK;
|
||||
wakeup_state = 0;
|
||||
len = uio->uio_resid;
|
||||
if (so->so_oobmark && len > so->so_oobmark - offset)
|
||||
len = so->so_oobmark - offset;
|
||||
|
@ -1587,7 +1600,10 @@ dontblock:
|
|||
(*pr->pr_usrreqs->pr_rcvd)(so, flags, l);
|
||||
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2");
|
||||
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2");
|
||||
error = sbwait(&so->so_rcv);
|
||||
if (wakeup_state & SS_RESTARTSYS)
|
||||
error = ERESTART;
|
||||
else
|
||||
error = sbwait(&so->so_rcv);
|
||||
if (error != 0) {
|
||||
sbunlock(&so->so_rcv);
|
||||
sounlock(so);
|
||||
|
@ -1596,6 +1612,7 @@ dontblock:
|
|||
}
|
||||
if ((m = so->so_rcv.sb_mb) != NULL)
|
||||
nextrecord = m->m_nextpkt;
|
||||
wakeup_state = so->so_state;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1663,7 +1680,6 @@ soshutdown(struct socket *so, int how)
|
|||
void
|
||||
sorestart(struct socket *so)
|
||||
{
|
||||
|
||||
/*
|
||||
* An application has called close() on an fd on which another
|
||||
* of its threads has called a socket system call.
|
||||
|
@ -1673,9 +1689,10 @@ sorestart(struct socket *so)
|
|||
* Any other fd will block again on the 2nd syscall.
|
||||
*/
|
||||
solock(so);
|
||||
cv_fdrestart(&so->so_cv);
|
||||
cv_fdrestart(&so->so_snd.sb_cv);
|
||||
cv_fdrestart(&so->so_rcv.sb_cv);
|
||||
so->so_state |= SS_RESTARTSYS;
|
||||
cv_broadcast(&so->so_cv);
|
||||
cv_broadcast(&so->so_snd.sb_cv);
|
||||
cv_broadcast(&so->so_rcv.sb_cv);
|
||||
sounlock(so);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: uipc_syscalls.c,v 1.209 2023/10/13 18:50:39 ad Exp $ */
|
||||
/* $NetBSD: uipc_syscalls.c,v 1.210 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009, 2023 The NetBSD Foundation, Inc.
|
||||
|
@ -61,7 +61,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.209 2023/10/13 18:50:39 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.210 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#ifdef _KERNEL_OPT
|
||||
#include "opt_pipe.h"
|
||||
|
@ -175,6 +175,7 @@ do_sys_accept(struct lwp *l, int sock, struct sockaddr *name,
|
|||
file_t *fp, *fp2;
|
||||
int error, fd;
|
||||
struct socket *so, *so2;
|
||||
short wakeup_state = 0;
|
||||
|
||||
if ((fp = fd_getfile(sock)) == NULL)
|
||||
return EBADF;
|
||||
|
@ -210,10 +211,15 @@ do_sys_accept(struct lwp *l, int sock, struct sockaddr *name,
|
|||
so->so_error = ECONNABORTED;
|
||||
break;
|
||||
}
|
||||
if (wakeup_state & SS_RESTARTSYS) {
|
||||
error = ERESTART;
|
||||
goto bad;
|
||||
}
|
||||
error = sowait(so, true, 0);
|
||||
if (error) {
|
||||
goto bad;
|
||||
}
|
||||
wakeup_state = so->so_state;
|
||||
}
|
||||
if (so->so_error) {
|
||||
error = so->so_error;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locks.c,v 1.87 2023/10/13 18:48:56 ad Exp $ */
|
||||
/* $NetBSD: locks.c,v 1.88 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007-2011 Antti Kantee. All Rights Reserved.
|
||||
|
@ -26,7 +26,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.87 2023/10/13 18:48:56 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: locks.c,v 1.88 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kmem.h>
|
||||
|
@ -486,13 +486,6 @@ cv_broadcast(kcondvar_t *cv)
|
|||
rumpuser_cv_broadcast(RUMPCV(cv));
|
||||
}
|
||||
|
||||
void
|
||||
cv_fdrestart(kcondvar_t *cv)
|
||||
{
|
||||
|
||||
rumpuser_cv_broadcast(RUMPCV(cv));
|
||||
}
|
||||
|
||||
bool
|
||||
cv_has_waiters(kcondvar_t *cv)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: locks_up.c,v 1.13 2023/10/13 18:48:56 ad Exp $ */
|
||||
/* $NetBSD: locks_up.c,v 1.14 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 Antti Kantee. All Rights Reserved.
|
||||
|
@ -35,7 +35,7 @@
|
|||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.13 2023/10/13 18:48:56 ad Exp $");
|
||||
__KERNEL_RCSID(0, "$NetBSD: locks_up.c,v 1.14 2023/11/02 10:31:55 martin Exp $");
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
|
@ -421,14 +421,6 @@ cv_broadcast(kcondvar_t *cv)
|
|||
rumpuser_cv_broadcast(RUMPCV(cv));
|
||||
}
|
||||
|
||||
void
|
||||
cv_fdrestart(kcondvar_t *cv)
|
||||
{
|
||||
|
||||
/* CPU == interlock */
|
||||
rumpuser_cv_broadcast(RUMPCV(cv));
|
||||
}
|
||||
|
||||
bool
|
||||
cv_has_waiters(kcondvar_t *cv)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: condvar.h,v 1.18 2023/10/13 18:48:56 ad Exp $ */
|
||||
/* $NetBSD: condvar.h,v 1.19 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2006, 2007, 2008, 2020, 2023 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2006, 2007, 2008, 2020 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -56,7 +56,6 @@ int cv_timedwaitbt_sig(kcondvar_t *, struct kmutex *, struct bintime *,
|
|||
|
||||
void cv_signal(kcondvar_t *);
|
||||
void cv_broadcast(kcondvar_t *);
|
||||
void cv_fdrestart(kcondvar_t *);
|
||||
|
||||
bool cv_has_waiters(kcondvar_t *);
|
||||
bool cv_is_valid(kcondvar_t *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: lwp.h,v 1.230 2023/10/15 10:29:44 riastradh Exp $ */
|
||||
/* $NetBSD: lwp.h,v 1.231 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2001, 2006, 2007, 2008, 2009, 2010, 2019, 2020, 2023
|
||||
|
@ -267,7 +267,6 @@ extern int maxlwp __read_mostly; /* max number of lwps */
|
|||
#define LW_CACHECRED 0x04000000 /* Cache new process credential */
|
||||
#define LW_WREBOOT 0x08000000 /* System is rebooting, please suspend */
|
||||
#define LW_UNPARKED 0x10000000 /* Unpark op pending */
|
||||
#define LW_RESTART 0x20000000 /* Return ERESTART after waking */
|
||||
#define LW_RUMP_CLEAR 0x40000000 /* Clear curlwp in RUMP scheduler */
|
||||
#define LW_RUMP_QEXIT 0x80000000 /* LWP should exit ASAP */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: pipe.h,v 1.41 2023/10/17 10:28:06 riastradh Exp $ */
|
||||
/* $NetBSD: pipe.h,v 1.42 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1996 John S. Dyson
|
||||
|
@ -75,34 +75,34 @@ struct pipebuf {
|
|||
/*
|
||||
* Bits in pipe_state.
|
||||
*/
|
||||
#define PIPE_RDASYNC 0x001 /* Async I/O on reader side */
|
||||
#define PIPE_WRASYNC 0x002 /* Async I/O on writer side */
|
||||
#define PIPE_RDOPEN 0x010 /* Reader side open */
|
||||
#define PIPE_WROPEN 0x020 /* Writer side open */
|
||||
#define PIPE_EOF 0x100 /* Pipe is in EOF condition */
|
||||
#define PIPE_SIGNALR 0x200 /* Do selwakeup() on read(2) */
|
||||
#define PIPE_RESIZED 0x400 /* Attempted to resize */
|
||||
#define PIPE_ASYNC 0x001 /* Async I/O */
|
||||
#define PIPE_EOF 0x010 /* Pipe is in EOF condition */
|
||||
#define PIPE_SIGNALR 0x020 /* Do selwakeup() on read(2) */
|
||||
#define PIPE_LOCKFL 0x100 /* Process has exclusive access to
|
||||
pointers/data. */
|
||||
/* unused 0x200 */
|
||||
#define PIPE_RESTART 0x400 /* Return ERESTART to blocked syscalls */
|
||||
|
||||
/*
|
||||
* Per-pipe data structure.
|
||||
* Two of these are linked together to produce bi-directional pipes.
|
||||
*/
|
||||
struct pipe {
|
||||
kmutex_t *pipe_lock; /* pipe mutex */
|
||||
struct lwp *pipe_owner; /* who holds the pipe busy */
|
||||
u_int pipe_state; /* pipe status info */
|
||||
struct pipebuf pipe_buffer; /* data storage */
|
||||
kcondvar_t pipe_read; /* cv for readers */
|
||||
kcondvar_t pipe_write; /* cv for writers */
|
||||
kcondvar_t pipe_busy; /* cv for locking */
|
||||
struct selinfo pipe_wrsel; /* for compat with select */
|
||||
struct selinfo pipe_rdsel; /* for compat with select */
|
||||
struct timespec pipe_atime; /* time of last access */
|
||||
struct timespec pipe_mtime; /* time of last modify */
|
||||
struct timespec pipe_btime; /* time of creation */
|
||||
pid_t pipe_wrpgid; /* process group for sigio */
|
||||
pid_t pipe_rdpgid; /* process group for sigio */
|
||||
vaddr_t pipe_kmem; /* preallocated PIPE_SIZE buffer */
|
||||
kmutex_t *pipe_lock; /* pipe mutex */
|
||||
kcondvar_t pipe_rcv; /* cv for readers */
|
||||
kcondvar_t pipe_wcv; /* cv for writers */
|
||||
kcondvar_t pipe_draincv; /* cv for close */
|
||||
kcondvar_t pipe_lkcv; /* locking */
|
||||
struct pipebuf pipe_buffer; /* data storage */
|
||||
struct selinfo pipe_sel; /* for compat with select */
|
||||
struct timespec pipe_atime; /* time of last access */
|
||||
struct timespec pipe_mtime; /* time of last modify */
|
||||
struct timespec pipe_btime; /* time of creation */
|
||||
struct pipe *pipe_peer; /* link with other direction */
|
||||
pid_t pipe_pgid; /* process group for sigio */
|
||||
u_int pipe_state; /* pipe status info */
|
||||
int pipe_busy; /* busy flag, to handle rundown */
|
||||
vaddr_t pipe_kmem; /* preallocated PIPE_SIZE buffer */
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* $NetBSD: socketvar.h,v 1.166 2023/10/13 18:50:39 ad Exp $ */
|
||||
/* $NetBSD: socketvar.h,v 1.167 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2008, 2009, 2023 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
|
@ -197,6 +197,7 @@ struct socket {
|
|||
#define SS_CANTRCVMORE 0x020 /* can't receive more data from peer */
|
||||
#define SS_RCVATMARK 0x040 /* at mark on input */
|
||||
#define SS_ISABORTING 0x080 /* aborting fd references - close() */
|
||||
#define SS_RESTARTSYS 0x100 /* restart blocked system calls */
|
||||
#define SS_POLLRDBAND 0x200 /* poll should return POLLRDBAND */
|
||||
#define SS_MORETOCOME 0x400 /*
|
||||
* hint from sosend to lower layer;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: fstat.c,v 1.119 2023/10/13 19:07:09 ad Exp $ */
|
||||
/* $NetBSD: fstat.c,v 1.120 2023/11/02 10:31:55 martin Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1988, 1993
|
||||
|
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993\
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)fstat.c 8.3 (Berkeley) 5/2/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: fstat.c,v 1.119 2023/10/13 19:07:09 ad Exp $");
|
||||
__RCSID("$NetBSD: fstat.c,v 1.120 2023/11/02 10:31:55 martin Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
|
@ -1271,7 +1271,6 @@ static void
|
|||
ptrans(struct file *fp, struct pipe *cpipe, int i)
|
||||
{
|
||||
struct pipe cp;
|
||||
int flag;
|
||||
|
||||
PREFIX(i);
|
||||
|
||||
|
@ -1282,12 +1281,12 @@ ptrans(struct file *fp, struct pipe *cpipe, int i)
|
|||
}
|
||||
|
||||
/* pipe descriptor is either read or write, never both */
|
||||
flag = (fp->f_flag & FWRITE) ? PIPE_WRASYNC : PIPE_RDASYNC;
|
||||
(void)printf("* pipe %p %s %s%s%s", cpipe,
|
||||
(void)printf("* pipe %p %s %p %s%s%s", cpipe,
|
||||
(fp->f_flag & FWRITE) ? "->" : "<-",
|
||||
cp.pipe_peer,
|
||||
(fp->f_flag & FWRITE) ? "w" : "r",
|
||||
(fp->f_flag & FNONBLOCK) ? "n" : "",
|
||||
(cp.pipe_state & flag) ? "a" : "");
|
||||
(cp.pipe_state & PIPE_ASYNC) ? "a" : "");
|
||||
oprint(fp, "\n");
|
||||
return;
|
||||
bad:
|
||||
|
|
Loading…
Reference in New Issue