Charles Wilson | 1 Mar 2011 03:32
Favicon

Re: Relocation patch for cygwin

On 2/28/2011 5:23 PM, Bruno Haible wrote:
> Thanks for the reminder. Three weeks ago, I concentrated on discussing the
> support of UCS-4 characters (still working on that). I've added minor tweaks
> (especially so as to avoid mixing the Win32 and the Cygwin approach), and
> committed this:

Thanks...

> +#if (defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__
>  # define WIN32_NATIVE
>  #endif

> -#if defined _WIN32 || defined __WIN32__ || defined __CYGWIN__ || defined __EMX__ || defined __DJGPP__
> -  /* Win32, Cygwin, OS/2, DOS */
> +#if ((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__) || defined __EMX__ || defined __DJGPP__
> +  /* Win32, OS/2, DOS */

I'm confused. You told Jan, in a different thread, to be /sure/ to use
WIN32_NATIVE throughout his new code, defined as above.  Yet here, you
repeat the same sequence of conditionals rather than using WIN32_NATIVE.
Why?

> +# ifdef __CYGWIN__
> +  /* The executable is accessible as /proc/≤pid>/exe, at least in
> +     Cygwin >= 1.5.  */
> +  {
> +    char *link;
> +
> +    link = xreadlink ("/proc/self/exe");
> +    if (link != NULL)
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 14:53
Picon

[PATCH 2/3] sendfd, recvf pass file descriptors along Unix domain sockets

Recvfd and sendfd can be used to pass an open file descriptor over a Unix domain socket from one process to another.
---
 lib/passfd.c   |  143 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/passfd.h   |   22 +++++++++
 modules/passfd |   28 +++++++++++
 3 files changed, 193 insertions(+), 0 deletions(-)
 create mode 100644 lib/passfd.c
 create mode 100644 lib/passfd.h
 create mode 100644 modules/passfd

diff --git a/lib/passfd.c b/lib/passfd.c
new file mode 100644
index 0000000..fc8965f
--- /dev/null
+++ b/lib/passfd.c
 <at>  <at>  -0,0 +1,143  <at>  <at> 
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 14:53
Picon

[PATCH 3/3] Add test for passfd

Add simple testing for passfd
---
 lib/passfd.c        |  134 ++++++++++++++++++++++++++-------------------------
 lib/passfd.h        |    7 +--
 tests/test-passfd.c |  108 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 179 insertions(+), 70 deletions(-)
 create mode 100644 tests/test-passfd.c

diff --git a/lib/passfd.c b/lib/passfd.c
index fc8965f..6ec495b 100644
--- a/lib/passfd.c
+++ b/lib/passfd.c
 <at>  <at>  -37,7 +37,8  <at>  <at> 

    return -1 in case of error, 0 on success
 */
-int sendfd(int sock,  int fd)
+int
+sendfd (int sock, int fd)
 {
   char send = 0;
   struct iovec iov[1];
 <at>  <at>  -45,36 +46,36  <at>  <at>  int sendfd(int sock,  int fd)

   /* send at least one char */
   iov[0].iov_base = &send;
-  iov[0].iov_len  = 1;	
-  msg.msg_iov     = iov;
-  msg.msg_iovlen  = 1;
-  msg.msg_name    = 0;
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 14:53
Picon

[PATCH 1/3] Add AF_UNIX test of socket familly

Test availability of AF_UNIX socket familly. It will be used by sendfd/receivefd.
---
 m4/afunix.m4   |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 m4/sockpfaf.m4 |   23 +++++++++++++-
 2 files changed, 119 insertions(+), 1 deletions(-)
 create mode 100644 m4/afunix.m4

diff --git a/m4/afunix.m4 b/m4/afunix.m4
new file mode 100644
index 0000000..4b8145c
--- /dev/null
+++ b/m4/afunix.m4
 <at>  <at>  -0,0 +1,97  <at>  <at> 
+# atoll.m4 serial 1
+dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SOCKET_AFUNIX],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+
+  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHT])
+  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 14:53
Picon

[V2] Openat first step passfd api

Second try of the passfd api a la plan 9.

Change since version 1: 
* use gnu style

Please comments

Bastien

Bastien ROUCARIES | 1 Mar 2011 15:04
Picon

[V3] Passfd

This time corrected with a git commit mistake

V3: correct git commit mistake
V2: style change

