123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130 |
- diff --git a/Makefile.am b/Makefile.am
- index 670cdcb..1d7043b 100644
- --- a/Makefile.am
- +++ b/Makefile.am
- @@ -25,7 +25,7 @@ SUBDIRS = src test
- pkgconfigdir = $(libdir)/pkgconfig
- pkgconfig_DATA = xshmfence.pc
-
- -EXTRA_DIST = xshmfence.pc.in ChangeLog
- +EXTRA_DIST = xshmfence.pc.in ChangeLog README.md
- MAINTAINERCLEANFILES = ChangeLog
-
- .PHONY: ChangeLog
- diff --git a/README b/README.md
- similarity index 56%
- rename from README
- rename to README.md
- index db193b7..748fe8a 100644
- --- a/README
- +++ b/README.md
- @@ -1,4 +1,5 @@
- libxshmfence - Shared memory 'SyncFence' synchronization primitive
- +------------------------------------------------------------------
-
- This library offers a CPU-based synchronization primitive compatible
- with the X SyncFence objects that can be shared between processes
- @@ -14,23 +15,15 @@ There are two underlying implementations:
- All questions regarding this software should be directed at the
- Xorg mailing list:
-
- - http://lists.freedesktop.org/mailman/listinfo/xorg
- -
- -Please submit bug reports to the Xorg bugzilla:
- -
- - https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
- + https://lists.x.org/mailman/listinfo/xorg
-
- The master development code repository can be found at:
-
- - git://anongit.freedesktop.org/git/xorg/lib/libxshmfence
- + https://gitlab.freedesktop.org/xorg/lib/libxshmfence
-
- - http://cgit.freedesktop.org/xorg/lib/libxshmfence
- +Please submit bug reports and requests to merge patches there.
-
- For patch submission instructions, see:
-
- - http://www.x.org/wiki/Development/Documentation/SubmittingPatches
- -
- -For more information on the git code manager, see:
- -
- - http://wiki.x.org/wiki/GitPage
- + https://www.x.org/wiki/Development/Documentation/SubmittingPatches
-
- diff --git a/configure.ac b/configure.ac
- index 8afe7a6..5636cb8 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -24,7 +24,7 @@ dnl Process this file with autoconf to create configure.
-
- AC_PREREQ([2.60])
- AC_INIT([libxshmfence], [1.3],
- - [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], [libxshmfence])
- + [https://gitlab.freedesktop.org/xorg/lib/libxshmfence/issues], [libxshmfence])
- AC_CONFIG_SRCDIR([Makefile.am])
- AC_CONFIG_HEADERS([config.h])
-
- @@ -91,7 +91,7 @@ AC_SUBST([XPROTO_CFLAGS])
-
- CFLAGS="$CFLAGS $XPROTO_CFLAGS"
-
- -AC_CHECK_FUNCS(memfd_create)
- +AC_CHECK_FUNCS(memfd_create mkostemp)
-
- AC_CHECK_DECLS([__NR_memfd_create], [], [], [[#include <asm/unistd.h>]])
-
- diff --git a/src/xshmfence_alloc.c b/src/xshmfence_alloc.c
- index 05cf953..932adb9 100644
- --- a/src/xshmfence_alloc.c
- +++ b/src/xshmfence_alloc.c
- @@ -26,6 +26,8 @@
-
- #include "xshmfenceint.h"
-
- +#include <fcntl.h>
- +
- #if !HAVE_MEMFD_CREATE
- #if HAVE_DECL___NR_MEMFD_CREATE
- #include <asm/unistd.h>
- @@ -68,10 +70,17 @@ xshmfence_alloc_shm(void)
- {
- char template[] = SHMDIR "/shmfd-XXXXXX";
- int fd;
- +#ifndef HAVE_MKOSTEMP
- + int flags;
- +#endif
-
- #if HAVE_MEMFD_CREATE
- fd = memfd_create("xshmfence", MFD_CLOEXEC|MFD_ALLOW_SEALING);
- if (fd < 0)
- +#endif
- +#ifdef SHM_ANON
- + fd = shm_open(SHM_ANON, O_RDWR|O_CLOEXEC, 0600);
- + if (fd < 0)
- #endif
- {
- #ifdef O_TMPFILE
- @@ -79,10 +88,21 @@ xshmfence_alloc_shm(void)
- if (fd < 0)
- #endif
- {
- +#ifdef HAVE_MKOSTEMP
- + fd = mkostemp(template, O_CLOEXEC);
- +#else
- fd = mkstemp(template);
- +#endif
- if (fd < 0)
- return fd;
- unlink(template);
- +#ifndef HAVE_MKOSTEMP
- + flags = fcntl(fd, F_GETFD);
- + if (flags != -1) {
- + flags |= FD_CLOEXEC;
- + fcntl(fd, F_SETFD, &flags);
- + }
- +#endif
- }
- }
- if (ftruncate(fd, sizeof (struct xshmfence)) < 0) {
|