From: Ian Jackson Date: Fri, 6 Oct 2017 18:04:03 +0000 (+0100) Subject: fishdescriptor: Utility for RTLD_NOW X-Git-Tag: archive/debian/6.0.0~1^2~38 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;ds=inline;h=22677ae542431ce09a8de83fecc3a22163a8d490;p=chiark-utils.git fishdescriptor: Utility for RTLD_NOW Actually we don't want to do this. It is better to use the python dl or os modules, so we will do that in a moment. Signed-off-by: Ian Jackson --- diff --git a/fishdescriptor/Makefile b/fishdescriptor/Makefile index e6b493a..5b63931 100644 --- a/fishdescriptor/Makefile +++ b/fishdescriptor/Makefile @@ -9,7 +9,7 @@ MINOR=0 LIBCANON= libfishdescriptor-donate.so.$(MAJOR) LIBTARGET= $(LIBCANON).$(MINOR) -all: $(LIBTARGET) +all: $(LIBTARGET) fishdescriptor $(LIBTARGET): donate.o $(CC) -shared -Wl,-soname -Wl,$(LIBCANON) -o $@ $< $(LIBS) diff --git a/fishdescriptor/fishdescriptor.c b/fishdescriptor/fishdescriptor.c new file mode 100644 index 0000000..b86831f --- /dev/null +++ b/fishdescriptor/fishdescriptor.c @@ -0,0 +1,42 @@ +/* + * + * utility + * + */ + +#define _GNU_SOURCE + +#include +#include +#include +#include +#include + +static const struct option longopts[] = { + { "print-rtld-now", 0, 0, '\1' }, + { } +}; + +static void printusage(FILE *f) { + fputs("usage: fishdescriptor --print-rtld-now\n",f); +} + +int main(int argc, char **argv) { + int o; + + while ((o = getopt_long(argc, argv, "", longopts, 0)) != -1) { + switch (o) { + case '\1' /* --print-rtld-now */: + printf("%d\n", RTLD_NOW); + exit (0); + default: + fputs("bad usage: unknown option\n",stderr); + printusage(stderr); + exit(-1); + } + } + + fputs("bad usage: XXX\n",stderr); + printusage(stderr); + exit(-1); +}