Re: [PATCH 1/3] Add a new exec_exec_file_name RPC

2014-04-11 Thread Samuel Thibault
Hello,

As a reminder, here is the issue:

“
$ cat bar
#!/bin/sh
echo \$0: $0

$ cat foo.c
...
char *arg[] = { argv[1], NULL };
execv (*arg, arg);
perror (execv);
...

$ ./foo ./bar
$0: ./bar
$ ./foo bar
$0: /dev/fd/3

Having /dev/fd/N in $0 instead of the real file name is what is breaking
libtool logic to find .libs and execute the correct binary, breaking
GLib's test suite.
”

as well as other issues met here and there in Debian packages.

Roland McGrath, le Tue 01 Jun 2010 16:22:57 -0700, a écrit :
 I am not convinced that this is worth doing.

Well, it has already been done, why not integrating it?  Not having it
upstream is giving us downstream pain.

 Any name from anywhere is always just a guess at what might be the
 right file name.

Err, not really here: the idea is to make glibc pass the filename it has
used to open the file. This is not a guess any more, this just reflects
reality.

 It is only a guess for convenience when not secure, after all.

But with this RPC extension, this is not a guess any more in cases where
it can not be one.

 There will always be cases where you can't manage to guess it.
 With fexecve, there isn't even any
 such file name to pass as a better guess than something derived from argv[0].

Sure, but in that case users will not even try to get a name from
argv[0], while in the ./foo bar case, I believe they are rightful in
thinking they can get a name from argv[0].

Samuel



[PATCH] include: fix the definition of device_open

2014-04-11 Thread Justus Winter
Previously, every userspace server implementing the device protocol
filtered the device definitions to replace the device_t type with
mach_port_send_t to make the device argument of device_open
polymorphic.  Rather than doing that, which makes it impossible to use
translation functions, fix the definition of device_open.

* include/device/device.defs (device_open): Redefine the device
argument to make it polymorphic unless a outran function is specified.
---
 include/device/device.defs | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/include/device/device.defs b/include/device/device.defs
index d9234e3..5fdf1bd 100644
--- a/include/device/device.defs
+++ b/include/device/device.defs
@@ -52,7 +52,16 @@ routine device_open(
sreplyport reply_port   : reply_port_t;
mode: dev_mode_t;
name: dev_name_t;
-   out device  : device_t
+   out device  : device_t =
+   MACH_MSG_TYPE_PORT_SEND
+   ctype: mach_port_t
+#ifKERNEL_SERVER
+   outtran: mach_port_t convert_device_to_port(device_t)
+#else
+#ifdef DEVICE_OUTTRAN
+   outtran: DEVICE_OUTTRAN
+#endif
+#endif /* KERNEL_SERVER */
);
 
 routine device_close(
-- 
1.9.1




[PATCH] boot: remove the ourdevice hack

2014-04-11 Thread Justus Winter
Previously, the device definitions were filtered using sed to replace
the device_t type with mach_port_send_t to make the device argument of
device_open polymorphic.  Rather than doing that, which makes it
impossible to use translation functions, the definition of device_open
has been amended.

* boot/Makefile: Remove the ourdevice hack.
* boot/boot.c: Adjust the include accordingly.
---
 boot/Makefile | 6 +-
 boot/boot.c   | 2 +-
 2 files changed, 2 insertions(+), 6 deletions(-)

diff --git a/boot/Makefile b/boot/Makefile
index 0d883b0..2d52f3f 100644
--- a/boot/Makefile
+++ b/boot/Makefile
@@ -20,7 +20,7 @@ makemode := utility
 
 SRCS = mach-crt0.c boot.c ux.c sigvec.S syscall.S \
boot_script.c userland-boot.c
-COMMON-OBJS = notifyServer.o ourdeviceServer.o \
+COMMON-OBJS = notifyServer.o deviceServer.o \
ioServer.o io_replyUser.o device_replyUser.o \
termServer.o bootstrapServer.o boot_script.o userland-boot.o
 OBJS = boot.o $(COMMON-OBJS)
@@ -39,10 +39,6 @@ include ../Makeconf
 
 all: boot # uxboot
 
-ourdevice.defs: device.defs
-   $(CPP) $(CPPFLAGS) -x c $ | sed -e '/out[  ]*device[   ]*:[
]*device_t/s/device_t/mach_port_send_t/'  $@
-
-
 uxboot.o: boot.c
$(COMPILE.c) -DUX $ -o $@
 
diff --git a/boot/boot.c b/boot/boot.c
index 0dbe1c2..ed29014 100644
--- a/boot/boot.c
+++ b/boot/boot.c
@@ -42,7 +42,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 
02139, USA.  */
 #include version.h
 
 #include notify_S.h
-#include ourdevice_S.h
+#include device_S.h
 #include io_S.h
 #include device_reply_U.h
 #include io_reply_U.h
-- 
1.9.1




Re: Hurd support in libpcap

2014-04-11 Thread Richard Braun
On Thu, Apr 10, 2014 at 02:01:17AM +0200, Richard Braun wrote:
 The first issue that can be noticed is that, despite the filter being
 filled with both NETF_IN and NETF_OUT, only incoming packets seem
 to be captured. This is probably a minor bug in libbpf but I didn't
 investigate yet.

The issue seems to be in libmachdev, which simply doesn't forward
sent packets to any packet filter. Is there a reason why libmachdev
is only built statically ?

-- 
Richard Braun



Re: GDB: warning: Can't wait for pid ???: No child processes (was: GNU accepted as a mentoring organization in GSOC 2014)

2014-04-11 Thread Zhang Cong
Hi,

On Wed, Apr 9, 2014 at 8:57 PM, Yue Lu hacklu.newb...@gmail.com wrote:



 The reason is that the native _GDB_ doesn't work either on Hurd. So as
 gdbserver. You can try to attach to a exist process by GDB, you will get
 that warnning. In detail, there is no distinct difference between the
 implementation of GDB and gdbserver. They are the same.


Why I need gdbserver is I will use gdbserver to start my process,  because
gdbserver is the parent of the debugged process,  this will not trigger the
hurd limit.

So, The question left is why the code was not merge to upstream,  And if it
can do, many hurder will thank you.

The upstream reject your patch?

Thanks,
Cong Zhang


Hurd port for gcc go PATCH 0-3 (9)

2014-04-11 Thread Svante Signell
Hi,

Attached are patches to enable gccgo to build properly on Debian
GNU/Hurd on gcc-4.9 (4.9-20140406). With split stack disabled around 70
libgo tests PASS and 50 FAIL (result seems to be somewhat random,
alignment problems there too?). With split stack enabled _all_ tests
fail, see
https://lists.gnu.org/archive/html/bug-hurd/2013-06/msg00100.html

patch0.diff is Debian specific, patch1.diff should be applied when
split-stack works properly while the rest are available for upstream.

patch0.diff: debian/rules.defs:
go_no_systems: remove gnu,
with_go: Check for DEB_TARGET_GNU_OS instead of DEB_TARGET_GNU_SYSTEM.
Otherwise kfreebsd-gnu causes go_no_systems to still be true for gnu.

patch1.diff: src/gcc/config/i386/gnu.h:
Enables split stack for GNU/Hurd. Until split-stack works properly with
the pthread library of Hurd this patch should not be applied. Maybe the
offsets should change, but that has to be synchronized with the
src/libgcc/config/i386/morestack.S assembly routine (unfortunately asm
is not my piece of cake).

patch2.diff: src/libgo/configure.ac:
Add GNU as a supported target OS for go.

patch3.diff: src/libgo/Makefile.am, src/libgo/Makefile.in
Add GNU specific go routines with the LIBGO_IS_GNU conditional.

Note: Creating the Makefile.in is hard (unnecessary) work since automake
is no longer used in the build system. 
Both (cd src/libgo;automake-1.11) and (cd src/libgo;autoreconf2.64)
fails. The diff for Makefile.in has to be patched by hand with the aid
of the diff for Makefile.am :( This file should be possible to generate
from Makefile.am when modifying manually. In my opinion the build system
is broken wrt libgo.

--- a/debian/rules.defs	2014-01-07 11:10:44.0 +0100
+++ b/debian/rules.defs	2014-01-07 11:23:47.0 +0100
@@ -721,7 +721,7 @@
 ifeq (,$(filter $(distrelease),lenny etch squeeze dapper hardy jaunty karmic lucid maverick natty oneiric))
   go_no_cpus := $(filter-out arm, $(go_no_cpus))
 endif
-go_no_systems := gnu kfreebsd-gnu
+go_no_systems := kfreebsd-gnu
 
 ifneq ($(with_base_only),yes)
   ifneq ($(separate_lang),yes)
@@ -731,7 +731,7 @@
 ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(go_no_cpus)))
   with_go := disabled for cpu $(DEB_TARGET_ARCH_CPU)
 endif
-ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(go_no_systems)))
+ifneq (,$(findstring $(DEB_TARGET_ARCH_OS),$(go_no_systems)))
   with_go := disabled for system $(DEB_TARGET_GNU_SYSTEM)
 endif
 ifeq ($(go_no_cross)-$(DEB_CROSS),yes-yes)
--- a/src/gcc/config/i386/gnu.h.orig	2014-01-05 20:58:22.0 +0100
+++ b/src/gcc/config/i386/gnu.h	2014-04-07 11:21:00.0 +0200
@@ -36,12 +36,14 @@
 #endif
 
 #ifdef TARGET_LIBC_PROVIDES_SSP
+/* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
+#define TARGET_THREAD_SSP_OFFSET	0x14
 
-/* Not supported yet.  */
-# undef TARGET_THREAD_SSP_OFFSET
-
-/* Not supported yet.  */
-# undef TARGET_CAN_SPLIT_STACK
-# undef TARGET_THREAD_SPLIT_STACK_OFFSET
-
+/* We only build the -fsplit-stack support in libgcc if the
+   assembler has full support for the CFI directives.  */
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#define TARGET_CAN_SPLIT_STACK
+#endif
+/* We steal the last transactional memory word.  */
+#define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
 #endif
--- a/src/libgo/configure.ac
+++ b/src/libgo/configure.ac
@@ -136,6 +136,7 @@
 is_dragonfly=no
 is_rtems=no
 is_solaris=no
+is_gnu=no
 GOOS=unknown
 case ${host} in
   *-*-darwin*)   is_darwin=yes;  GOOS=darwin ;;
@@ -147,6 +148,7 @@
   *-*-dragonfly*) is_dragonfly=yes; GOOS=dragonfly ;;
   *-*-rtems*)is_rtems=yes;   GOOS=rtems ;;
   *-*-solaris2*) is_solaris=yes; GOOS=solaris ;;
+  *-*-gnu*)  is_gnu=yes; GOOS=gnu ;;
 esac
 AM_CONDITIONAL(LIBGO_IS_DARWIN, test $is_darwin = yes)
 AM_CONDITIONAL(LIBGO_IS_FREEBSD, test $is_freebsd = yes)
