diff options
Diffstat (limited to 'nptl/tst-cancel4-common.h')
-rw-r--r-- | nptl/tst-cancel4-common.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/nptl/tst-cancel4-common.h b/nptl/tst-cancel4-common.h index a526c0cca1..10cc4f36ce 100644 --- a/nptl/tst-cancel4-common.h +++ b/nptl/tst-cancel4-common.h @@ -62,6 +62,20 @@ static pthread_barrier_t b2; #define WRITE_BUFFER_SIZE 16384 +/* Set the send buffer of socket S to 1 byte so any send operation + done with WRITE_BUFFER_SIZE bytes will force syscall blocking. */ +static void +set_socket_buffer (int s) +{ + int val = 1; + socklen_t len = sizeof(val); + + TEST_VERIFY_EXIT (setsockopt (s, SOL_SOCKET, SO_SNDBUF, &val, + sizeof(val)) == 0); + TEST_VERIFY_EXIT (getsockopt (s, SOL_SOCKET, SO_SNDBUF, &val, &len) == 0); + TEST_VERIFY_EXIT (val < WRITE_BUFFER_SIZE); +} + /* Cleanup handling test. */ static int cl_called; |