SecBSD's official ports repository
This commit is contained in:
commit
2c0afcbbf3
64331 changed files with 5339189 additions and 0 deletions
54
sysutils/nomad/patches/patch-command_agent_host_openbsd_go
Normal file
54
sysutils/nomad/patches/patch-command_agent_host_openbsd_go
Normal file
|
@ -0,0 +1,54 @@
|
|||
Index: command/agent/host/openbsd.go
|
||||
--- command/agent/host/openbsd.go.orig
|
||||
+++ command/agent/host/openbsd.go
|
||||
@@ -0,0 +1,50 @@
|
||||
+// +build openbsd
|
||||
+
|
||||
+package host
|
||||
+
|
||||
+import (
|
||||
+ "syscall"
|
||||
+)
|
||||
+
|
||||
+func IntToString(orig []int8) string {
|
||||
+ ret := make([]byte, len(orig))
|
||||
+ size := -1
|
||||
+ for i, o := range orig {
|
||||
+ if o == 0 {
|
||||
+ size = i
|
||||
+ break
|
||||
+ }
|
||||
+ ret[i] = byte(o)
|
||||
+ }
|
||||
+ if size == -1 {
|
||||
+ size = len(orig)
|
||||
+ }
|
||||
+
|
||||
+ return string(ret[0:size])
|
||||
+}
|
||||
+
|
||||
+// mountedPaths produces a list of mounts
|
||||
+func mountedPaths() []string {
|
||||
+ var paths []string
|
||||
+
|
||||
+ n, err := syscall.Getfsstat(nil, 1)
|
||||
+ if err != nil {
|
||||
+ return []string{err.Error()}
|
||||
+ }
|
||||
+
|
||||
+ data := make([]syscall.Statfs_t, n)
|
||||
+ _, err = syscall.Getfsstat(data, 1)
|
||||
+ if err != nil {
|
||||
+ return []string{err.Error()}
|
||||
+ }
|
||||
+
|
||||
+ empty := syscall.Statfs_t{}
|
||||
+ for _, stat := range data {
|
||||
+ if stat == empty {
|
||||
+ return []string{"empy stat struct returned"}
|
||||
+ }
|
||||
+ paths = append(paths, IntToString(stat.F_mntonname[:]))
|
||||
+ }
|
||||
+
|
||||
+ return paths
|
||||
+}
|
Loading…
Add table
Add a link
Reference in a new issue