[rtems commit] psxhdrs: Add tests for <sys/socket.h> API compliance

Joel Sherril joel at rtems.org
Thu Feb 12 22:18:32 UTC 2015


Module:    rtems
Branch:    master
Commit:    eedaf9baba448415f31fa4e3484d800072247e1c
Changeset: http://git.rtems.org/rtems/commit/?id=eedaf9baba448415f31fa4e3484d800072247e1c

Author:    Joel Sherrill <joel.sherrill at oarcorp.com>
Date:      Wed Feb 11 14:00:35 2015 -0600

psxhdrs: Add tests for <sys/socket.h> API compliance

---

 testsuites/psxtests/configure.ac                   |  5 ++-
 testsuites/psxtests/psxhdrs/Makefile.am            | 21 ++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/accept.c    | 32 +++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/bind.c      | 32 +++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/connect.c   | 32 +++++++++++++++
 .../psxtests/psxhdrs/sys/socket/getpeername.c      | 32 +++++++++++++++
 .../psxtests/psxhdrs/sys/socket/getsockname.c      | 32 +++++++++++++++
 .../psxtests/psxhdrs/sys/socket/getsockopt.c       | 35 +++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/listen.c    | 31 +++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/recv.c      | 35 +++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c  | 37 ++++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c   | 33 ++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/send.c      | 35 +++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c   | 33 ++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/sendto.c    | 36 +++++++++++++++++
 .../psxtests/psxhdrs/sys/socket/setsockopt.c       | 35 +++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/shutdown.c  | 36 +++++++++++++++++
 testsuites/psxtests/psxhdrs/sys/socket/socket.c    | 44 +++++++++++++++++++++
 .../psxtests/psxhdrs/sys/socket/socketpair.c       | 45 ++++++++++++++++++++++
 19 files changed, 620 insertions(+), 1 deletion(-)

diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 60eb02c..00c9970 100644
--- a/testsuites/psxtests/configure.ac
+++ b/testsuites/psxtests/configure.ac
@@ -24,8 +24,11 @@ RTEMS_CANONICALIZE_TOOLS
 
 RTEMS_CHECK_CUSTOM_BSP(RTEMS_BSP)
 RTEMS_CHECK_CXX(RTEMS_BSP)
+RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API])
+RTEMS_CHECK_CPUOPTS([RTEMS_NETWORKING])
 
-AM_CONDITIONAL([HAS_NETWORKING],[test x"$HAS_NETWORKING" = x"yes"])
+AM_CONDITIONAL(HAS_CXX,test "$rtems_cv_HAS_CPLUSPLUS" = "yes")
+AM_CONDITIONAL([HAS_NETWORKING],test "$rtems_cv_RTEMS_NETWORKING" = "yes")
 AM_CONDITIONAL([HAS_CPLUSPLUS],[test x"$HAS_CPLUSPLUS" = x"yes"])
 
 RTEMS_CHECK_CPUOPTS([RTEMS_POSIX_API])
diff --git a/testsuites/psxtests/psxhdrs/Makefile.am b/testsuites/psxtests/psxhdrs/Makefile.am
index 086df57..819cd64 100644
--- a/testsuites/psxtests/psxhdrs/Makefile.am
+++ b/testsuites/psxtests/psxhdrs/Makefile.am
@@ -22,6 +22,27 @@ lib_a_SOURCES = clock01.c clock02.c clock03.c clock04.c clock05.c clock06.c \
     time08.c time09.c time10.c time11.c time12.c time13.c timer01.c \
     timer02.c timer03.c timer04.c timer05.c timer06.c timer07.c
 
