forked from Imagelibrary/rtems
psxhdrs: Add tests for <sys/socket.h> API compliance
This commit is contained in:
@@ -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])
|
||||
|
||||
@@ -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
|
||||
|
||||
32
testsuites/psxtests/psxhdrs/sys/socket/accept.c
Normal file
32
testsuites/psxtests/psxhdrs/sys/socket/accept.c
Normal file
@@ -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);
|
||||
}
|
||||
32
testsuites/psxtests/psxhdrs/sys/socket/bind.c
Normal file
32
testsuites/psxtests/psxhdrs/sys/socket/bind.c
Normal file
@@ -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);
|
||||
}
|
||||
32
testsuites/psxtests/psxhdrs/sys/socket/connect.c
Normal file
32
testsuites/psxtests/psxhdrs/sys/socket/connect.c
Normal file
@@ -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);
|
||||
}
|
||||
32
testsuites/psxtests/psxhdrs/sys/socket/getpeername.c
Normal file
32
testsuites/psxtests/psxhdrs/sys/socket/getpeername.c
Normal file
@@ -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);
|
||||
}
|
||||
32
testsuites/psxtests/psxhdrs/sys/socket/getsockname.c
Normal file
32
testsuites/psxtests/psxhdrs/sys/socket/getsockname.c
Normal file
@@ -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);
|
||||
}
|
||||
35
testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
Normal file
35
testsuites/psxtests/psxhdrs/sys/socket/getsockopt.c
Normal file
@@ -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);
|
||||
}
|
||||
31
testsuites/psxtests/psxhdrs/sys/socket/listen.c
Normal file
31
testsuites/psxtests/psxhdrs/sys/socket/listen.c
Normal file
@@ -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);
|
||||
}
|
||||
35
testsuites/psxtests/psxhdrs/sys/socket/recv.c
Normal file
35
testsuites/psxtests/psxhdrs/sys/socket/recv.c
Normal file
@@ -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);
|
||||
}
|
||||
37
testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c
Normal file
37
testsuites/psxtests/psxhdrs/sys/socket/recvfrom.c
Normal file
@@ -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);
|
||||
}
|
||||
33
testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c
Normal file
33
testsuites/psxtests/psxhdrs/sys/socket/recvmsg.c
Normal file
@@ -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);
|
||||
}
|
||||
35
testsuites/psxtests/psxhdrs/sys/socket/send.c
Normal file
35
testsuites/psxtests/psxhdrs/sys/socket/send.c
Normal file
@@ -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);
|
||||
}
|
||||
33
testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
Normal file
33
testsuites/psxtests/psxhdrs/sys/socket/sendmsg.c
Normal file
@@ -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);
|
||||
}
|
||||
36
testsuites/psxtests/psxhdrs/sys/socket/sendto.c
Normal file
36
testsuites/psxtests/psxhdrs/sys/socket/sendto.c
Normal file
@@ -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);
|
||||
}
|
||||
35
testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
Normal file
35
testsuites/psxtests/psxhdrs/sys/socket/setsockopt.c
Normal file
@@ -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);
|
||||
}
|
||||
36
testsuites/psxtests/psxhdrs/sys/socket/shutdown.c
Normal file
36
testsuites/psxtests/psxhdrs/sys/socket/shutdown.c
Normal file
@@ -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);
|
||||
}
|
||||
44
testsuites/psxtests/psxhdrs/sys/socket/socket.c
Normal file
44
testsuites/psxtests/psxhdrs/sys/socket/socket.c
Normal file
@@ -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);
|
||||
}
|
||||
45
testsuites/psxtests/psxhdrs/sys/socket/socketpair.c
Normal file
45
testsuites/psxtests/psxhdrs/sys/socket/socketpair.c
Normal file
@@ -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);
|
||||
}
|
||||
Reference in New Issue
Block a user