-/* $OpenBSD: init_sysent.c,v 1.247 2022/09/03 12:35:29 mbuhl Exp $ */
+/* $OpenBSD: init_sysent.c,v 1.248 2022/09/03 21:13:48 mbuhl Exp $ */
/*
* System call switch table.
-/* $OpenBSD: syscalls.c,v 1.245 2022/09/03 12:35:29 mbuhl Exp $ */
+/* $OpenBSD: syscalls.c,v 1.246 2022/09/03 21:13:48 mbuhl Exp $ */
/*
* System call names.
-; $OpenBSD: syscalls.master,v 1.231 2022/09/03 12:33:44 mbuhl Exp $
+; $OpenBSD: syscalls.master,v 1.232 2022/09/03 21:13:48 mbuhl Exp $
; $NetBSD: syscalls.master,v 1.32 1996/04/23 10:24:21 mycroft Exp $
; @(#)syscalls.master 8.2 (Berkeley) 1/13/94
115 STD { int sys___realpath(const char *pathname, \
char *resolved); }
116 STD NOLOCK { int sys_recvmmsg(int s, struct mmsghdr *mmsg, \
- unsigned int vlen, unsigned int flags, \
+ unsigned int vlen, int flags, \
struct timespec *timeout); }
-117 STD NOLOCK { int sys_sendmmsg(int s, \
- struct mmsghdr *mmsg, unsigned int vlen, \
- unsigned int flags); }
+117 STD NOLOCK { int sys_sendmmsg(int s, struct mmsghdr *mmsg,\
+ unsigned int vlen, int flags); }
118 STD { int sys_getsockopt(int s, int level, int name, \
void *val, socklen_t *avalsize); }
119 STD { int sys_thrkill(pid_t tid, int signum, void *tcb); }
-/* $OpenBSD: uipc_syscalls.c,v 1.203 2022/09/03 12:33:44 mbuhl Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.204 2022/09/03 21:13:48 mbuhl Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
syscallarg(int) s;
syscallarg(struct mmsghdr *) mmsg;
syscallarg(unsigned int) vlen;
- syscallarg(unsigned int) flags;
+ syscallarg(int) flags;
} */ *uap = v;
struct mmsghdr mmsg, *mmsgp;
struct iovec aiov[UIO_SMALLIOV], *iov = aiov, *uiov;
size_t iovlen = UIO_SMALLIOV;
register_t retsnd;
unsigned int vlen, dgrams;
- int error = 0;
+ int error = 0, flags, s;
+
+ s = SCARG(uap, s);
+ flags = SCARG(uap, flags);
/* Arbitrarily capped at 1024 datagrams. */
vlen = SCARG(uap, vlen);
mmsg.msg_hdr.msg_iov = iov;
mmsg.msg_hdr.msg_flags = 0;
- error = sendit(p, SCARG(uap, s), &mmsg.msg_hdr,
- SCARG(uap, flags), &retsnd);
+ error = sendit(p, s, &mmsg.msg_hdr, flags, &retsnd);
if (error)
break;
*retval = dgrams;
- if (dgrams)
- return 0;
- return error;
+ if (error && dgrams > 0)
+ error = 0;
+
+ return (error);
}
int
syscallarg(int) s;
syscallarg(struct mmsghdr *) mmsg;
syscallarg(unsigned int) vlen;
- syscallarg(unsigned int) flags;
+ syscallarg(int) flags;
syscallarg(struct timespec *) timeout;
} */ *uap = v;
struct mmsghdr mmsg, *mmsgp;
- struct timespec ts, now;
+ struct timespec ts, now, *timeout;
struct iovec aiov[UIO_SMALLIOV], *uiov, *iov = aiov;
- struct file *fp;
- struct socket *so;
- struct timespec *timeout;
size_t iovlen = UIO_SMALLIOV;
register_t retrec;
unsigned int vlen, dgrams;
int error = 0, flags, s;
- s = SCARG(uap, s);
- if ((error = getsock(p, s, &fp)))
- return (error);
- so = (struct socket *)fp->f_data;
-
timeout = SCARG(uap, timeout);
if (timeout != NULL) {
error = copyin(timeout, &ts, sizeof(ts));
if (error)
- return error;
+ return (error);
#ifdef KTRACE
if (KTRPOINT(p, KTR_STRUCT))
ktrreltimespec(p, &ts);
#endif
+ if (!timespecisvalid(&ts))
+ return (EINVAL);
+
getnanotime(&now);
timespecadd(&now, &ts, &ts);
}
+ s = SCARG(uap, s);
flags = SCARG(uap, flags);
/* Arbitrarily capped at 1024 datagrams. */
uiov = mmsg.msg_hdr.msg_iov;
mmsg.msg_hdr.msg_iov = iov;
- mmsg.msg_hdr.msg_flags = flags;
+ mmsg.msg_hdr.msg_flags = flags & ~MSG_WAITFORONE;
error = recvit(p, s, &mmsg.msg_hdr, NULL, &retrec);
if (error) {
break;
}
- if (dgrams == 0 && flags & MSG_WAITFORONE) {
- flags &= ~MSG_WAITFORONE;
+ if (flags & MSG_WAITFORONE)
flags |= MSG_DONTWAIT;
- }
mmsg.msg_hdr.msg_iov = uiov;
mmsg.msg_len = retrec;
* will catch it next time.
*/
if (error && dgrams > 0) {
- so->so_error = error;
+ struct file *fp;
+ struct socket *so;
+
+ if (getsock(p, s, &fp) == 0) {
+ so = (struct socket *)fp->f_data;
+ so->so_error = error;
+
+ FRELE(fp, p);
+ }
error = 0;
}
- FRELE(fp, p);
return (error);
}
-/* $OpenBSD: socket.h,v 1.104 2022/09/03 12:33:45 mbuhl Exp $ */
+/* $OpenBSD: socket.h,v 1.105 2022/09/03 21:13:48 mbuhl Exp $ */
/* $NetBSD: socket.h,v 1.14 1996/02/09 18:25:36 christos Exp $ */
/*
ssize_t recv(int, void *, size_t, int);
ssize_t recvfrom(int, void *, size_t, int, struct sockaddr *, socklen_t *);
ssize_t recvmsg(int, struct msghdr *, int);
-int recvmmsg(int, struct mmsghdr *, unsigned int, unsigned int,
- struct timespec *);
+int recvmmsg(int, struct mmsghdr *, unsigned int, int, struct timespec *);
ssize_t send(int, const void *, size_t, int);
ssize_t sendto(int, const void *,
size_t, int, const struct sockaddr *, socklen_t);
ssize_t sendmsg(int, const struct msghdr *, int);
-int sendmmsg(int, struct mmsghdr *, unsigned int, unsigned int);
+int sendmmsg(int, struct mmsghdr *, unsigned int, int);
int setsockopt(int, int, int, const void *, socklen_t);
int shutdown(int, int);
int sockatmark(int);
-/* $OpenBSD: syscall.h,v 1.244 2022/09/03 12:35:29 mbuhl Exp $ */
+/* $OpenBSD: syscall.h,v 1.245 2022/09/03 21:13:48 mbuhl Exp $ */
/*
* System call numbers.
/* syscall: "__realpath" ret: "int" args: "const char *" "char *" */
#define SYS___realpath 115
-/* syscall: "recvmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "unsigned int" "struct timespec *" */
+/* syscall: "recvmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "int" "struct timespec *" */
#define SYS_recvmmsg 116
-/* syscall: "sendmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "unsigned int" */
+/* syscall: "sendmmsg" ret: "int" args: "int" "struct mmsghdr *" "unsigned int" "int" */
#define SYS_sendmmsg 117
/* syscall: "getsockopt" ret: "int" args: "int" "int" "int" "void *" "socklen_t *" */
-/* $OpenBSD: syscallargs.h,v 1.247 2022/09/03 12:35:29 mbuhl Exp $ */
+/* $OpenBSD: syscallargs.h,v 1.248 2022/09/03 21:13:48 mbuhl Exp $ */
/*
* System call argument lists.
syscallarg(int) s;
syscallarg(struct mmsghdr *) mmsg;
syscallarg(unsigned int) vlen;
- syscallarg(unsigned int) flags;
+ syscallarg(int) flags;
syscallarg(struct timespec *) timeout;
};
syscallarg(int) s;
syscallarg(struct mmsghdr *) mmsg;
syscallarg(unsigned int) vlen;
- syscallarg(unsigned int) flags;
+ syscallarg(int) flags;
};
struct sys_getsockopt_args {