@@ -157,6 +159,7 @@
 AM_CONDITIONAL(LIBGO_IS_DRAGONFLY, test $is_dragonfly = yes)
 AM_CONDITIONAL(LIBGO_IS_RTEMS, test $is_rtems = yes)
 AM_CONDITIONAL(LIBGO_IS_SOLARIS, test $is_solaris = yes)
+AM_CONDITIONAL(LIBGO_IS_GNU, test $is_gnu = yes)
 AC_SUBST(GOOS)
 
 dnl Test whether we need to use DejaGNU or whether we can use the
--- a/src/libgo/Makefile.am
+++ b/src/libgo/Makefile.am
@@ -418,9 +418,13 @@
 if LIBGO_IS_SOLARIS
 runtime_netpoll_files = runtime/netpoll_select.c
 else
+if LIBGO_IS_GNU
+runtime_netpoll_files = runtime/netpoll_select.c
+else
 runtime_netpoll_files = runtime/netpoll_kqueue.c
 endif
 endif
+endif
 
 runtime_files = \
 	runtime/go-append.c \
@@ -682,7 +686,7 @@
 go_net_cgo_file = go/net/cgo_linux.go
 go_net_sock_file = go/net/sock_linux.go
 go_net_sockopt_file = go/net/sockopt_linux.go
-go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go
+go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_bsd.go
 else
 if LIBGO_IS_SOLARIS
 go_net_cgo_file = go/net/cgo_linux.go
@@ -702,6 +706,12 @@
 go_net_sockopt_file = go/net/sockopt_bsd.go
 go_net_sockoptip_file = go/net/sockoptip_bsd.go go/net/sockoptip_posix.go
 else
+if 

Re: GDB: warning: Can't wait for pid ???: No child processes

2014-04-11 Thread Thomas Schwinge
Hi!

On Fri, 11 Apr 2014 20:18:19 +0800, Zhang Cong congzh...@mathphoenix.com 
wrote:
 On Wed, Apr 9, 2014 at 8:57 PM, Yue Lu hacklu.newb...@gmail.com wrote:
 So, The question left is why the code was not merge to upstream,  And if it
 can do, many hurder will thank you.
 
 The upstream reject your patch?

Not at all.  It just needs to be done; the patch has to be brought into
a form suitable for commit upstream (without a lot of TODO items,
properly code formatting, and so on), and has to be rebased on top of the
current upstream master branch.


Grüße,
 Thomas


pgpTkyJiqPb2L.pgp
Description: PGP signature


Hurd port for gcc go PATCH 4-6 (9)

2014-04-11 Thread Svante Signell
(continued)

patch4.diff: src/libgo/go/syscall/libcall_posix-1.go:
New file, a copy of libcall_posix.go with the mount call removed.
mount/umount functionality exists but is currently part of Hurd
utilities.

patch5.diff: src/libgo/go/net/sock_gnu.go
Create a dummy function for maxListenerBacklog() until implemented.

patch6.diff: src/libgo/go/syscall/libcall_gnu.go
Create a dummy function for raw_ptrace() until implemented.

--- a/src/libgo/go/syscall/libcall_posix.go
+++ b/src/libgo/go/syscall/libcall_posix.go
@@ -3,6 +3,8 @@
 // license that can be found in the LICENSE file.
 
 // POSIX library calls.
+// Removed the mount call for GNU/Hurd, it exists but use translators.
+// Functionality is not the same as descibed in sys/mount.h
 // This file is compiled as ordinary Go code,
 // but it is also input to mksyscall,
 // which parses the //sys lines and generates library call stubs.
@@ -271,9 +273,6 @@
 //sys	Mknod(path string, mode uint32, dev int) (err error)
 //mknod(path *byte, mode Mode_t, dev _dev_t) _C_int
 
-//sys	Mount(source string, target string, fstype string, flags uintptr, data string) (err error)
-//mount(source *byte, target *byte, fstype *byte, flags _C_long, data *byte) _C_int
-
 //sys	Nanosleep(time *Timespec, leftover *Timespec) (err error)
 //nanosleep(time *Timespec, leftover *Timespec) _C_int
 
--- /dev/null
+++ b/src/libgo/go/net/sock_gnu.go
@@ -0,0 +1,14 @@
+// Copyright 2014 The Go Authors.  All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// +build gnu
+
+package net
+
+import syscall
+
+func maxListenerBacklog() int {
+   // TODO: Implement this
+   return syscall.SOMAXCONN
+}
--- /dev/null
+++ b/src/libgo/go/syscall/libcall_gnu.go
@@ -0,0 +1,11 @@
+// Copyright 2014 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+//FIXME: Try with libcall_irix.go
+
+package syscall
+
+// Dummy function
+func raw_ptrace(request int, pid int, addr *byte, data *byte) Errno {
+return ENOSYS
+}


Hurd port for gcc go PATCH 7-9 (9)

2014-04-11 Thread Svante Signell
(continued)

patch7.diff: src/libgo/go/syscall/wait.c
Set WCONTINUED to zero if not defined (same fix as for lto in gcc-4.9)

patch8.diff: src/libgo/mksysinfo.sh
Add special treatment of EWOULDBLOCK, SYS_FCNTL and st_dev since they
are either not defined or defined differently for the script to catch
them. 

patch9.diff: src/libgo/runtime/netpoll.goc
Rename errno to errno1 since errno clashes with errno.h included in
that file on Hurd.
--- a/src/libgo/go/syscall/wait.c
+++ b/src/libgo/go/syscall/wait.c
@@ -8,6 +8,9 @@
OS-independent.  */
 
 #include stdint.h
+#ifndef WCONTINUED
+#define WCONTINUED 0
+#endif
 #include sys/wait.h
 
 #include runtime.h
--- a/src/libgo/mksysinfo.sh
+++ b/src/libgo/mksysinfo.sh
@@ -210,6 +210,11 @@
   egrep '#define E[A-Z0-9_]+ ' | \
   sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(_\1)/'  ${OUT}
 
+# Special treatment of EWOULDBLOCK for GNU/Hurd
+# /usr/include/bits/errno.h: #define EWOULDBLOCK EAGAIN
+egrep '^const EWOULDBLOCK = Errno(_EWOULDBLOCK)' ${OUT} | \
+sed -i.bak -e 's/_EWOULDBLOCK/_EAGAIN/' ${OUT}
+
 # The O_xxx flags.
 egrep '^const _(O|F|FD)_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
@@ -225,6 +230,11 @@
   echo const F_DUPFD_CLOEXEC = 0  ${OUT}
 fi
 
+# Special treatment of SYS_FCNTL for GNU/Hurd
+if ! grep '^const SYS_FCNTL' ${OUT} /dev/null 21; then
+  echo const SYS_FCNTL = 0  ${OUT}
+fi
+
 # These flags can be lost on i386 GNU/Linux when using
 # -D_FILE_OFFSET_BITS=64, because we see #define F_SETLK F_SETLK64
 # before we see the definition of F_SETLK64.
@@ -528,6 +538,8 @@
 
 # The stat type.
 # Prefer largefile variant if available.
+# Special treatment of st_dev for GNU/Hurd
+# /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid
 stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
 if test $stat != ; then
   grep '^type _stat64 ' gen-sysinfo.go
@@ -536,6 +548,7 @@
 fi | sed -e 's/type _stat64/type Stat_t/' \
  -e 's/type _stat/type Stat_t/' \
  -e 's/st_dev/Dev/' \
+ -e 's/st_fsid/Dev/' \
  -e 's/st_ino/Ino/g' \
  -e 's/st_nlink/Nlink/' \
  -e 's/st_mode/Mode/' \
--- a/src/libgo/runtime/netpoll.goc.orig	2013-11-07 01:23:21.0 +0100
+++ b/src/libgo/runtime/netpoll.goc	2014-03-28 09:07:15.0 +0100
@@ -68,7 +68,7 @@
 	runtime_netpollinit();
 }
 
-func runtime_pollOpen(fd uintptr) (pd *PollDesc, errno int) {
+func runtime_pollOpen(fd uintptr) (pd *PollDesc, errno1 int) {
 	pd = allocPollDesc();
 	runtime_lock(pd);
 	if(pd-wg != nil  pd-wg != READY)
@@ -84,7 +84,7 @@
 	pd-wd = 0;
 	runtime_unlock(pd);
 
-	errno = runtime_netpollopen(fd, pd);
+	errno1 = runtime_netpollopen(fd, pd);
 }
 
 func runtime_pollClose(pd *PollDesc) {


Cleaning up dde for the Hurd (was: Hurd support in libpcap)

2014-04-11 Thread Justus Winter
Hi :)

Quoting Richard Braun (2014-04-11 11:42:47)
 On Thu, Apr 10, 2014 at 02:01:17AM +0200, Richard Braun wrote:
  The first issue that can be noticed is that, despite the filter being
  filled with both NETF_IN and NETF_OUT, only incoming packets seem
  to be captured. This is probably a minor bug in libbpf but I didn't
  investigate yet.
 
 The issue seems to be in libmachdev, which simply doesn't forward
 sent packets to any packet filter. Is there a reason why libmachdev
 is only built statically ?

This is most likely just an oversight.  I started going over the dde
code.  Zheng Da got lot's of little details wrong.  This is not meant
to sound harsh, I'm full of respect that he got dde-based drivers
up and running during a gsoc.

Now let's team up and clean up his work so that we can merge it
upstream and have a good template for more dde-based drivers :)

Cheers,
Justus



[PATCH 4/6] libmachdev: remove unused function

2014-04-11 Thread Justus Winter
* libmachdev/ds_routines.c (mach_device_reference): Remove unused function.
---
 libmachdev/ds_routines.c | 6 --
 1 file changed, 6 deletions(-)

diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index a1fb058..66e5756 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -88,12 +88,6 @@ mach_device_deallocate (void *device)
   ports_port_deref (device);
 }
 
