xref: /freebsd/lib/libc/sys/Makefile.inc (revision c5405d1c850765d04f74067ebb71f57e9a26b8ea)
1
2# sys sources
3.PATH: ${LIBC_SRCTOP}/${LIBC_ARCH}/sys ${LIBC_SRCTOP}/sys
4
5# Include the generated makefile containing the *complete* list
6# of syscall names in MIASM.
7.include "${SRCTOP}/sys/sys/syscall.mk"
8
9# Include machine dependent definitions.
10#
11# MDASM names override the default syscall names in MIASM.
12# NOASM will prevent the default syscall code from being generated.
13# PSEUDO generates _<sys>() and __sys_<sys>() symbols, but not <sys>().
14#
15# While historically machine dependent, all architectures have the following
16# declarations in common:
17#
18NOASM=	exit.o \
19	getlogin.o \
20	sstk.o \
21	yield.o
22PSEUDO=	_exit.o \
23	_getlogin.o
24.sinclude "${LIBC_SRCTOP}/${LIBC_ARCH}/sys/Makefile.inc"
25
26SRCS+= clock_gettime.c gettimeofday.c __vdso_gettimeofday.c
27NOASM+=  clock_gettime.o gettimeofday.o
28PSEUDO+= _clock_gettime.o _gettimeofday.o
29
30# Sources common to both syscall interfaces:
31SRCS+=	\
32	__error.c \
33	interposing_table.c
34
35SRCS+= getdents.c lstat.c mknod.c stat.c
36
37NOASM+=  sched_getcpu.o
38PSEUDO+= _sched_getcpu.o
39
40SRCS+= brk.c
41SRCS+= closefrom.c
42SRCS+= pipe.c
43SRCS+= shm_open.c
44SRCS+= vadvise.c
45SRCS+= POSIX2x_Fork.c
46
47SRCS+=	compat-stub.c
48
49INTERPOSED = \
50	accept \
51	accept4 \
52	aio_suspend \
53	clock_nanosleep \
54	close \
55	connect \
56	fcntl \
57	fdatasync \
58	fsync \
59	fork \
60	kevent \
61	msync \
62	nanosleep \
63	open \
64	openat \
65	pdfork \
66	poll \
67	ppoll \
68	pselect \
69	ptrace \
70	read \
71	readv \
72	recvfrom \
73	recvmsg \
74	select \
75	sendmsg \
76	sendto \
77	setcontext \
78	sigaction \
79	sigprocmask \
80	sigsuspend \
81	sigtimedwait \
82	sigwait \
83	sigwaitinfo \
84	swapcontext \
85	wait4 \
86	wait6 \
87	write \
88	writev
89
90SRCS+=	${INTERPOSED:S/$/.c/}
91NOASM+=	${INTERPOSED:S/$/.o/}
92PSEUDO+=	${INTERPOSED:C/^.*$/_&.o/}
93
94# Add machine dependent asm sources:
95SRCS+=${MDASM}
96
97# Look though the complete list of syscalls (MIASM) for names that are
98# not defined with machine dependent implementations (MDASM) and are
99# not declared for no generation of default code (NOASM).  Add each
100# syscall that satisfies these conditions to the ASM list.
101.for _asm in ${MIASM}
102.if (${MDASM:R:M${_asm:R}} == "")
103.if (${NOASM:R:M${_asm:R}} == "")
104ASM+=$(_asm)
105.endif
106.endif
107.endfor
108
109SASM=	${ASM:S/.o/.S/}
110
111SPSEUDO= ${PSEUDO:S/.o/.S/}
112
113SRCS+=	${SASM} ${SPSEUDO}
114
115SYM_MAPS+=	${LIBC_SRCTOP}/sys/Symbol.map
116
117# Generated files
118CLEANFILES+=	${SASM} ${SPSEUDO}
119
120.if ${MACHINE_CPUARCH} == "amd64" || ${MACHINE_CPUARCH} == "i386" || \
121    ${MACHINE_CPUARCH} == "powerpc" || ${MACHINE_CPUARCH} == "arm"
122NOTE_GNU_STACK='\t.section .note.GNU-stack,"",%%progbits\n'
123.else
124NOTE_GNU_STACK=''
125.endif
126.if ${MACHINE_CPUARCH} == "aarch64"
127FEATURE_NOTE='\#include <sys/elf_common.h>\nGNU_PROPERTY_AARCH64_FEATURE_1_NOTE(GNU_PROPERTY_AARCH64_FEATURE_1_VAL)'
128.else
129FEATURE_NOTE=''
130.endif
131
132${SASM}:
133	printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
134	printf '#include "compat.h"\n' >> ${.TARGET}
135	printf '#include "SYS.h"\nRSYSCALL(${.PREFIX})\n' >> ${.TARGET}
136	printf  ${NOTE_GNU_STACK} >>${.TARGET}
137	printf  ${FEATURE_NOTE} >> ${.TARGET}
138
139${SPSEUDO}:
140	printf '/* %sgenerated by libc/sys/Makefile.inc */\n' @ > ${.TARGET}
141	printf '#include "compat.h"\n' >> ${.TARGET}
142	printf '#include "SYS.h"\nPSEUDO(${.PREFIX:S/_//})\n' \
143	    >> ${.TARGET}
144	printf ${NOTE_GNU_STACK} >>${.TARGET}
145	printf ${FEATURE_NOTE} >> ${.TARGET}
146
147MAN+=	abort2.2 \
148	accept.2 \
149	access.2 \
150	acct.2 \
151	adjtime.2 \
152	aio_cancel.2 \
153	aio_error.2 \
154	aio_fsync.2 \
155	aio_mlock.2 \
156	aio_read.2 \
157	aio_return.2 \
158	aio_suspend.2 \
159	aio_waitcomplete.2 \
160	aio_write.2 \
161	bind.2 \
162	bindat.2 \
163	brk.2 \
164	cap_enter.2 \
165	cap_fcntls_limit.2 \
166	cap_ioctls_limit.2 \
167	cap_rights_limit.2 \
168	chdir.2 \
169	chflags.2 \
170	chmod.2 \
171	chown.2 \
172	chroot.2 \
173	clock_gettime.2 \
174	close.2 \
175	closefrom.2 \
176	connect.2 \
177	connectat.2 \
178	copy_file_range.2 \
179	cpuset.2 \
180	cpuset_getaffinity.2 \
181	cpuset_getdomain.2 \
182	dup.2 \
183	eventfd.2 \
184	execve.2 \
185	_exit.2 \
186	extattr_get_file.2 \
187	fcntl.2 \
188	ffclock.2 \
189	fhlink.2 \
190	fhopen.2 \
191	fhreadlink.2 \
192	flock.2 \
193	fork.2 \
194	fspacectl.2 \
195	fsync.2 \
196	getdirentries.2 \
197	getdtablesize.2 \
198	getfh.2 \
199	getfsstat.2 \
200	getgid.2 \
201	getgroups.2 \
202	getitimer.2 \
203	getlogin.2 \
204	getloginclass.2 \
205	getpeername.2 \
206	getpgrp.2 \
207	getpid.2 \
208	getpriority.2 \
209	getrandom.2 \
210	getrlimit.2 \
211	getrusage.2 \
212	getsid.2 \
213	getsockname.2 \
214	getsockopt.2 \
215	gettimeofday.2 \
216	getuid.2 \
217	intro.2 \
218	ioctl.2 \
219	issetugid.2 \
220	jail.2 \
221	kenv.2 \
222	kill.2 \
223	kldfind.2 \
224	kldfirstmod.2 \
225	kldload.2 \
226	kldnext.2 \
227	kldstat.2 \
228	kldsym.2 \
229	kldunload.2 \
230	kqueue.2 \
231	ktrace.2 \
232	link.2 \
233	lio_listio.2 \
234	listen.2 \
235	lseek.2 \
236	madvise.2 \
237	mincore.2 \
238	minherit.2 \
239	mkdir.2 \
240	mkfifo.2 \
241	mknod.2 \
242	mlock.2 \
243	mlockall.2 \
244	mmap.2 \
245	modfind.2 \
246	modnext.2 \
247	modstat.2 \
248	mount.2 \
249	mprotect.2 \
250	mq_close.2 \
251	mq_getattr.2 \
252	mq_notify.2 \
253	mq_open.2 \
254	mq_receive.2 \
255	mq_send.2 \
256	mq_setattr.2 \
257	mq_unlink.2 \
258	msgctl.2 \
259	msgget.2 \
260	msgrcv.2 \
261	msgsnd.2 \
262	msync.2 \
263	munmap.2 \
264	nanosleep.2 \
265	nfssvc.2 \
266	ntp_adjtime.2 \
267	open.2 \
268	pathconf.2 \
269	pdfork.2 \
270	pipe.2 \
271	poll.2 \
272	posix_fadvise.2 \
273	posix_fallocate.2 \
274	posix_openpt.2 \
275	procctl.2 \
276	profil.2 \
277	pselect.2 \
278	ptrace.2 \
279	quotactl.2 \
280	rctl_add_rule.2 \
281	read.2 \
282	readlink.2 \
283	reboot.2 \
284	recv.2 \
285	rename.2 \
286	revoke.2 \
287	rfork.2 \
288	rmdir.2 \
289	rtprio.2 \
290	sched_get_priority_max.2 \
291	sched_setparam.2 \
292	sched_setscheduler.2 \
293	sched_yield.2 \
294	sctp_generic_recvmsg.2 \
295	sctp_generic_sendmsg.2 \
296	sctp_peeloff.2 \
297	select.2 \
298	semctl.2 \
299	semget.2 \
300	semop.2 \
301	send.2 \
302	setfib.2 \
303	sendfile.2 \
304	setgroups.2 \
305	setpgid.2 \
306	setregid.2 \
307	setresuid.2 \
308	setreuid.2 \
309	setsid.2 \
310	setuid.2 \
311	shmat.2 \
312	shmctl.2 \
313	shmget.2 \
314	shm_open.2 \
315	shutdown.2 \
316	sigaction.2 \
317	sigaltstack.2 \
318	sigfastblock.2 \
319	sigpending.2 \
320	sigprocmask.2 \
321	sigqueue.2 \
322	sigreturn.2 \
323	sigstack.2 \
324	sigsuspend.2 \
325	sigwait.2 \
326	sigwaitinfo.2 \
327	socket.2 \
328	socketpair.2 \
329	stat.2 \
330	statfs.2 \
331	swapon.2 \
332	symlink.2 \
333	sync.2 \
334	sysarch.2 \
335	syscall.2 \
336	thr_exit.2 \
337	thr_kill.2 \
338	thr_new.2 \
339	thr_self.2 \
340	thr_set_name.2 \
341	thr_suspend.2 \
342	thr_wake.2 \
343	timer_create.2 \
344	timer_delete.2 \
345	timer_settime.2 \
346	timerfd.2 \
347	truncate.2 \
348	umask.2 \
349	undelete.2 \
350	unlink.2 \
351	utimensat.2 \
352	utimes.2 \
353	utrace.2 \
354	uuidgen.2 \
355	vfork.2 \
356	wait.2 \
357	write.2 \
358	_umtx_op.2
359
360MLINKS+=aio_read.2 aio_readv.2
361MLINKS+=aio_write.2 aio_writev.2
362MLINKS+=accept.2 accept4.2
363MLINKS+=access.2 eaccess.2 \
364	access.2 faccessat.2
365MLINKS+=brk.2 sbrk.2
366MLINKS+=cap_enter.2 cap_getmode.2
367MLINKS+=cap_fcntls_limit.2 cap_fcntls_get.2
368MLINKS+=cap_ioctls_limit.2 cap_ioctls_get.2
369MLINKS+=chdir.2 fchdir.2
370MLINKS+=chflags.2 chflagsat.2 \
371	chflags.2 fchflags.2 \
372	chflags.2 lchflags.2
373MLINKS+=chmod.2 fchmod.2 \
374	chmod.2 fchmodat.2 \
375	chmod.2 lchmod.2
376MLINKS+=chown.2 fchown.2 \
377	chown.2 fchownat.2 \
378	chown.2 lchown.2
379MLINKS+=clock_gettime.2 clock_getres.2 \
380	clock_gettime.2 clock_settime.2
381MLINKS+=closefrom.2 close_range.2
382MLINKS+=nanosleep.2 clock_nanosleep.2
383MLINKS+=cpuset.2 cpuset_getid.2 \
384	cpuset.2 cpuset_setid.2
385MLINKS+=cpuset_getaffinity.2 cpuset_setaffinity.2
386MLINKS+=cpuset_getdomain.2 cpuset_setdomain.2
387MLINKS+=dup.2 dup2.2
388MLINKS+=eventfd.2 eventfd_read.3 \
389	eventfd.2 eventfd_write.3
390MLINKS+=execve.2 fexecve.2
391MLINKS+=extattr_get_file.2 extattr.2 \
392	extattr_get_file.2 extattr_delete_fd.2 \
393	extattr_get_file.2 extattr_delete_file.2 \
394	extattr_get_file.2 extattr_delete_link.2 \
395	extattr_get_file.2 extattr_get_fd.2 \
396	extattr_get_file.2 extattr_get_link.2 \
397	extattr_get_file.2 extattr_list_fd.2 \
398	extattr_get_file.2 extattr_list_file.2 \
399	extattr_get_file.2 extattr_list_link.2 \
400	extattr_get_file.2 extattr_set_fd.2 \
401	extattr_get_file.2 extattr_set_file.2 \
402	extattr_get_file.2 extattr_set_link.2
403MLINKS+=ffclock.2 ffclock_getcounter.2 \
404	ffclock.2 ffclock_getestimate.2 \
405	ffclock.2 ffclock_setestimate.2
406MLINKS+=fhlink.2 fhlinkat.2
407MLINKS+=fhopen.2 fhstat.2 fhopen.2 fhstatfs.2
408MLINKS+=fork.2 _Fork.2
409MLINKS+=fsync.2 fdatasync.2
410MLINKS+=getdirentries.2 getdents.2
411MLINKS+=getfh.2 lgetfh.2 \
412	getfh.2 getfhat.2
413MLINKS+=getgid.2 getegid.2
414MLINKS+=getitimer.2 setitimer.2
415MLINKS+=getlogin.2 getlogin_r.3
416MLINKS+=getlogin.2 setlogin.2
417MLINKS+=getloginclass.2 setloginclass.2
418MLINKS+=getpgrp.2 getpgid.2
419MLINKS+=getpid.2 getppid.2
420MLINKS+=getpriority.2 setpriority.2
421MLINKS+=getrlimit.2 setrlimit.2
422MLINKS+=getsockopt.2 setsockopt.2
423MLINKS+=gettimeofday.2 settimeofday.2
424MLINKS+=getuid.2 geteuid.2
425MLINKS+=intro.2 errno.2
426MLINKS+=jail.2 jail_attach.2 \
427	jail.2 jail_get.2 \
428	jail.2 jail_remove.2 \
429	jail.2 jail_set.2
430MLINKS+=kldunload.2 kldunloadf.2
431MLINKS+=kqueue.2 kevent.2 \
432	kqueue.2 kqueuex.2 \
433	kqueue.2 EV_SET.3
434MLINKS+=link.2 linkat.2
435MLINKS+=madvise.2 posix_madvise.2
436MLINKS+=mkdir.2 mkdirat.2
437MLINKS+=mkfifo.2 mkfifoat.2
438MLINKS+=mknod.2 mknodat.2
439MLINKS+=mlock.2 munlock.2
440MLINKS+=mlockall.2 munlockall.2
441MLINKS+=modnext.2 modfnext.2
442MLINKS+=mount.2 nmount.2 \
443	mount.2 unmount.2
444MLINKS+=mq_receive.2 mq_timedreceive.2
445MLINKS+=mq_send.2 mq_timedsend.2
446MLINKS+=ntp_adjtime.2 ntp_gettime.2
447MLINKS+=open.2 openat.2
448MLINKS+=pathconf.2 fpathconf.2
449MLINKS+=pathconf.2 lpathconf.2
450MLINKS+=pdfork.2 pdgetpid.2\
451	pdfork.2 pdkill.2
452MLINKS+=pipe.2 pipe2.2
453MLINKS+=poll.2 ppoll.2
454MLINKS+=rctl_add_rule.2 rctl_get_limits.2 \
455	rctl_add_rule.2 rctl_get_racct.2 \
456	rctl_add_rule.2 rctl_get_rules.2 \
457	rctl_add_rule.2 rctl_remove_rule.2
458MLINKS+=read.2 pread.2 \
459	read.2 preadv.2 \
460	read.2 readv.2
461MLINKS+=readlink.2 readlinkat.2
462MLINKS+=recv.2 recvfrom.2 \
463	recv.2 recvmsg.2
464MLINKS+=rename.2 renameat.2
465MLINKS+=rtprio.2 rtprio_thread.2
466MLINKS+=sched_get_priority_max.2 sched_get_priority_min.2 \
467	sched_get_priority_max.2 sched_rr_get_interval.2
468MLINKS+=sched_setparam.2 sched_getparam.2
469MLINKS+=sched_setscheduler.2 sched_getscheduler.2
470MLINKS+=sctp_generic_sendmsg.2 sctp_generic_sendmsg_iov.2
471MLINKS+=select.2 FD_CLR.3 \
472	select.2 FD_ISSET.3 \
473	select.2 FD_SET.3 \
474	select.2 FD_ZERO.3
475MLINKS+=send.2 sendmsg.2 \
476	send.2 sendto.2
477MLINKS+=setpgid.2 setpgrp.2
478MLINKS+=setresuid.2 getresgid.2 \
479	setresuid.2 getresuid.2 \
480	setresuid.2 setresgid.2
481MLINKS+=setuid.2 setegid.2 \
482	setuid.2 seteuid.2 \
483	setuid.2 setgid.2
484MLINKS+=shmat.2 shmdt.2
485MLINKS+=shm_open.2 memfd_create.3 \
486	shm_open.2 shm_create_largepage.3 \
487	shm_open.2 shm_unlink.2 \
488	shm_open.2 shm_rename.2
489MLINKS+=sigwaitinfo.2 sigtimedwait.2
490MLINKS+=stat.2 fstat.2 \
491	stat.2 fstatat.2 \
492	stat.2 lstat.2
493MLINKS+=statfs.2 fstatfs.2
494MLINKS+=swapon.2 swapoff.2
495MLINKS+=symlink.2 symlinkat.2
496MLINKS+=syscall.2 __syscall.2
497MLINKS+=timer_settime.2 timer_getoverrun.2 \
498	timer_settime.2 timer_gettime.2
499MLINKS+=timerfd.2 timerfd_create.2 \
500	timerfd.2 timerfd_gettime.2 \
501	timerfd.2 timerfd_settime.2
502MLINKS+=thr_kill.2 thr_kill2.2
503MLINKS+=truncate.2 ftruncate.2
504MLINKS+=unlink.2 unlinkat.2
505MLINKS+=unlink.2 funlinkat.2
506MLINKS+=utimensat.2 futimens.2
507MLINKS+=utimes.2 futimes.2 \
508	utimes.2 futimesat.2 \
509	utimes.2 lutimes.2
510MLINKS+=wait.2 wait3.2 \
511	wait.2 wait4.2 \
512	wait.2 waitpid.2 \
513	wait.2 waitid.2 \
514	wait.2 wait6.2
515MLINKS+=write.2 pwrite.2 \
516	write.2 pwritev.2 \
517	write.2 writev.2
518