summaryrefslogtreecommitdiff
path: root/sys/kern/sys_socket.c
diff options
context:
space:
mode:
authorriastradh <riastradh@NetBSD.org>2023-04-22 13:52:54 +0000
committerriastradh <riastradh@NetBSD.org>2023-04-22 13:52:54 +0000
commitca38e52195090063cad0680fa8cf71c23583a7dc (patch)
tree2d58bb503661ae3c7752f3e8b58a0c8cb868f5c6 /sys/kern/sys_socket.c
parent86ada786f403b5b3de8e1cb68a322acfce393fa8 (diff)
file(9): New fo_fpathconf operation.
XXX kernel revbump -- struct fileops API and ABI change
Diffstat (limited to 'sys/kern/sys_socket.c')
-rw-r--r--sys/kern/sys_socket.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 8135a8a1e55..eb1c5dc1969 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_socket.c,v 1.79 2020/11/17 03:22:33 chs Exp $ */
+/* $NetBSD: sys_socket.c,v 1.80 2023/04/22 13:52:54 riastradh Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.79 2020/11/17 03:22:33 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.80 2023/04/22 13:52:54 riastradh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -80,6 +80,8 @@ __KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.79 2020/11/17 03:22:33 chs Exp $");
#include <net/if.h>
#include <net/route.h>
+static int soo_fpathconf(struct file *, int, register_t *);
+
const struct fileops socketops = {
.fo_name = "socket",
.fo_read = soo_read,
@@ -91,6 +93,7 @@ const struct fileops socketops = {
.fo_close = soo_close,
.fo_kqfilter = soo_kqfilter,
.fo_restart = soo_restart,
+ .fo_fpathconf = soo_fpathconf,
};
int (*ifioctl)(struct socket *, u_long, void *, struct lwp *) = (void *)eopnotsupp;
@@ -263,3 +266,16 @@ soo_restart(file_t *fp)
sorestart(fp->f_socket);
}
+
+static int
+soo_fpathconf(struct file *fp, int name, register_t *retval)
+{
+
+ switch (name) {
+ case _PC_PIPE_BUF:
+ *retval = PIPE_BUF;
+ return 0;
+ default:
+ return EINVAL;
+ }
+}