diff options
author | Andrew G. Morgan <morgan@kernel.org> | 2020-12-09 08:12:43 -0800 |
---|---|---|
committer | Andrew G. Morgan <morgan@kernel.org> | 2020-12-09 08:30:38 -0800 |
commit | 4d13894a85386feeca22ebf7c0f84f4173376e0f (patch) | |
tree | 961d8afcd8cced1c4c78791933edbd5d6e5cda5a | |
parent | b9f056164180c4bd8acf75ed524d260bac9f4cf0 (diff) | |
download | libcap2-4d13894a85386feeca22ebf7c0f84f4173376e0f.tar.gz |
Further trim the psx headers and support easy vendoring.psx/v0.2.46-rc3
Remove psx_pthread_create() from libpsx - given the way -lpsx is
linked this is not needed.
Also, as pointed out by Lorenz Bauer, "go mod vendor" support
was unable to vendor a copy of psx_syscall.h because it didn't
reside in the same directory as the *.go code for the psx package.
(General discussion https://github.com/golang/go/issues/26366 .)
Given that we can, avoid the use of a sub-directory in the libcap
tree.
Signed-off-by: Andrew G. Morgan <morgan@kernel.org>
-rw-r--r-- | go/Makefile | 5 | ||||
l--------- | libcap/include/sys/psx_syscall.h | 2 | ||||
l--------- | libcap/psx_syscall.h | 1 | ||||
-rw-r--r-- | psx/psx.c | 13 | ||||
-rw-r--r-- | psx/psx.go | 3 | ||||
-rw-r--r-- | psx/psx_syscall.h (renamed from psx/include/sys/psx_syscall.h) | 17 |
6 files changed, 7 insertions, 34 deletions
diff --git a/go/Makefile b/go/Makefile index bfee9f4..b22a9bc 100644 --- a/go/Makefile +++ b/go/Makefile @@ -104,9 +104,8 @@ endif install: all rm -rf $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx - mkdir -p $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx/include/sys - for x in src/$(IMPORTDIR)/psx/* ; do if [ -d $$x ]; then continue; fi; install -m 0644 $$x $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx; done - install -m 0644 src/$(IMPORTDIR)/psx/include/sys/psx_syscall.h $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx/include/sys/psx_syscall.h + mkdir -p $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx + install -m 0644 src/$(IMPORTDIR)/psx/* $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/psx mkdir -p $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/cap rm -rf $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/cap/* install -m 0644 src/$(IMPORTDIR)/cap/* $(FAKEROOT)$(GOPKGDIR)/$(IMPORTDIR)/cap diff --git a/libcap/include/sys/psx_syscall.h b/libcap/include/sys/psx_syscall.h index 1578765..ebac5fe 120000 --- a/libcap/include/sys/psx_syscall.h +++ b/libcap/include/sys/psx_syscall.h @@ -1 +1 @@ -../../../psx/include/sys/psx_syscall.h
\ No newline at end of file +../../../psx/psx_syscall.h
\ No newline at end of file diff --git a/libcap/psx_syscall.h b/libcap/psx_syscall.h new file mode 120000 index 0000000..dc748bb --- /dev/null +++ b/libcap/psx_syscall.h @@ -0,0 +1 @@ +include/sys/psx_syscall.h
\ No newline at end of file @@ -25,9 +25,10 @@ #include <stdlib.h> #include <string.h> #include <unistd.h> -#include <sys/psx_syscall.h> #include <sys/syscall.h> +#include "psx_syscall.h" + /* * psx_load_syscalls() is weakly defined so we can have it overridden * by libpsx if it is linked. Specifically, when libcap calls @@ -487,16 +488,6 @@ int __wrap_pthread_create(pthread_t *thread, const pthread_attr_t *attr, } /* - * psx_pthread_create is a wrapper for pthread_create() that registers - * the newly created thread. If your threads are created already, they - * can be individually registered with psx_register(). - */ -int psx_pthread_create(pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine) (void *), void *arg) { - return __wrap_pthread_create(thread, attr, start_routine, arg); -} - -/* * __psx_immediate_syscall does one syscall using the current * process. */ @@ -55,11 +55,10 @@ import ( "syscall" ) -// #cgo CFLAGS: -I${SRCDIR}/include // #cgo LDFLAGS: -lpthread -Wl,-wrap,pthread_create // // #include <errno.h> -// #include <sys/psx_syscall.h> +// #include "psx_syscall.h" // // long __errno_too(long set_errno) { // long v = errno; diff --git a/psx/include/sys/psx_syscall.h b/psx/psx_syscall.h index d1159e2..4c99375 100644 --- a/psx/include/sys/psx_syscall.h +++ b/psx/psx_syscall.h @@ -52,23 +52,6 @@ long int psx_syscall6(long int syscall_nr, long int arg4, long int arg5, long int arg6); /* - * psx_pthread_create() wraps the -lpthread pthread_create() function - * call and registers the generated thread with the psx_syscall - * infrastructure. - * - * Note, to transparently redirect all the pthread_create() calls in - * your binary to psx_pthread_create(), link with: - * - * gcc ... -lpsx -lpthread -Wl,-wrap,pthread_create - * - * [That is, libpsx contains an internal definition for the - * __wrap_pthread_create function to invoke psx_pthread_create - * functionality instead.] - */ -int psx_pthread_create(pthread_t *thread, const pthread_attr_t *attr, - void *(*start_routine) (void *), void *arg); - -/* * This function should be used by systems to obtain pointers to the * two syscall functions provided by the PSX library. A linkage trick * is to define this function as weak in a library that can optionally |