unix_cmsg.c (294645) | unix_cmsg.c (294646) |
---|---|
1/*- 2 * Copyright (c) 2005 Andrey Simonenko 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 2005 Andrey Simonenko 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 11 unchanged lines hidden (view full) --- 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 */ 26 27#include <sys/cdefs.h> |
28__FBSDID("$FreeBSD: head/tools/regression/sockets/unix_cmsg/unix_cmsg.c 294645 2016-01-23 22:44:00Z ngie $"); | 28__FBSDID("$FreeBSD: head/tools/regression/sockets/unix_cmsg/unix_cmsg.c 294646 2016-01-23 22:49:13Z ngie $"); |
29 30#include <sys/param.h> 31#include <sys/resource.h> 32#include <sys/time.h> 33#include <sys/select.h> 34#include <sys/socket.h> 35#include <sys/ucred.h> 36#include <sys/un.h> --- 41 unchanged lines hidden (view full) --- 78#endif 79 80static int t_cmsgcred(void); 81static int t_sockcred_1(void); 82static int t_sockcred_2(void); 83static int t_cmsgcred_sockcred(void); 84static int t_timeval(void); 85static int t_bintime(void); | 29 30#include <sys/param.h> 31#include <sys/resource.h> 32#include <sys/time.h> 33#include <sys/select.h> 34#include <sys/socket.h> 35#include <sys/ucred.h> 36#include <sys/un.h> --- 41 unchanged lines hidden (view full) --- 78#endif 79 80static int t_cmsgcred(void); 81static int t_sockcred_1(void); 82static int t_sockcred_2(void); 83static int t_cmsgcred_sockcred(void); 84static int t_timeval(void); 85static int t_bintime(void); |
86/* 87 * The testcase fails on 64-bit architectures (amd64), but passes on 32-bit 88 * architectures (i386); see bug 206543 89 */ 90#ifndef __LP64__ |
|
86static int t_cmsg_len(void); | 91static int t_cmsg_len(void); |
92#endif |
|
87static int t_peercred(void); 88 89struct test_func { 90 int (*func)(void); 91 const char *desc; 92}; 93 94static const struct test_func test_stream_tbl[] = { --- 20 unchanged lines hidden (view full) --- 115 { 116 .func = t_timeval, 117 .desc = "Sending, receiving timeval" 118 }, 119 { 120 .func = t_bintime, 121 .desc = "Sending, receiving bintime" 122 }, | 93static int t_peercred(void); 94 95struct test_func { 96 int (*func)(void); 97 const char *desc; 98}; 99 100static const struct test_func test_stream_tbl[] = { --- 20 unchanged lines hidden (view full) --- 121 { 122 .func = t_timeval, 123 .desc = "Sending, receiving timeval" 124 }, 125 { 126 .func = t_bintime, 127 .desc = "Sending, receiving bintime" 128 }, |
129#ifndef __LP64__ |
|
123 { 124 .func = t_cmsg_len, 125 .desc = "Check cmsghdr.cmsg_len" 126 }, | 130 { 131 .func = t_cmsg_len, 132 .desc = "Check cmsghdr.cmsg_len" 133 }, |
134#endif |
|
127 { 128 .func = t_peercred, 129 .desc = "Check LOCAL_PEERCRED socket option" 130 } 131}; 132 133#define TEST_STREAM_TBL_SIZE \ 134 (sizeof(test_stream_tbl) / sizeof(test_stream_tbl[0])) --- 18 unchanged lines hidden (view full) --- 153 { 154 .func = t_timeval, 155 .desc = "Sending, receiving timeval" 156 }, 157 { 158 .func = t_bintime, 159 .desc = "Sending, receiving bintime" 160 }, | 135 { 136 .func = t_peercred, 137 .desc = "Check LOCAL_PEERCRED socket option" 138 } 139}; 140 141#define TEST_STREAM_TBL_SIZE \ 142 (sizeof(test_stream_tbl) / sizeof(test_stream_tbl[0])) --- 18 unchanged lines hidden (view full) --- 161 { 162 .func = t_timeval, 163 .desc = "Sending, receiving timeval" 164 }, 165 { 166 .func = t_bintime, 167 .desc = "Sending, receiving bintime" 168 }, |
169#ifndef __LP64__ |
|
161 { 162 .func = t_cmsg_len, 163 .desc = "Check cmsghdr.cmsg_len" 164 } | 170 { 171 .func = t_cmsg_len, 172 .desc = "Check cmsghdr.cmsg_len" 173 } |
174#endif |
|
165}; 166 167#define TEST_DGRAM_TBL_SIZE \ 168 (sizeof(test_dgram_tbl) / sizeof(test_dgram_tbl[0])) 169 170static bool debug = false; 171static bool server_flag = true; 172static bool send_data_flag = true; --- 1651 unchanged lines hidden (view full) --- 1824} 1825 1826static int 1827t_bintime(void) 1828{ 1829 return (t_generic(t_bintime_client, t_bintime_server)); 1830} 1831 | 175}; 176 177#define TEST_DGRAM_TBL_SIZE \ 178 (sizeof(test_dgram_tbl) / sizeof(test_dgram_tbl[0])) 179 180static bool debug = false; 181static bool server_flag = true; 182static bool send_data_flag = true; --- 1651 unchanged lines hidden (view full) --- 1834} 1835 1836static int 1837t_bintime(void) 1838{ 1839 return (t_generic(t_bintime_client, t_bintime_server)); 1840} 1841 |
1842#ifndef __LP64__ |
|
1832static int 1833t_cmsg_len_client(int fd) 1834{ 1835 struct msghdr msghdr; 1836 struct iovec iov[1]; 1837 struct cmsghdr *cmsghdr; 1838 void *cmsg_data; 1839 size_t size, cmsg_size; --- 76 unchanged lines hidden (view full) --- 1916 return (rv); 1917} 1918 1919static int 1920t_cmsg_len(void) 1921{ 1922 return (t_generic(t_cmsg_len_client, t_cmsg_len_server)); 1923} | 1843static int 1844t_cmsg_len_client(int fd) 1845{ 1846 struct msghdr msghdr; 1847 struct iovec iov[1]; 1848 struct cmsghdr *cmsghdr; 1849 void *cmsg_data; 1850 size_t size, cmsg_size; --- 76 unchanged lines hidden (view full) --- 1927 return (rv); 1928} 1929 1930static int 1931t_cmsg_len(void) 1932{ 1933 return (t_generic(t_cmsg_len_client, t_cmsg_len_server)); 1934} |
1935#endif |
|
1924 1925static int 1926t_peercred_client(int fd) 1927{ 1928 struct xucred xucred; 1929 socklen_t len; 1930 1931 if (sync_recv() < 0) --- 55 unchanged lines hidden --- | 1936 1937static int 1938t_peercred_client(int fd) 1939{ 1940 struct xucred xucred; 1941 socklen_t len; 1942 1943 if (sync_recv() < 0) --- 55 unchanged lines hidden --- |