summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@oarcorp.com>2015-02-11 14:00:35 -0600
committerJoel Sherrill <joel.sherrill@oarcorp.com>2015-02-12 15:23:33 -0600
commiteedaf9baba448415f31fa4e3484d800072247e1c (patch)
tree2ecc1d5ad9f431ed90aced68a59ff1df18c5af3d
parentsys/socket.h: Include <sys/types.h> for ssize_t (diff)
downloadrtems-eedaf9baba448415f31fa4e3484d800072247e1c.tar.bz2
psxhdrs: Add tests for <sys/socket.h> API compliance
-rw-r--r--testsuites/psxtests/configure.ac5
-rw-r--r--testsuites/psxtests/psxhdrs/Makefile.am21
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/accept.c32
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/bind.c32
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/connect.c32
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/getpeername.c32
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/getsockname.c32
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c35
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/listen.c31
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/recv.c35
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c37
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c33
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/send.c35
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c33
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/sendto.c36
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c35
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/shutdown.c36
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/socket.c44
-rw-r--r--testsuites/psxtests/psxhdrs/sys/socket/socketpair.c45
19 files changed, 620 insertions, 1 deletions
diff --git a/testsuites/psxtests/configure.ac b/testsuites/psxtests/configure.ac
index 60eb02ccf8..00c9970062 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 086df5736e..819cd64510 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@.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 0000000000..f57ecd5410
--- /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 0000000000..8572fc20b3
--- /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 0000000000..2f852bfc97
--- /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 0000000000..94c5988466
--- /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 0000000000..53863a8b00
--- /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 0000000000..9554068a98
--- /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 0000000000..0edb16bc8b
--- /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 0000000000..05bc608b10
--- /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 0000000000..0f9f948e5d
--- /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 0000000000..76723268af
--- /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 0000000000..65394a9586
--- /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 0000000000..bf6115b00f
--- /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 0000000000..e93f4c1aac
--- /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 0000000000..2dd396a1a1
--- /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 0000000000..d804295aa3
--- /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 0000000000..ac692fe443
--- /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 0000000000..9cc67a9b63
--- /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);
+}