Skip to content

Commit 6cd5922

Browse files
bradfitzraggi
authored andcommitted
all: adjust build tags for plan9
Signed-off-by: Brad Fitzpatrick <[email protected]>
1 parent 88b11b4 commit 6cd5922

File tree

6 files changed

+26
-5
lines changed

6 files changed

+26
-5
lines changed

conn/bind_std.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,11 @@ func listenNet(network string, port int) (*net.UDPConn, int, error) {
136136
return conn.(*net.UDPConn), uaddr.Port, nil
137137
}
138138

139+
// errEADDRINUSE is syscall.EADDRINUSE, boxed into an interface once
140+
// in erraddrinuse.go on almost all platforms. For other platforms,
141+
// it's at least non-nil.
142+
var errEADDRINUSE error = errors.New("")
143+
139144
func (s *StdNetBind) Open(uport uint16) ([]ReceiveFunc, uint16, error) {
140145
s.mu.Lock()
141146
defer s.mu.Unlock()
@@ -162,7 +167,7 @@ again:
162167

163168
// Listen on the same port as we're using for ipv4.
164169
v6conn, port, err = listenNet("udp6", port)
165-
if uport == 0 && errors.Is(err, syscall.EADDRINUSE) && tries < 100 {
170+
if uport == 0 && errors.Is(err, errEADDRINUSE) && tries < 100 {
166171
v4conn.Close()
167172
tries++
168173
goto again

conn/controlfns_unix.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !windows && !linux && !wasm
1+
//go:build !windows && !linux && !wasm && !plan9
22

33
/* SPDX-License-Identifier: MIT
44
*

conn/erraddrinuse.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
//go:build !plan9
2+
3+
/* SPDX-License-Identifier: MIT
4+
*
5+
* Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
6+
*/
7+
8+
package conn
9+
10+
import "syscall"
11+
12+
func init() {
13+
errEADDRINUSE = syscall.EADDRINUSE
14+
}

ipc/uapi_wasm.go renamed to ipc/uapi_fake.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
//go:build wasm || plan9
2+
13
/* SPDX-License-Identifier: MIT
24
*
35
* Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
46
*/
57

68
package ipc
79

8-
// Made up sentinel error codes for {js,wasip1}/wasm.
10+
// Made up sentinel error codes for {js,wasip1}/wasm, and plan9.
911
const (
1012
IpcErrorIO = 1
1113
IpcErrorInvalid = 2

rwcancel/rwcancel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build !windows && !wasm
1+
//go:build !windows && !wasm && !plan9
22

33
/* SPDX-License-Identifier: MIT
44
*

rwcancel/rwcancel_stub.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//go:build windows || wasm
1+
//go:build windows || wasm || plan9
22

33
// SPDX-License-Identifier: MIT
44

0 commit comments

Comments
 (0)