<div dir="ltr">We want to make sure we don't write files to disk. /tmp on some systems is backed by a disk, not tmpfs.<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 8, 2013 at 2:53 AM, Mark Kettenis <span dir="ltr"><<a href="mailto:mark.kettenis@xs4all.nl" target="_blank">mark.kettenis@xs4all.nl</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">> From: Alan Coopersmith <<a href="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</a>><br>
> Date: Thu, 7 Nov 2013 20:55:44 -0800<br>
<div class="im">><br>
> Signed-off-by: Alan Coopersmith <<a href="mailto:alan.coopersmith@oracle.com">alan.coopersmith@oracle.com</a>><br>
> ---<br>
> Makefile | 9 +++++----<br>
> shmfd.c | 4 ++++<br>
> 2 files changed, 9 insertions(+), 4 deletions(-)<br>
<br>
</div>Ah, is this the example code I have been looking for the last couple<br>
of days?<br>
<br>
Anyway, wouldn't it be better to use /tmp instead of adding this<br>
(admittedly small) #ifdef spaghetti?<br>
<div class="HOEnZb"><div class="h5"><br>
> diff --git a/Makefile b/Makefile<br>
> index e77f938..672979e 100644<br>
> --- a/Makefile<br>
> +++ b/Makefile<br>
> @@ -1,7 +1,8 @@<br>
> -CFLAGS=-Wall -O0 -g $(shell pkg-config --cflags xcb-shm xcb-aux xcb-dri3 xcb-present xshmfence)<br>
> -LIBS=$(shell pkg-config --libs xcb-shm xcb-aux xcb-dri3 xcb-present xshmfence)<br>
> +CFLAGS=-Wall -O0 -g $(shell pkg-config --cflags xcb-shm xcb-aux xcb-dri3 xcb-present) -m64<br>
> +LIBS=$(LDFLAGS) $(shell pkg-config --libs xcb-shm xcb-aux xcb-dri3 xcb-present)<br>
><br>
> -all: shmfd dri3 futex xfence present pipefence shmtest<br>
> +#all: shmfd dri3 futex xfence present pipefence shmtest<br>
> +all: shmfd present<br>
><br>
> SHMFD_OBJS=shmfd.o<br>
><br>
> @@ -42,4 +43,4 @@ clean:<br>
> rm -f shmfd $(SHMFD_OBJS)<br>
> rm -f dri3 $(DRI3_OBJS)<br>
> rm -f futex $(FUTEX_OBJS)<br>
> - rm -f present $(PRESENT_OBJS)<br>
> \ No newline at end of file<br>
> + rm -f present $(PRESENT_OBJS)<br>
> diff --git a/shmfd.c b/shmfd.c<br>
> index 4dee9de..cdd3889 100644<br>
> --- a/shmfd.c<br>
> +++ b/shmfd.c<br>
> @@ -32,7 +32,11 @@ int<br>
> make_shm(int size, void **addrp)<br>
> {<br>
> void *addr;<br>
> +#ifdef linux<br>
> char template[] = "/run/shm/shmfd-XXXXXX";<br>
> +#else<br>
> + char template[] = "/var/tmp/shmfd-XXXXXX";<br>
> +#endif<br>
> int fd = mkstemp(template);<br>
><br>
> if (fd < 0)<br>
> --<br>
> 1.7.9.2<br>
><br>
> _______________________________________________<br>
> <a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
> Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
> Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
><br>
_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br> Jasper<br>
</div></div></div>