• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..06-Mar-2019-

linux/H06-Mar-2019-2,6671,875

.gitignoreH A D06-Mar-201916 32

README.mdH A D06-Mar-20198 KiB174130

affinity_linux.goH A D06-Mar-20193.2 KiB12571

aliases.goH A D06-Mar-2019372 155

asm_aix_ppc64.sH A D06-Mar-2019410 185

asm_darwin_386.sH A D06-Mar-2019675 3011

asm_darwin_amd64.sH A D06-Mar-2019678 3011

asm_darwin_arm.sH A D06-Mar-2019686 3111

asm_darwin_arm64.sH A D06-Mar-2019691 3111

asm_dragonfly_amd64.sH A D06-Mar-2019681 3011

asm_freebsd_386.sH A D06-Mar-2019676 3011

asm_freebsd_amd64.sH A D06-Mar-2019679 3011

asm_freebsd_arm.sH A D06-Mar-2019666 3011

asm_freebsd_arm64.sH A D06-Mar-2019679 3011

asm_linux_386.sH A D06-Mar-20191.4 KiB6640

asm_linux_amd64.sH A D06-Mar-20191.2 KiB5837

asm_linux_arm.sH A D06-Mar-20191.1 KiB5736

asm_linux_arm64.sH A D06-Mar-20191.1 KiB5335

asm_linux_mips64x.sH A D06-Mar-20191.1 KiB5735

asm_linux_mipsx.sH A D06-Mar-20191.1 KiB5532

asm_linux_ppc64x.sH A D06-Mar-2019921 4527

asm_linux_s390x.sH A D06-Mar-20191.1 KiB5735

asm_netbsd_386.sH A D06-Mar-2019675 3011

asm_netbsd_amd64.sH A D06-Mar-2019678 3011

asm_netbsd_arm.sH A D06-Mar-2019665 3011

asm_netbsd_arm64.sH A D06-Mar-2019668 3011

asm_openbsd_386.sH A D06-Mar-2019676 3011

asm_openbsd_amd64.sH A D06-Mar-2019679 3011

asm_openbsd_arm.sH A D06-Mar-2019666 3011

asm_solaris_amd64.sH A D06-Mar-2019426 185

bluetooth_linux.goH A D06-Mar-2019655 3624

cap_freebsd.goH A D06-Mar-20195 KiB196148

constants.goH A D06-Mar-2019289 146

creds_test.goH A D06-Mar-20193.1 KiB135107

darwin_test.goH A D06-Mar-20197.6 KiB211171

dev_aix_ppc.goH A D06-Mar-2019745 2810

dev_aix_ppc64.goH A D06-Mar-2019864 3012

dev_darwin.goH A D06-Mar-2019747 2510

dev_dragonfly.goH A D06-Mar-20191 KiB3110

dev_freebsd.goH A D06-Mar-20191,013 3110

dev_linux.goH A D06-Mar-20191.5 KiB4318

dev_linux_test.goH A D06-Mar-20191.5 KiB5743

dev_netbsd.goH A D06-Mar-2019913 3015

dev_openbsd.goH A D06-Mar-2019918 3015

dirent.goH A D06-Mar-2019624 185

endian_big.goH A D06-Mar-2019236 102

endian_little.goH A D06-Mar-2019266 102

env_unix.goH A D06-Mar-2019616 3217

errors_freebsd_386.goH A D06-Mar-20199.2 KiB228219

errors_freebsd_amd64.goH A D06-Mar-20199.2 KiB228219

errors_freebsd_arm.goH A D06-Mar-20198.8 KiB227219

example_exec_test.goH A D06-Mar-2019404 2010

example_flock_test.goH A D06-Mar-2019594 2615

export_test.goH A D06-Mar-2019259 102

fcntl.goH A D06-Mar-2019980 3318

fcntl_darwin.goH A D06-Mar-2019587 199

fcntl_linux_32bit.goH A D06-Mar-2019388 144

gccgo.goH A D06-Mar-20192 KiB6340

gccgo_c.cH A D06-Mar-20191 KiB4024

