diff options
-rw-r--r-- | cpukit/ChangeLog | 7 | ||||
-rw-r--r-- | cpukit/libnetworking/Makefile.am | 5 | ||||
-rw-r--r-- | cpukit/libnetworking/rtems/rtems_socketpair.c | 51 |
3 files changed, 61 insertions, 2 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index 3e6f46a9ee..ef7ef19a91 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,10 @@ +2007-09-21 Joel Sherrill <joel.sherrill@oarcorp.com> + + * libnetworking/Makefile.am: Add dummy socketpair() implementation to + document what is required to provide a fully functional + implementation. + * libnetworking/rtems/rtems_socketpair.c: New file. + 2007-09-21 Ralf Corsépius <ralf.corsepius@rtems.org> * aclocal/version.m4: Bump RTEMS_API to 4.9. diff --git a/cpukit/libnetworking/Makefile.am b/cpukit/libnetworking/Makefile.am index 9042b3139b..71f5c8d158 100644 --- a/cpukit/libnetworking/Makefile.am +++ b/cpukit/libnetworking/Makefile.am @@ -121,8 +121,9 @@ libnetworking_a_SOURCES += rtems/sghostname.c rtems/issetugid.c \ rtems/rtems_showmbuf.c rtems/rtems_showroute.c rtems/rtems_showifstat.c \ rtems/rtems_showipstat.c rtems/rtems_showicmpstat.c \ rtems/rtems_showtcpstat.c rtems/rtems_showudpstat.c rtems/rtems_select.c \ - rtems/mkrootfs.c rtems/rtems_bsdnet_malloc_starvation.c -libnetworking_a_SOURCES += rtems/rtems_mii_ioctl.c rtems/rtems_mii_ioctl_kern.c + rtems/mkrootfs.c rtems/rtems_bsdnet_malloc_starvation.c \ + rtems/rtems_mii_ioctl.c rtems/rtems_mii_ioctl_kern.c \ + rtems/rtems_socketpair.c ## sys diff --git a/cpukit/libnetworking/rtems/rtems_socketpair.c b/cpukit/libnetworking/rtems/rtems_socketpair.c new file mode 100644 index 0000000000..0e0141919e --- /dev/null +++ b/cpukit/libnetworking/rtems/rtems_socketpair.c @@ -0,0 +1,51 @@ +/* + * socketpair() for RTEMS + * + * This file exists primarily to document what is required to provide + * a functional implementation of socketpair() for RTEMS. + * + * The socketpair() service requires that the "local domain" sockets + * be functional. This is denoted by the domain constants AF_LOCAL + * and AF_UNIX and the protocol constants PF_LOCAL and PF_UNIX. The + * local domain functionality is implemented in the file kern/uipc_usrreq.c + * which was not part of the initial port of the FreeBSD stack to + * RTEMS. + * + * The FreeBSD socketpair implementation appears to be dependent on + * file system features which are not available currently in RTEMS. + * + * COPYRIGHT (c) 1989-2007. + * On-Line Applications Research Corporation (OAR). + * + * The license and distribution terms for this file may be + * found in the file LICENSE in this distribution or at + * http://www.rtems.com/license/LICENSE. + * + * $Id$ + */ + +#if HAVE_CONFIG_H +#include "config.h" +#endif + +#include <unistd.h> +#include <sys/socket.h> +#include <sys/errno.h> + +int socketpair (int domain, int type, int protocol, int *rsv) +{ + if ( !rsv ) { + errno = EFAULT; + return -1; + } + + /* + * Yes, we do not support socketpair() so this is really paranoid. + * But it ensures that someone calling this routine and ignoring + * the return status will get errors from subsequent socket calls. + */ + rsv[ 0 ] = -1; + rsv[ 1 ] = -1; + errno = ENOSYS; + return -1; +} |