NetBSD/lib/libc/compat/sys/compat_socket.c
mrg e2eb31d3a3 version the socket(2) syscall. for compat30 socket, we use
EPROTONOSUPPORT instead of EAFNOSUPPORT.

from pavel@ with a little bit of clean up from myself.

XXX: netbsd32 (and perhaps other emulations) should be able
XXX: to call the standard socket calls for this i think, but
XXX: revisit this at another time.
2006-06-26 21:23:56 +00:00

28 lines
665 B
C

/* $NetBSD: compat_socket.c,v 1.1 2006/06/26 21:23:56 mrg Exp $ */
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: compat_socket.c,v 1.1 2006/06/26 21:23:56 mrg Exp $");
#endif /* LIBC_SCCS and not lint */
#define __LIBC12_SOURCE__
#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <compat/sys/socket.h>
__warn_references(socket,
"warning: reference to compatibility socket(); include <sys/socket.h> for correct reference")
int
socket(int domain, int type, int protocol)
{
int res;
res = __socket30(domain, type, protocol);
if (errno == EAFNOSUPPORT)
errno = EPROTONOSUPPORT;
return res;
}