curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support from WolfSSL. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder himself.

make test: SHUT_RDWR, SHUT_RD, SHUT_WR not defined

From: Kevin R. Bulgrien via curl-library <>
Date: Mon, 19 Apr 2021 17:34:14 -0500 (CDT)

On SCO OpenServer 5.0.7, sys/socket.h does not define either SHUT_RDWR,
SHUT_RD, and SHUT_WR. This causes a problem when running `make test`.

May I suggest a patch similar to the following patch that improves the
workarounds for missing SHUT_RD, SHUT_WR, and SHUT_RDWR definitions?

$ cat curl-7.76.0-i686-pc-sco3.2v5.0.7-3.patch
--- curl-7.76.0/lib/curl_setup.h.orig 2021-03-30 07:39:12.000000000 -0500
+++ curl-7.76.0/lib/curl_setup.h 2021-04-19 15:37:51.000000000 -0500
_at__at_ -715,10 +715,12 _at__at_

- * Portable symbolic names for Winsock shutdown() mode flags.
+ * Portable symbolic names for Winsock shutdown() mode flags and other
+ * systems that do not define them.

+#if defined(USE_WINSOCK) || \
+ !defined(SHUT_RD) && (defined(HAVE_SOCKET_H) || defined(HAVE_SYS_SOCKET_H))
 # define SHUT_RD 0x00
 # define SHUT_WR 0x01
 # define SHUT_RDWR 0x02


$ grep shutdown /usr/include/sys/socket.h
int shutdown __P((int, int));

On these systems, `man SSC shutdown` mentions use of -lsocket
and documents the values to use when calling shutdown(). The
man page indicates 0 shuts off reads, 1 shuts off sends, and,
2 disallows both sends and receives.

The only /usr/include reference to SHUT_* defines appears in the
system's /usr/include/php/main/php_network.h file:

/* These are here, rather than with the win32 counterparts above,
 * since <sys/socket.h> defines them. */
#ifndef SHUT_RD
# define SHUT_RD 0
# define SHUT_WR 1
# define SHUT_RDWR 2

Kevin R. Bulgrien
Received on 2021-04-20