]> Cypherpunks repositories - gostls13.git/commitdiff
syscall, internal/poll: fix build on js/wasm
authorBrad Fitzpatrick <bradfitz@golang.org>
Fri, 22 Jun 2018 17:45:30 +0000 (17:45 +0000)
committerBrad Fitzpatrick <bradfitz@golang.org>
Fri, 22 Jun 2018 17:58:16 +0000 (17:58 +0000)
Fixes #26014

Change-Id: I9d92414a9181c5d189e3e266666950656bf00406
Reviewed-on: https://go-review.googlesource.com/120576
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/internal/poll/fd_unix.go
src/syscall/net_js.go

index 5639a9dab62dc463586d57d5dc579bc50edfff4b..c10ac8949681e7f90876757e97e858711f71c9e8 100644 (file)
@@ -455,9 +455,10 @@ func DupCloseOnExec(fd int) (int, string, error) {
                switch e1 {
                case 0:
                        return int(r0), "", nil
-               case syscall.EINVAL:
-                       // Old kernel. Fall back to the portable way
-                       // from now on.
+               case syscall.EINVAL, syscall.ENOSYS:
+                       // Old kernel, or js/wasm (which returns
+                       // ENOSYS). Fall back to the portable way from
+                       // now on.
                        atomic.StoreInt32(&tryDupCloexec, 0)
                default:
                        return -1, "fcntl", e1
index 0149e2bfc53ed7c3ebeb6cbb7cfa577b9c40781e..d5bf1f4f99332a50943c01cf06386e10d7e14e18 100644 (file)
@@ -38,6 +38,13 @@ const (
        SO_ERROR
 )
 
+// Misc constants expected by package net but not supported.
+const (
+       _ = iota
+       F_DUPFD_CLOEXEC
+       SYS_FCNTL = 500 // unsupported; same value as net_nacl.go
+)
+
 type Sockaddr interface {
 }