X7ROOT File Manager
Current Path:
/opt/golang/1.22.0/src/syscall
opt
/
golang
/
1.22.0
/
src
/
syscall
/
๐
..
๐
asan.go
(410 B)
๐
asan0.go
(342 B)
๐
asm9_unix2_amd64.s
(1.19 KB)
๐
asm_aix_ppc64.s
(540 B)
๐
asm_darwin_amd64.s
(2.93 KB)
๐
asm_darwin_arm64.s
(2.83 KB)
๐
asm_freebsd_arm.s
(2.96 KB)
๐
asm_freebsd_arm64.s
(2.79 KB)
๐
asm_freebsd_riscv64.s
(2.76 KB)
๐
asm_linux_386.s
(3.08 KB)
๐
asm_linux_amd64.s
(1.33 KB)
๐
asm_linux_arm.s
(1.77 KB)
๐
asm_linux_arm64.s
(916 B)
๐
asm_linux_loong64.s
(947 B)
๐
asm_linux_mips64x.s
(985 B)
๐
asm_linux_mipsx.s
(1.75 KB)
๐
asm_linux_ppc64x.s
(913 B)
๐
asm_linux_riscv64.s
(861 B)
๐
asm_linux_s390x.s
(2.15 KB)
๐
asm_netbsd_arm.s
(2.85 KB)
๐
asm_netbsd_arm64.s
(2.88 KB)
๐
asm_openbsd_386.s
(1.04 KB)
๐
asm_openbsd_amd64.s
(1.04 KB)
๐
asm_openbsd_arm.s
(1.04 KB)
๐
asm_openbsd_arm64.s
(1.04 KB)
๐
asm_openbsd_mips64.s
(2.85 KB)
๐
asm_openbsd_ppc64.s
(1.04 KB)
๐
asm_openbsd_riscv64.s
(1.04 KB)
๐
asm_plan9_386.s
(3.14 KB)
๐
asm_plan9_amd64.s
(3.36 KB)
๐
asm_plan9_arm.s
(3.25 KB)
๐
asm_solaris_amd64.s
(1.8 KB)
๐
asm_unix_386.s
(2.74 KB)
๐
asm_unix_amd64.s
(2.15 KB)
๐
bpf_bsd.go
(4.03 KB)
๐
const_plan9.go
(1.36 KB)
๐
creds_test.go
(3.37 KB)
๐
dir_plan9.go
(5.62 KB)
๐
dirent.go
(3.09 KB)
๐
dirent_test.go
(3.43 KB)
๐
dll_windows.go
(7.63 KB)
๐
endian_big.go
(249 B)
๐
endian_little.go
(309 B)
๐
env_unix.go
(2.73 KB)
๐
env_windows.go
(1.96 KB)
๐
errors_plan9.go
(1.61 KB)
๐
exec_aix_test.go
(823 B)
๐
exec_bsd.go
(7.95 KB)
๐
exec_freebsd.go
(8.43 KB)
๐
exec_freebsd_test.go
(2.41 KB)
๐
exec_libc.go
(8.17 KB)
๐
exec_libc2.go
(8.19 KB)
๐
exec_linux.go
(22.81 KB)
๐
exec_linux_test.go
(20.37 KB)
๐
exec_pdeathsig_test.go
(4.49 KB)
๐
exec_plan9.go
(13.25 KB)
๐
exec_solaris_test.go
(815 B)
๐
exec_unix.go
(8.63 KB)
๐
exec_unix_test.go
(8.28 KB)
๐
exec_windows.go
(10.3 KB)
๐
exec_windows_test.go
(3.11 KB)
๐
export_darwin_test.go
(348 B)
๐
export_linux_test.go
(296 B)
๐
export_rlimit_test.go
(262 B)
๐
export_unix_test.go
(391 B)
๐
export_wasip1_test.go
(267 B)
๐
export_windows_test.go
(500 B)
๐
flock_aix.go
(564 B)
๐
flock_bsd.go
(469 B)
๐
flock_linux.go
(641 B)
๐
flock_linux_32bit.go
(511 B)
๐
forkpipe.go
(604 B)
๐
forkpipe2.go
(2.6 KB)
๐
fs_js.go
(10.84 KB)
๐
fs_wasip1.go
(24.07 KB)
๐
fs_wasip1_test.go
(1.98 KB)
๐
getdirentries_test.go
(2.07 KB)
๐
js
๐
lsf_linux.go
(2.12 KB)
๐
mkall.sh
(14.62 KB)
๐
mkasm.go
(1.88 KB)
๐
mkerrors.sh
(10.71 KB)
๐
mkpost.go
(2.28 KB)
๐
mksyscall.pl
(10.19 KB)
๐
mksyscall_libc.pl
(8.02 KB)
๐
mksyscall_windows.go
(1.99 KB)
๐
mksysctl_openbsd.pl
(5.04 KB)
๐
mksysnum_dragonfly.pl
(866 B)
๐
mksysnum_freebsd.pl
(1.35 KB)
๐
mksysnum_linux.pl
(1.26 KB)
๐
mksysnum_netbsd.pl
(1.01 KB)
๐
mksysnum_openbsd.pl
(872 B)
๐
mksysnum_plan9.sh
(459 B)
๐
mmap_unix_test.go
(500 B)
๐
msan.go
(410 B)
๐
msan0.go
(342 B)
๐
net.go
(1.19 KB)
๐
net_fake.go
(883 B)
๐
net_js.go
(1.38 KB)
๐
net_wasip1.go
(1.82 KB)
๐
netlink_linux.go
(4.77 KB)
๐
os_wasip1.go
(252 B)
๐
pwd_plan9.go
(2.27 KB)
๐
rlimit.go
(1.59 KB)
๐
rlimit_darwin.go
(593 B)
๐
rlimit_stub.go
(338 B)
๐
rlimit_test.go
(953 B)
๐
route_bsd.go
(9.1 KB)
๐
route_darwin.go
(2.01 KB)
๐
route_dragonfly.go
(2.61 KB)
๐
route_freebsd.go
(2.67 KB)
๐
route_freebsd_32bit.go
(1.14 KB)
๐
route_freebsd_64bit.go
(762 B)
๐
route_netbsd.go
(1.43 KB)
๐
route_openbsd.go
(1.46 KB)
๐
security_windows.go
(10.01 KB)
๐
setuidgid_32_linux.go
(435 B)
๐
setuidgid_linux.go
(421 B)
๐
sockcmsg_dragonfly.go
(547 B)
๐
sockcmsg_linux.go
(1.12 KB)
๐
sockcmsg_unix.go
(2.51 KB)
๐
sockcmsg_unix_other.go
(1.08 KB)
๐
syscall.go
(3.78 KB)
๐
syscall_aix.go
(17.9 KB)
๐
syscall_aix_ppc64.go
(405 B)
๐
syscall_bsd.go
(13.63 KB)
๐
syscall_bsd_test.go
(1.17 KB)
๐
syscall_darwin.go
(10.74 KB)
๐
syscall_darwin_amd64.go
(1.91 KB)
๐
syscall_darwin_arm64.go
(1.82 KB)
๐
syscall_dragonfly.go
(8.55 KB)
๐
syscall_dragonfly_amd64.go
(1.12 KB)
๐
syscall_freebsd.go
(8.72 KB)
๐
syscall_freebsd_386.go
(1.17 KB)
๐
syscall_freebsd_amd64.go
(1.12 KB)
๐
syscall_freebsd_arm.go
(1.16 KB)
๐
syscall_freebsd_arm64.go
(1.12 KB)
๐
syscall_freebsd_riscv64.go
(1.12 KB)
๐
syscall_freebsd_test.go
(424 B)
๐
syscall_illumos.go
(613 B)
๐
syscall_js.go
(6.71 KB)
๐
syscall_linux.go
(35.62 KB)
๐
syscall_linux_386.go
(10.34 KB)
๐
syscall_linux_accept.go
(961 B)
๐
syscall_linux_accept4.go
(592 B)
๐
syscall_linux_amd64.go
(4.78 KB)
๐
syscall_linux_arm.go
(7.05 KB)
๐
syscall_linux_arm64.go
(6.21 KB)
๐
syscall_linux_loong64.go
(7.08 KB)
๐
syscall_linux_mips64x.go
(5.98 KB)
๐
syscall_linux_mipsx.go
(6.85 KB)
๐
syscall_linux_ppc64x.go
(4.63 KB)
๐
syscall_linux_riscv64.go
(5.75 KB)
๐
syscall_linux_s390x.go
(7.9 KB)
๐
syscall_linux_test.go
(21.1 KB)
๐
syscall_netbsd.go
(7.78 KB)
๐
syscall_netbsd_386.go
(716 B)
๐
syscall_netbsd_amd64.go
(709 B)
๐
syscall_netbsd_arm.go
(716 B)
๐
syscall_netbsd_arm64.go
(709 B)
๐
syscall_openbsd.go
(6.97 KB)
๐
syscall_openbsd1.go
(534 B)
๐
syscall_openbsd_386.go
(715 B)
๐
syscall_openbsd_amd64.go
(701 B)
๐
syscall_openbsd_arm.go
(715 B)
๐
syscall_openbsd_arm64.go
(906 B)
๐
syscall_openbsd_libc.go
(3.28 KB)
๐
syscall_openbsd_mips64.go
(970 B)
๐
syscall_openbsd_ppc64.go
(906 B)
๐
syscall_openbsd_riscv64.go
(906 B)
๐
syscall_plan9.go
(9.37 KB)
๐
syscall_plan9_test.go
(1.15 KB)
๐
syscall_ptrace_test.go
(768 B)
๐
syscall_solaris.go
(15.66 KB)
๐
syscall_solaris_amd64.go
(487 B)
๐
syscall_solarisonly.go
(304 B)
๐
syscall_test.go
(1.44 KB)
๐
syscall_unix.go
(12.11 KB)
๐
syscall_unix_test.go
(9.43 KB)
๐
syscall_wasip1.go
(9.37 KB)
๐
syscall_windows.go
(52.6 KB)
๐
syscall_windows_test.go
(5.73 KB)
๐
tables_js.go
(19.17 KB)
๐
tables_wasip1.go
(6.49 KB)
๐
time_fake.go
(677 B)
๐
time_nofake.go
(351 B)
๐
timestruct.go
(954 B)
๐
types_aix.go
(3.35 KB)
๐
types_darwin.go
(5.03 KB)
๐
types_dragonfly.go
(5.05 KB)
๐
types_freebsd.go
(6.72 KB)
๐
types_illumos_amd64.go
(379 B)
๐
types_linux.go
(10.9 KB)
๐
types_netbsd.go
(4.77 KB)
๐
types_openbsd.go
(5.04 KB)
๐
types_solaris.go
(4.88 KB)
๐
types_windows.go
(27.75 KB)
๐
types_windows_386.go
(477 B)
๐
types_windows_amd64.go
(477 B)
๐
types_windows_arm.go
(477 B)
๐
types_windows_arm64.go
(477 B)
๐
wtf8_windows.go
(2.67 KB)
๐
wtf8_windows_test.go
(4.31 KB)
๐
zerrors_aix_ppc64.go
(47.16 KB)
๐
zerrors_darwin_amd64.go
(55.28 KB)
๐
zerrors_darwin_arm64.go
(55.79 KB)
๐
zerrors_dragonfly_amd64.go
(59.62 KB)
๐
zerrors_freebsd_386.go
(67.35 KB)
๐
zerrors_freebsd_amd64.go
(67.4 KB)
๐
zerrors_freebsd_arm.go
(67.34 KB)
๐
zerrors_freebsd_arm64.go
(67.41 KB)
๐
zerrors_freebsd_riscv64.go
(67.41 KB)
๐
zerrors_linux_386.go
(57.36 KB)
๐
zerrors_linux_amd64.go
(57.39 KB)
๐
zerrors_linux_arm.go
(57.88 KB)
๐
zerrors_linux_arm64.go
(68.57 KB)
๐
zerrors_linux_loong64.go
(82.47 KB)
๐
zerrors_linux_mips.go
(69.18 KB)
๐
zerrors_linux_mips64.go
(68.5 KB)
๐
zerrors_linux_mips64le.go
(68.5 KB)
๐
zerrors_linux_mipsle.go
(69.18 KB)
๐
zerrors_linux_ppc64.go
(70.89 KB)
๐
zerrors_linux_ppc64le.go
(71.84 KB)
๐
zerrors_linux_riscv64.go
(70.8 KB)
๐
zerrors_linux_s390x.go
(73.28 KB)
๐
zerrors_netbsd_386.go
(67.48 KB)
๐
zerrors_netbsd_amd64.go
(67.07 KB)
๐
zerrors_netbsd_arm.go
(66.49 KB)
๐
zerrors_netbsd_arm64.go
(67.07 KB)
๐
zerrors_openbsd_386.go
(62.52 KB)
๐
zerrors_openbsd_amd64.go
(62.48 KB)
๐
zerrors_openbsd_arm.go
(62.47 KB)
๐
zerrors_openbsd_arm64.go
(66.36 KB)
๐
zerrors_openbsd_mips64.go
(66.66 KB)
๐
zerrors_openbsd_ppc64.go
(67.14 KB)
๐
zerrors_openbsd_riscv64.go
(67.1 KB)
๐
zerrors_solaris_amd64.go
(50.72 KB)
๐
zerrors_windows.go
(9.97 KB)
๐
zsyscall_aix_ppc64.go
(41.4 KB)
๐
zsyscall_darwin_amd64.go
(51.72 KB)
๐
zsyscall_darwin_amd64.s
(8.7 KB)
๐
zsyscall_darwin_arm64.go
(51.67 KB)
๐
zsyscall_darwin_arm64.s
(8.67 KB)
๐
zsyscall_dragonfly_amd64.go
(31.67 KB)
๐
zsyscall_freebsd_386.go
(31.21 KB)
๐
zsyscall_freebsd_amd64.go
(31.07 KB)
๐
zsyscall_freebsd_arm.go
(31.23 KB)
๐
zsyscall_freebsd_arm64.go
(31.07 KB)
๐
zsyscall_freebsd_riscv64.go
(31.07 KB)
๐
zsyscall_linux_386.go
(34.68 KB)
๐
zsyscall_linux_amd64.go
(39.5 KB)
๐
zsyscall_linux_arm.go
(38.92 KB)
๐
zsyscall_linux_arm64.go
(37.81 KB)
๐
zsyscall_linux_loong64.go
(37.08 KB)
๐
zsyscall_linux_mips.go
(40.34 KB)
๐
zsyscall_linux_mips64.go
(40.34 KB)
๐
zsyscall_linux_mips64le.go
(40.35 KB)
๐
zsyscall_linux_mipsle.go
(40.34 KB)
๐
zsyscall_linux_ppc64.go
(40.98 KB)
๐
zsyscall_linux_ppc64le.go
(40.99 KB)
๐
zsyscall_linux_riscv64.go
(37.84 KB)
๐
zsyscall_linux_s390x.go
(35.3 KB)
๐
zsyscall_netbsd_386.go
(30.11 KB)
๐
zsyscall_netbsd_amd64.go
(29.97 KB)
๐
zsyscall_netbsd_arm.go
(30.12 KB)
๐
zsyscall_netbsd_arm64.go
(29.97 KB)
๐
zsyscall_openbsd_386.go
(48.07 KB)
๐
zsyscall_openbsd_386.s
(8.09 KB)
๐
zsyscall_openbsd_amd64.go
(47.92 KB)
๐
zsyscall_openbsd_amd64.s
(8.09 KB)
๐
zsyscall_openbsd_arm.go
(48.09 KB)
๐
zsyscall_openbsd_arm.s
(8.09 KB)
๐
zsyscall_openbsd_arm64.go
(47.92 KB)
๐
zsyscall_openbsd_arm64.s
(8.09 KB)
๐
zsyscall_openbsd_mips64.go
(30.05 KB)
๐
zsyscall_openbsd_ppc64.go
(47.92 KB)
๐
zsyscall_openbsd_ppc64.s
(8.78 KB)
๐
zsyscall_openbsd_riscv64.go
(47.93 KB)
๐
zsyscall_openbsd_riscv64.s
(8.09 KB)
๐
zsyscall_plan9_386.go
(6.17 KB)
๐
zsyscall_plan9_amd64.go
(6.18 KB)
๐
zsyscall_plan9_arm.go
(6.17 KB)
๐
zsyscall_solaris_amd64.go
(37.56 KB)
๐
zsyscall_windows.go
(56.73 KB)
๐
zsysctl_openbsd.go
(11.39 KB)
๐
zsysnum_darwin_amd64.go
(14.55 KB)
๐
zsysnum_darwin_arm64.go
(14.39 KB)
๐
zsysnum_dragonfly_amd64.go
(22.94 KB)
๐
zsysnum_freebsd_386.go
(25.46 KB)
๐
zsysnum_freebsd_amd64.go
(25.46 KB)
๐
zsysnum_freebsd_arm.go
(25.46 KB)
๐
zsysnum_freebsd_arm64.go
(35.79 KB)
๐
zsysnum_freebsd_riscv64.go
(35.79 KB)
๐
zsysnum_linux_386.go
(11.27 KB)
๐
zsysnum_linux_amd64.go
(10.11 KB)
๐
zsysnum_linux_arm.go
(11.55 KB)
๐
zsysnum_linux_arm64.go
(8.95 KB)
๐
zsysnum_linux_loong64.go
(10.28 KB)
๐
zsysnum_linux_mips.go
(12.1 KB)
๐
zsysnum_linux_mips64.go
(10.93 KB)
๐
zsysnum_linux_mips64le.go
(10.93 KB)
๐
zsysnum_linux_mipsle.go
(12.1 KB)
๐
zsysnum_linux_ppc64.go
(11.47 KB)
๐
zsysnum_linux_ppc64le.go
(11.49 KB)
๐
zsysnum_linux_riscv64.go
(8.88 KB)
๐
zsysnum_linux_s390x.go
(10.64 KB)
๐
zsysnum_netbsd_386.go
(25.69 KB)
๐
zsysnum_netbsd_amd64.go
(25.69 KB)
๐
zsysnum_netbsd_arm.go
(25.69 KB)
๐
zsysnum_netbsd_arm64.go
(25.69 KB)
๐
zsysnum_openbsd_386.go
(14.16 KB)
๐
zsysnum_openbsd_amd64.go
(14.16 KB)
๐
zsysnum_openbsd_arm.go
(14.46 KB)
๐
zsysnum_openbsd_arm64.go
(14.72 KB)
๐
zsysnum_openbsd_mips64.go
(14.93 KB)
๐
zsysnum_openbsd_ppc64.go
(15.83 KB)
๐
zsysnum_openbsd_riscv64.go
(15.67 KB)
๐
zsysnum_plan9.go
(1.03 KB)
๐
zsysnum_solaris_amd64.go
(293 B)
๐
ztypes_aix_ppc64.go
(4.17 KB)
๐
ztypes_darwin_amd64.go
(6.95 KB)
๐
ztypes_darwin_arm64.go
(6.95 KB)
๐
ztypes_dragonfly_amd64.go
(6.7 KB)
๐
ztypes_freebsd_386.go
(8 KB)
๐
ztypes_freebsd_amd64.go
(8.03 KB)
๐
ztypes_freebsd_arm.go
(8.03 KB)
๐
ztypes_freebsd_arm64.go
(8.03 KB)
๐
ztypes_freebsd_riscv64.go
(8.03 KB)
๐
ztypes_linux_386.go
(11.58 KB)
๐
ztypes_linux_amd64.go
(11.95 KB)
๐
ztypes_linux_arm.go
(11.47 KB)
๐
ztypes_linux_arm64.go
(10.16 KB)
๐
ztypes_linux_loong64.go
(10.77 KB)
๐
ztypes_linux_mips.go
(9.96 KB)
๐
ztypes_linux_mips64.go
(10.08 KB)
๐
ztypes_linux_mips64le.go
(10.08 KB)
๐
ztypes_linux_mipsle.go
(9.96 KB)
๐
ztypes_linux_ppc64.go
(10.25 KB)
๐
ztypes_linux_ppc64le.go
(10.38 KB)
๐
ztypes_linux_riscv64.go
(10.23 KB)
๐
ztypes_linux_s390x.go
(10.44 KB)
๐
ztypes_netbsd_386.go
(5.99 KB)
๐
ztypes_netbsd_amd64.go
(6.17 KB)
๐
ztypes_netbsd_arm.go
(6.13 KB)
๐
ztypes_netbsd_arm64.go
(6.17 KB)
๐
ztypes_openbsd_386.go
(6.73 KB)
๐
ztypes_openbsd_amd64.go
(6.89 KB)
๐
ztypes_openbsd_arm.go
(6.84 KB)
๐
ztypes_openbsd_arm64.go
(6.66 KB)
๐
ztypes_openbsd_mips64.go
(6.66 KB)
๐
ztypes_openbsd_ppc64.go
(6.69 KB)
๐
ztypes_openbsd_riscv64.go
(6.69 KB)
๐
ztypes_solaris_amd64.go
(5.57 KB)
Editing: syscall_windows_test.go
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package syscall_test import ( "fmt" "internal/testenv" "os" "os/exec" "path/filepath" "strings" "syscall" "testing" ) func TestOpen_Dir(t *testing.T) { dir := t.TempDir() h, err := syscall.Open(dir, syscall.O_RDONLY, 0) if err != nil { t.Fatalf("Open failed: %v", err) } syscall.CloseHandle(h) h, err = syscall.Open(dir, syscall.O_RDONLY|syscall.O_TRUNC, 0) if err == nil { t.Error("Open should have failed") } else { syscall.CloseHandle(h) } h, err = syscall.Open(dir, syscall.O_RDONLY|syscall.O_CREAT, 0) if err == nil { t.Error("Open should have failed") } else { syscall.CloseHandle(h) } } func TestComputerName(t *testing.T) { name, err := syscall.ComputerName() if err != nil { t.Fatalf("ComputerName failed: %v", err) } if len(name) == 0 { t.Error("ComputerName returned empty string") } } func TestWin32finddata(t *testing.T) { dir := t.TempDir() path := filepath.Join(dir, "long_name.and_extension") f, err := os.Create(path) if err != nil { t.Fatalf("failed to create %v: %v", path, err) } f.Close() type X struct { fd syscall.Win32finddata got byte pad [10]byte // to protect ourselves } var want byte = 2 // it is unlikely to have this character in the filename x := X{got: want} pathp, _ := syscall.UTF16PtrFromString(path) h, err := syscall.FindFirstFile(pathp, &(x.fd)) if err != nil { t.Fatalf("FindFirstFile failed: %v", err) } err = syscall.FindClose(h) if err != nil { t.Fatalf("FindClose failed: %v", err) } if x.got != want { t.Fatalf("memory corruption: want=%d got=%d", want, x.got) } } func abort(funcname string, err error) { panic(funcname + " failed: " + err.Error()) } func ExampleLoadLibrary() { h, err := syscall.LoadLibrary("kernel32.dll") if err != nil { abort("LoadLibrary", err) } defer syscall.FreeLibrary(h) proc, err := syscall.GetProcAddress(h, "GetVersion") if err != nil { abort("GetProcAddress", err) } r, _, _ := syscall.Syscall(uintptr(proc), 0, 0, 0, 0) major := byte(r) minor := uint8(r >> 8) build := uint16(r >> 16) print("windows version ", major, ".", minor, " (Build ", build, ")\n") } func TestTOKEN_ALL_ACCESS(t *testing.T) { if syscall.TOKEN_ALL_ACCESS != 0xF01FF { t.Errorf("TOKEN_ALL_ACCESS = %x, want 0xF01FF", syscall.TOKEN_ALL_ACCESS) } } func TestStdioAreInheritable(t *testing.T) { testenv.MustHaveGoBuild(t) testenv.MustHaveCGO(t) testenv.MustHaveExecPath(t, "gcc") tmpdir := t.TempDir() // build go dll const dlltext = ` package main import "C" import ( "fmt" ) //export HelloWorld func HelloWorld() { fmt.Println("Hello World") } func main() {} ` dllsrc := filepath.Join(tmpdir, "helloworld.go") err := os.WriteFile(dllsrc, []byte(dlltext), 0644) if err != nil { t.Fatal(err) } dll := filepath.Join(tmpdir, "helloworld.dll") cmd := exec.Command(testenv.GoToolPath(t), "build", "-o", dll, "-buildmode", "c-shared", dllsrc) out, err := testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { t.Fatalf("failed to build go library: %s\n%s", err, out) } // build c exe const exetext = ` #include <stdlib.h> #include <windows.h> int main(int argc, char *argv[]) { system("hostname"); ((void(*)(void))GetProcAddress(LoadLibraryA(%q), "HelloWorld"))(); system("hostname"); return 0; } ` exe := filepath.Join(tmpdir, "helloworld.exe") cmd = exec.Command("gcc", "-o", exe, "-xc", "-") cmd.Stdin = strings.NewReader(fmt.Sprintf(exetext, dll)) out, err = testenv.CleanCmdEnv(cmd).CombinedOutput() if err != nil { t.Fatalf("failed to build c executable: %s\n%s", err, out) } out, err = exec.Command(exe).Output() if err != nil { t.Fatalf("c program execution failed: %v: %v", err, string(out)) } hostname, err := os.Hostname() if err != nil { t.Fatal(err) } have := strings.ReplaceAll(string(out), "\n", "") have = strings.ReplaceAll(have, "\r", "") want := fmt.Sprintf("%sHello World%s", hostname, hostname) if have != want { t.Fatalf("c program output is wrong: got %q, want %q", have, want) } } func TestGetwd_DoesNotPanicWhenPathIsLong(t *testing.T) { // Regression test for https://github.com/golang/go/issues/60051. // The length of a filename is also limited, so we can't reproduce the // crash by creating a single directory with a very long name; we need two // layers. a200 := strings.Repeat("a", 200) dirname := filepath.Join(t.TempDir(), a200, a200) err := os.MkdirAll(dirname, 0o700) if err != nil { t.Skipf("MkdirAll failed: %v", err) } err = os.Chdir(dirname) if err != nil { t.Skipf("Chdir failed: %v", err) } // Change out of the temporary directory so that we don't inhibit its // removal during test cleanup. defer os.Chdir(`\`) syscall.Getwd() } func TestGetStartupInfo(t *testing.T) { var si syscall.StartupInfo err := syscall.GetStartupInfo(&si) if err != nil { // see https://go.dev/issue/31316 t.Fatalf("GetStartupInfo: got error %v, want nil", err) } } func FuzzUTF16FromString(f *testing.F) { f.Add("hi") // ASCII f.Add("รข") // latin1 f.Add("ใญใ") // plane 0 f.Add("๐") // extra Plane 0 f.Add("\x90") // invalid byte f.Add("\xe3\x81") // truncated f.Add("\xe3\xc1\x81") // invalid middle byte f.Fuzz(func(t *testing.T, tst string) { res, err := syscall.UTF16FromString(tst) if err != nil { if strings.Contains(tst, "\x00") { t.Skipf("input %q contains a NUL byte", tst) } t.Fatalf("UTF16FromString(%q): %v", tst, err) } t.Logf("UTF16FromString(%q) = %04x", tst, res) if len(res) < 1 || res[len(res)-1] != 0 { t.Fatalf("missing NUL terminator") } if len(res) > len(tst)+1 { t.Fatalf("len(%04x) > len(%q)+1", res, tst) } }) }
Upload File
Create Folder