mkdir-p: Depend on 'mkdir'.
[gnulib.git] / tests / test-nonblocking-socket.h
blobd1a0fd75d7f537d1b2b93e2d1f1c76514f35f661
1 /* Test for nonblocking read and write.
3 Copyright (C) 2011-2018 Free Software Foundation, Inc.
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3 of the License, or
8 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <https://www.gnu.org/licenses/>. */
18 /* A data block ought to be larger than the size of the in-kernel buffer.
19 Working values of SOCKET_DATA_BLOCK_SIZE, depending on kernel:
21 Platform SOCKET_DATA_BLOCK_SIZE
23 Linux >= 7350000 (depends on circumstances)
24 FreeBSD >= 107521
25 OpenBSD >= 106430 (depends on circumstances)
26 Mac OS X >= 680000 (depends on circumstances)
27 AIX 5.1 >= 125713
28 AIX 7.1 >= 200000 (depends on circumstances)
29 HP-UX >= 114689
30 IRIX >= 61089
31 OSF/1 >= 122881
32 Solaris 7 >= 63000 (depends on circumstances)
33 Solaris 8 >= 49153
34 Solaris 9 >= 73729
35 Solaris 10 >= 98305
36 Solaris 11 2010-11 >= 73729
37 Cygwin 1.5.x >= 66294401 but then write() fails with ENOBUFS
38 Cygwin 1.7.x >= 163838 (depends on circumstances)
39 native Windows >= 66294401
41 #define SOCKET_DATA_BLOCK_SIZE 1000000
43 /* On Linux, Mac OS X, Cygwin 1.5.x, native Windows,
44 sockets have very large buffers in the kernel, so that write() calls
45 succeed before the reader has started reading, even if fd is blocking
46 and the amount of data is larger than 1 MB. */
47 #if defined __linux__ || (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __CYGWIN__
48 # define SOCKET_HAS_LARGE_BUFFER 1
49 #else
50 # define SOCKET_HAS_LARGE_BUFFER 0
51 #endif