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