1hdr	netdb,stropts,netinet/in,netinet/tcp
2lib	fattach,getdtablesize,gethostname,getrlimit,sigblock,uname
3lib	recvmsg,sendmsg
4lib	ntohs,ntohl,htons,htonl sys/types.h sys/socket.h netinet/in.h
5mem	statvfs.f_fstr sys/types.h sys/statvfs.h
6mem	msghdr.msg_accrights sys/types.h sys/uio.h sys/socket.h
7mem	msghdr.msg_control sys/types.h sys/uio.h sys/socket.h
8mem	msghdr.msg_flags sys/types.h sys/uio.h sys/socket.h
9mem	utsname.nodeext sys/utsname.h
10sym	revents sys/types.h poll.h
11sys	file,inet/tcp_user,resource,select,socket,sockio,uio,un,utsname
12
13tst	stream_pipe note{ pipes are streams }end execute{
14	#include <sys/types.h>
15	#include <stropts.h>
16	_BEGIN_EXTERNS_
17	extern int	pipe _ARG_((int*));
18	_END_EXTERNS_
19	main()
20	{	struct strpeek	pbuf;
21		int fds[2];
22		if (pipe(fds)) return 1;
23		pbuf.flags = 0;
24		pbuf.ctlbuf.maxlen = pbuf.databuf.maxlen =
25		pbuf.ctlbuf.len = pbuf.databuf.len = 0;
26		pbuf.ctlbuf.buf = pbuf.databuf.buf = 0;
27		return ioctl(fds[0],I_PEEK,&pbuf) < 0;
28	}
29}end
30
31tst	tst_rsh run{
32	: remote shell
33	path=`echo $PATH:/usr/add-on/ucb/bin:/usr/add-on/bsd/bin:/usr/ucb:/usr/bsd | sed 's/:/ /g'`
34	rsh=ssh
35	hostname=`exec 2>/dev/null && hostname || uname -n || cat /etc/whoami || echo local`
36	for b in ssh rsh remsh
37	do	for d in $path
38		do	if	test -x $d/$b
39			then	case $b in
40				rsh)	case `$d/$b $hostname echo ok 2>/dev/null & sleep 5` in
41					ok)	;;
42					*)	continue ;;
43					esac
44					;;
45				esac
46				rsh=$d/$b
47				break 2
48			fi
49		done
50	done
51	echo '#define CS_REMOTE_SHELL	''"'$rsh'"	/* remote shell path */'
52}end
53
54tst	compile{
55	#include <sys/types.h>
56	#include <sys/socket.h>
57	int f()
58	{
59		int len;
60		struct sockaddr	sa;
61		return getsockname(0, &sa, &len);
62	}
63}end pass{
64	echo 'typedef int Sock_size_t;'
65}end fail{
66	echo 'typedef size_t Sock_size_t;'
67}end
68
69tst	cat{
70	#if _sys_inet_tcp_user
71	#define CS_LIB_V10	1
72	#else
73	#if _sys_socket && _hdr_netdb
74	#define CS_LIB_SOCKET	1
75	#if _sys_un
76	#define CS_LIB_SOCKET_UN	1
77	#if _mem_msg_accrights_msghdr && ! _mem_msg_flags_msghdr
78	#undef _mem_msg_control_msghdr
79	#endif
80	#if _lib_recvmsg && _lib_sendmsg && ( _mem_msg_accrights_msghdr || _mem_msg_control_msghdr )
81	#define CS_LIB_SOCKET_RIGHTS	1
82	#endif
83	#endif
84	#endif
85	#if _hdr_stropts && _lib_fattach && _stream_pipe
86	#define CS_LIB_STREAM	1
87	#endif
88	#endif
89	#if !_sys_statvfs
90	#define _mem_f_fstr_statvfs	1
91	#define _mem_f_fsid_statvfs	1
92	#endif
93}end
94
95tst	mem_f_fsid_statvfs compile{
96	#include <sys/types.h>
97	#include <sys/statvfs.h>
98	int foo()
99	{
100		struct statvfs	fs;
101		fs.f_fsid = 0;
102	}
103}end
104