Re: [PATCH xserver 1/2] shm, xwayland: prefer atomic close-on-exec without O_TMPFILE

2018-02-02 Thread Adam Jackson
On Fri, 2017-07-07 at 16:31 +0200, Jan Beich wrote:
> Signed-off-by: Jan Beich 

Added the equivalent bits to the meson build (hence the failure below)
and merged:

remote: E: failed to find patch for rev 
1e23f03dd5fb6c981ef6d64c084f72fc6820ed71.
remote: I: 0 patch(es) updated to state Accepted.
To ssh://git.freedesktop.org/git/xorg/xserver
   3e3b8a40f..1e23f03dd  master -> master

- ajax
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/2] shm, xwayland: prefer atomic close-on-exec without O_TMPFILE

2017-07-07 Thread Julien Cristau
On Fri, Jul  7, 2017 at 22:41:06 +0200, Jan Beich wrote:

> Julien Cristau  writes:
> 
> > On Fri, Jul  7, 2017 at 16:31:48 +0200, Jan Beich wrote:
> >> -  flags = fcntl(fd, F_GETFD);
> >> +#ifndef HAVE_MKOSTEMP
> >> +  int flags = fcntl(fd, F_GETFD);
> >
> > Do we allow mixed declarations and code nowadays?
> 
> xserver has quite a few of those already, even in Xext/shm.c e.g.,
> 
Those examples are all at the beginning of a block, so they don't count
:)

Anyway, I think
https://cgit.freedesktop.org/xorg/xserver/tree/doc/c-extensions#n35
answers my question, so it's fine.

Cheers,
Julien
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/2] shm, xwayland: prefer atomic close-on-exec without O_TMPFILE

2017-07-07 Thread Jan Beich
Julien Cristau  writes:

> On Fri, Jul  7, 2017 at 16:31:48 +0200, Jan Beich wrote:
>> -flags = fcntl(fd, F_GETFD);
>> +#ifndef HAVE_MKOSTEMP
>> +int flags = fcntl(fd, F_GETFD);
>
> Do we allow mixed declarations and code nowadays?

xserver has quite a few of those already, even in Xext/shm.c e.g.,

  doShmPutImage(DrawablePtr dst, GCPtr pGC,
  ...
  else {
  GCPtr putGC = GetScratchGC(depth, dst->pScreen);
  ...
  ProcShmPutImage(ClientPtr client)
  ...
  if (stuff->sendEvent) {
  xShmCompletionEvent ev = {
  .type = ShmCompletionCode,
  .drawable = stuff->drawable,
  .minorEvent = X_ShmPutImage,
  .majorEvent = ShmReqCode,
  .shmseg = stuff->shmseg,
  .offset = stuff->offset
  };
  ...
  ProcPanoramiXShmCreatePixmap(ClientPtr client)
  ...
  FOR_NSCREENS(j) {
  ShmScrPrivateRec *screen_priv;
  ...
  ShmExtensionInit(void)
  ...
  for (i = 0; i < screenInfo.numScreens; i++) {
  ShmScrPrivateRec *screen_priv =
  ShmInitScreenPriv(screenInfo.screens[i]);
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Re: [PATCH xserver 1/2] shm, xwayland: prefer atomic close-on-exec without O_TMPFILE

2017-07-07 Thread Julien Cristau
On Fri, Jul  7, 2017 at 16:31:48 +0200, Jan Beich wrote:

> 
> Signed-off-by: Jan Beich 
> ---
>  Xext/shm.c  | 9 +++--
>  configure.ac| 2 +-
>  include/dix-config.h.in | 3 +++
>  3 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Xext/shm.c b/Xext/shm.c
> index 91ea90b14..6edeba6fb 100644
> --- a/Xext/shm.c
> +++ b/Xext/shm.c
> @@ -1199,7 +1199,6 @@ shm_tmpfile(void)
>  {
>  #ifdef SHMDIR
>   int fd;
> - int flags;
>   chartemplate[] = SHMDIR "/shmfd-XX";
>  #ifdef O_TMPFILE
>   fd = open(SHMDIR, O_TMPFILE|O_RDWR|O_CLOEXEC|O_EXCL, 0666);
> @@ -1209,15 +1208,21 @@ shm_tmpfile(void)
>   }
>   ErrorF ("Not using O_TMPFILE\n");
>  #endif
> +#ifdef HAVE_MKOSTEMP
> + fd = mkostemp(template, O_CLOEXEC);
> +#else
>   fd = mkstemp(template);
> +#endif
>   if (fd < 0)
>   return -1;
>   unlink(template);
> - flags = fcntl(fd, F_GETFD);
> +#ifndef HAVE_MKOSTEMP
> + int flags = fcntl(fd, F_GETFD);

Do we allow mixed declarations and code nowadays?

Cheers,
Julien
___
xorg-devel@lists.x.org: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel