all: add GOOS=ios

Following CL 254740, this CL does it on x/sys.

Updates golang/go#38485.

Change-Id: I5eab09a9a87c87fc883b5701434415648fb28eb0
Reviewed-on: https://go-review.googlesource.com/c/sys/+/255557
Trust: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
diff --git a/cpu/cpu_arm64.go b/cpu/cpu_arm64.go
index 2d90024..951078f 100644
--- a/cpu/cpu_arm64.go
+++ b/cpu/cpu_arm64.go
@@ -39,7 +39,7 @@
 
 func archInit() {
 	switch runtime.GOOS {
-	case "android", "darwin", "netbsd":
+	case "android", "darwin", "ios", "netbsd":
 		// Android and iOS don't seem to allow reading these registers.
 		//
 		// NetBSD:
diff --git a/cpu/cpu_test.go b/cpu/cpu_test.go
index 83fa5ef..c04ea74 100644
--- a/cpu/cpu_test.go
+++ b/cpu/cpu_test.go
@@ -31,7 +31,7 @@
 }
 
 func TestARM64minimalFeatures(t *testing.T) {
-	if runtime.GOARCH != "arm64" || runtime.GOOS == "darwin" {
+	if runtime.GOARCH != "arm64" || (runtime.GOOS == "darwin" || runtime.GOOS == "ios") {
 		return
 	}
 	if !cpu.ARM64.HasASIMD {
diff --git a/unix/sockcmsg_unix_other.go b/unix/sockcmsg_unix_other.go
index 7d08dae..abdedcf 100644
--- a/unix/sockcmsg_unix_other.go
+++ b/unix/sockcmsg_unix_other.go
@@ -20,7 +20,7 @@
 	case "aix":
 		// There is no alignment on AIX.
 		salign = 1
-	case "darwin", "illumos", "solaris":
+	case "darwin", "ios", "illumos", "solaris":
 		// NOTE: It seems like 64-bit Darwin, Illumos and Solaris
 		// kernels still require 32-bit aligned access to network
 		// subsystem.
diff --git a/unix/syscall_bsd.go b/unix/syscall_bsd.go
index 60bbe10..9ebe92e 100644
--- a/unix/syscall_bsd.go
+++ b/unix/syscall_bsd.go
@@ -272,7 +272,7 @@
 	if err != nil {
 		return
 	}
-	if runtime.GOOS == "darwin" && len == 0 {
+	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && len == 0 {
 		// Accepted socket has no address.
 		// This is likely due to a bug in xnu kernels,
 		// where instead of ECONNABORTED error socket
diff --git a/unix/syscall_unix_test.go b/unix/syscall_unix_test.go
index 7d31402..f86e1e2 100644
--- a/unix/syscall_unix_test.go
+++ b/unix/syscall_unix_test.go
@@ -165,7 +165,7 @@
 // "-test.run=^TestPassFD$" and an environment variable used to signal
 // that the test should become the child process instead.
 func TestPassFD(t *testing.T) {
-	if runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
+	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64") {
 		t.Skip("cannot exec subprocess on iOS, skipping test")
 	}
 
@@ -377,7 +377,7 @@
 	}
 	set := rlimit
 	set.Cur = set.Max - 1
-	if runtime.GOOS == "darwin" && set.Cur > 4096 {
+	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && set.Cur > 4096 {
 		// rlim_min for RLIMIT_NOFILE should be equal to
 		// or lower than kern.maxfilesperproc, which on
 		// some machines are 4096. See #40564.
@@ -394,7 +394,7 @@
 	}
 	set = rlimit
 	set.Cur = set.Max - 1
-	if runtime.GOOS == "darwin" && set.Cur > 4096 {
+	if (runtime.GOOS == "darwin" || runtime.GOOS == "ios") && set.Cur > 4096 {
 		set.Cur = 4096
 	}
 	if set != get {
@@ -402,7 +402,7 @@
 		// increase the soft limit of rlimit sandbox, though
 		// Setrlimit never reports an error.
 		switch runtime.GOOS {
-		case "darwin":
+		case "darwin", "ios":
 		default:
 			t.Fatalf("Rlimit: change failed: wanted %#v got %#v", set, get)
 		}
@@ -483,7 +483,7 @@
 
 func TestPoll(t *testing.T) {
 	if runtime.GOOS == "android" ||
-		(runtime.GOOS == "darwin" && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")) {
+		((runtime.GOOS == "darwin" || runtime.GOOS == "ios") && (runtime.GOARCH == "arm" || runtime.GOARCH == "arm64")) {
 		t.Skip("mkfifo syscall is not available on android and iOS, skipping test")
 	}
 
@@ -597,7 +597,7 @@
 	switch runtime.GOOS {
 	case "android":
 		dirs = []string{"/", "/system/bin"}
-	case "darwin":
+	case "darwin", "ios":
 		switch runtime.GOARCH {
 		case "arm", "arm64":
 			d1, err := ioutil.TempDir("", "d1")