gccgo_linux_amd64.goH A D06-Mar-2019429 2110

ioctl.goH A D06-Mar-2019950 3112

mkall.shH A D06-Mar-20197.1 KiB215185

mkasm_darwin.goH A D06-Mar-20191.7 KiB6248

mkerrors.shH A D06-Mar-201916 KiB660583

mkpost.goH A D06-Mar-20193.5 KiB10757

mksyscall.goH A D06-Mar-201912.3 KiB403308

mksyscall_aix_ppc.goH A D06-Mar-201911.8 KiB405316

mksyscall_aix_ppc64.goH A D06-Mar-201918.6 KiB603428

mksyscall_solaris.goH A D06-Mar-20199.4 KiB336248

mksysctl_openbsd.plH A D06-Mar-20195.2 KiB266221

mksysnum.goH A D06-Mar-20194.5 KiB191145

mmap_unix_test.goH A D06-Mar-2019976 4229

openbsd_pledge.goH A D06-Mar-20193.7 KiB167102

openbsd_test.goH A D06-Mar-20192.4 KiB11487

openbsd_unveil.goH A D06-Mar-20191.1 KiB4528

pagesize_unix.goH A D06-Mar-2019367 165

race.goH A D06-Mar-2019607 3118

race0.goH A D06-Mar-2019509 2613

sendfile_test.goH A D06-Mar-20192.3 KiB9973

sockcmsg_linux.goH A D06-Mar-20191 KiB3721

sockcmsg_unix.goH A D06-Mar-20193.1 KiB11881

str.goH A D06-Mar-2019615 2718

syscall.goH A D06-Mar-20192 KiB5518

syscall_aix.goH A D06-Mar-201915.6 KiB548308

syscall_aix_ppc.goH A D06-Mar-2019965 3516

syscall_aix_ppc64.goH A D06-Mar-2019932 3516

syscall_aix_test.goH A D06-Mar-20193.5 KiB163128

syscall_bsd.goH A D06-Mar-201915.6 KiB625463

syscall_bsd_test.goH A D06-Mar-20192 KiB9071

syscall_darwin.goH A D06-Mar-201919 KiB690249

syscall_darwin_386.goH A D06-Mar-20191.9 KiB6432

syscall_darwin_amd64.goH A D06-Mar-20191.9 KiB6432

syscall_darwin_arm.goH A D06-Mar-20191.8 KiB6535

syscall_darwin_arm64.goH A D06-Mar-20191.8 KiB6735

syscall_darwin_libSystem.goH A D06-Mar-20191.3 KiB3211

syscall_darwin_test.goH A D06-Mar-20191.4 KiB6446

syscall_dragonfly.goH A D06-Mar-201914.2 KiB540169

syscall_dragonfly_amd64.goH A D06-Mar-20191.2 KiB5335

syscall_freebsd.goH A D06-Mar-201922.4 KiB825392

syscall_freebsd_386.goH A D06-Mar-20191.2 KiB5335

syscall_freebsd_amd64.goH A D06-Mar-20191.2 KiB5335

syscall_freebsd_arm.goH A D06-Mar-20191.2 KiB5335

syscall_freebsd_arm64.goH A D06-Mar-20191.2 KiB5335

syscall_freebsd_test.goH A D06-Mar-20197.3 KiB313251

syscall_linux.goH A D06-Mar-201950.3 KiB1,7681,048

syscall_linux_386.goH A D06-Mar-201910.6 KiB387271

syscall_linux_amd64.goH A D06-Mar-20196.3 KiB19189

syscall_linux_amd64_gc.goH A D06-Mar-2019297 143

syscall_linux_arm.goH A D06-Mar-20198.2 KiB275162

syscall_linux_arm64.goH A D06-Mar-20196.7 KiB224130

syscall_linux_gc.goH A D06-Mar-2019495 153

syscall_linux_gc_386.goH A D06-Mar-2019582 175

syscall_linux_gccgo_386.goH A D06-Mar-2019979 3120

