[PATCH:shmfd 2/2] Use /var/tmp instead of /run/shm on non-linux OS'es
Mark Kettenis
mark.kettenis at xs4all.nl
Thu Nov 7 23:53:24 PST 2013
> From: Alan Coopersmith <alan.coopersmith at oracle.com>
> Date: Thu, 7 Nov 2013 20:55:44 -0800
>
> Signed-off-by: Alan Coopersmith <alan.coopersmith at oracle.com>
> ---
> Makefile | 9 +++++----
> shmfd.c | 4 ++++
> 2 files changed, 9 insertions(+), 4 deletions(-)
Ah, is this the example code I have been looking for the last couple
of days?
Anyway, wouldn't it be better to use /tmp instead of adding this
(admittedly small) #ifdef spaghetti?
> diff --git a/Makefile b/Makefile
> index e77f938..672979e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1,7 +1,8 @@
> -CFLAGS=-Wall -O0 -g $(shell pkg-config --cflags xcb-shm xcb-aux xcb-dri3 xcb-present xshmfence)
> -LIBS=$(shell pkg-config --libs xcb-shm xcb-aux xcb-dri3 xcb-present xshmfence)
> +CFLAGS=-Wall -O0 -g $(shell pkg-config --cflags xcb-shm xcb-aux xcb-dri3 xcb-present) -m64
> +LIBS=$(LDFLAGS) $(shell pkg-config --libs xcb-shm xcb-aux xcb-dri3 xcb-present)
>
> -all: shmfd dri3 futex xfence present pipefence shmtest
> +#all: shmfd dri3 futex xfence present pipefence shmtest
> +all: shmfd present
>
> SHMFD_OBJS=shmfd.o
>
> @@ -42,4 +43,4 @@ clean:
> rm -f shmfd $(SHMFD_OBJS)
> rm -f dri3 $(DRI3_OBJS)
> rm -f futex $(FUTEX_OBJS)
> - rm -f present $(PRESENT_OBJS)
> \ No newline at end of file
> + rm -f present $(PRESENT_OBJS)
> diff --git a/shmfd.c b/shmfd.c
> index 4dee9de..cdd3889 100644
> --- a/shmfd.c
> +++ b/shmfd.c
> @@ -32,7 +32,11 @@ int
> make_shm(int size, void **addrp)
> {
> void *addr;
> +#ifdef linux
> char template[] = "/run/shm/shmfd-XXXXXX";
> +#else
> + char template[] = "/var/tmp/shmfd-XXXXXX";
> +#endif
> int fd = mkstemp(template);
>
> if (fd < 0)
> --
> 1.7.9.2
>
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>
More information about the xorg-devel
mailing list