source: rtems/cpukit/libnetworking/rtems/rtems_socketpair.c @ cb68253

5
Last change on this file since cb68253 was cb68253, checked in by Sebastian Huber <sebastian.huber@…>, on 09/07/18 at 04:19:02

network: Use kernel/user space header files

Add and use <machine/rtems-bsd-kernel-space.h> and
<machine/rtems-bsd-user-space.h> similar to the libbsd to avoid command
line defines and defines scattered throught the code base.

Simplify cpukit/libnetworking/Makefile.am.

Update #3375.

  • Property mode set to 100644
File size: 1.5 KB
Line 
1#include <machine/rtems-bsd-kernel-space.h>
2
3/*
4 *  socketpair() for RTEMS
5 *
6 *  This file exists primarily to document what is required to provide
7 *  a functional implementation of socketpair() for RTEMS.
8 *
9 *  The socketpair() service requires that the "local domain" sockets
10 *  be functional.  This is denoted by the domain constants AF_LOCAL
11 *  and AF_UNIX and the protocol constants PF_LOCAL and PF_UNIX.  The
12 *  local domain functionality is implemented in the file kern/uipc_usrreq.c
13 *  which was not part of the initial port of the FreeBSD stack to
14 *  RTEMS.
15 *
16 *  The FreeBSD socketpair implementation appears to be dependent on
17 *  file system features which are not available currently in RTEMS.
18 *
19 *  COPYRIGHT (c) 1989-2007.
20 *  On-Line Applications Research Corporation (OAR).
21 *
22 *  The license and distribution terms for this file may be
23 *  found in the file LICENSE in this distribution or at
24 *  http://www.rtems.org/license/LICENSE.
25 */
26
27#if HAVE_CONFIG_H
28#include "config.h"
29#endif
30
31#include <unistd.h>
32#include <sys/socket.h>
33#include <errno.h>
34
35#include "rtems_syscall.h"
36
37int socketpair (int domain, int type, int protocol, int *rsv)
38{
39  if ( !rsv ) {
40    errno = EFAULT;
41    return -1;
42  }
43
44  /*
45   *  Yes, we do not support socketpair() so this is really paranoid.
46   *  But it ensures that someone calling this routine and ignoring
47   *  the return status will get errors from subsequent socket calls.
48   */
49  rsv[ 0 ] = -1;
50  rsv[ 1 ] = -1;
51  errno = ENOSYS;
52  return -1;
53}
Note: See TracBrowser for help on using the repository browser.