syscall_linux_gccgo_arm.goH A D06-Mar-2019589 2112

syscall_linux_mips64x.goH A D06-Mar-20196.7 KiB223128

syscall_linux_mipsx.goH A D06-Mar-20197.2 KiB235128

syscall_linux_ppc64x.goH A D06-Mar-20195.9 KiB15354

syscall_linux_riscv64.goH A D06-Mar-20196.8 KiB227133

syscall_linux_s390x.goH A D06-Mar-201910.4 KiB339238

syscall_linux_sparc64.goH A D06-Mar-20195.2 KiB14861

syscall_linux_test.goH A D06-Mar-201913.2 KiB534421

syscall_netbsd.goH A D06-Mar-201916.2 KiB623184

syscall_netbsd_386.goH A D06-Mar-2019735 3421

syscall_netbsd_amd64.goH A D06-Mar-2019730 3421

syscall_netbsd_arm.goH A D06-Mar-2019735 3421

syscall_netbsd_arm64.goH A D06-Mar-2019730 3421

syscall_netbsd_test.goH A D06-Mar-20191.3 KiB5236

syscall_openbsd.goH A D06-Mar-201911.3 KiB400161

syscall_openbsd_386.goH A D06-Mar-2019915 3822

syscall_openbsd_amd64.goH A D06-Mar-2019905 3822

syscall_openbsd_arm.goH A D06-Mar-2019915 3822

syscall_openbsd_test.goH A D06-Mar-20191,018 5038

syscall_solaris.goH A D06-Mar-201920.9 KiB738469

syscall_solaris_amd64.goH A D06-Mar-2019509 2413

syscall_solaris_test.goH A D06-Mar-20191.1 KiB5641

syscall_test.goH A D06-Mar-20191.3 KiB6145

syscall_unix.goH A D06-Mar-201910.4 KiB417321

syscall_unix_gc.goH A D06-Mar-2019622 166

syscall_unix_gc_ppc64x.goH A D06-Mar-2019798 2514

syscall_unix_test.goH A D06-Mar-201917.2 KiB733604

timestruct.goH A D06-Mar-20192.5 KiB8344

timestruct_test.goH A D06-Mar-20191.7 KiB5541

types_aix.goH A D06-Mar-20194.1 KiB237102

types_darwin.goH A D06-Mar-20195.5 KiB278120

types_dragonfly.goH A D06-Mar-20195.1 KiB264114

types_freebsd.goH A D06-Mar-20197.4 KiB357143

types_netbsd.goH A D06-Mar-20195.6 KiB290126

types_openbsd.goH A D06-Mar-20195.2 KiB277117

types_solaris.goH A D06-Mar-20195.3 KiB267112

xattr_bsd.goH A D06-Mar-20195 KiB241178

xattr_test.goH A D06-Mar-20194.6 KiB208155

zerrors_aix_ppc.goH A D06-Mar-201952 KiB1,3731,354

zerrors_aix_ppc64.goH A D06-Mar-201952.2 KiB1,3741,355

zerrors_darwin_386.goH A D06-Mar-201972.8 KiB1,7841,765

zerrors_darwin_amd64.goH A D06-Mar-201972.8 KiB1,7841,765

zerrors_darwin_arm.goH A D06-Mar-201972.8 KiB1,7841,765

zerrors_darwin_arm64.goH A D06-Mar-201972.8 KiB1,7841,765

zerrors_dragonfly_amd64.goH A D06-Mar-201967.1 KiB1,6511,632

zerrors_freebsd_386.goH A D06-Mar-201969.8 KiB1,7941,775

zerrors_freebsd_amd64.goH A D06-Mar-201969.9 KiB1,7951,776

zerrors_freebsd_arm.goH A D06-Mar-201970.2 KiB1,8031,784

zerrors_freebsd_arm64.goH A D06-Mar-201969.9 KiB1,7951,776

zerrors_linux_386.goH A D06-Mar-2019124.1 KiB2,8362,817

zerrors_linux_amd64.goH A D06-Mar-2019124.1 KiB2,8362,817