-static inline void
-mach_device_reference (mach_device_t device)
-{
-  ports_port_ref (device);
-}
-
 static inline struct mach_device *
 mach_convert_port_to_device (device_t device)
 {
-- 
1.9.1




[PATCH 2/6] eth-multiplexer: fix receiver lookups

2014-04-11 Thread Justus Winter
Previously, the device definitions were filtered using sed to replace
the device_t type with mach_port_send_t to make the device argument of
device_open polymorphic.  Rather than doing that, which makes it
impossible to use translation functions, the definition of device_open
has been amended.

* eth-multiplexer/Makefile: Remove ourdevice hack that changes
device_t to mach_port_send_t.
* eth-multiplexer/multiplexer.c: Likewise.
* eth-multiplexer/device_impl.c: Fix all device_t receiver lookups.
* eth-multiplexer/mig-decls.h: New file.
* eth-multiplexer/mig-mutate.h: Add mutators.

fu_eth-multiplexer
---
 eth-multiplexer/Makefile  |  8 ++
 eth-multiplexer/device_impl.c | 59 ++-
 eth-multiplexer/mig-decls.h   | 45 +
 eth-multiplexer/mig-mutate.h  |  7 +
 eth-multiplexer/multiplexer.c |  2 +-
 5 files changed, 68 insertions(+), 53 deletions(-)
 create mode 100644 eth-multiplexer/mig-decls.h

diff --git a/eth-multiplexer/Makefile b/eth-multiplexer/Makefile
index 15d05a6..882c3d0 100644
--- a/eth-multiplexer/Makefile
+++ b/eth-multiplexer/Makefile
@@ -21,18 +21,14 @@ target = eth-multiplexer
 
 #CFLAGS += -DDEBUG
 SRCS = ethernet.c vdev.c multiplexer.c dev_stat.c netfs_impl.c notify_impl.c 
device_impl.c demuxer.c
-MIGSTUBS = ourdeviceServer.o notifyServer.o
+MIGSTUBS = deviceServer.o notifyServer.o
 MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
 LCLHDRS = ethernet.h util.h vdev.h netfs_impl.h
-DIST_FILES = ourdevice.defs notify.defs
+DIST_FILES = device.defs notify.defs
 HURDLIBS=ports fshelp shouldbeinlibc netfs bpf
 OTHERLIBS = -lpthread
 
 CFLAGS += -I$(top_srcdir)/libbpf
 
 include ../Makeconf
-
-ourdevice.defs: device.defs
-   $(CPP) $(CPPFLAGS) -x c $ | sed -e '/out[  ]*device[   ]*:[
]*device_t/s/device_t/mach_port_send_t/'  $@
-
diff --git a/eth-multiplexer/device_impl.c b/eth-multiplexer/device_impl.c
index 459d9c4..35a4da4 100644
--- a/eth-multiplexer/device_impl.c
+++ b/eth-multiplexer/device_impl.c
@@ -27,7 +27,7 @@
 
 #include ethernet.h
 #include vdev.h
-#include ourdevice_S.h
+#include device_S.h
 #include notify_S.h
 #include bpf_impl.h
 #include netfs_impl.h
@@ -40,38 +40,29 @@ extern struct port_info *notify_pi;
 
 /* Implementation of device interface */
 kern_return_t
