add rumpuser_net_setsockopt()

This commit is contained in:
pooka 2009-09-02 19:02:51 +00:00
parent 767b154f7a
commit 87afe0b831
2 changed files with 19 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser.h,v 1.24 2009/06/10 18:34:49 pooka Exp $ */
/* $NetBSD: rumpuser.h,v 1.25 2009/09/02 19:02:51 pooka Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@ -179,5 +179,6 @@ int rumpuser_net_listen(int, int, int *);
enum rumpuser_getnametype { RUMPUSER_SOCKNAME, RUMPUSER_PEERNAME };
int rumpuser_net_getname(int, struct sockaddr *, int *,
enum rumpuser_getnametype, int *);
int rumpuser_net_setsockopt(int, int, int, const void *, int, int *);
#endif /* _RUMP_RUMPUSER_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: rumpuser_net.c,v 1.6 2009/01/26 12:08:39 pooka Exp $ */
/* $NetBSD: rumpuser_net.c,v 1.7 2009/09/02 19:02:51 pooka Exp $ */
/*
* Copyright (c) 2008 Antti Kantee. All Rights Reserved.
@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#if !defined(lint)
__RCSID("$NetBSD: rumpuser_net.c,v 1.6 2009/01/26 12:08:39 pooka Exp $");
__RCSID("$NetBSD: rumpuser_net.c,v 1.7 2009/09/02 19:02:51 pooka Exp $");
#endif /* !lint */
#include <sys/types.h>
@ -108,3 +108,18 @@ rumpuser_net_getname(int s, struct sockaddr *so, int *lenp,
return rv;
}
int
rumpuser_net_setsockopt(int s, int level, int name,
const void *data, int dlen, int *error)
{
socklen_t slen = dlen;
int rv;
rv = setsockopt(s, level, name, data, slen);
if (rv == -1)
*error = errno;
else
*error = 0;
return rv;
}