be atomically read from any context.
ok bluhm@, visa@
-/* $OpenBSD: kern_pledge.c,v 1.227 2018/01/08 11:54:28 mpi Exp $ */
+/* $OpenBSD: kern_pledge.c,v 1.228 2018/01/09 15:14:23 mpi Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
}
int
-pledge_socket(struct proc *p, int domain, int state)
+pledge_socket(struct proc *p, int domain, unsigned int state)
{
if (! ISSET(p->p_p->ps_flags, PS_PLEDGE))
return 0;
-/* $OpenBSD: uipc_socket.c,v 1.213 2018/01/02 12:54:07 mpi Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.214 2018/01/09 15:14:23 mpi Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
u_long len, off, oobmark;
long space;
int error = 0, maxreached = 0;
- short state;
+ unsigned int state;
soassertlocked(so);
-/* $OpenBSD: uipc_syscalls.c,v 1.161 2018/01/02 06:38:45 guenther Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.162 2018/01/09 15:14:23 mpi Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
struct file *fp;
int type = SCARG(uap, type);
int domain = SCARG(uap, domain);
- int fd, error, ss = 0;
+ int fd, error;
+ unsigned int ss = 0;
if ((type & SOCK_DNS) && !(domain == AF_INET || domain == AF_INET6))
return (EINVAL);
-/* $OpenBSD: tcp_usrreq.c,v 1.162 2017/12/01 10:33:33 bluhm Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.163 2018/01/09 15:14:23 mpi Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
inp = sotoinpcb(so);
tp = tcp_newtcpcb(inp);
if (tp == NULL) {
- int nofd = so->so_state & SS_NOFDREF; /* XXX */
+ unsigned int nofd = so->so_state & SS_NOFDREF; /* XXX */
so->so_state &= ~SS_NOFDREF; /* don't free the socket yet */
in_pcbdetach(inp);
-/* $OpenBSD: pledge.h,v 1.33 2017/12/12 01:12:34 deraadt Exp $ */
+/* $OpenBSD: pledge.h,v 1.34 2018/01/09 15:14:23 mpi Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
int pledge_adjtime(struct proc *p, const void *v);
int pledge_sendit(struct proc *p, const void *to);
int pledge_sockopt(struct proc *p, int set, int level, int optname);
-int pledge_socket(struct proc *p, int domain, int state);
+int pledge_socket(struct proc *p, int domain, unsigned int state);
int pledge_ioctl(struct proc *p, long com, struct file *);
int pledge_ioctl_drm(struct proc *p, long com, dev_t device);
int pledge_ioctl_vmm(struct proc *p, long com);
-/* $OpenBSD: socketvar.h,v 1.81 2018/01/02 12:54:07 mpi Exp $ */
+/* $OpenBSD: socketvar.h,v 1.82 2018/01/09 15:14:23 mpi Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
* private data and error information.
*/
struct socket {
+ const struct protosw *so_proto; /* protocol handle */
+ void *so_pcb; /* protocol control block */
+ u_int so_state; /* internal state flags SS_*, below */
short so_type; /* generic type, see socket.h */
short so_options; /* from socket call, see socket.h */
short so_linger; /* time to linger while closing */
- short so_state; /* internal state flags SS_*, below */
- void *so_pcb; /* protocol control block */
- const struct protosw *so_proto; /* protocol handle */
/*
* Variables for connection queueing.
* Socket where accepts occur is so_head in all subsidiary sockets.
short so_qlen; /* number of connections on so_q */
short so_qlimit; /* max number queued connections */
short so_timeo; /* connection timeout */
- u_short so_error; /* error affecting connection */
+ u_int so_error; /* error affecting connection */
pid_t so_pgid; /* pgid for signals */
uid_t so_siguid; /* uid of process who set so_pgid */
uid_t so_sigeuid; /* euid of process who set so_pgid */
sbspace(struct socket *so, struct sockbuf *sb)
{
KASSERT(sb == &so->so_rcv || sb == &so->so_snd);
-#if 0
- /* XXXSMP kqueue_scan() calling filt_sowrite() cannot sleep. */
- soassertlocked(so);
-#endif
return lmin(sb->sb_hiwat - sb->sb_cc, sb->sb_mbmax - sb->sb_mbcnt);
}