Skip to content

Commit 32ee499

Browse files
committed
fix: resolve compilation issues on non-Linux platforms (broker, pal_windows)
1 parent a095549 commit 32ee499

4 files changed

Lines changed: 29 additions & 8 deletions

File tree

internal/cli/broker.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"os"
99
"path/filepath"
1010
"sync"
11-
"syscall"
1211
"time"
1312

1413
"github.com/nathfavour/anyisland/internal/agent"
@@ -168,13 +167,6 @@ func (b *UpdateBroker) handleHandshake(conn net.Conn) BrokerResponse {
168167
return BrokerResponse{Status: "UNMANAGED"}
169168
}
170169

171-
func (b *UpdateBroker) getPeerPID(f *os.File) (int, error) {
172-
ucred, err := syscall.GetsockoptUcred(int(f.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
173-
if err != nil {
174-
return 0, err
175-
}
176-
return int(ucred.Pid), nil
177-
}
178170

179171
func (b *UpdateBroker) checkTool(name string) BrokerResponse {
180172
tools, err := b.reg.ListTools()

internal/cli/broker_linux.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//go:build linux
2+
3+
package cli
4+
5+
import (
6+
"os"
7+
"syscall"
8+
)
9+
10+
func (b *UpdateBroker) getPeerPID(f *os.File) (int, error) {
11+
ucred, err := syscall.GetsockoptUcred(int(f.Fd()), syscall.SOL_SOCKET, syscall.SO_PEERCRED)
12+
if err != nil {
13+
return 0, err
14+
}
15+
return int(ucred.Pid), nil
16+
}

internal/cli/broker_others.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//go:build !linux
2+
3+
package cli
4+
5+
import (
6+
"fmt"
7+
"os"
8+
)
9+
10+
func (b *UpdateBroker) getPeerPID(f *os.File) (int, error) {
11+
return 0, fmt.Errorf("peer PID resolution not supported on this platform")
12+
}

internal/pal/pal_windows.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
package pal
44

55
import (
6+
"fmt"
67
"os"
78
"os/exec"
89
"strings"

0 commit comments

Comments
 (0)