listen_backlog.c (256281) | listen_backlog.c (281974) |
---|---|
1/*- 2 * Copyright (c) 2005 Robert N. M. Watson 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * | 1/*- 2 * Copyright (c) 2005 Robert N. M. Watson 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 --- 9 unchanged lines hidden (view full) --- 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 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 * $FreeBSD: stable/10/tools/regression/sockets/listen_backlog/listen_backlog.c 150286 2005-09-18 13:42:19Z rwatson $ | 26 * $FreeBSD: stable/10/tools/regression/sockets/listen_backlog/listen_backlog.c 281974 2015-04-25 05:31:52Z ngie $ |
27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31#include <sys/sysctl.h> 32 33#include <err.h> 34#include <errno.h> --- 178 unchanged lines hidden (view full) --- 213} 214 215/* 216 * Create a socket, set the initial listen() state, then update the queue 217 * depth using listen(). Check that the backlog is as expected after both 218 * the first and second listen(). 219 */ 220static int | 27 */ 28 29#include <sys/types.h> 30#include <sys/socket.h> 31#include <sys/sysctl.h> 32 33#include <err.h> 34#include <errno.h> --- 178 unchanged lines hidden (view full) --- 213} 214 215/* 216 * Create a socket, set the initial listen() state, then update the queue 217 * depth using listen(). Check that the backlog is as expected after both 218 * the first and second listen(). 219 */ 220static int |
221socket_listen_update(int domain, int type, int protocol, int backlog, | 221socket_listen_update(int domain __unused, int type __unused, 222 int protocol __unused, int backlog, |
222 int update_backlog, int listen_backlog_assertion, 223 int update_backlog_assertion, int *sockp, const char *domainstring, 224 const char *typestring, const char *testclass, const char *test) 225{ 226 int backlog_retrieved, sock; 227 228 sock = socket(PF_INET, SOCK_STREAM, 0); 229 if (sock < 0) { --- 130 unchanged lines hidden (view full) --- 360 "SO_LISTENQLIMIT, 0) succeeded"); 361 close(sock); 362 exit(-1); 363 } 364 close(sock); 365} 366 367int | 223 int update_backlog, int listen_backlog_assertion, 224 int update_backlog_assertion, int *sockp, const char *domainstring, 225 const char *typestring, const char *testclass, const char *test) 226{ 227 int backlog_retrieved, sock; 228 229 sock = socket(PF_INET, SOCK_STREAM, 0); 230 if (sock < 0) { --- 130 unchanged lines hidden (view full) --- 361 "SO_LISTENQLIMIT, 0) succeeded"); 362 close(sock); 363 exit(-1); 364 } 365 close(sock); 366} 367 368int |
368main(int argc, char *argv[]) | 369main(void) |
369{ 370 size_t len; 371 372 len = sizeof(somaxconn); 373 if (sysctlbyname("kern.ipc.somaxconn", &somaxconn, &len, NULL, 0) 374 < 0) 375 err(-1, "sysctlbyname(kern.ipc.somaxconn)"); 376 377 test_defaults(); 378 test_listen_update(); 379 test_set_qlimit(); 380 381 return (0); 382} | 370{ 371 size_t len; 372 373 len = sizeof(somaxconn); 374 if (sysctlbyname("kern.ipc.somaxconn", &somaxconn, &len, NULL, 0) 375 < 0) 376 err(-1, "sysctlbyname(kern.ipc.somaxconn)"); 377 378 test_defaults(); 379 test_listen_update(); 380 test_set_qlimit(); 381 382 return (0); 383} |