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