zerrors_linux_arm.goH A D06-Mar-2019124.3 KiB2,8422,823

zerrors_linux_arm64.goH A D06-Mar-2019123.7 KiB2,8272,808

zerrors_linux_mips.goH A D06-Mar-2019124.5 KiB2,8432,824

zerrors_linux_mips64.goH A D06-Mar-2019124.6 KiB2,8432,824

zerrors_linux_mips64le.goH A D06-Mar-2019124.6 KiB2,8432,824

zerrors_linux_mipsle.goH A D06-Mar-2019124.6 KiB2,8432,824

zerrors_linux_ppc64.goH A D06-Mar-2019127 KiB2,8982,879

zerrors_linux_ppc64le.goH A D06-Mar-2019127 KiB2,8982,879

zerrors_linux_riscv64.goH A D06-Mar-2019123.5 KiB2,8232,804

zerrors_linux_s390x.goH A D06-Mar-2019126.7 KiB2,8962,877

zerrors_linux_sparc64.goH A D06-Mar-2019126.8 KiB2,8922,873

zerrors_netbsd_386.goH A D06-Mar-201972.5 KiB1,7731,754

zerrors_netbsd_amd64.goH A D06-Mar-201972.1 KiB1,7631,744

zerrors_netbsd_arm.goH A D06-Mar-201971.6 KiB1,7521,733

zerrors_netbsd_arm64.goH A D06-Mar-201972.1 KiB1,7631,744

zerrors_openbsd_386.goH A D06-Mar-201967.7 KiB1,6551,636

zerrors_openbsd_amd64.goH A D06-Mar-201972.3 KiB1,7661,747

zerrors_openbsd_arm.goH A D06-Mar-201967.8 KiB1,6571,638

zerrors_solaris_amd64.goH A D06-Mar-201958.1 KiB1,5331,514

zptrace386_linux.goH A D06-Mar-20191.8 KiB8162

zptracearm_linux.goH A D06-Mar-20191.2 KiB4223

zptracemips_linux.goH A D06-Mar-20191.4 KiB5132

zptracemipsle_linux.goH A D06-Mar-20191.4 KiB5132

zsyscall_aix_ppc.goH A D06-Mar-201935.1 KiB1,451971

zsyscall_aix_ppc64.goH A D06-Mar-201929.7 KiB1,4091,048

zsyscall_aix_ppc64_gc.goH A D06-Mar-201941.3 KiB1,163579

zsyscall_aix_ppc64_gccgo.goH A D06-Mar-201929.9 KiB1,043575

zsyscall_darwin_386.1_11.goH A D06-Mar-201943 KiB1,8111,380

zsyscall_darwin_386.goH A D06-Mar-201966.9 KiB2,5061,519

zsyscall_darwin_386.sH A D06-Mar-20199.7 KiB285279

zsyscall_darwin_amd64.1_11.goH A D06-Mar-201942.8 KiB1,8111,380

zsyscall_darwin_amd64.goH A D06-Mar-201967.2 KiB2,5211,527

zsyscall_darwin_amd64.sH A D06-Mar-20199.8 KiB287281

zsyscall_darwin_arm.1_11.goH A D06-Mar-201942.5 KiB1,7941,366

zsyscall_darwin_arm.goH A D06-Mar-201966.2 KiB2,4841,504

zsyscall_darwin_arm.sH A D06-Mar-20199.6 KiB283277

zsyscall_darwin_arm64.1_11.goH A D06-Mar-201942.3 KiB1,7941,366

zsyscall_darwin_arm64.goH A D06-Mar-201966 KiB2,4841,504

zsyscall_darwin_arm64.sH A D06-Mar-20199.6 KiB283277

zsyscall_dragonfly_amd64.goH A D06-Mar-201938.7 KiB1,6601,256

zsyscall_freebsd_386.goH A D06-Mar-201948.2 KiB2,0161,543

zsyscall_freebsd_amd64.goH A D06-Mar-201948 KiB2,0161,543

zsyscall_freebsd_arm.goH A D06-Mar-201948.3 KiB2,0161,543