Bastien ROUCARIES | 1 Mar 2011 15:04
Picon

[PATCH 3/3] Add test for passfd

Add simple testing for passfd
---
 modules/passfd-tests |   11 +++++
 tests/test-passfd.c  |  110 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 121 insertions(+), 0 deletions(-)
 create mode 100644 modules/passfd-tests
 create mode 100644 tests/test-passfd.c

diff --git a/modules/passfd-tests b/modules/passfd-tests
new file mode 100644
index 0000000..f1badfe
--- /dev/null
+++ b/modules/passfd-tests
 <at>  <at>  -0,0 +1,11  <at>  <at> 
+Files:
+tests/test-passfd.c
+tests/macros.h
+
+Depends-on:
+
+configure.ac:
+
+Makefile.am:
+TESTS += test-passfd
+check_PROGRAMS += test-passfd
diff --git a/tests/test-passfd.c b/tests/test-passfd.c
new file mode 100644
index 0000000..2812c30
--- /dev/null
+++ b/tests/test-passfd.c
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 15:04
Picon

[PATCH 2/3] sendfd, recvf pass file descriptors along Unix domain sockets

Recvfd and sendfd can be used to pass an open file descriptor over a Unix domain socket from one process to another.
---
 lib/passfd.c   |  145 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 lib/passfd.h   |   21 ++++++++
 modules/passfd |   28 +++++++++++
 3 files changed, 194 insertions(+), 0 deletions(-)
 create mode 100644 lib/passfd.c
 create mode 100644 lib/passfd.h
 create mode 100644 modules/passfd

diff --git a/lib/passfd.c b/lib/passfd.c
new file mode 100644
index 0000000..6ec495b
--- /dev/null
+++ b/lib/passfd.c
 <at>  <at>  -0,0 +1,145  <at>  <at> 
+/* Copyright (C) 2011 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
(Continue reading)

Bastien ROUCARIES | 1 Mar 2011 15:04
Picon

[PATCH 1/3] Add AF_UNIX test of socket familly

Test availability of AF_UNIX socket familly. It will be used by sendfd/receivefd.
---
 m4/afunix.m4   |   97 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 m4/sockpfaf.m4 |   23 +++++++++++++-
 2 files changed, 119 insertions(+), 1 deletions(-)
 create mode 100644 m4/afunix.m4

diff --git a/m4/afunix.m4 b/m4/afunix.m4
new file mode 100644
index 0000000..4b8145c
--- /dev/null
+++ b/m4/afunix.m4
 <at>  <at>  -0,0 +1,97  <at>  <at> 
+# atoll.m4 serial 1
+dnl Copyright (C) 2008-2011 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_SOCKET_AFUNIX],
+[
+  AC_REQUIRE([gl_HEADER_SYS_SOCKET])
+  AC_REQUIRE([gl_SOCKET_FAMILIES])
+
+  AC_MSG_CHECKING([for UNIX domain sockets SCM_RIGHT])
+  AC_CACHE_VAL([gl_cv_socket_unix_scm_rights],
+  [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
(Continue reading)

Jim Meyering | 1 Mar 2011 15:24
Gravatar

copy-file.c vs ignoring chown's return value

Hi Bruno,

We're about to use the copy-file module in iwhd,
and I'm seeing this warning/error with our gcc options:

  copy-file.c: In function 'copy_file_preserving':
  copy-file.c:120:9: error: ignoring return value of 'chown', declared with attribute
warn_unused_result [-Wunused-result]

I see two ways to address the problem.
One is to add this pragma along with a comment somewhere in copy-file.c:

    # pragma GCC diagnostic ignored "-Wunused-result"

but that seems unwise.  In a file like that, it would be all too easy to
introduce a real bug that would be warned about by -Wunused-result.
IMHO, we must not turn off that option.

How about this patch instead?

From 6b8f3f6439d77ad4b84765eaee9eab501bd0d4de Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering <at> redhat.com>
Date: Tue, 1 Mar 2011 15:20:33 +0100
Subject: [PATCH] copy-file: ignore warning about chown's unused return value

* lib/copy-file.c: Include "ignore-value.h".
(copy_file_preserving): Ignore chown failure.
* modules/copy-file (Depends-on): Add ignore-value.
---
 ChangeLog         |    7 +++++++
(Continue reading)


Gmane