aboutsummaryrefslogtreecommitdiff
path: root/go
diff options
context:
space:
mode:
authorAndrew G. Morgan <morgan@kernel.org>2020-12-11 23:27:50 -0800
committerAndrew G. Morgan <morgan@kernel.org>2020-12-11 23:48:29 -0800
commit90192cd36471c7dfb44b4ecd6a8ccf7595d26e9d (patch)
tree527da7c7d23a0ab06fd9cfeac874351ee18badff /go
parente7e0e1b9e2cf3378d329174ed5b0c716b0539c72 (diff)
downloadlibcap-90192cd36471c7dfb44b4ecd6a8ccf7595d26e9d.tar.gz
Refactor the "psx" vs "cap" package cgo-or-not complexity to "psx".
I've decided to put the decision to call syscall.AllThreadsSyscall*() into "psx" instead of the "cap" package. This should make client use of "psx" more straightforward and the code will 'just compile' if the user builds with CGO_ENABLED=1 or CGO_ENABLED=0. It also makes the "psx" package useful for other applications besides the "cap" package. Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
Diffstat (limited to 'go')
-rw-r--r--go/Makefile15
1 files changed, 9 insertions, 6 deletions
diff --git a/go/Makefile b/go/Makefile
index 3bd79c8..05ec7bf 100644
--- a/go/Makefile
+++ b/go/Makefile
@@ -61,8 +61,8 @@ ifeq ($(RAISE_GO_FILECAP),yes)
@echo "NOTE: RAISED cap_setpcap,cap_net_bind_service ON web binary"
endif
-setid: ../goapps/setid/setid.go $(CAPGOPACKAGE)
- GO111MODULE=off CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build -o $@ $(GOBUILDTAG) $<
+setid: ../goapps/setid/setid.go $(CAPGOPACKAGE) $(PSXGOPACKAGE)
+ GO111MODULE=off CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build -o $@ $(GOBUILDTAG) $<
gowns: ../goapps/gowns/gowns.go $(CAPGOPACKAGE)
GO111MODULE=off CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH=$(GOPATH) $(GO) build -o $@ $(GOBUILDTAG) $<
@@ -77,15 +77,18 @@ ifeq ($(CGO_REQUIRED),0)
endif
# Bug reported issues:
+# https://bugzilla.kernel.org/show_bug.cgi?id=210533 (cgo - fixed)
+# https://github.com/golang/go/issues/43149 (nocgo - not fixed yet)
+# When the latter is fixed we can replace CGO_ENABLED=1 with ="$(CGO_REQUIRED)"
psx-signals: psx-signals.go $(PSXGOPACKAGE)
- GO111MODULE=off CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $<
+ GO111MODULE=off CGO_ENABLED=1 CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $<
b210613: b210613.go $(CAPGOPACKAGE)
- GO111MODULE=off CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $<
+ GO111MODULE=off CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" GOPATH=$(GOPATH) $(GO) build $<
test: all
- GO111MODULE=off CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/psx
- GO111MODULE=off CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/cap
+ GO111MODULE=off CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/psx
+ GO111MODULE=off CGO_ENABLED="$(CGO_REQUIRED)" CGO_LDFLAGS_ALLOW="$(CGO_LDFLAGS_ALLOW)" GOPATH="$(GOPATH)" $(GO) test $(IMPORTDIR)/cap
LD_LIBRARY_PATH=../libcap ./compare-cap
./psx-signals
./setid --caps=false