Name | Date | Size | #Lines | LOC | ||
---|---|---|---|---|---|---|
.. | - | - | ||||
.gitignore | D | 03-May-2024 | 16 | 3 | 2 | |
README.md | D | 03-May-2024 | 8.1 KiB | 174 | 130 | |
affinity_linux.go | D | 03-May-2024 | 3.2 KiB | 125 | 71 | |
asm_darwin_386.s | D | 03-May-2024 | 675 | 30 | 11 | |
asm_darwin_amd64.s | D | 03-May-2024 | 678 | 30 | 11 | |
asm_darwin_arm.s | D | 03-May-2024 | 686 | 31 | 11 | |
asm_darwin_arm64.s | D | 03-May-2024 | 691 | 31 | 11 | |
asm_dragonfly_amd64.s | D | 03-May-2024 | 681 | 30 | 11 | |
asm_freebsd_386.s | D | 03-May-2024 | 676 | 30 | 11 | |
asm_freebsd_amd64.s | D | 03-May-2024 | 679 | 30 | 11 | |
asm_freebsd_arm.s | D | 03-May-2024 | 666 | 30 | 11 | |
asm_linux_386.s | D | 03-May-2024 | 1.4 KiB | 66 | 40 | |
asm_linux_amd64.s | D | 03-May-2024 | 1.2 KiB | 58 | 37 | |
asm_linux_arm.s | D | 03-May-2024 | 1.1 KiB | 57 | 36 | |
asm_linux_arm64.s | D | 03-May-2024 | 1.1 KiB | 53 | 35 | |
asm_linux_mips64x.s | D | 03-May-2024 | 1.1 KiB | 57 | 35 | |
asm_linux_mipsx.s | D | 03-May-2024 | 1.1 KiB | 55 | 32 | |
asm_linux_ppc64x.s | D | 03-May-2024 | 1.1 KiB | 57 | 35 | |
asm_linux_s390x.s | D | 03-May-2024 | 1.1 KiB | 57 | 35 | |
asm_netbsd_386.s | D | 03-May-2024 | 675 | 30 | 11 | |
asm_netbsd_amd64.s | D | 03-May-2024 | 678 | 30 | 11 | |
asm_netbsd_arm.s | D | 03-May-2024 | 665 | 30 | 11 | |
asm_openbsd_386.s | D | 03-May-2024 | 676 | 30 | 11 | |
asm_openbsd_amd64.s | D | 03-May-2024 | 679 | 30 | 11 | |
asm_openbsd_arm.s | D | 03-May-2024 | 666 | 30 | 11 | |
asm_solaris_amd64.s | D | 03-May-2024 | 426 | 18 | 5 | |
bluetooth_linux.go | D | 03-May-2024 | 655 | 36 | 24 | |
cap_freebsd.go | D | 03-May-2024 | 5 KiB | 196 | 148 | |
constants.go | D | 03-May-2024 | 285 | 14 | 6 | |
dev_darwin.go | D | 03-May-2024 | 747 | 25 | 10 | |
dev_dragonfly.go | D | 03-May-2024 | 1 KiB | 31 | 10 | |
dev_freebsd.go | D | 03-May-2024 | 1,013 | 31 | 10 | |
dev_linux.go | D | 03-May-2024 | 1.5 KiB | 43 | 18 | |
dev_netbsd.go | D | 03-May-2024 | 913 | 30 | 15 | |
dev_openbsd.go | D | 03-May-2024 | 918 | 30 | 15 | |
dirent.go | D | 03-May-2024 | 620 | 18 | 5 | |
endian_big.go | D | 03-May-2024 | 236 | 10 | 2 | |
endian_little.go | D | 03-May-2024 | 266 | 10 | 2 | |
env_unix.go | D | 03-May-2024 | 612 | 32 | 17 | |
errors_freebsd_386.go | D | 03-May-2024 | 9.2 KiB | 228 | 219 | |
errors_freebsd_amd64.go | D | 03-May-2024 | 9.2 KiB | 228 | 219 | |
errors_freebsd_arm.go | D | 03-May-2024 | 8.8 KiB | 227 | 219 | |
fcntl.go | D | 03-May-2024 | 936 | 29 | 14 | |
fcntl_linux_32bit.go | D | 03-May-2024 | 388 | 14 | 4 | |
gccgo.go | D | 03-May-2024 | 1.9 KiB | 62 | 40 | |
gccgo_c.c | D | 03-May-2024 | 1 KiB | 39 | 24 | |
gccgo_linux_amd64.go | D | 03-May-2024 | 429 | 21 | 10 | |
mkall.sh | D | 03-May-2024 | 6.1 KiB | 189 | 162 | |
mkerrors.sh | D | 03-May-2024 | 14.7 KiB | 605 | 531 | |
mkpost.go | D | 03-May-2024 | 3.1 KiB | 99 | 53 | |
mksyscall.pl | D | 03-May-2024 | 8.4 KiB | 342 | 270 | |
mksyscall_solaris.pl | D | 03-May-2024 | 6.9 KiB | 290 | 218 | |
mksysctl_openbsd.pl | D | 03-May-2024 | 5.2 KiB | 265 | 220 | |
mksysnum_darwin.pl | D | 03-May-2024 | 751 | 40 | 24 | |
mksysnum_dragonfly.pl | D | 03-May-2024 | 1 KiB | 51 | 31 | |
mksysnum_freebsd.pl | D | 03-May-2024 | 1 KiB | 51 | 31 | |
mksysnum_netbsd.pl | D | 03-May-2024 | 1.2 KiB | 59 | 38 | |
mksysnum_openbsd.pl | D | 03-May-2024 | 1 KiB | 51 | 31 | |
openbsd_pledge.go | D | 03-May-2024 | 891 | 39 | 27 | |
pagesize_unix.go | D | 03-May-2024 | 363 | 16 | 5 | |
race.go | D | 03-May-2024 | 607 | 31 | 18 | |
race0.go | D | 03-May-2024 | 505 | 26 | 13 | |
sockcmsg_linux.go | D | 03-May-2024 | 1 KiB | 37 | 21 | |
sockcmsg_unix.go | D | 03-May-2024 | 2.9 KiB | 105 | 71 | |
str.go | D | 03-May-2024 | 611 | 27 | 18 | |
syscall.go | D | 03-May-2024 | 2 KiB | 55 | 18 | |
syscall_bsd.go | D | 03-May-2024 | 15.6 KiB | 625 | 463 | |
syscall_darwin.go | D | 03-May-2024 | 18.4 KiB | 681 | 249 | |
syscall_darwin_386.go | D | 03-May-2024 | 1.7 KiB | 69 | 42 | |
syscall_darwin_amd64.go | D | 03-May-2024 | 1.6 KiB | 69 | 42 | |
syscall_darwin_arm.go | D | 03-May-2024 | 1.7 KiB | 67 | 42 | |
syscall_darwin_arm64.go | D | 03-May-2024 | 1.6 KiB | 69 | 42 | |
syscall_dragonfly.go | D | 03-May-2024 | 13.3 KiB | 524 | 163 | |
syscall_dragonfly_amd64.go | D | 03-May-2024 | 1.2 KiB | 53 | 35 | |
syscall_freebsd.go | D | 03-May-2024 | 19.7 KiB | 757 | 318 | |
syscall_freebsd_386.go | D | 03-May-2024 | 1.2 KiB | 53 | 35 | |
syscall_freebsd_amd64.go | D | 03-May-2024 | 1.2 KiB | 53 | 35 | |
syscall_freebsd_arm.go | D | 03-May-2024 | 1.2 KiB | 53 | 35 | |
syscall_linux.go | D | 03-May-2024 | 41.5 KiB | 1,475 | 850 | |
syscall_linux_386.go | D | 03-May-2024 | 10.5 KiB | 386 | 271 | |
syscall_linux_amd64.go | D | 03-May-2024 | 5.5 KiB | 163 | 72 | |
syscall_linux_amd64_gc.go | D | 03-May-2024 | 297 | 14 | 3 | |
syscall_linux_arm.go | D | 03-May-2024 | 7.7 KiB | 260 | 156 | |
syscall_linux_arm64.go | D | 03-May-2024 | 6.2 KiB | 213 | 126 | |
syscall_linux_gc.go | D | 03-May-2024 | 495 | 15 | 3 | |
syscall_linux_gc_386.go | D | 03-May-2024 | 582 | 17 | 5 | |
syscall_linux_gccgo_386.go | D | 03-May-2024 | 979 | 31 | 20 | |
syscall_linux_gccgo_arm.go | D | 03-May-2024 | 589 | 21 | 12 | |
syscall_linux_mips64x.go | D | 03-May-2024 | 6.4 KiB | 215 | 122 | |
syscall_linux_mipsx.go | D | 03-May-2024 | 7.1 KiB | 235 | 131 | |
syscall_linux_ppc64x.go | D | 03-May-2024 | 5.1 KiB | 132 | 44 | |
syscall_linux_s390x.go | D | 03-May-2024 | 9.9 KiB | 325 | 231 | |
syscall_linux_sparc64.go | D | 03-May-2024 | 5.1 KiB | 147 | 61 | |
syscall_netbsd.go | D | 03-May-2024 | 13.6 KiB | 569 | 156 | |
syscall_netbsd_386.go | D | 03-May-2024 | 735 | 34 | 21 | |
syscall_netbsd_amd64.go | D | 03-May-2024 | 730 | 34 | 21 | |
syscall_netbsd_arm.go | D | 03-May-2024 | 735 | 34 | 21 | |
syscall_openbsd.go | D | 03-May-2024 | 9.9 KiB | 369 | 134 | |
syscall_openbsd_386.go | D | 03-May-2024 | 735 | 34 | 21 | |
syscall_openbsd_amd64.go | D | 03-May-2024 | 905 | 38 | 22 | |
syscall_openbsd_arm.go | D | 03-May-2024 | 735 | 34 | 21 | |
syscall_solaris.go | D | 03-May-2024 | 20.6 KiB | 727 | 459 | |
syscall_solaris_amd64.go | D | 03-May-2024 | 509 | 24 | 13 | |
syscall_unix.go | D | 03-May-2024 | 9.6 KiB | 395 | 308 | |
syscall_unix_gc.go | D | 03-May-2024 | 606 | 16 | 6 | |
timestruct.go | D | 03-May-2024 | 2.5 KiB | 83 | 44 | |
types_darwin.go | D | 03-May-2024 | 5.5 KiB | 278 | 120 | |
types_dragonfly.go | D | 03-May-2024 | 5.5 KiB | 281 | 130 | |
types_freebsd.go | D | 03-May-2024 | 8.5 KiB | 403 | 152 | |
types_netbsd.go | D | 03-May-2024 | 5.5 KiB | 282 | 123 | |
types_openbsd.go | D | 03-May-2024 | 5.5 KiB | 283 | 130 | |
types_solaris.go | D | 03-May-2024 | 5.7 KiB | 284 | 128 | |
zerrors_darwin_386.go | D | 03-May-2024 | 72.8 KiB | 1,784 | 1,765 | |
zerrors_darwin_amd64.go | D | 03-May-2024 | 72.8 KiB | 1,784 | 1,765 | |
zerrors_darwin_arm.go | D | 03-May-2024 | 72.8 KiB | 1,784 | 1,765 | |
zerrors_darwin_arm64.go | D | 03-May-2024 | 72.8 KiB | 1,784 | 1,765 | |
zerrors_dragonfly_amd64.go | D | 03-May-2024 | 64.3 KiB | 1,587 | 1,568 | |
zerrors_freebsd_386.go | D | 03-May-2024 | 68.7 KiB | 1,765 | 1,746 | |
zerrors_freebsd_amd64.go | D | 03-May-2024 | 68.8 KiB | 1,766 | 1,747 | |
zerrors_freebsd_arm.go | D | 03-May-2024 | 69 KiB | 1,774 | 1,755 | |
zerrors_linux_386.go | D | 03-May-2024 | 113.4 KiB | 2,603 | 2,584 | |
zerrors_linux_amd64.go | D | 03-May-2024 | 113.4 KiB | 2,603 | 2,584 | |
zerrors_linux_arm.go | D | 03-May-2024 | 113.6 KiB | 2,609 | 2,590 | |
zerrors_linux_arm64.go | D | 03-May-2024 | 113 KiB | 2,594 | 2,575 | |
zerrors_linux_mips.go | D | 03-May-2024 | 113.9 KiB | 2,611 | 2,592 | |
zerrors_linux_mips64.go | D | 03-May-2024 | 113.9 KiB | 2,611 | 2,592 | |
zerrors_linux_mips64le.go | D | 03-May-2024 | 113.9 KiB | 2,611 | 2,592 | |
zerrors_linux_mipsle.go | D | 03-May-2024 | 113.9 KiB | 2,611 | 2,592 | |
zerrors_linux_ppc64.go | D | 03-May-2024 | 116.3 KiB | 2,664 | 2,645 | |
zerrors_linux_ppc64le.go | D | 03-May-2024 | 116.3 KiB | 2,664 | 2,645 | |
zerrors_linux_s390x.go | D | 03-May-2024 | 116.1 KiB | 2,663 | 2,644 | |
zerrors_linux_sparc64.go | D | 03-May-2024 | 83.9 KiB | 2,143 | 2,124 | |
zerrors_netbsd_386.go | D | 03-May-2024 | 70.6 KiB | 1,729 | 1,710 | |
zerrors_netbsd_amd64.go | D | 03-May-2024 | 70.2 KiB | 1,719 | 1,700 | |
zerrors_netbsd_arm.go | D | 03-May-2024 | 69.7 KiB | 1,708 | 1,689 | |
zerrors_openbsd_386.go | D | 03-May-2024 | 65.5 KiB | 1,601 | 1,582 | |
zerrors_openbsd_amd64.go | D | 03-May-2024 | 69.9 KiB | 1,707 | 1,688 | |
zerrors_openbsd_arm.go | D | 03-May-2024 | 65.5 KiB | 1,603 | 1,584 | |
zerrors_solaris_amd64.go | D | 03-May-2024 | 56.7 KiB | 1,498 | 1,479 | |
zptrace386_linux.go | D | 03-May-2024 | 1.8 KiB | 81 | 62 | |
zptracearm_linux.go | D | 03-May-2024 | 1.2 KiB | 42 | 23 | |
zptracemips_linux.go | D | 03-May-2024 | 1.4 KiB | 51 | 32 | |
zptracemipsle_linux.go | D | 03-May-2024 | 1.4 KiB | 51 | 32 | |
zsyscall_darwin_386.go | D | 03-May-2024 | 40 KiB | 1,713 | 1,306 | |
zsyscall_darwin_amd64.go | D | 03-May-2024 | 39.8 KiB | 1,713 | 1,306 | |
zsyscall_darwin_arm.go | D | 03-May-2024 | 40 KiB | 1,713 | 1,306 | |
zsyscall_darwin_arm64.go | D | 03-May-2024 | 39.8 KiB | 1,713 | 1,306 | |
zsyscall_dragonfly_amd64.go | D | 03-May-2024 | 35 KiB | 1,509 | 1,132 | |
zsyscall_freebsd_386.go | D | 03-May-2024 | 46 KiB | 1,938 | 1,483 | |
zsyscall_freebsd_amd64.go | D | 03-May-2024 | 45.8 KiB | 1,938 | 1,483 | |
zsyscall_freebsd_arm.go | D | 03-May-2024 | 46 KiB | 1,938 | 1,483 | |
zsyscall_linux_386.go | D | 03-May-2024 | 47.7 KiB | 2,011 | 1,547 | |
zsyscall_linux_amd64.go | D | 03-May-2024 | 52.1 KiB | 2,178 | 1,669 | |
zsyscall_linux_arm.go | D | 03-May-2024 | 50.8 KiB | 2,113 | 1,622 | |
zsyscall_linux_arm64.go | D | 03-May-2024 | 48.5 KiB | 2,020 | 1,550 | |
zsyscall_linux_mips.go | D | 03-May-2024 | 52.4 KiB | 2,179 | 1,670 | |
zsyscall_linux_mips64.go | D | 03-May-2024 | 51.7 KiB | 2,162 | 1,659 | |
zsyscall_linux_mips64le.go | D | 03-May-2024 | 51.8 KiB | 2,162 | 1,659 | |
zsyscall_linux_mipsle.go | D | 03-May-2024 | 52.4 KiB | 2,179 | 1,670 | |
zsyscall_linux_ppc64.go | D | 03-May-2024 | 53.2 KiB | 2,225 | 1,704 | |
zsyscall_linux_ppc64le.go | D | 03-May-2024 | 53.3 KiB | 2,225 | 1,704 | |
zsyscall_linux_s390x.go | D | 03-May-2024 | 47 KiB | 1,995 | 1,537 | |
zsyscall_linux_sparc64.go | D | 03-May-2024 | 52.1 KiB | 2,173 | 1,667 | |
zsyscall_netbsd_386.go | D | 03-May-2024 | 33.5 KiB | 1,440 | 1,081 | |
zsyscall_netbsd_amd64.go | D | 03-May-2024 | 33.3 KiB | 1,440 | 1,081 | |
zsyscall_netbsd_arm.go | D | 03-May-2024 | 33.5 KiB | 1,440 | 1,081 | |
zsyscall_openbsd_386.go | D | 03-May-2024 | 35 KiB | 1,509 | 1,132 | |
zsyscall_openbsd_amd64.go | D | 03-May-2024 | 34.8 KiB | 1,509 | 1,132 | |
zsyscall_openbsd_arm.go | D | 03-May-2024 | 35 KiB | 1,509 | 1,132 | |
zsyscall_solaris_amd64.go | D | 03-May-2024 | 45.5 KiB | 1,698 | 1,304 | |
zsysctl_openbsd_386.go | D | 03-May-2024 | 11.7 KiB | 271 | 265 | |
zsysctl_openbsd_amd64.go | D | 03-May-2024 | 11.1 KiB | 258 | 250 | |
zsysctl_openbsd_arm.go | D | 03-May-2024 | 11.7 KiB | 271 | 265 | |
zsysnum_darwin_386.go | D | 03-May-2024 | 17.7 KiB | 437 | 430 | |
zsysnum_darwin_amd64.go | D | 03-May-2024 | 17.7 KiB | 437 | 430 | |
zsysnum_darwin_arm.go | D | 03-May-2024 | 17.7 KiB | 437 | 430 | |
zsysnum_darwin_arm64.go | D | 03-May-2024 | 17.7 KiB | 437 | 430 | |
zsysnum_dragonfly_amd64.go | D | 03-May-2024 | 23.6 KiB | 316 | 307 | |
zsysnum_freebsd_386.go | D | 03-May-2024 | 25 KiB | 354 | 346 | |
zsysnum_freebsd_amd64.go | D | 03-May-2024 | 25 KiB | 354 | 346 | |
zsysnum_freebsd_arm.go | D | 03-May-2024 | 25 KiB | 354 | 346 | |
zsysnum_linux_386.go | D | 03-May-2024 | 12.7 KiB | 391 | 384 | |
zsysnum_linux_amd64.go | D | 03-May-2024 | 11.1 KiB | 343 | 336 | |
zsysnum_linux_arm.go | D | 03-May-2024 | 11.8 KiB | 363 | 356 | |
zsysnum_linux_arm64.go | D | 03-May-2024 | 9.3 KiB | 287 | 280 | |
zsysnum_linux_mips.go | D | 03-May-2024 | 12.7 KiB | 376 | 369 | |
zsysnum_linux_mips64.go | D | 03-May-2024 | 11.3 KiB | 336 | 329 | |
zsysnum_linux_mips64le.go | D | 03-May-2024 | 11.3 KiB | 336 | 329 | |
zsysnum_linux_mipsle.go | D | 03-May-2024 | 12.7 KiB | 376 | 369 | |
zsysnum_linux_ppc64.go | D | 03-May-2024 | 12.2 KiB | 374 | 367 | |
zsysnum_linux_ppc64le.go | D | 03-May-2024 | 12.2 KiB | 374 | 367 | |
zsysnum_linux_s390x.go | D | 03-May-2024 | 11 KiB | 336 | 329 | |
zsysnum_linux_sparc64.go | D | 03-May-2024 | 11.4 KiB | 349 | 342 | |
zsysnum_netbsd_386.go | D | 03-May-2024 | 25.6 KiB | 275 | 268 | |
zsysnum_netbsd_amd64.go | D | 03-May-2024 | 25.6 KiB | 275 | 268 | |
zsysnum_netbsd_arm.go | D | 03-May-2024 | 25.6 KiB | 275 | 268 | |
zsysnum_openbsd_386.go | D | 03-May-2024 | 14 KiB | 208 | 201 | |
zsysnum_openbsd_amd64.go | D | 03-May-2024 | 14.8 KiB | 218 | 211 | |
zsysnum_openbsd_arm.go | D | 03-May-2024 | 14.5 KiB | 214 | 207 | |
ztypes_darwin_386.go | D | 03-May-2024 | 7.2 KiB | 490 | 426 | |
ztypes_darwin_amd64.go | D | 03-May-2024 | 7.3 KiB | 500 | 436 | |
ztypes_darwin_arm.go | D | 03-May-2024 | 7.2 KiB | 491 | 426 | |
ztypes_darwin_arm64.go | D | 03-May-2024 | 7.3 KiB | 500 | 436 | |
ztypes_dragonfly_amd64.go | D | 03-May-2024 | 7.1 KiB | 487 | 427 | |
ztypes_freebsd_386.go | D | 03-May-2024 | 8.6 KiB | 554 | 487 | |
ztypes_freebsd_amd64.go | D | 03-May-2024 | 8.7 KiB | 557 | 490 | |
ztypes_freebsd_arm.go | D | 03-May-2024 | 8.7 KiB | 557 | 490 | |
ztypes_linux_386.go | D | 03-May-2024 | 46 KiB | 1,847 | 1,706 | |
ztypes_linux_amd64.go | D | 03-May-2024 | 46.3 KiB | 1,867 | 1,726 | |
ztypes_linux_arm.go | D | 03-May-2024 | 45.8 KiB | 1,836 | 1,695 | |
ztypes_linux_arm64.go | D | 03-May-2024 | 46 KiB | 1,846 | 1,705 | |
ztypes_linux_mips.go | D | 03-May-2024 | 45.9 KiB | 1,841 | 1,700 | |
ztypes_linux_mips64.go | D | 03-May-2024 | 46 KiB | 1,848 | 1,707 | |
ztypes_linux_mips64le.go | D | 03-May-2024 | 46 KiB | 1,848 | 1,707 | |
ztypes_linux_mipsle.go | D | 03-May-2024 | 45.9 KiB | 1,841 | 1,700 | |
ztypes_linux_ppc64.go | D | 03-May-2024 | 46.2 KiB | 1,856 | 1,715 | |
ztypes_linux_ppc64le.go | D | 03-May-2024 | 46.2 KiB | 1,856 | 1,715 | |
ztypes_linux_s390x.go | D | 03-May-2024 | 46.6 KiB | 1,873 | 1,729 | |
ztypes_linux_sparc64.go | D | 03-May-2024 | 12 KiB | 691 | 614 | |
ztypes_netbsd_386.go | D | 03-May-2024 | 6.6 KiB | 449 | 387 | |
ztypes_netbsd_amd64.go | D | 03-May-2024 | 6.8 KiB | 456 | 394 | |
ztypes_netbsd_arm.go | D | 03-May-2024 | 6.8 KiB | 454 | 392 | |
ztypes_openbsd_386.go | D | 03-May-2024 | 7.2 KiB | 485 | 424 | |
ztypes_openbsd_amd64.go | D | 03-May-2024 | 7.1 KiB | 485 | 424 | |
ztypes_openbsd_arm.go | D | 03-May-2024 | 7.1 KiB | 478 | 417 | |
ztypes_solaris_amd64.go | D | 03-May-2024 | 6.6 KiB | 460 | 399 |
README.md
1# Building `sys/unix` 2 3The sys/unix package provides access to the raw system call interface of the 4underlying operating system. See: https://godoc.org/golang.org/x/sys/unix 5 6Porting Go to a new architecture/OS combination or adding syscalls, types, or 7constants to an existing architecture/OS pair requires some manual effort; 8however, there are tools that automate much of the process. 9 10## Build Systems 11 12There are currently two ways we generate the necessary files. We are currently 13migrating the build system to use containers so the builds are reproducible. 14This is being done on an OS-by-OS basis. Please update this documentation as 15components of the build system change. 16 17### Old Build System (currently for `GOOS != "Linux" || GOARCH == "sparc64"`) 18 19The old build system generates the Go files based on the C header files 20present on your system. This means that files 21for a given GOOS/GOARCH pair must be generated on a system with that OS and 22architecture. This also means that the generated code can differ from system 23to system, based on differences in the header files. 24 25To avoid this, if you are using the old build system, only generate the Go 26files on an installation with unmodified header files. It is also important to 27keep track of which version of the OS the files were generated from (ex. 28Darwin 14 vs Darwin 15). This makes it easier to track the progress of changes 29and have each OS upgrade correspond to a single change. 30 31To build the files for your current OS and architecture, make sure GOOS and 32GOARCH are set correctly and run `mkall.sh`. This will generate the files for 33your specific system. Running `mkall.sh -n` shows the commands that will be run. 34 35Requirements: bash, perl, go 36 37### New Build System (currently for `GOOS == "Linux" && GOARCH != "sparc64"`) 38 39The new build system uses a Docker container to generate the go files directly 40from source checkouts of the kernel and various system libraries. This means 41that on any platform that supports Docker, all the files using the new build 42system can be generated at once, and generated files will not change based on 43what the person running the scripts has installed on their computer. 44 45The OS specific files for the new build system are located in the `${GOOS}` 46directory, and the build is coordinated by the `${GOOS}/mkall.go` program. When 47the kernel or system library updates, modify the Dockerfile at 48`${GOOS}/Dockerfile` to checkout the new release of the source. 49 50To build all the files under the new build system, you must be on an amd64/Linux 51system and have your GOOS and GOARCH set accordingly. Running `mkall.sh` will 52then generate all of the files for all of the GOOS/GOARCH pairs in the new build 53system. Running `mkall.sh -n` shows the commands that will be run. 54 55Requirements: bash, perl, go, docker 56 57## Component files 58 59This section describes the various files used in the code generation process. 60It also contains instructions on how to modify these files to add a new 61architecture/OS or to add additional syscalls, types, or constants. Note that 62if you are using the new build system, the scripts cannot be called normally. 63They must be called from within the docker container. 64 65### asm files 66 67The hand-written assembly file at `asm_${GOOS}_${GOARCH}.s` implements system 68call dispatch. There are three entry points: 69``` 70 func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) 71 func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) 72 func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) 73``` 74The first and second are the standard ones; they differ only in how many 75arguments can be passed to the kernel. The third is for low-level use by the 76ForkExec wrapper. Unlike the first two, it does not call into the scheduler to 77let it know that a system call is running. 78 79When porting Go to an new architecture/OS, this file must be implemented for 80each GOOS/GOARCH pair. 81 82### mksysnum 83 84Mksysnum is a script located at `${GOOS}/mksysnum.pl` (or `mksysnum_${GOOS}.pl` 85for the old system). This script takes in a list of header files containing the 86syscall number declarations and parses them to produce the corresponding list of 87Go numeric constants. See `zsysnum_${GOOS}_${GOARCH}.go` for the generated 88constants. 89 90Adding new syscall numbers is mostly done by running the build on a sufficiently 91new installation of the target OS (or updating the source checkouts for the 92new build system). However, depending on the OS, you make need to update the 93parsing in mksysnum. 94 95### mksyscall.pl 96 97The `syscall.go`, `syscall_${GOOS}.go`, `syscall_${GOOS}_${GOARCH}.go` are 98hand-written Go files which implement system calls (for unix, the specific OS, 99or the specific OS/Architecture pair respectively) that need special handling 100and list `//sys` comments giving prototypes for ones that can be generated. 101 102The mksyscall.pl script takes the `//sys` and `//sysnb` comments and converts 103them into syscalls. This requires the name of the prototype in the comment to 104match a syscall number in the `zsysnum_${GOOS}_${GOARCH}.go` file. The function 105prototype can be exported (capitalized) or not. 106 107Adding a new syscall often just requires adding a new `//sys` function prototype 108with the desired arguments and a capitalized name so it is exported. However, if 109you want the interface to the syscall to be different, often one will make an 110unexported `//sys` prototype, an then write a custom wrapper in 111`syscall_${GOOS}.go`. 112 113### types files 114 115For each OS, there is a hand-written Go file at `${GOOS}/types.go` (or 116`types_${GOOS}.go` on the old system). This file includes standard C headers and 117creates Go type aliases to the corresponding C types. The file is then fed 118through godef to get the Go compatible definitions. Finally, the generated code 119is fed though mkpost.go to format the code correctly and remove any hidden or 120private identifiers. This cleaned-up code is written to 121`ztypes_${GOOS}_${GOARCH}.go`. 122 123The hardest part about preparing this file is figuring out which headers to 124include and which symbols need to be `#define`d to get the actual data 125structures that pass through to the kernel system calls. Some C libraries 126preset alternate versions for binary compatibility and translate them on the 127way in and out of system calls, but there is almost always a `#define` that can 128get the real ones. 129See `types_darwin.go` and `linux/types.go` for examples. 130 131To add a new type, add in the necessary include statement at the top of the 132file (if it is not already there) and add in a type alias line. Note that if 133your type is significantly different on different architectures, you may need 134some `#if/#elif` macros in your include statements. 135 136### mkerrors.sh 137 138This script is used to generate the system's various constants. This doesn't 139just include the error numbers and error strings, but also the signal numbers 140an a wide variety of miscellaneous constants. The constants come from the list 141of include files in the `includes_${uname}` variable. A regex then picks out 142the desired `#define` statements, and generates the corresponding Go constants. 143The error numbers and strings are generated from `#include <errno.h>`, and the 144signal numbers and strings are generated from `#include <signal.h>`. All of 145these constants are written to `zerrors_${GOOS}_${GOARCH}.go` via a C program, 146`_errors.c`, which prints out all the constants. 147 148To add a constant, add the header that includes it to the appropriate variable. 149Then, edit the regex (if necessary) to match the desired constant. Avoid making 150the regex too broad to avoid matching unintended constants. 151 152 153## Generated files 154 155### `zerror_${GOOS}_${GOARCH}.go` 156 157A file containing all of the system's generated error numbers, error strings, 158signal numbers, and constants. Generated by `mkerrors.sh` (see above). 159 160### `zsyscall_${GOOS}_${GOARCH}.go` 161 162A file containing all the generated syscalls for a specific GOOS and GOARCH. 163Generated by `mksyscall.pl` (see above). 164 165### `zsysnum_${GOOS}_${GOARCH}.go` 166 167A list of numeric constants for all the syscall number of the specific GOOS 168and GOARCH. Generated by mksysnum (see above). 169 170### `ztypes_${GOOS}_${GOARCH}.go` 171 172A file containing Go types for passing into (or returning from) syscalls. 173Generated by godefs and the types file (see above). 174