xref: /titanic_41/usr/src/lib/libast/common/features/sys (revision 34f9b3eef6fdadbda0a846aa4d68691ac40eace5)
1*da2e3ebdSchinset	prototyped
2*da2e3ebdSchiniff	AST_SYS
3*da2e3ebdSchinref	-D_def_map_ast
4*da2e3ebdSchin
5*da2e3ebdSchinprint	#if __mips == 2 && !defined(_NO_LARGEFILE64_SOURCE)
6*da2e3ebdSchinprint	#define	_NO_LARGEFILE64_SOURCE	1
7*da2e3ebdSchinprint	#endif
8*da2e3ebdSchinprint	#if !defined(_NO_LARGEFILE64_SOURCE) && _typ_off64_t && _lib_lseek64 && _lib_stat64
9*da2e3ebdSchinprint	#if !defined(_LARGEFILE64_SOURCE)
10*da2e3ebdSchinprint	#define _LARGEFILE64_SOURCE	1
11*da2e3ebdSchinprint	#endif
12*da2e3ebdSchinprint	#if !defined(_LARGEFILE_SOURCE)
13*da2e3ebdSchinprint	#define _LARGEFILE_SOURCE	1
14*da2e3ebdSchinprint	#endif
15*da2e3ebdSchinprint	#else
16*da2e3ebdSchinprint	#undef	_LARGEFILE64_SOURCE
17*da2e3ebdSchinprint	#undef	_LARGEFILE_SOURCE
18*da2e3ebdSchinprint	#undef	_typ_off64_t
19*da2e3ebdSchinprint	#undef	_typ_struct_dirent64
20*da2e3ebdSchinprint	#undef	_lib_creat64
21*da2e3ebdSchinprint	#undef	_lib_fstat64
22*da2e3ebdSchinprint	#undef	_lib_fstatvfs64
23*da2e3ebdSchinprint	#undef	_lib_ftruncate64
24*da2e3ebdSchinprint	#undef	_lib_lseek64
25*da2e3ebdSchinprint	#undef	_lib_lstat64
26*da2e3ebdSchinprint	#undef	_lib_mmap64
27*da2e3ebdSchinprint	#undef	_lib_open64
28*da2e3ebdSchinprint	#undef	_lib_readdir64
29*da2e3ebdSchinprint	#undef	_lib_stat64
30*da2e3ebdSchinprint	#undef	_lib_statvfs64
31*da2e3ebdSchinprint	#undef	_lib_truncate64
32*da2e3ebdSchinprint	#endif
33*da2e3ebdSchin
34*da2e3ebdSchinprint	#if defined(__STDC__) && !defined(__USE_FIXED_PROTOTYPES__)
35*da2e3ebdSchinprint	#define __USE_FIXED_PROTOTYPES__	1	/* kick gcc out of the past */
36*da2e3ebdSchinprint	#endif
37*da2e3ebdSchin
38*da2e3ebdSchinheader	stdlib.h
39*da2e3ebdSchinheader	stddef.h
40*da2e3ebdSchinheader	sys/types.h
41*da2e3ebdSchinheader	stdint.h
42*da2e3ebdSchinheader	inttypes.h
43*da2e3ebdSchinheader	string.h
44*da2e3ebdSchinheader	unistd.h
45*da2e3ebdSchinheader	limits.h
46*da2e3ebdSchinheader	fcntl.h
47*da2e3ebdSchinheader	locale.h
48*da2e3ebdSchin
49*da2e3ebdSchintyp dev_t,nlink_t fail{
50*da2e3ebdSchin	echo "#ifndef $m"
51*da2e3ebdSchin	echo "#define $m	1"
52*da2e3ebdSchin	echo "typedef short $v;"
53*da2e3ebdSchin	echo "#endif"
54*da2e3ebdSchin}end
55*da2e3ebdSchintyp gid_t,mode_t,uid_t fail{
56*da2e3ebdSchin	echo "#ifndef $m"
57*da2e3ebdSchin	echo "#define $m	1"
58*da2e3ebdSchin	echo "typedef unsigned short $v;"
59*da2e3ebdSchin	echo "#endif"
60*da2e3ebdSchin}end
61*da2e3ebdSchintyp wchar_t stdio.h wchar.h fail{
62*da2e3ebdSchin	echo "#ifndef $m"
63*da2e3ebdSchin	echo "#define $m	1"
64*da2e3ebdSchin	echo "typedef unsigned short $v;"
65*da2e3ebdSchin	echo "#endif"
66*da2e3ebdSchin}end
67*da2e3ebdSchintyp pid_t,ssize_t fail{
68*da2e3ebdSchin	echo "#ifndef $m"
69*da2e3ebdSchin	echo "#define $m	1"
70*da2e3ebdSchin	echo "typedef int $v;"
71*da2e3ebdSchin	echo "#endif"
72*da2e3ebdSchin}end
73*da2e3ebdSchintyp wint_t stdio.h wchar.h fail{
74*da2e3ebdSchin	echo "#ifndef $m"
75*da2e3ebdSchin	echo "#define $m	1"
76*da2e3ebdSchin	echo "typedef int $v;"
77*da2e3ebdSchin	echo "#endif"
78*da2e3ebdSchin}end
79*da2e3ebdSchintyp socklen_t sys/socket.h fail{
80*da2e3ebdSchin	echo "#ifndef $m"
81*da2e3ebdSchin	echo "#define $m	1"
82*da2e3ebdSchin	echo "typedef int $v;"
83*da2e3ebdSchin	echo "#endif"
84*da2e3ebdSchin}end
85*da2e3ebdSchintyp size_t fail{
86*da2e3ebdSchin	echo "#ifndef $m"
87*da2e3ebdSchin	echo "#define $m	1"
88*da2e3ebdSchin	echo "typedef unsigned int $v;"
89*da2e3ebdSchin	echo "#endif"
90*da2e3ebdSchin}end
91*da2e3ebdSchintyp clock_t,ino_t,off_t,ptrdiff_t fail{
92*da2e3ebdSchin	echo "#ifndef $m"
93*da2e3ebdSchin	echo "#define $m	1"
94*da2e3ebdSchin	echo "typedef long $v;"
95*da2e3ebdSchin	echo "#endif"
96*da2e3ebdSchin}end
97*da2e3ebdSchintyp time_t fail{
98*da2e3ebdSchin	echo "#ifndef $m"
99*da2e3ebdSchin	echo "#define $m	1"
100*da2e3ebdSchin	echo "typedef unsigned long $v;"
101*da2e3ebdSchin	echo "#endif"
102*da2e3ebdSchin}end
103*da2e3ebdSchintyp div_t fail{
104*da2e3ebdSchin	echo "#ifndef $m"
105*da2e3ebdSchin	echo "#define $m	1"
106*da2e3ebdSchin	echo "typedef struct { int quot; int rem; } $v;"
107*da2e3ebdSchin	echo "#endif"
108*da2e3ebdSchin}end
109*da2e3ebdSchintyp ldiv_t fail{
110*da2e3ebdSchin	echo "#ifndef $m"
111*da2e3ebdSchin	echo "#define $m	1"
112*da2e3ebdSchin	echo "typedef struct { long quot; long rem; } $v;"
113*da2e3ebdSchin	echo "#endif"
114*da2e3ebdSchin}end
115*da2e3ebdSchintst	typ_signed_size_t output{
116*da2e3ebdSchin	#include <sys/types.h>
117*da2e3ebdSchin	int
118*da2e3ebdSchin	main()
119*da2e3ebdSchin	{
120*da2e3ebdSchin		unsigned long u = ~0;
121*da2e3ebdSchin		size_t s = ~0;
122*da2e3ebdSchin		if (s >= 0)
123*da2e3ebdSchin			return 1;
124*da2e3ebdSchin		printf("#if !defined(__cplusplus) && !defined(c_plusplus) && !defined(_typ_signed_size_t)\n/* what dipsticks made size_t signed? sun. */\ntypedef unsigned %s _ast_size_t;\n#undef\tsize_t\n#define size_t\t_ast_size_t\n#endif\n", u == (unsigned long)s ? "long" : "int");
125*da2e3ebdSchin		return 0;
126*da2e3ebdSchin	}
127*da2e3ebdSchin}end
128*da2e3ebdSchin
129*da2e3ebdSchindefine	offsetof	(type,member)	((size_t)&(((type*)0)->member))
130*da2e3ebdSchindefine	EXIT_FAILURE	1
131*da2e3ebdSchindefine	EXIT_SUCCESS	0
132*da2e3ebdSchindefine	MB_CUR_MAX	1
133*da2e3ebdSchindefine	RAND_MAX	32767
134*da2e3ebdSchin
135*da2e3ebdSchindefine	STDIN_FILENO	0
136*da2e3ebdSchindefine	STDOUT_FILENO	1
137*da2e3ebdSchindefine	STDERR_FILENO	2
138*da2e3ebdSchin
139*da2e3ebdSchindefine	NULL		0
140*da2e3ebdSchin
141*da2e3ebdSchindefine	SEEK_SET	0
142*da2e3ebdSchindefine	SEEK_CUR	1
143*da2e3ebdSchindefine	SEEK_END	2
144*da2e3ebdSchin
145*da2e3ebdSchindefine	F_OK		0
146*da2e3ebdSchindefine	X_OK		1
147*da2e3ebdSchindefine	W_OK		2
148*da2e3ebdSchindefine	R_OK		4
149*da2e3ebdSchin
150*da2e3ebdSchinprint	#if _BLD_ast && defined(__EXPORT__)
151*da2e3ebdSchinprint	#define extern	__EXPORT__
152*da2e3ebdSchinprint	#endif
153*da2e3ebdSchin
154*da2e3ebdSchinextern	_exit		void		(int)
155*da2e3ebdSchinextern	abort		void		(void)
156*da2e3ebdSchinextern	abs		int		(int)
157*da2e3ebdSchinextern	access		int		(const char*, int)
158*da2e3ebdSchinextern	alarm		unsigned	(unsigned)
159*da2e3ebdSchinextern	atexit		int		(void(*)(void))
160*da2e3ebdSchinextern	atof		double		(const char*)
161*da2e3ebdSchinextern	atoi		int		(const char*)
162*da2e3ebdSchinextern	atol		long		(const char*)
163*da2e3ebdSchinextern	bsearch		void*		(const void*, const void*, size_t, size_t, int(*)(const void*, const void*))
164*da2e3ebdSchinextern	calloc		void*		(size_t, size_t)
165*da2e3ebdSchinextern	cfree		void		(void*)
166*da2e3ebdSchinextern	chdir		int		(const char*)
167*da2e3ebdSchinextern	chown		int		(const char*, uid_t, gid_t)
168*da2e3ebdSchinextern	close		int		(int)
169*da2e3ebdSchinextern	confstr		size_t		(int, char*, size_t)
170*da2e3ebdSchinextern	div		div_t		(int, int)
171*da2e3ebdSchinextern	dup		int		(int)
172*da2e3ebdSchinextern	dup2		int		(int, int)
173*da2e3ebdSchinextern	eaccess		int		(const char*, int)
174*da2e3ebdSchinextern	execl		int		(const char*, const char*, ...)
175*da2e3ebdSchinextern	execle		int		(const char*, const char*, ...)
176*da2e3ebdSchinextern	execlp		int		(const char*, const char*, ...)
177*da2e3ebdSchinextern	execv		int		(const char*, char* const[])
178*da2e3ebdSchinextern	execve		int		(const char*, char* const[], char* const[])
179*da2e3ebdSchinextern	execve		int		(const char*, char* const[], char* const[])
180*da2e3ebdSchinextern	execvp		int		(const char*, char* const[])
181*da2e3ebdSchinextern	execvpe		int		(const char*, char* const[], char* const[])
182*da2e3ebdSchinextern	exit		void		(int)
183*da2e3ebdSchinextern	fork		pid_t		(void)
184*da2e3ebdSchinextern	fpathconf	long		(int, int)
185*da2e3ebdSchinextern	free		void		(void*)
186*da2e3ebdSchinextern	fsync		int		(int)
187*da2e3ebdSchinextern	ftruncate	int		(int, off_t)
188*da2e3ebdSchinextern	getcwd		char*		(char*, size_t)
189*da2e3ebdSchinextern	getegid		gid_t		(void)
190*da2e3ebdSchinextern	getenv		char*		(const char*)
191*da2e3ebdSchinextern	geteuid		uid_t		(void)
192*da2e3ebdSchinextern	getgid		gid_t		(void)
193*da2e3ebdSchinextern	getgroups	int		(int, gid_t[])
194*da2e3ebdSchinextern	getlogin	char*		(void)
195*da2e3ebdSchinextern	getpgrp		pid_t		(void)
196*da2e3ebdSchinextern	getpid		pid_t		(void)
197*da2e3ebdSchinextern	getppid		pid_t		(void)
198*da2e3ebdSchinextern	gettxt		char*		(const char*, const char*)
199*da2e3ebdSchinextern	getuid		uid_t		(void)
200*da2e3ebdSchinextern	isatty		int		(int)
201*da2e3ebdSchinextern	labs		long		(long)
202*da2e3ebdSchinextern	ldiv		ldiv_t		(long, long)
203*da2e3ebdSchinextern	link		int		(const char*, const char*)
204*da2e3ebdSchinextern	lseek		off_t		(int, off_t, int)
205*da2e3ebdSchinextern	malloc		void*		(size_t)
206*da2e3ebdSchinextern	mblen		int		(const char*, size_t)
207*da2e3ebdSchinextern	mbstowcs	size_t		(wchar_t*, const char*, size_t)
208*da2e3ebdSchinextern	mbtowc		int		(wchar_t*, const char*, size_t)
209*da2e3ebdSchinextern	memalign	void*		(size_t, size_t)
210*da2e3ebdSchinextern	memccpy		void*		(void*, const void*, int, size_t)
211*da2e3ebdSchinextern	memchr		void*		(const void*, int, size_t)
212*da2e3ebdSchinextern	memcmp		int		(const void*, const void*, size_t)
213*da2e3ebdSchinextern	memcpy		void*		(void*, const void*, size_t)
214*da2e3ebdSchinextern	memmove		void*		(void*, const void*, size_t)
215*da2e3ebdSchinextern	memset		void*		(void*, int, size_t)
216*da2e3ebdSchinextern	pathconf	long		(const char*, int)
217*da2e3ebdSchinextern	pause		int		(void)
218*da2e3ebdSchinextern	pipe		int		(int[])
219*da2e3ebdSchinextern	pvalloc		void*		(size_t)
220*da2e3ebdSchinextern	qsort		void		(void*, size_t, size_t, int(*)(const void*, const void*))
221*da2e3ebdSchinextern	rand		int		(void)
222*da2e3ebdSchinextern	read		ssize_t		(int, void*, size_t)
223*da2e3ebdSchinextern	realloc		void*		(void*, size_t)
224*da2e3ebdSchinextern	realpath	char*		(const char*, char*)
225*da2e3ebdSchinextern	resolvepath	char*		(const char*, char*, size_t)
226*da2e3ebdSchinextern	rmdir		int		(const char*)
227*da2e3ebdSchinextern	setgid		int		(gid_t)
228*da2e3ebdSchinextern	setpgid		int		(pid_t, pid_t)
229*da2e3ebdSchinextern	setsid		pid_t		(void)
230*da2e3ebdSchinextern	setuid		int		(uid_t)
231*da2e3ebdSchinextern	sleep		unsigned		(unsigned int)
232*da2e3ebdSchinextern	spawnveg	pid_t		(const char*, char* const[], char* const[], pid_t)
233*da2e3ebdSchinextern	srand		void		(unsigned int)
234*da2e3ebdSchinextern	strcasecmp	int		(const char*, const char*)
235*da2e3ebdSchinextern	strcat		char*		(char*, const char*)
236*da2e3ebdSchinextern	strchr		char*		(const char*, int)
237*da2e3ebdSchinextern	strcmp		int		(const char*, const char*)
238*da2e3ebdSchinextern	strcoll		int		(const char*, const char*)
239*da2e3ebdSchinextern	strcpy		char*		(char*, const char*)
240*da2e3ebdSchinextern	strcspn		size_t		(const char*, const char*)
241*da2e3ebdSchinextern	strdup		char*		(const char*)
242*da2e3ebdSchinextern	strlcat		size_t		(char*, const char*, size_t)
243*da2e3ebdSchinextern	strlcpy		size_t		(char*, const char*, size_t)
244*da2e3ebdSchinextern	strlen		size_t		(const char*)
245*da2e3ebdSchinextern	strncasecmp	int		(const char*, const char*, size_t)
246*da2e3ebdSchinextern	strncat		char*		(char*, const char*, size_t)
247*da2e3ebdSchinextern	strncmp		int		(const char*, const char*, size_t)
248*da2e3ebdSchinextern	strncpy		char*		(char*, const char*, size_t)
249*da2e3ebdSchinextern	strpbrk		char*		(const char*, const char*)
250*da2e3ebdSchinextern	strrchr		char*		(const char*, int)
251*da2e3ebdSchinextern	strspn		size_t		(const char*, const char*)
252*da2e3ebdSchinextern	strstr		char*		(const char*, const char*)
253*da2e3ebdSchinextern	strtok		char*		(char*, const char*)
254*da2e3ebdSchinextern	strxfrm		size_t		(char*, const char*, size_t)
255*da2e3ebdSchinextern	swab		void		(const void*, void*, ssize_t)
256*da2e3ebdSchinextern	sysconf		long		(int)
257*da2e3ebdSchinextern	system		int		(const char*)
258*da2e3ebdSchinextern	tcgetpgrp	pid_t		(int)
259*da2e3ebdSchinextern	tcsetpgrp	int		(int, pid_t)
260*da2e3ebdSchinextern	truncate	int		(const char*, off_t)
261*da2e3ebdSchinextern	ttyname		char*		(int)
262*da2e3ebdSchinextern	unlink		int		(const char*)
263*da2e3ebdSchinextern	valloc		void*		(size_t)
264*da2e3ebdSchinextern	wcstombs	size_t		(char*, const wchar_t*, size_t)
265*da2e3ebdSchinextern	wctomb		int		(char*, wchar_t)
266*da2e3ebdSchinextern	write		ssize_t		(int, const void*, size_t)
267*da2e3ebdSchin
268*da2e3ebdSchinprint	#undef	extern
269*da2e3ebdSchin
270*da2e3ebdSchin# <stdarg.h> is handled by proto so this must be after the last test
271*da2e3ebdSchin
272*da2e3ebdSchinprint	#include <stdarg.h>
273