zsyscall_freebsd_arm64.goH A D06-Mar-201948 KiB2,0161,543

zsyscall_linux_386.goH A D06-Mar-201952.9 KiB2,2211,715

zsyscall_linux_amd64.goH A D06-Mar-201957.4 KiB2,3881,837

zsyscall_linux_arm.goH A D06-Mar-201956.6 KiB2,3431,804

zsyscall_linux_arm64.goH A D06-Mar-201954.2 KiB2,2451,730

zsyscall_linux_mips.goH A D06-Mar-201957.9 KiB2,4011,847

zsyscall_linux_mips64.goH A D06-Mar-201957 KiB2,3721,827

zsyscall_linux_mips64le.goH A D06-Mar-201957 KiB2,3721,827

zsyscall_linux_mipsle.goH A D06-Mar-201957.9 KiB2,4011,847

zsyscall_linux_ppc64.goH A D06-Mar-201958.9 KiB2,4501,884

zsyscall_linux_ppc64le.goH A D06-Mar-201958.9 KiB2,4501,884

zsyscall_linux_riscv64.goH A D06-Mar-201953.7 KiB2,2251,713

zsyscall_linux_s390x.goH A D06-Mar-201952.7 KiB2,2201,717

zsyscall_linux_sparc64.goH A D06-Mar-201957.3 KiB2,3831,835

zsyscall_netbsd_386.goH A D06-Mar-201943.4 KiB1,8271,402

zsyscall_netbsd_amd64.goH A D06-Mar-201943.2 KiB1,8271,402

zsyscall_netbsd_arm.goH A D06-Mar-201943.4 KiB1,8271,402

zsyscall_netbsd_arm64.goH A D06-Mar-201943.2 KiB1,8271,402

zsyscall_openbsd_386.goH A D06-Mar-201939.5 KiB1,6931,283

zsyscall_openbsd_amd64.goH A D06-Mar-201939.4 KiB1,6931,283

zsyscall_openbsd_arm.goH A D06-Mar-201939.5 KiB1,6931,283

zsyscall_solaris_amd64.goH A D06-Mar-201953.8 KiB1,9541,304

zsysctl_openbsd_386.goH A D06-Mar-201911.7 KiB271265

zsysctl_openbsd_amd64.goH A D06-Mar-201911.6 KiB271263

zsysctl_openbsd_arm.goH A D06-Mar-201911.7 KiB271265

zsysnum_darwin_386.goH A D06-Mar-201917.7 KiB437430

zsysnum_darwin_amd64.goH A D06-Mar-201917.8 KiB439432

zsysnum_darwin_arm.goH A D06-Mar-201917.7 KiB437430

zsysnum_darwin_arm64.goH A D06-Mar-201917.7 KiB437430

zsysnum_dragonfly_amd64.goH A D06-Mar-201926.4 KiB316307

zsysnum_freebsd_386.goH A D06-Mar-201936.8 KiB404396

zsysnum_freebsd_amd64.goH A D06-Mar-201936.8 KiB404396

zsysnum_freebsd_arm.goH A D06-Mar-201936.8 KiB404396

zsysnum_freebsd_arm64.goH A D06-Mar-201929 KiB396388

zsysnum_linux_386.goH A D06-Mar-201912.8 KiB393386

zsysnum_linux_amd64.goH A D06-Mar-201911.2 KiB345338

zsysnum_linux_arm.goH A D06-Mar-201911.9 KiB365358

zsysnum_linux_arm64.goH A D06-Mar-20199.4 KiB290283

zsysnum_linux_mips.goH A D06-Mar-201912.8 KiB378371

zsysnum_linux_mips64.goH A D06-Mar-201911.4 KiB338331

zsysnum_linux_mips64le.goH A D06-Mar-201911.4 KiB338331

zsysnum_linux_mipsle.goH A D06-Mar-201912.8 KiB378371

zsysnum_linux_ppc64.goH A D06-Mar-201912.2 KiB376369

