Diffstat (limited to 'mcon/U/sockopt.U')
1 files changed, 87 insertions, 0 deletions
diff --git a/mcon/U/sockopt.U b/mcon/U/sockopt.U
new file mode 100644
@@ -0,0 +1,87 @@
+?RCS: $Id: sockopt.U,v 184.108.40.206 1995/07/25 14:16:14 ram Exp $
+?RCS: Copyright (c) 1991-1993, Raphael Manfredi
+?RCS: You may redistribute only under the terms of the Artistic Licence,
+?RCS: as specified in the README file that comes with the distribution.
+?RCS: You may reuse parts of this distribution only within the terms of
+?RCS: that same Artistic Licence; a copy of which may be found at the root
+?RCS: of the source tree for dist 3.0.
+?RCS: $Log: sockopt.U,v $
+?RCS: Revision 220.127.116.11 1995/07/25 14:16:14 ram
+?RCS: patch56: obsoleted KEEPALIVE in favor of CAN_KEEPALIVE for consistency
+?RCS: Revision 3.0 1993/08/18 12:09:48 ram
+?RCS: Baseline for dist 3.0 netwide release.
+?MAKE:d_keepalive: cat rm contains +cc +ccflags socketlib sockethdr \
+ d_oldsock libs Oldconfig Setvar Findhdr
+?MAKE: -pick add $@ %<
+?S: This symbol conditionally defines CAN_KEEPALIVE which indicates to the C
+?S: program that setsockopt SO_KEEPALIVE will work properly.
+?C: This symbol if defined indicates to the C program that the SO_KEEPALIVE
+?C: option of setsockopt() will work as advertised in the manual.
+?H:#$d_keepalive CAN_KEEPALIVE /**/
+: see if setsockopt with SO_KEEPALIVE works as advertised
+echo " "
+case "$d_oldsock" in
+ if $contains SO_KEEPALIVE `./findhdr sys/socket.h` \
+ /dev/null >/dev/null 2>&1
+ echo "OK, let's see if SO_KEEPALIVE works as advertised..." >&4
+ $cat > socket.c <<EOP
+ int s = socket(AF_INET, SOCK_STREAM, 0);
+ if (s == -1)
+ if (-1 == setsockopt(s, SOL_SOCKET, SO_KEEPALIVE, 0, 0))
+ if $cc $ccflags $sockethdr socket.c -o socket $libs \
+ $socketlib >/dev/null 2>&1; then
+ ./socket >/dev/null 2>&1
+ case $? in
+ 0) echo "Yes, it does!"
+ 1) $cat <<EOM
+(Something went wrong -- Assuming SO_KEEPALIVE is broken)
+ 2) echo "No, it doesn't. Don't trust your manuals!!"
+ cat <<EOM
+(I can't compile the test program -- Assuming SO_KEEPALIVE is broken)
+ echo "Strange!! You have BSD 4.2 sockets but no SO_KEEPALIVE option."
+*) cat <<EOM
+As you have an old socket interface, you can't have heard of SO_KEEPALIVE.
+$rm -f socket socket.c