-ds_xxx_device_set_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_set_status (struct vether_device *vdev, dev_flavor_t flavor,
  dev_status_t status, size_t statu_cnt)
 {
-  struct vether_device *vdev = ports_lookup_port (port_bucket, device,
- vdev_portclass);
   if (vdev == NULL)
 return D_NO_SUCH_DEVICE;
-  ports_port_deref (vdev);
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_get_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_get_status (struct vether_device *vdev, dev_flavor_t flavor,
  dev_status_t status, size_t *statuscnt)
 {
-  struct vether_device *vdev = ports_lookup_port (port_bucket, device,
- vdev_portclass);
   if (vdev == NULL)
 return D_NO_SUCH_DEVICE;
-  ports_port_deref (vdev);
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_set_filter (device_t device, mach_port_t rec,
+ds_xxx_device_set_filter (struct vether_device *vdev, mach_port_t rec,
  int pri, filter_array_t filt, size_t len)
 {
-  struct vether_device *vdev = ports_lookup_port (port_bucket, device,
- vdev_portclass);
   if (vdev == NULL)
 return D_NO_SUCH_DEVICE;
-  ports_port_deref (vdev);
   return D_INVALID_OPERATION;
 }
 
@@ -140,20 +131,18 @@ ds_device_open (mach_port_t master_port, mach_port_t 
reply_port,
 }
 
 kern_return_t
-ds_device_close (device_t device)
+ds_device_close (struct vether_device *device)
 {
   return 0;
 }
 
 kern_return_t
-ds_device_write (device_t device, mach_port_t reply_port,
+ds_device_write (struct vether_device *vdev, mach_port_t reply_port,
 mach_msg_type_name_t reply_type, dev_mode_t mode,
 recnum_t recnum, io_buf_ptr_t data, size_t datalen,
 int *bytes_written)
 {
   kern_return_t ret = 0;
-  struct vether_device *vdev = ports_lookup_port (port_bucket, device,
- vdev_portclass);
   if (vdev == NULL)
 {
   vm_deallocate (mach_task_self (), (vm_address_t) data, datalen);
@@ -169,103 +158,82 @@ ds_device_write (device_t device, mach_port_t reply_port,
   /* The data in device_write() is transmifered out of line,
* so the server-side function has to deallocate it. */
   vm_deallocate (mach_task_self (), (vm_address_t) data, datalen);
-  ports_port_deref (vdev);
   return ret;
 }
 
 kern_return_t
-ds_device_write_inband (device_t device, mach_port_t reply_port,
+ds_device_write_inband (struct 

[PATCH 1/6] eth-filter: fix receiver lookups

2014-04-11 Thread Justus Winter
Previously, the device definitions were filtered using sed to replace
the device_t type with mach_port_send_t to make the device argument of
device_open polymorphic.  Rather than doing that, which makes it
impossible to use translation functions, the definition of device_open
has been amended.

* eth-filter/Makefile: Remove the ourdevice hack that changes
device_t to mach_port_send_t.
* eth-filter/filter.c: Fix all device_t receiver lookups.
* eth-filter/mig-decls.h: New file.
* eth-filter/mig-mutate.h: Add mutators.
---
 eth-filter/Makefile |  7 ++-
 eth-filter/filter.c | 50 +
 eth-filter/mig-decls.h  | 45 
 eth-filter/mig-mutate.h |  7 +++
 4 files changed, 67 insertions(+), 42 deletions(-)
 create mode 100644 eth-filter/mig-decls.h

diff --git a/eth-filter/Makefile b/eth-filter/Makefile
index 0b2..deee1e5 100644
--- a/eth-filter/Makefile
+++ b/eth-filter/Makefile
@@ -20,10 +20,10 @@ makemode := server
 
 SRCS = bpf_impl.c filter.c queue.c pcap_filter.c
 LCLHDRS = bpf_impl.h queue.h util.h
-DIST_FILES = ourdevice.defs notify.defs
+DIST_FILES = device.defs notify.defs
 HURDLIBS = ports trivfs fshelp ihash shouldbeinlibc
 target = eth-filter
-MIGSTUBS = ourdeviceServer.o notifyServer.o
+MIGSTUBS = deviceServer.o notifyServer.o
 MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
 
@@ -31,6 +31,3 @@ include ../Makeconf
 
 #CFLAGS += -I../pfinet/linux-src/include -I../pfinet/glue-include
 LDFLAGS += -lpcap
-
-ourdevice.defs: device.defs
-   $(CPP) $(CPPFLAGS) -x c $ | sed -e '/out[  ]*device[   ]*:[
]*device_t/s/device_t/mach_port_send_t/'  $@
diff --git a/eth-filter/filter.c b/eth-filter/filter.c
index 04bf7b1..8c76c7b 100644
--- a/eth-filter/filter.c
+++ b/eth-filter/filter.c
@@ -40,7 +40,7 @@
 #include hurd/ihash.h
 #include hurd/fshelp.h
 
-#include ourdevice_S.h
+#include device_S.h
 #include notify_S.h
 #include bpf_impl.h
 #include util.h
@@ -287,21 +287,21 @@ do_mach_notify_dead_name (struct port_info *pi,
 
 /* Implementation of device interface */
 kern_return_t 
-ds_xxx_device_set_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_set_status (struct proxy_user *device, dev_flavor_t flavor,
  dev_status_t status, size_t statu_cnt)
 {
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_get_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_get_status (struct proxy_user *device, dev_flavor_t flavor,
  dev_status_t status, size_t *statuscnt)
 {
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_set_filter (device_t device, mach_port_t rec,
+ds_xxx_device_set_filter (struct proxy_user *device, mach_port_t rec,
  int pri, filter_array_t filt, size_t len)
 {
   return D_INVALID_OPERATION;
@@ -359,13 +359,13 @@ ds_device_open (mach_port_t master_port, mach_port_t 
reply_port,
 }
 
 kern_return_t
-ds_device_close (device_t device)
+ds_device_close (struct proxy_user *device)
 {
   return 0;
 }
 
 kern_return_t
-ds_device_write (device_t device, mach_port_t reply_port,
+ds_device_write (struct proxy_user *user, mach_port_t reply_port,
 mach_msg_type_name_t reply_type, dev_mode_t mode,
 recnum_t recnum, io_buf_ptr_t data, size_t datalen,
 int *bytes_written)
@@ -374,17 +374,14 @@ ds_device_write (device_t device, mach_port_t reply_port,
   int has_filter = 0;
   net_hash_entry_t entp, *hash_headp;
   net_rcv_port_t infp, nextfp;
-  struct proxy_user *user;
   struct proxy *proxy;
 
-  user = ports_lookup_port (port_bucket, device, user_portclass);
   if (user == NULL)
 {
   vm_deallocate (mach_task_self (), (vm_address_t) data, datalen);
   return D_INVALID_OPERATION;
 }
   proxy = user-proxy;
-  ports_port_deref (user);
 
   /* The packet can be sent as long as it passes one filter,
* even thought there is usually only one filter in the list. */
@@ -420,20 +417,17 @@ ds_device_write (device_t device, mach_port_t reply_port,
 }
 
 kern_return_t
-ds_device_write_inband (device_t device, mach_port_t reply_port,
+ds_device_write_inband (struct proxy_user *user, mach_port_t reply_port,
mach_msg_type_name_t reply_type, dev_mode_t mode,
recnum_t recnum, io_buf_ptr_inband_t data,
size_t datalen, int *bytes_written)
 {
   kern_return_t ret;
-  struct proxy_user *user;
   struct proxy *proxy;
 
-  user = ports_lookup_port (port_bucket, device, user_portclass);
   if (user == NULL)
 return D_INVALID_OPERATION;
   proxy = user-proxy;
-  ports_port_deref (user);
 
   ret = device_write_inband (proxy-device_port, mode, recnum, data,
 datalen, bytes_written);
@@ -441,20 +435,17 @@ ds_device_write_inband (device_t device, mach_port_t 
reply_port,
 }
 
 kern_return_t
-ds_device_read 

dde cleanups

2014-04-11 Thread Justus Winter
Here are some patches for the dde stuff currently residing in the
incubator repo.

Justus




[PATCH 6/6] libmachdev: fix function declaration

2014-04-11 Thread Justus Winter
* libmachdev/ds_routines.c: Include mig-generated device_S.h.
(ds_device_intr_register): Fix function declaration.
---
 libmachdev/ds_routines.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index e415cdb..bbf5488 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -63,6 +63,7 @@
 #include ddekit/thread.h
 
 #include vm_param.h
+#include device_S.h
 #include device_reply_U.h
 #include io_req.h
 #include dev_hdr.h
@@ -126,7 +127,7 @@ ds_xxx_device_set_filter (struct mach_device *device, 
mach_port_t rec,
 
 io_return_t
 ds_device_intr_register (mach_port_t master_port, int irq,
-  int id, mach_port_t receive_port)
+int flags, int id, mach_port_t receive_port)
 {
   return D_INVALID_OPERATION;
 }
-- 
1.9.1




[PATCH 5/6] libmachdev: fix receiver lookups

2014-04-11 Thread Justus Winter
Previously, the device definitions were filtered using sed to replace
the device_t type with mach_port_send_t to make the device argument of
device_open polymorphic.  Rather than doing that, which makes it
impossible to use translation functions, the definition of device_open
has been amended.

* libmachdev/Makefile: Remove ourdevice hack that changes
device_t to mach_port_send_t.
* libmachdev/device.defs (device_open): Make the device parameter
polymorphic like it was done in gnumach.
* libmachdev/ds_routines.c (port_bucket): Drop static qualifier so
that it can be used in the intrans function.
(dev_class): Likewise.
(ds_*): Fix all device_t receiver lookups.
* libmachdev/mig-decls.h: New file.
* libmachdev/mig-mutate.h: Add mutators.
---
 libmachdev/Makefile  |   5 +-
 libmachdev/device.defs   |  11 +++-
 libmachdev/ds_routines.c | 146 +++
 libmachdev/mig-decls.h   |  44 ++
 libmachdev/mig-mutate.h  |   7 +++
 5 files changed, 94 insertions(+), 119 deletions(-)
 create mode 100644 libmachdev/mig-decls.h

diff --git a/libmachdev/Makefile b/libmachdev/Makefile
index e006461..a47bf32 100644
--- a/libmachdev/Makefile
+++ b/libmachdev/Makefile
@@ -20,7 +20,7 @@ makemode := library
 libname = libmachdev
 
 SRCS = deviceUser.c machUser.c net.c ds_routines.c queue.c trivfs_server.c \
-   device_replyUser.c ourdeviceServer.c notifyServer.c misc.c block.c
+   device_replyUser.c deviceServer.c notifyServer.c misc.c block.c
 LCLHDRS = dev_hdr.h device_emul.h ds_routines.h vm_param.h \
  util.h queue.h io_req.h if_ether.h machdev.h linux-errno.h \
  errno-base.h
@@ -32,8 +32,5 @@ MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 
 include ../Makeconf
 
-ourdevice.defs: device.defs
-   $(CPP) $(CPPFLAGS) -x c $ | sed -e '/out[  ]*device[   ]*:[
]*device_t/s/device_t/mach_port_send_t/'  $@
-
 $(libname).so.$(hurd-version):
echo INPUT ( $(libname).a )  $@
diff --git a/libmachdev/device.defs b/libmachdev/device.defs
index 7c39f8a..5c16a37 100644
--- a/libmachdev/device.defs
+++ b/libmachdev/device.defs
@@ -56,7 +56,16 @@ routine device_open(
sreplyport reply_port   : reply_port_t;
mode: dev_mode_t;
name: dev_name_t;
-   out device  : device_t
+   out device  : device_t =
+   MACH_MSG_TYPE_PORT_SEND
+   ctype: mach_port_t
+#ifKERNEL_SERVER
+   outtran: mach_port_t convert_device_to_port(device_t)
+#else
+#ifdef DEVICE_OUTTRAN
+   outtran: DEVICE_OUTTRAN
+#endif
+#endif /* KERNEL_SERVER */
);
 
 routine device_close(
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 66e5756..e415cdb 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -70,8 +70,8 @@
 #include queue.h
 #include mach_glue.h
 
-static struct port_bucket *port_bucket;
-static struct port_class *dev_class;
+struct port_bucket *port_bucket;
+struct port_class *dev_class;
 
 #define NUM_EMULATION num_emul
 #define MAX_NUM_EMULATION 32
@@ -88,12 +88,6 @@ mach_device_deallocate (void *device)
   ports_port_deref (device);
 }
 
-static inline struct mach_device *
-mach_convert_port_to_device (device_t device)
-{
-  return ports_lookup_port (port_bucket, device, dev_class);
-}
-
 /*
  * What follows is the interface for the native Mach devices.
  */
@@ -110,21 +104,21 @@ mach_convert_device_to_port (mach_device_t device)
 
 /* Implementation of device interface */
 kern_return_t 
-ds_xxx_device_set_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_set_status (struct mach_device *device, dev_flavor_t flavor,
  dev_status_t status, size_t statu_cnt)
 {
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_get_status (device_t device, dev_flavor_t flavor,
+ds_xxx_device_get_status (struct mach_device *device, dev_flavor_t flavor,
  dev_status_t status, size_t *statuscnt)
 {
   return D_INVALID_OPERATION;
 }
 
 kern_return_t
-ds_xxx_device_set_filter (device_t device, mach_port_t rec,
+ds_xxx_device_set_filter (struct mach_device *device, mach_port_t rec,
  int pri, filter_array_t filt, size_t len)
 {
   return D_INVALID_OPERATION;
@@ -176,244 +170,168 @@ ds_device_open (mach_port_t open_port, mach_port_t 
reply_port,
 }
 
 io_return_t
-ds_device_close (device_t dev)
+ds_device_close (struct mach_device *device)
 {
-  struct mach_device *device;
   io_return_t ret;
 
-  /* Refuse if device is dead or not completely open.  */
-  if (dev == MACH_PORT_NULL)
+  if (device == NULL)
 return D_NO_SUCH_DEVICE;
 
-  device = mach_convert_port_to_device (dev);
   ret = (device-dev.emul_ops-close
 ? (*device-dev.emul_ops-close) (device-dev.emul_data)
 : D_SUCCESS);
   mach_device_deallocate (device);
-
-  ports_port_deref 

[PATCH 3/6] libmachdev: avoid doing pointer arithmetic to get the port_info

2014-04-11 Thread Justus Winter
Previously, mach_convert_port_to_device would return a pointer to
struct emul_device, which is embedded in struct mach_device.  In order
to get to the port_info structure which is right before that,
device_to_pi would subtract offsetof (struct mach_device, dev) from
the pointer.  Avoid that by making mach_convert_port_to_device return
a pointer to struct mach_device instead.

* libmachdev/ds_routines.c (mach_convert_port_to_device): Return
struct mach_dev *.
(device_to_pi): Remove now unused function.
(ds_device_close): Adjust accordingly.
(ds_device_write): Likewise.
(ds_device_write_inband): Likewise.
(ds_device_read): Likewise.
(ds_device_read_inband): Likewise.
(ds_device_set_status): Likewise.
(ds_device_get_status): Likewise.
(ds_device_set_filter): Likewise.
---
 libmachdev/ds_routines.c | 119 ++-
 1 file changed, 56 insertions(+), 63 deletions(-)

diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index d22fb2f..a1fb058 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -94,20 +94,10 @@ mach_device_reference (mach_device_t device)
   ports_port_ref (device);
 }
 
-static inline emul_device_t
+static inline struct mach_device *
 mach_convert_port_to_device (device_t device)
 {
-  mach_device_t dev = ports_lookup_port (port_bucket, device, dev_class);
-  if (dev == NULL)
-return NULL;
-
-  return dev-dev;
-}
-
-static inline void *
-device_to_pi (emul_device_t device)
-{
-  return ((void *) device) - (int) ((mach_device_t) 0)-dev;
+  return ports_lookup_port (port_bucket, device, dev_class);
 }
 
 /*
@@ -194,7 +184,7 @@ ds_device_open (mach_port_t open_port, mach_port_t 
reply_port,
 io_return_t
 ds_device_close (device_t dev)
 {
-  emul_device_t device;
+  struct mach_device *device;
   io_return_t ret;
 
   /* Refuse if device is dead or not completely open.  */
@@ -202,12 +192,12 @@ ds_device_close (device_t dev)
 return D_NO_SUCH_DEVICE;
 
   device = mach_convert_port_to_device (dev);
-  ret = (device-emul_ops-close
-? (*device-emul_ops-close) (device-emul_data)
+  ret = (device-dev.emul_ops-close
+? (*device-dev.emul_ops-close) (device-dev.emul_data)
 : D_SUCCESS);
-  mach_device_deallocate (device_to_pi (device));
+  mach_device_deallocate (device);
 
-  ports_port_deref (device_to_pi (device));
+  ports_port_deref (device);
   return ret;
 }
 
@@ -217,7 +207,7 @@ ds_device_write (device_t dev, mach_port_t reply_port,
 recnum_t recnum, io_buf_ptr_t data, unsigned int count,
 int *bytes_written)
 {
-  emul_device_t device;
+  struct mach_device *device;
   io_return_t ret;
 
   /* Refuse if device is dead or not completely open.  */
@@ -231,16 +221,16 @@ ds_device_write (device_t dev, mach_port_t reply_port,
   if (device == NULL)
 return D_INVALID_OPERATION;
 
-  if (! device-emul_ops-write)
+  if (! device-dev.emul_ops-write)
 {
-  ports_port_deref (device_to_pi (device));
+  ports_port_deref (device);
   return D_INVALID_OPERATION;
 }
 
-  ret = (*device-emul_ops-write) (device-emul_data, reply_port,
-   reply_port_type, mode, recnum,
-   data, count, bytes_written);
-  ports_port_deref (device_to_pi (device));
+  ret = (*device-dev.emul_ops-write) (device-dev.emul_data, reply_port,
+   reply_port_type, mode, recnum,
+   data, count, bytes_written);
+  ports_port_deref (device);
 
   return ret;
 }
@@ -252,7 +242,7 @@ ds_device_write_inband (device_t dev, mach_port_t 
reply_port,
io_buf_ptr_inband_t data, unsigned count,
int *bytes_written)
 {
-  emul_device_t device;
+  struct mach_device *device;
   io_return_t ret;
 
   /* Refuse if device is dead or not completely open.  */
@@ -266,16 +256,17 @@ ds_device_write_inband (device_t dev, mach_port_t 
reply_port,
   if (device == NULL)
 return D_INVALID_OPERATION;
 
-  if (! device-emul_ops-write_inband)
+  if (! device-dev.emul_ops-write_inband)
 {
-  ports_port_deref (device_to_pi (device));
+  ports_port_deref (device);
   return D_INVALID_OPERATION;
 }
 
-  ret = (*device-emul_ops-write_inband) (device-emul_data, reply_port,
-  reply_port_type, mode, recnum,
-  data, count, bytes_written);
-  ports_port_deref (device_to_pi (device));
+  ret = (*device-dev.emul_ops-write_inband) (device-dev.emul_data,
+  reply_port, reply_port_type,
+  mode, recnum,
+  data, count, bytes_written);
+  ports_port_deref (device);
 
   return ret;
 }
@@ -286,7 +277,7 @@ ds_device_read (device_t dev, mach_port_t reply_port,
recnum_t recnum, int count, io_buf_ptr_t 

Re: Cleaning up dde for the Hurd (was: Hurd support in libpcap)

2014-04-11 Thread Richard Braun
On Fri, Apr 11, 2014 at 03:13:02PM +0200, Justus Winter wrote:
 This is most likely just an oversight.  I started going over the dde
 code.  Zheng Da got lot's of little details wrong.  This is not meant
 to sound harsh, I'm full of respect that he got dde-based drivers
 up and running during a gsoc.

Agreed.

 Now let's team up and clean up his work so that we can merge it
 upstream and have a good template for more dde-based drivers :)

It won't be easy and I'll probably won't have time to do much about it,
for a change... But at least, I'm currently working on fixing locking
on packet filters and actually relaying sent packets so that packet
capture works. Note that this may slightly reduce performance because
of the way filters work, i.e. a net_msg must be completely forged,
with memory copies, before being sent to packet filters, even if there
is no filter installed. If someone wants to work on optimizing this,
feel free to do it, but please mind the details because that's where
the tricky bugs will come from.

-- 
Richard Braun



Re: Circular dependency with glibc libpthread libihash

2014-04-11 Thread Ludovic Courtès
Manolis Ragkousis manolis...@gmail.com skribis:

 When libpthread tries to link against libihash.so I get the error:

 /lib/libihash.so: file not recognized: File format not recognized.

 This happens because libihash was built using the native compiler.
 So I changed the flag in libihash configure to --host so it will use
 the cross-compiler. But then I got the error configure:3008: error: C
 compiler cannot create executables.
 I read the config.log file and the problem arise from this
 /../gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
 cannot find crt1.o: No such file or directory
 /../gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
 cannot find crti.o: No such file or directory
 /../gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
 cannot find -lc
 /../gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
 cannot find crtn.o: No such file or directory

 It tries to compile a program, but cannot find these files, so it
 fails. But in order to have them we need glibc.

Could you show what test tries to compile a program?  (Send config.log.)

Thanks,
Ludo’.



Re: Circular dependency with glibc libpthread libihash

2014-04-11 Thread Manolis Ragkousis
0:00 Ludovic Courtès l...@gnu.org:

 Could you show what test tries to compile a program?  (Send config.log.)


Here it is
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by GNU Hurd configure 0.5, which was
generated by GNU Autoconf 2.69.  Invocation command line was

  $ ../source/configure 
CONFIG_SHELL=/gnu/store/281n6ma5jxy9sb3nwc09mzpqx43vczr6-bash-4.2/bin/bash 
SHELL=/gnu/store/281n6ma5jxy9sb3nwc09mzpqx43vczr6-bash-4.2/bin/bash 
--prefix=/gnu/store/qsyxfd97vcy5fq2hkq5r2gaq5zidjpi7-hurd-minimal-cross-i686-pc-gnu-0.5
 --enable-fast-install --host=i686-pc-gnu --without-parted

## - ##
## Platform. ##
## - ##

hostname = localhost
uname -m = x86_64
uname -r = 3.13.6-1-ARCH
uname -s = Linux
uname -v = #1 SMP PREEMPT Fri Mar 7 22:47:48 CET 2014

/usr/bin/uname -p = unknown
/bin/uname -X = unknown

/bin/arch  = unknown
/usr/bin/arch -k   = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo  = unknown
/bin/machine   = unknown
/usr/bin/oslevel   = unknown
/bin/universe  = unknown

PATH: 
/gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/bin
PATH: 
/gnu/store/nkrr16lw55p75483z2an0c67nnqdm4l5-binutils-cross-i686-pc-gnu-2.23.2/bin
PATH: /gnu/store/144wbw5kmmwnxd57zr5q274sx4pa52kd-mig-cross-1.4/bin
PATH: /gnu/store/1i1jcl43kcs9v0g962sj5s70igxy2g2g-autoconf-2.69/bin
PATH: /gnu/store/f4v605p9fva9kjragznh3l28nfpzmcqp-tar-1.27.1/bin
PATH: /gnu/store/7267cq3clzcbgd1k7s5rg0i0vp2yklpl-gzip-1.6/bin
PATH: /gnu/store/a1ir9y0bgaazp6n58y3qbhmfymjq3yxq-bzip2-1.0.6/bin
PATH: /gnu/store/1zs7xnaby6vl49195sid1klx3gk03mwd-xz-5.0.4/bin
PATH: /gnu/store/2ly72pfnmg28ps7jdj83516gvbn6371j-diffutils-3.3/bin
PATH: /gnu/store/1qdk13ly4c5iqqz7nay0x4fn6ls5r1b9-patch-2.7.1/bin
PATH: /gnu/store/gjl05yl9lvgjhznz5v985mys861svp34-coreutils-8.21/bin
PATH: /gnu/store/sj5ivydxwm1943y2g06vhwfwpn9hc1a1-sed-4.2.2/bin
PATH: /gnu/store/v2q2595q6n4gs32j15ga65bgy0yqg76g-grep-2.15/bin
PATH: /gnu/store/r534qbhj6jni2x30q4rgl8ry8rilarak-findutils-4.4.2/bin
PATH: /gnu/store/3j4pxqg9rskk9365m6jqi59pvcyq1d82-gawk-4.1.0/bin
PATH: /gnu/store/pwm61di9kpfks4acn0k6kp2rwa0wjl5j-make-4.0/bin
PATH: /gnu/store/281n6ma5jxy9sb3nwc09mzpqx43vczr6-bash-4.2/bin
PATH: /gnu/store/r7lpkp8d2df74rw24ndcivxvjzdgxn8d-ld-wrapper-0/bin
PATH: /gnu/store/xbryfykc21adgrq3z56g4c6xvv2lb645-binutils-2.23.2/bin
PATH: /gnu/store/z8qifq9172ad17a7mxg9w8jq51axwwqr-gcc-4.8.2/bin
PATH: /gnu/store/5v11czsqd9x9xqvsww9dk7h5i47laym0-glibc-2.18/bin
PATH: /gnu/store/5v11czsqd9x9xqvsww9dk7h5i47laym0-glibc-2.18/sbin


## --- ##
## Core tests. ##
## --- ##

configure:2245: checking build system type
configure:2259: result: x86_64-unknown-linux-gnu
configure:2279: checking host system type
configure:2292: result: i686-pc-gnu
configure:2402: checking for a BSD-compatible install
configure:2470: result: 
/gnu/store/281n6ma5jxy9sb3nwc09mzpqx43vczr6-bash-4.2/bin/bash 
/tmp/nix-build-hurd-minimal-cross-i686-pc-gnu-0.5.drv-0/source/install-sh -c -C
configure:2485: checking for gawk
configure:2501: found 
/gnu/store/3j4pxqg9rskk9365m6jqi59pvcyq1d82-gawk-4.1.0/bin/gawk
configure:2512: result: gawk
configure:2523: checking for a sed that does not truncate output
configure:2587: result: 
/gnu/store/sj5ivydxwm1943y2g06vhwfwpn9hc1a1-sed-4.2.2/bin/sed
configure:2601: checking for i686-pc-gnu-gcc
configure:2617: found 
/gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/bin/i686-pc-gnu-gcc
configure:2628: result: i686-pc-gnu-gcc
configure:2897: checking for C compiler version
configure:2906: i686-pc-gnu-gcc --version 5
i686-pc-gnu-gcc (GCC) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:2917: $? = 0
configure:2906: i686-pc-gnu-gcc -v 5
Using built-in specs.
COLLECT_GCC=i686-pc-gnu-gcc
COLLECT_LTO_WRAPPER=/gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/4.8.2/lto-wrapper
Target: i686-pc-gnu
Configured with: 
Thread model: single
gcc version 4.8.2 (GCC) 
configure:2917: $? = 0
configure:2906: i686-pc-gnu-gcc -V 5
i686-pc-gnu-gcc: error: unrecognized command line option '-V'
i686-pc-gnu-gcc: fatal error: no input files
compilation terminated.
configure:2917: $? = 1
configure:2906: i686-pc-gnu-gcc -qversion 5
i686-pc-gnu-gcc: error: unrecognized command line option '-qversion'
i686-pc-gnu-gcc: fatal error: no input files
compilation terminated.
configure:2917: $? = 1
configure:2937: checking whether the C compiler works
configure:2959: i686-pc-gnu-gccconftest.c  5
/gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
 cannot find crt1.o: No such file or directory

Re: Circular dependency with glibc libpthread libihash

2014-04-11 Thread Ludovic Courtès
Manolis Ragkousis manolis...@gmail.com skribis:

 0:00 Ludovic Courtès l...@gnu.org:

 Could you show what test tries to compile a program?  (Send config.log.)


 Here it is

Thanks.

 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.

 It was created by GNU Hurd configure 0.5, which was
 generated by GNU Autoconf 2.69.  Invocation command line was

[...]

 configure:2937: checking whether the C compiler works
 configure:2959: i686-pc-gnu-gccconftest.c  5
 /gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
  cannot find crt1.o: No such file or directory
 /gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
  cannot find crti.o: No such file or directory
 /gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
  cannot find -lc
 /gnu/store/kavylb2khfqq9rj42diyciinv3i8inj4-gcc-cross-sans-libc-i686-pc-gnu-4.8.2/libexec/gcc/i686-pc-gnu/ld:
  cannot find crtn.o: No such file or directory
 collect2: error: ld returned 1 exit status

Could you try this patch for the Hurd’s configure.in?

diff --git a/configure.ac b/configure.ac
index ecabfdf..7ede6db 100644
--- a/configure.ac
+++ b/configure.ac
@@ -83,6 +83,13 @@ AC_PROG_INSTALL
 AC_PROG_AWK
 AC_PROG_SED
 
+if test x$cross_compiling = xyes; then
+   # It may be that we don't have a working libc yet, for instance
+   # because we're bootstrapping the cross-compilation tool chain.
+   # Thus, use this undocumented Autoconf macro designed for this.
+   AC_NO_EXECUTABLES
+fi
+
 AC_PROG_CC
 # Require GCC.
 if test x$GCC != xyes; then

Thanks,
Ludo’.


Re: problem on shut-down

2014-04-11 Thread Riccardo Mottola

Hi,

Justus Winter wrote:

appears to be something with my xinted/telnetd!
Could you please specify which packages you are using?  Debian has
three telnetd packages, and I don't seem to be able to locate the
xinetd package at all.

Justus

dpkg-query shows me:

ii  telnet 0.17-36+b1 hurd-i386The 
telnet client
ii  telnetd-ssl0.17.24+0.1-24 hurd-i386
telnet server with SSL encryption support
ii  openbsd-inetd  0.20091229-3 hurd-i386OpenBSD 
Internet Superserver
ii  update-inetd   4.43 all  inetd 
configuration file updater


Riccardo



Re: Hurd support in libpcap

2014-04-11 Thread Samuel Thibault
Richard Braun, le Fri 11 Apr 2014 11:42:47 +0200, a écrit :
 On Thu, Apr 10, 2014 at 02:01:17AM +0200, Richard Braun wrote:
  The first issue that can be noticed is that, despite the filter being
  filled with both NETF_IN and NETF_OUT, only incoming packets seem
  to be captured. This is probably a minor bug in libbpf but I didn't
  investigate yet.
 
 The issue seems to be in libmachdev, which simply doesn't forward
 sent packets to any packet filter. Is there a reason why libmachdev
 is only built statically ?

IIRC it wasn't working properly when linked dynamically.

Samuel



Re: [PATCH 6/6] libmachdev: fix function declaration

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 15:34:14 +0200, a écrit :
 * libmachdev/ds_routines.c: Include mig-generated device_S.h.
 (ds_device_intr_register): Fix function declaration.

Ack.

 ---
  libmachdev/ds_routines.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
 index e415cdb..bbf5488 100644
 --- a/libmachdev/ds_routines.c
 +++ b/libmachdev/ds_routines.c
 @@ -63,6 +63,7 @@
  #include ddekit/thread.h
  
  #include vm_param.h
 +#include device_S.h
  #include device_reply_U.h
  #include io_req.h
  #include dev_hdr.h
 @@ -126,7 +127,7 @@ ds_xxx_device_set_filter (struct mach_device *device, 
 mach_port_t rec,
  
  io_return_t
  ds_device_intr_register (mach_port_t master_port, int irq,
 -int id, mach_port_t receive_port)
 +  int flags, int id, mach_port_t receive_port)
  {
return D_INVALID_OPERATION;
  }
 -- 
 1.9.1
 

-- 
Samuel
s bah, j'aime bien les feux d'artifices, mais j'ai peur de me prendre un 
boeing sur le coin de la gueule si je vais sur le pont de brooklyn
 -+- #ens-mim - 11 septembre forever -+-



Re: [PATCH 1/6] eth-filter: fix receiver lookups

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 15:34:09 +0200, a écrit :
 -DIST_FILES = ourdevice.defs notify.defs
 +DIST_FILES = device.defs notify.defs

Mmm, why keeping device.defs?  Shouldn't we be using the one from
gnumach?

Samuel



Re: [PATCH] include: fix the definition of device_open

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 09:32:30 +0200, a écrit :
 Previously, every userspace server implementing the device protocol
 filtered the device definitions to replace the device_t type with
 mach_port_send_t to make the device argument of device_open
 polymorphic.  Rather than doing that, which makes it impossible to use
 translation functions, fix the definition of device_open.

I don't know enough of MIG to be sure of the details: can this break
applications which would not be doing the sed part?

Samuel



Re: Hurd port for gcc go PATCH 0-3 (9)

2014-04-11 Thread Samuel Thibault
Svante Signell, le Fri 11 Apr 2014 14:47:21 +0200, a écrit :
  #ifdef TARGET_LIBC_PROVIDES_SSP
 +/* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
 +#define TARGET_THREAD_SSP_OFFSET 0x14

Err, not the Hurd variant, no.  Is it really needed?

 @@ -682,7 +686,7 @@
  go_net_cgo_file = go/net/cgo_linux.go
  go_net_sock_file = go/net/sock_linux.go
  go_net_sockopt_file = go/net/sockopt_linux.go
 -go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_posix.go
 +go_net_sockoptip_file = go/net/sockoptip_linux.go go/net/sockoptip_bsd.go
  else

This seems doubtful, isn't that the Linux case?

Samuel



Re: Hurd port for gcc go PATCH 7-9 (9)

2014-04-11 Thread Samuel Thibault
Svante Signell, le Fri 11 Apr 2014 14:57:35 +0200, a écrit :
 --- a/src/libgo/mksysinfo.sh
 +++ b/src/libgo/mksysinfo.sh

Err, these seem to get applied to all systems, not just GNU/Hurd, isn't
that a concern?

 @@ -210,6 +210,11 @@
egrep '#define E[A-Z0-9_]+ ' | \
sed -e 's/^#define \(E[A-Z0-9_]*\) .*$/const \1 = Errno(_\1)/'  ${OUT}
  
 +# Special treatment of EWOULDBLOCK for GNU/Hurd
 +# /usr/include/bits/errno.h: #define EWOULDBLOCK EAGAIN
 +egrep '^const EWOULDBLOCK = Errno(_EWOULDBLOCK)' ${OUT} | \
 +sed -i.bak -e 's/_EWOULDBLOCK/_EAGAIN/' ${OUT}
 +
  # The O_xxx flags.
  egrep '^const _(O|F|FD)_' gen-sysinfo.go | \
sed -e 's/^\(const \)_\([^= ]*\)\(.*\)$/\1\2 = _\2/'  ${OUT}
 @@ -225,6 +230,11 @@
echo const F_DUPFD_CLOEXEC = 0  ${OUT}
  fi
  
 +# Special treatment of SYS_FCNTL for GNU/Hurd
 +if ! grep '^const SYS_FCNTL' ${OUT} /dev/null 21; then
 +  echo const SYS_FCNTL = 0  ${OUT}
 +fi
 +
  # These flags can be lost on i386 GNU/Linux when using
  # -D_FILE_OFFSET_BITS=64, because we see #define F_SETLK F_SETLK64
  # before we see the definition of F_SETLK64.

These should be fine, however.

 @@ -528,6 +538,8 @@
  
  # The stat type.
  # Prefer largefile variant if available.
 +# Special treatment of st_dev for GNU/Hurd
 +# /usr/include/i386-gnu/bits/stat.h: #define st_dev st_fsid
  stat=`grep '^type _stat64 ' gen-sysinfo.go || true`
  if test $stat != ; then
grep '^type _stat64 ' gen-sysinfo.go
 @@ -536,6 +548,7 @@
  fi | sed -e 's/type _stat64/type Stat_t/' \
   -e 's/type _stat/type Stat_t/' \
   -e 's/st_dev/Dev/' \
 + -e 's/st_fsid/Dev/' \
   -e 's/st_ino/Ino/g' \
   -e 's/st_nlink/Nlink/' \
   -e 's/st_mode/Mode/' \

Samuel



[PATCH 2/8] devnode: fix argp_program_version, remove argp_program_bug_address

2014-04-11 Thread Justus Winter
* devnode/devnode.c: Fix argp_program_version, remove
argp_program_bug_address.
---
 devnode/devnode.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/devnode/devnode.c b/devnode/devnode.c
index 101675d..dbbd40e 100644
--- a/devnode/devnode.c
+++ b/devnode/devnode.c
@@ -35,6 +35,7 @@
 #include device/device.h
 #include hurd/trivfs.h
 #include hurd/ports.h
+#include version.h
 
 #include device_S.h
 #include notify_S.h
@@ -48,8 +49,8 @@ static char *master_file;
 /* The master device port for opening the interface. */
 static mach_port_t master_device;
 
-const char *argp_program_version = devnode 0.1;
-const char *argp_program_bug_address = bug-hurd@gnu.org;
+const char *argp_program_version = STANDARD_HURD_VERSION (devnode);
+
 static const char args_doc[] = device;
 static const char doc[] = Hurd devnode translator.;
 static const struct argp_option options[] =
-- 
1.9.1




[PATCH 1/8] devnode: remove the ourdevice hack

2014-04-11 Thread Justus Winter
Previously, the device definitions were filtered using sed to replace
the device_t type with mach_port_send_t to make the device argument of
device_open polymorphic.  Rather than doing that, which makes it
impossible to use translation functions, the definition of device_open
has been amended.

* devnode/Makefile: Remove the ourdevice hack that changes
device_t to mach_port_send_t.
* devnode/devnode.c: Likewise.
---
 devnode/Makefile  | 7 ++-
 devnode/devnode.c | 2 +-
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/devnode/Makefile b/devnode/Makefile
index 2c8af58..05b5801 100644
--- a/devnode/Makefile
+++ b/devnode/Makefile
@@ -20,14 +20,11 @@ makemode := server
 
 SRCS = devnode.c
 LCLHDRS = util.h
-DIST_FILES = ourdevice.defs notify.defs
+DIST_FILES = device.defs notify.defs
 HURDLIBS = ports trivfs fshelp shouldbeinlibc
 target = devnode
-MIGSTUBS = ourdeviceServer.o notifyServer.o
+MIGSTUBS = deviceServer.o notifyServer.o
 MIGSFLAGS = -imacros $(srcdir)/mig-mutate.h
 OBJS = $(SRCS:.c=.o) $(MIGSTUBS)
 
 include ../Makeconf
-
-ourdevice.defs: device.defs
-   $(CPP) $(CPPFLAGS) -x c $ | sed -e '/out[  ]*device[   ]*:[
]*device_t/s/device_t/mach_port_send_t/'  $@
diff --git a/devnode/devnode.c b/devnode/devnode.c
index 61fc509..101675d 100644
--- a/devnode/devnode.c
+++ b/devnode/devnode.c
@@ -36,7 +36,7 @@
 #include hurd/trivfs.h
 #include hurd/ports.h
 
-#include ourdevice_S.h
+#include device_S.h
 #include notify_S.h
 #include util.h
 
-- 
1.9.1




[PATCH 4/8] eth-multiplexer: fix argp_program_version, remove argp_program_bug_address

2014-04-11 Thread Justus Winter
* eth-multiplexer/multiplexer.c: Fix argp_program_version, remove
argp_program_bug_address.
---
 eth-multiplexer/multiplexer.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
index c36ab78..a133f45 100644
--- a/eth-multiplexer/multiplexer.c
+++ b/eth-multiplexer/multiplexer.c
@@ -39,6 +39,7 @@
 #include device/device.h
 #include hurd/ports.h
 #include hurd/netfs.h
+#include version.h
 
 #include ethernet.h
 #include vdev.h
@@ -51,8 +52,8 @@
 /* The device which the multiplexer connects to */
 static char *device_file;
 
-const char *argp_program_version = eth-multiplexer 0.1;
-const char *argp_program_bug_address = bug-hurd@gnu.org;
+const char *argp_program_version = STANDARD_HURD_VERSION (eth-multiplexer);
+
 static const char doc[] = Hurd multiplexer server.;
 static const struct argp_option options[] =
 {
-- 
1.9.1




[PATCH 3/8] eth-filter: fix argp_program_version, remove argp_program_bug_address

2014-04-11 Thread Justus Winter
* eth-filter/filter.c: Fix argp_program_version, remove
argp_program_bug_address.
---
 eth-filter/filter.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/eth-filter/filter.c b/eth-filter/filter.c
index 8c76c7b..7a25c10 100644
--- a/eth-filter/filter.c
+++ b/eth-filter/filter.c
@@ -39,6 +39,7 @@
 #include hurd/ports.h
 #include hurd/ihash.h
 #include hurd/fshelp.h
+#include version.h
 
 #include device_S.h
 #include notify_S.h
@@ -73,8 +74,8 @@ static struct hurd_ihash proxy_deliverport_ht
 
 /* The name of the network interface that the filter translator sits on. */
 static char *device_file;
-const char *argp_program_version = eth-filter 0.1;
-const char *argp_program_bug_address = bug-hurd@gnu.org;
+const char *argp_program_version = STANDARD_HURD_VERSION (eth-filter);
+
 static const char doc[] = Hurd filter translator.;
 static const struct argp_option options[] =
 {
-- 
1.9.1




[PATCH 7/8] eth-filter: improve the demuxer function

2014-04-11 Thread Justus Winter
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection Handling Multiple Request
Types.  This avoids initializing the reply message in every X_server
function.  The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.

* eth-filter/filter.c (filter_demuxer): Improve the demuxer function.
Also, move it below the ethernet_demuxer function to avoid the need
for a forward declaration.  Prioritize the ethernet_demuxer.
---
 eth-filter/filter.c | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/eth-filter/filter.c b/eth-filter/filter.c
index 7a25c10..482b080 100644
--- a/eth-filter/filter.c
+++ b/eth-filter/filter.c
@@ -194,17 +194,6 @@ clean_proxy_device (void *p)
 device-proxy-device = NULL;
 }
 
-static int
-filter_demuxer (mach_msg_header_t *inp,
-   mach_msg_header_t *outp)
-{
-  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int ethernet_demuxer (mach_msg_header_t *, mach_msg_header_t *);
-  return device_server (inp, outp) || notify_server (inp, outp)
-|| ethernet_demuxer (inp, outp) || trivfs_demuxer (inp, outp);
-}
-
 int
 ethernet_demuxer (mach_msg_header_t *inp,
  mach_msg_header_t *outp)
@@ -233,6 +222,24 @@ ethernet_demuxer (mach_msg_header_t *inp,
   return 1;
 }
 
+static int
+filter_demuxer (mach_msg_header_t *inp,
+   mach_msg_header_t *outp)
+{
+  mig_routine_t routine;
+  if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
+  (routine = device_server_routine (inp)) ||
+  (routine = notify_server_routine (inp)) ||
+  (routine = NULL, trivfs_demuxer (inp, outp)))
+{
+  if (routine)
+(*routine) (inp, outp);
+  return TRUE;
+}
+  else
+return FALSE;
+}
+
 /* Implementation of notify interface */
 kern_return_t
 do_mach_notify_port_deleted (struct port_info *pi,
-- 
1.9.1




[PATCH 8/8] eth-multiplexer: improve the demuxer function

2014-04-11 Thread Justus Winter
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection Handling Multiple Request
Types.  This avoids initializing the reply message in every X_server
function.  The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.

* eth-multiplexer/multiplexer.c (multiplexer_demuxer): Improve the
demuxer function.  Prioritize the ethernet_demuxer.
---
 eth-multiplexer/multiplexer.c | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
index a133f45..cc0024e 100644
--- a/eth-multiplexer/multiplexer.c
+++ b/eth-multiplexer/multiplexer.c
@@ -79,12 +79,17 @@ static int
 multiplexer_demuxer (mach_msg_header_t *inp,
  mach_msg_header_t *outp)
 {
-  int device_server (mach_msg_header_t *, mach_msg_header_t *);
-  int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-
-  return (device_server (inp, outp)
-  || notify_server (inp, outp)
-  || ethernet_demuxer (inp, outp));
+  mig_routine_t routine;
+  if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
+  (routine = device_server_routine (inp)) ||
+  (routine = notify_server_routine (inp)))
+{
+  if (routine)
+(*routine) (inp, outp);
+  return TRUE;
+}
+  else
+return FALSE;
 }
 
 static void *
-- 
1.9.1




[PATCH 6/8] libmachdev: improve the demuxer functions

2014-04-11 Thread Justus Winter
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection Handling Multiple Request
Types.  This avoids initializing the reply message in every X_server
function.  The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.

* libmachdev/ds_routines.c (demuxer): Improve the demuxer function.
* libmachdev/trivfs_server.c (demuxer): Likewise.
---
 libmachdev/ds_routines.c   | 14 +-
 libmachdev/trivfs_server.c | 17 +++--
 2 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index bbf5488..0e431a3 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -360,11 +360,15 @@ void mach_device_init()
 static int
 demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  int ret;
-  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  ret = device_server (inp, outp) || notify_server (inp, outp);
-  return ret;
+  mig_routine_t routine;
+  if ((routine = device_server_routine (inp)) ||
+  (routine = notify_server_routine (inp)))
+{
+  (*routine) (inp, outp);
+  return TRUE;
+}
+  else
+return FALSE;
 }
 
 void reg_dev_emul (struct device_emulation_ops *ops)
diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
index 6d5b3ad..0d7fe24 100644
--- a/libmachdev/trivfs_server.c
+++ b/libmachdev/trivfs_server.c
@@ -125,12 +125,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
 static int
 demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
 {
-  int ret;
-  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  ret = device_server (inp, outp) || notify_server (inp, outp)
-|| trivfs_demuxer (inp, outp);
-  return ret;
+  mig_routine_t routine;
+  if ((routine = device_server_routine (inp)) ||
+  (routine = notify_server_routine (inp)) ||
+  (routine = NULL, trivfs_demuxer (inp, outp)))
+{
+  if (routine)
+(*routine) (inp, outp);
+  return TRUE;
+}
+  else
+return FALSE;
 }
 
 void
-- 
1.9.1




[PATCH 5/8] devnode: improve the demuxer function

2014-04-11 Thread Justus Winter
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection Handling Multiple Request
Types.  This avoids initializing the reply message in every X_server
function.  The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.

* devnode/devnode.c (devnode_demuxer): Improve the demuxer function.
---
 devnode/devnode.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/devnode/devnode.c b/devnode/devnode.c
index dbbd40e..789bf51 100644
--- a/devnode/devnode.c
+++ b/devnode/devnode.c
@@ -82,10 +82,17 @@ static int
 devnode_demuxer (mach_msg_header_t *inp,
mach_msg_header_t *outp)
 {
-  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
-  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
-  return device_server (inp, outp) || notify_server (inp, outp)
-|| trivfs_demuxer (inp, outp);
+  mig_routine_t routine;
+  if ((routine = device_server_routine (inp)) ||
+  (routine = notify_server_routine (inp)) ||
+  (routine = NULL, trivfs_demuxer (inp, outp)))
+{
+  if (routine)
+(*routine) (inp, outp);
+  return TRUE;
+}
+  else
+return FALSE;
 }
 
 /* Implementation of notify interface */
-- 
1.9.1




Re: [PATCH] include: fix the definition of device_open

2014-04-11 Thread Justus Winter
Quoting Samuel Thibault (2014-04-11 22:27:09)
 Justus Winter, le Fri 11 Apr 2014 09:32:30 +0200, a écrit :
  Previously, every userspace server implementing the device protocol
  filtered the device definitions to replace the device_t type with
  mach_port_send_t to make the device argument of device_open
  polymorphic.  Rather than doing that, which makes it impossible to use
  translation functions, fix the definition of device_open.
 
 I don't know enough of MIG to be sure of the details: can this break
 applications which would not be doing the sed part?

Yes.  However, I found every server implementing the device protocol
doing it and most actually making good use of the extra
mach_msg_type_name_t argument.

Justus



Re: [PATCH 4/8] eth-multiplexer: fix argp_program_version, remove argp_program_bug_address

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:54 +0200, a écrit :
 * eth-multiplexer/multiplexer.c: Fix argp_program_version, remove
 argp_program_bug_address.

Ack.

 ---
  eth-multiplexer/multiplexer.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
 index c36ab78..a133f45 100644
 --- a/eth-multiplexer/multiplexer.c
 +++ b/eth-multiplexer/multiplexer.c
 @@ -39,6 +39,7 @@
  #include device/device.h
  #include hurd/ports.h
  #include hurd/netfs.h
 +#include version.h
  
  #include ethernet.h
  #include vdev.h
 @@ -51,8 +52,8 @@
  /* The device which the multiplexer connects to */
  static char *device_file;
  
 -const char *argp_program_version = eth-multiplexer 0.1;
 -const char *argp_program_bug_address = bug-hurd@gnu.org;
 +const char *argp_program_version = STANDARD_HURD_VERSION (eth-multiplexer);
 +
  static const char doc[] = Hurd multiplexer server.;
  static const struct argp_option options[] =
  {
 -- 
 1.9.1
 

-- 
Samuel
c ah (on trouve fluide glacial sur le net, ou il faut aller dans le monde reel 
?)
s dans le monde reel
c zut



Re: [PATCH 3/8] eth-filter: fix argp_program_version, remove argp_program_bug_address

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:53 +0200, a écrit :
 * eth-filter/filter.c: Fix argp_program_version, remove
 argp_program_bug_address.

Ack.

 ---
  eth-filter/filter.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/eth-filter/filter.c b/eth-filter/filter.c
 index 8c76c7b..7a25c10 100644
 --- a/eth-filter/filter.c
 +++ b/eth-filter/filter.c
 @@ -39,6 +39,7 @@
  #include hurd/ports.h
  #include hurd/ihash.h
  #include hurd/fshelp.h
 +#include version.h
  
  #include device_S.h
  #include notify_S.h
 @@ -73,8 +74,8 @@ static struct hurd_ihash proxy_deliverport_ht
  
  /* The name of the network interface that the filter translator sits on. */
  static char *device_file;
 -const char *argp_program_version = eth-filter 0.1;
 -const char *argp_program_bug_address = bug-hurd@gnu.org;
 +const char *argp_program_version = STANDARD_HURD_VERSION (eth-filter);
 +
  static const char doc[] = Hurd filter translator.;
  static const struct argp_option options[] =
  {
 -- 
 1.9.1
 

-- 
Samuel
Hi ! I'm a .signature virus ! Copy me into your ~/.signature, please !



Re: [PATCH 5/8] devnode: improve the demuxer function

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:55 +0200, a écrit :
 Handle multiple request types as recommended by the Mach Server
 Writer's Guide section 4, subsection Handling Multiple Request
 Types.  This avoids initializing the reply message in every X_server
 function.  The reply message has already been properly initialized in
 libports, so there is no need to call mig_reply_setup.

Ack.

 * devnode/devnode.c (devnode_demuxer): Improve the demuxer function.
 ---
  devnode/devnode.c | 15 +++
  1 file changed, 11 insertions(+), 4 deletions(-)
 
 diff --git a/devnode/devnode.c b/devnode/devnode.c
 index dbbd40e..789bf51 100644
 --- a/devnode/devnode.c
 +++ b/devnode/devnode.c
 @@ -82,10 +82,17 @@ static int
  devnode_demuxer (mach_msg_header_t *inp,
   mach_msg_header_t *outp)
  {
 -  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
 -  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
 -  return device_server (inp, outp) || notify_server (inp, outp)
 -|| trivfs_demuxer (inp, outp);
 +  mig_routine_t routine;
 +  if ((routine = device_server_routine (inp)) ||
 +  (routine = notify_server_routine (inp)) ||
 +  (routine = NULL, trivfs_demuxer (inp, outp)))
 +{
 +  if (routine)
 +(*routine) (inp, outp);
 +  return TRUE;
 +}
 +  else
 +return FALSE;
  }
  
  /* Implementation of notify interface */
 -- 
 1.9.1
 

-- 
Samuel
d bah à défaut de ligne TGV, ils ont un GR
 -+- #ens-mim - comment ça, paumé ?! -+-



Re: [PATCH 6/8] libmachdev: improve the demuxer functions

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:56 +0200, a écrit :
 Handle multiple request types as recommended by the Mach Server
 Writer's Guide section 4, subsection Handling Multiple Request
 Types.  This avoids initializing the reply message in every X_server
 function.  The reply message has already been properly initialized in
 libports, so there is no need to call mig_reply_setup.

Ack.

 * libmachdev/ds_routines.c (demuxer): Improve the demuxer function.
 * libmachdev/trivfs_server.c (demuxer): Likewise.
 ---
  libmachdev/ds_routines.c   | 14 +-
  libmachdev/trivfs_server.c | 17 +++--
  2 files changed, 20 insertions(+), 11 deletions(-)
 
 diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
 index bbf5488..0e431a3 100644
 --- a/libmachdev/ds_routines.c
 +++ b/libmachdev/ds_routines.c
 @@ -360,11 +360,15 @@ void mach_device_init()
  static int
  demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
  {
 -  int ret;
 -  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
 -  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
 -  ret = device_server (inp, outp) || notify_server (inp, outp);
 -  return ret;
 +  mig_routine_t routine;
 +  if ((routine = device_server_routine (inp)) ||
 +  (routine = notify_server_routine (inp)))
 +{
 +  (*routine) (inp, outp);
 +  return TRUE;
 +}
 +  else
 +return FALSE;
  }
  
  void reg_dev_emul (struct device_emulation_ops *ops)
 diff --git a/libmachdev/trivfs_server.c b/libmachdev/trivfs_server.c
 index 6d5b3ad..0d7fe24 100644
 --- a/libmachdev/trivfs_server.c
 +++ b/libmachdev/trivfs_server.c
 @@ -125,12 +125,17 @@ trivfs_goaway (struct trivfs_control *fsys, int flags)
  static int
  demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
  {
 -  int ret;
 -  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
 -  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
 -  ret = device_server (inp, outp) || notify_server (inp, outp)
 -|| trivfs_demuxer (inp, outp);
 -  return ret;
 +  mig_routine_t routine;
 +  if ((routine = device_server_routine (inp)) ||
 +  (routine = notify_server_routine (inp)) ||
 +  (routine = NULL, trivfs_demuxer (inp, outp)))
 +{
 +  if (routine)
 +(*routine) (inp, outp);
 +  return TRUE;
 +}
 +  else
 +return FALSE;
  }
  
  void
 -- 
 1.9.1
 

-- 
Samuel
Running Windows on a Pentium is like having a brand new Porsche but only
be able to drive backwards with the handbrake on.
(Unknown source)



Re: [PATCH 8/8] eth-multiplexer: improve the demuxer function

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:58 +0200, a écrit :
 Handle multiple request types as recommended by the Mach Server
 Writer's Guide section 4, subsection Handling Multiple Request
 Types.  This avoids initializing the reply message in every X_server
 function.  The reply message has already been properly initialized in
 libports, so there is no need to call mig_reply_setup.

Ack.

 * eth-multiplexer/multiplexer.c (multiplexer_demuxer): Improve the
 demuxer function.  Prioritize the ethernet_demuxer.
 ---
  eth-multiplexer/multiplexer.c | 17 +++--
  1 file changed, 11 insertions(+), 6 deletions(-)
 
 diff --git a/eth-multiplexer/multiplexer.c b/eth-multiplexer/multiplexer.c
 index a133f45..cc0024e 100644
 --- a/eth-multiplexer/multiplexer.c
 +++ b/eth-multiplexer/multiplexer.c
 @@ -79,12 +79,17 @@ static int
  multiplexer_demuxer (mach_msg_header_t *inp,
 mach_msg_header_t *outp)
  {
 -  int device_server (mach_msg_header_t *, mach_msg_header_t *);
 -  int notify_server (mach_msg_header_t *, mach_msg_header_t *);
 -
 -  return (device_server (inp, outp)
 -|| notify_server (inp, outp)
 -|| ethernet_demuxer (inp, outp));
 +  mig_routine_t routine;
 +  if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
 +  (routine = device_server_routine (inp)) ||
 +  (routine = notify_server_routine (inp)))
 +{
 +  if (routine)
 +(*routine) (inp, outp);
 +  return TRUE;
 +}
 +  else
 +return FALSE;
  }
  
  static void *
 -- 
 1.9.1
 

-- 
Samuel
B l'alim je sais où elle est, elle est juste à côté de la dame qui dort
g B: clairement faut revoir les priorités dans la vie
g B: une dame ça se retrouve, un uptime...



Re: [PATCH 7/8] eth-filter: improve the demuxer function

2014-04-11 Thread Samuel Thibault
Justus Winter, le Fri 11 Apr 2014 23:09:57 +0200, a écrit :
 Handle multiple request types as recommended by the Mach Server
 Writer's Guide section 4, subsection Handling Multiple Request
 Types.  This avoids initializing the reply message in every X_server
 function.  The reply message has already been properly initialized in
 libports, so there is no need to call mig_reply_setup.

Ack.

 * eth-filter/filter.c (filter_demuxer): Improve the demuxer function.
 Also, move it below the ethernet_demuxer function to avoid the need
 for a forward declaration.  Prioritize the ethernet_demuxer.
 ---
  eth-filter/filter.c | 29 ++---
  1 file changed, 18 insertions(+), 11 deletions(-)
 
 diff --git a/eth-filter/filter.c b/eth-filter/filter.c
 index 7a25c10..482b080 100644
 --- a/eth-filter/filter.c
 +++ b/eth-filter/filter.c
 @@ -194,17 +194,6 @@ clean_proxy_device (void *p)
  device-proxy-device = NULL;
  }
  
 -static int
 -filter_demuxer (mach_msg_header_t *inp,
 - mach_msg_header_t *outp)
 -{
 -  extern int device_server (mach_msg_header_t *, mach_msg_header_t *);
 -  extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
 -  extern int ethernet_demuxer (mach_msg_header_t *, mach_msg_header_t *);
 -  return device_server (inp, outp) || notify_server (inp, outp)
 -|| ethernet_demuxer (inp, outp) || trivfs_demuxer (inp, outp);
 -}
 -
  int
  ethernet_demuxer (mach_msg_header_t *inp,
 mach_msg_header_t *outp)
 @@ -233,6 +222,24 @@ ethernet_demuxer (mach_msg_header_t *inp,
return 1;
  }
  
 +static int
 +filter_demuxer (mach_msg_header_t *inp,
 + mach_msg_header_t *outp)
 +{
 +  mig_routine_t routine;
 +  if ((routine = NULL, ethernet_demuxer (inp, outp)) ||
 +  (routine = device_server_routine (inp)) ||
 +  (routine = notify_server_routine (inp)) ||
 +  (routine = NULL, trivfs_demuxer (inp, outp)))
 +{
 +  if (routine)
 +(*routine) (inp, outp);
 +  return TRUE;
 +}
 +  else
 +return FALSE;
 +}
 +
  /* Implementation of notify interface */
  kern_return_t
  do_mach_notify_port_deleted (struct port_info *pi,
 -- 
 1.9.1
 

-- 
Samuel
s je la connaissais pas celle la : make: Entering an unknown directory
 -+- #ens-mim -+-



Re: GCC's -fsplit-stack disturbing Mach's vm_allocate

2014-04-11 Thread Samuel Thibault
Thomas Schwinge, le Wed 09 Apr 2014 09:36:42 +0200, a écrit :
 Well, the first step is to verify that TARGET_THREAD_SPLIT_STACK_OFFSET
 and similar configury is correct for the Hurd,

It's not.  I've checked what TARGET_THREAD_SPLIT_STACK_OFFSET is, it's
an offset inside the tcbhead_t structure, and we don't have that field
at all...  We may want to extend our tcbhead_t the same way as Linux
i386.

 and figure out what's
 going on with the zero-page unmapping (discussed earlier in this thread),
 and then mmap failing with 1073741846 (EINVAL).

Here is the backtrace

#0  __vm_map (target_task=1, address=address@entry=0x1029cc4, 
size=size@entry=0, mask=mask@entry=0, anywhere=1, 
memory_object=memory_object@entry=0, offset=offset@entry=0, 
copy=copy@entry=1, cur_protection=cur_protection@entry=1, 
max_protection=max_protection@entry=7, inheritance=inheritance@entry=1)
at /usr/src/eglibc-2.18/build-tree/hurd-i386-libc/mach/vm_map.c:56
#1  0x0118a3e8 in __mmap (addr=0x0, len=0, prot=4, flags=2, fd=-1, offset=0) at 
../sysdeps/mach/hurd/mmap.c:145
#2  0x0804960d in __morestack_load_mmap ()
#3  0x08049d12 in __libc_csu_init ()
#4  0x010b4671 in __libc_start_main (main=0x80489dd main, argc=1, 
argv=0x1029de4, init=0x8049cc0 __libc_csu_init, fini=0x8049d30 
__libc_csu_fini, rtld_fini=0xfb90 _dl_fini, 
stack_end=0x1029ddc) at libc-start.c:246
#5  0x08048901 in _start ()

It's indeed:

/* This function is called at program startup time to make sure that
   mmap, munmap, and getpagesize are resolved if linking dynamically.
   We want to resolve them while we have enough stack for them, rather
   than calling into the dynamic linker while low on stack space.  */

void
__morestack_load_mmap (void)
{
  /* Call with bogus values to run faster.  We don't care if the call
 fails.  Pass __MORESTACK_CURRENT_SEGMENT to make sure that any
 TLS accessor function is resolved.  */
  mmap (__morestack_current_segment, 0, PROT_READ, MAP_ANONYMOUS, -1, 0);
  mprotect (NULL, 0, 0);
  munmap (0, getpagesize ());
}

Yes...

So, do we really want to let munmap poke a hole at address 0 and thus
let further vm_map() return address 0?

Samuel