zsysnum_linux_ppc64le.goH A D06-Mar-201912.2 KiB376369

zsysnum_linux_riscv64.goH A D06-Mar-20199.4 KiB289282

zsysnum_linux_s390x.goH A D06-Mar-201911 KiB338331

zsysnum_linux_sparc64.goH A D06-Mar-201911.5 KiB352345

zsysnum_netbsd_386.goH A D06-Mar-201925.7 KiB275268

zsysnum_netbsd_amd64.goH A D06-Mar-201925.7 KiB275268

zsysnum_netbsd_arm.goH A D06-Mar-201925.7 KiB275268

zsysnum_netbsd_arm64.goH A D06-Mar-201925.7 KiB275268

zsysnum_openbsd_386.goH A D06-Mar-201917.8 KiB219212

zsysnum_openbsd_amd64.goH A D06-Mar-201917.8 KiB219212

zsysnum_openbsd_arm.goH A D06-Mar-201917.8 KiB219212

ztypes_aix_ppc.goH A D06-Mar-20194.7 KiB346288

ztypes_aix_ppc64.goH A D06-Mar-20194.9 KiB355297

ztypes_darwin_386.goH A D06-Mar-20197.2 KiB490426

ztypes_darwin_amd64.goH A D06-Mar-20197.3 KiB500436

ztypes_darwin_arm.goH A D06-Mar-20197.2 KiB491426

ztypes_darwin_arm64.goH A D06-Mar-20197.3 KiB500436

ztypes_dragonfly_amd64.goH A D06-Mar-20196.9 KiB470411

ztypes_freebsd_386.goH A D06-Mar-20199.1 KiB604534

ztypes_freebsd_amd64.goH A D06-Mar-20199.1 KiB603533

ztypes_freebsd_arm.goH A D06-Mar-20199.1 KiB603533

ztypes_freebsd_arm64.goH A D06-Mar-20199.1 KiB603533

ztypes_linux_386.goH A D06-Mar-201950.4 KiB2,0641,900

ztypes_linux_amd64.goH A D06-Mar-201950.6 KiB2,0771,913

ztypes_linux_arm.goH A D06-Mar-201950.2 KiB2,0551,891

ztypes_linux_arm64.goH A D06-Mar-201950.2 KiB2,0561,892

ztypes_linux_mips.goH A D06-Mar-201950.3 KiB2,0611,897

ztypes_linux_mips64.goH A D06-Mar-201950.3 KiB2,0581,894

ztypes_linux_mips64le.goH A D06-Mar-201950.3 KiB2,0581,894

ztypes_linux_mipsle.goH A D06-Mar-201950.3 KiB2,0611,897

ztypes_linux_ppc64.goH A D06-Mar-201950.4 KiB2,0661,902

ztypes_linux_ppc64le.goH A D06-Mar-201950.4 KiB2,0661,902

ztypes_linux_riscv64.goH A D06-Mar-201950.5 KiB2,0831,919

ztypes_linux_s390x.goH A D06-Mar-201950.7 KiB2,0801,913

ztypes_linux_sparc64.goH A D06-Mar-201950.3 KiB2,0611,897

ztypes_netbsd_386.goH A D06-Mar-20196.8 KiB466401

ztypes_netbsd_amd64.goH A D06-Mar-20197 KiB473408

ztypes_netbsd_arm.goH A D06-Mar-20197 KiB471406

ztypes_netbsd_arm64.goH A D06-Mar-20197 KiB473408

ztypes_openbsd_386.goH A D06-Mar-20199.2 KiB561498

ztypes_openbsd_amd64.goH A D06-Mar-20199.1 KiB561498

ztypes_openbsd_arm.goH A D06-Mar-20199.1 KiB562499

ztypes_solaris_amd64.goH A D06-Mar-20196.4 KiB443383

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"`)
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, go
36
37### New Build System (currently for `GOOS == "linux"`)
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, 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/programs 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 Go program located at `${GOOS}/mksysnum.go` (or `mksysnum_${GOOS}.go`
85for the old system). This program 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.go
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.go program 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.go` (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