Add a prog_setsockopt (thanks kre@)
This commit is contained in:
parent
4ea9b97786
commit
a17e9ce771
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prog_ops.h,v 1.3 2014/11/06 21:29:32 christos Exp $ */
|
||||
/* $NetBSD: prog_ops.h,v 1.4 2020/04/02 18:32:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -36,36 +36,50 @@
|
||||
struct prog_ops {
|
||||
int (*op_init)(void);
|
||||
|
||||
int (*op_sysctl)(const int *, u_int, void *, size_t *,
|
||||
const void *, size_t);
|
||||
|
||||
int (*op_socket)(int, int, int);
|
||||
int (*op_setsockopt)(int, int, int, const void *, socklen_t);
|
||||
|
||||
|
||||
int (*op_open)(const char *, int, ...);
|
||||
pid_t (*op_getpid)(void);
|
||||
|
||||
ssize_t (*op_read)(int, void *, size_t);
|
||||
ssize_t (*op_write)(int, const void *, size_t);
|
||||
|
||||
int (*op_sysctl)(const int *, u_int, void *, size_t *,
|
||||
const void *, size_t);
|
||||
|
||||
int (*op_shutdown)(int, int);
|
||||
};
|
||||
extern const struct prog_ops prog_ops;
|
||||
|
||||
#define prog_init prog_ops.op_init
|
||||
|
||||
#define prog_socket prog_ops.op_socket
|
||||
#define prog_setsockopt prog_ops.op_setsockopt
|
||||
|
||||
#define prog_open prog_ops.op_open
|
||||
#define prog_getpid prog_ops.op_getpid
|
||||
|
||||
#define prog_read prog_ops.op_read
|
||||
#define prog_write prog_ops.op_write
|
||||
|
||||
#define prog_sysctl prog_ops.op_sysctl
|
||||
|
||||
#define prog_shutdown prog_ops.op_shutdown
|
||||
|
||||
#else
|
||||
#define prog_init ((int (*)(void))NULL)
|
||||
|
||||
#define prog_socket socket
|
||||
#define prog_setsockopt setsockopt
|
||||
|
||||
#define prog_open open
|
||||
#define prog_getpid getpid
|
||||
|
||||
#define prog_read read
|
||||
#define prog_write write
|
||||
|
||||
#define prog_sysctl sysctl
|
||||
#define prog_shutdown shutdown
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route.c,v 1.167 2020/03/14 22:26:39 roy Exp $ */
|
||||
/* $NetBSD: route.c,v 1.168 2020/04/02 18:32:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1989, 1991, 1993
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1989, 1991, 1993\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)route.c 8.6 (Berkeley) 4/28/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: route.c,v 1.167 2020/03/14 22:26:39 roy Exp $");
|
||||
__RCSID("$NetBSD: route.c,v 1.168 2020/04/02 18:32:31 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -212,7 +212,7 @@ main(int argc, char * const *argv)
|
||||
int on = 1;
|
||||
|
||||
sock = prog_socket(PF_ROUTE, SOCK_RAW, 0);
|
||||
if (setsockopt(sock, SOL_SOCKET, SO_RERROR,
|
||||
if (prog_setsockopt(sock, SOL_SOCKET, SO_RERROR,
|
||||
&on, sizeof(on)) == -1)
|
||||
warn("SO_RERROR");
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route_hostops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $ */
|
||||
/* $NetBSD: route_hostops.c,v 1.2 2020/04/02 18:32:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: route_hostops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
|
||||
__RCSID("$NetBSD: route_hostops.c,v 1.2 2020/04/02 18:32:31 christos Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -41,14 +41,17 @@ __RCSID("$NetBSD: route_hostops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
|
||||
#include "prog_ops.h"
|
||||
|
||||
const struct prog_ops prog_ops = {
|
||||
.op_socket = socket,
|
||||
.op_open = open,
|
||||
.op_getpid = getpid,
|
||||
|
||||
.op_read = read,
|
||||
.op_write = write,
|
||||
.op_socket = socket,
|
||||
.op_setsockopt = setsockopt,
|
||||
|
||||
.op_sysctl = sysctl,
|
||||
.op_open = open,
|
||||
.op_getpid = getpid,
|
||||
|
||||
.op_shutdown = shutdown,
|
||||
.op_read = read,
|
||||
.op_write = write,
|
||||
|
||||
.op_sysctl = sysctl,
|
||||
|
||||
.op_shutdown = shutdown,
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: route_rumpops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $ */
|
||||
/* $NetBSD: route_rumpops.c,v 1.2 2020/04/02 18:32:31 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2010 The NetBSD Foundation, Inc.
|
||||
@ -28,7 +28,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: route_rumpops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
|
||||
__RCSID("$NetBSD: route_rumpops.c,v 1.2 2020/04/02 18:32:31 christos Exp $");
|
||||
#endif /* !lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -43,16 +43,18 @@ __RCSID("$NetBSD: route_rumpops.c,v 1.1 2010/12/13 17:39:47 pooka Exp $");
|
||||
#include "prog_ops.h"
|
||||
|
||||
const struct prog_ops prog_ops = {
|
||||
.op_init = rumpclient_init,
|
||||
.op_init = rumpclient_init,
|
||||
|
||||
.op_socket = rump_sys_socket,
|
||||
.op_open = rump_sys_open,
|
||||
.op_getpid = rump_sys_getpid,
|
||||
.op_socket = rump_sys_socket,
|
||||
.op_setsockopt = rump_sys_setsockopt,
|
||||
|
||||
.op_read = rump_sys_read,
|
||||
.op_write = rump_sys_write,
|
||||
.op_open = rump_sys_open,
|
||||
.op_getpid = rump_sys_getpid,
|
||||
|
||||
.op_sysctl = rump_sys___sysctl,
|
||||
.op_read = rump_sys_read,
|
||||
.op_write = rump_sys_write,
|
||||
|
||||
.op_shutdown = rump_sys_shutdown,
|
||||
.op_sysctl = rump_sys___sysctl,
|
||||
|
||||
.op_shutdown = rump_sys_shutdown,
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user