+if HAS_NETWORKING
+# methods in <sys/socket.h>
+lib_a_SOURCES += sys/socket/accept.c
+lib_a_SOURCES += sys/socket/bind.c
+lib_a_SOURCES += sys/socket/connect.c
+lib_a_SOURCES += sys/socket/getpeername.c
+lib_a_SOURCES += sys/socket/getsockname.c
+lib_a_SOURCES += sys/socket/getsockopt.c
+lib_a_SOURCES += sys/socket/listen.c
+lib_a_SOURCES += sys/socket/recv.c
+lib_a_SOURCES += sys/socket/recvfrom.c
+lib_a_SOURCES += sys/socket/recvmsg.c
+lib_a_SOURCES += sys/socket/send.c
+lib_a_SOURCES += sys/socket/sendmsg.c
+lib_a_SOURCES += sys/socket/sendto.c
+lib_a_SOURCES += sys/socket/setsockopt.c
+lib_a_SOURCES += sys/socket/shutdown.c
+lib_a_SOURCES += sys/socket/socket.c
+lib_a_SOURCES += sys/socket/socketpair.c
+endif
+
 include $(RTEMS_ROOT)/make/custom/@RTEMS_BSP at .cfg
 include $(top_srcdir)/../automake/compile.am
 include $(top_srcdir)/../automake/leaf.am
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/accept.c b/testsuites/psxtests/psxhdrs/sys/socket/accept.c
new file mode 100644
index 0000000..f57ecd5
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/accept.c
@@ -0,0 +1,32 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the accept() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  struct  sockaddr addr;
+  socklen_t        addrlen;
+
+  return accept(sockfd, &addr, &addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/bind.c b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
new file mode 100644
index 0000000..8572fc2
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/bind.c
@@ -0,0 +1,32 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the bind() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  struct  sockaddr addr;
+  socklen_t        addrlen = sizeof(addr);
+
+  return bind(sockfd, &addr, addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/connect.c b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
new file mode 100644
index 0000000..2f852bf
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/connect.c
@@ -0,0 +1,32 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the connect() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  struct  sockaddr addr;
+  socklen_t        addrlen = sizeof(addr);
+
+  return connect(sockfd, &addr, addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/getpeername.c b/testsuites/psxtests/psxhdrs/sys/socket/getpeername.c
new file mode 100644
index 0000000..94c5988
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/getpeername.c
@@ -0,0 +1,32 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the getpeername() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  struct  sockaddr addr;
+  socklen_t        addrlen;
+
+  return getpeername(sockfd, &addr, &addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/getsockname.c b/testsuites/psxtests/psxhdrs/sys/socket/getsockname.c
new file mode 100644
index 0000000..53863a8
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/getsockname.c
@@ -0,0 +1,32 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the getsockname() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  struct  sockaddr addr;
+  socklen_t        addrlen;
+
+  return getsockname(sockfd, &addr, &addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
new file mode 100644
index 0000000..9554068
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
@@ -0,0 +1,35 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the getsockopt() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  int              level = SOL_SOCKET;
+  int              optname = 67;
+  int              value;
+  void            *optval = &value;
+  socklen_t        optlen;
+
+  return getsockopt(sockfd, level, optname, optval, &optlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/listen.c b/testsuites/psxtests/psxhdrs/sys/socket/listen.c
new file mode 100644
index 0000000..0edb16b
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/listen.c
@@ -0,0 +1,31 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the listen() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     sockfd = 4;
+  int     backlog = 7;
+
+  return listen(sockfd, backlog);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/recv.c b/testsuites/psxtests/psxhdrs/sys/socket/recv.c
new file mode 100644
index 0000000..05bc608
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/recv.c
@@ -0,0 +1,35 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the recv() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     sockfd = 4;
+  int     buffer;
+  void   *buf = &buffer;
+  size_t  len = sizeof(buffer);
+  int     flags = 7;
+
+
+  return recv(sockfd, buf, len, flags);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c b/testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c
new file mode 100644
index 0000000..0f9f948
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c
@@ -0,0 +1,37 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the recvfrom() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int              sockfd = 4;
+  int              buffer;
+  void            *buf = &buffer;
+  size_t           len = sizeof(buffer);
+  int              flags = 7;
+  struct  sockaddr src_addr;
+  socklen_t        addrlen;
+
+
+  return recvfrom(sockfd, buf, len, flags, &src_addr, &addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c b/testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c
new file mode 100644
index 0000000..7672326
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c
@@ -0,0 +1,33 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the recvmsg() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int           sockfd = 4;
+  struct msghdr msg;
+  int           flags = 7;
+
+
+  return recvmsg(sockfd, &msg, flags);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/send.c b/testsuites/psxtests/psxhdrs/sys/socket/send.c
new file mode 100644
index 0000000..65394a9
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/send.c
@@ -0,0 +1,35 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the send() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     sockfd = 4;
+  int     buffer;
+  void   *buf = &buffer;
+  size_t  len = sizeof(buffer);
+  int     flags = 7;
+
+
+  return send(sockfd, buf, len, flags);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
new file mode 100644
index 0000000..bf6115b
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
@@ -0,0 +1,33 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the sendmsg() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int           sockfd = 4;
+  struct msghdr msg;
+  int           flags = 7;
+
+
+  return sendmsg(sockfd, &msg, flags);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/sendto.c b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
new file mode 100644
index 0000000..e93f4c1
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/sendto.c
@@ -0,0 +1,36 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the sendto() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int              sockfd = 4;
+  int              buffer;
+  const void      *buf = &buffer;
+  size_t           len = sizeof(buffer);
+  int              flags = 7;
+  struct  sockaddr dest_addr;
+  socklen_t        addrlen = sizeof(dest_addr);
+
+  return sendto(sockfd, buf, len, flags, &dest_addr, addrlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
new file mode 100644
index 0000000..2dd396a
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
@@ -0,0 +1,35 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the setsockopt() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+int test(void);
+
+int test(void)
+{
+  int              sockfd = 4;
+  int              level = SOL_SOCKET;
+  int              optname = 67;
+  int              value;
+  void            *optval = &value;
+  socklen_t        optlen = sizeof(value);
+
+  return setsockopt(sockfd, level, optname, optval, optlen);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/shutdown.c b/testsuites/psxtests/psxhdrs/sys/socket/shutdown.c
new file mode 100644
index 0000000..d804295
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/shutdown.c
@@ -0,0 +1,36 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the shutdown() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     sockfd = 4;
+  int     how;
+
+  /* use all values */
+  how = SHUT_RD;
+  how = SHUT_WR;
+  how = SHUT_RDWR;
+
+  return shutdown(sockfd, how);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/socket.c b/testsuites/psxtests/psxhdrs/sys/socket/socket.c
new file mode 100644
index 0000000..ac692fe
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/socket.c
@@ -0,0 +1,44 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the socket() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     domain;
+  int     type;
+  int     protocol = 1;
+
+  /* use primary values */
+  domain = AF_UNIX;
+  domain = AF_LOCAL;
+  domain = AF_INET;
+
+  /* use some types */
+  type = SOCK_STREAM;
+  type = SOCK_DGRAM;
+  type = SOCK_SEQPACKET;
+  type = SOCK_RAW;
+  type = SOCK_RDM;
+
+  return socket(domain, type, protocol);
+}
diff --git a/testsuites/psxtests/psxhdrs/sys/socket/socketpair.c b/testsuites/psxtests/psxhdrs/sys/socket/socketpair.c
new file mode 100644
index 0000000..9cc67a9
--- /dev/null
+++ b/testsuites/psxtests/psxhdrs/sys/socket/socketpair.c
@@ -0,0 +1,45 @@
+/**
+ *  @file
+ *
+ *  This test file is used to verify that the socketpair() method has the
+ *  correct signature.
+ */
+
+/*
+ *  COPYRIGHT (c) 2015.
+ *  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.org/license/LICENSE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <sys/socket.h>
+
+ssize_t test(void);
+
+ssize_t test(void)
+{
+  int     domain;
+  int     type;
+  int     protocol = 1;
+  int     sv[2] = { 2, 3 };
+
+  /* use primary values */
+  domain = AF_UNIX;
+  domain = AF_LOCAL;
+  domain = AF_INET;
+
+  /* use some types */
+  type = SOCK_STREAM;
+  type = SOCK_DGRAM;
+  type = SOCK_SEQPACKET;
+  type = SOCK_RAW;
+  type = SOCK_RDM;
+
+  return socketpair(domain, type, protocol, sv);
+}




More information about the vc mailing list