This is an automated email from the git hooks/post-receive script. sthibault pushed a commit to branch dde in repository hurd.
commit 1c5e9b5fd65d2c385f5d3f696eb0d05a86fb2755 Merge: 5018bd3 89a49ec Author: Justus Winter <[email protected]> Date: Wed Sep 13 14:10:33 2017 +0200 Merge remote-tracking branch 'mainline/master' into dde ChangeLog | 33 + Makeconf | 6 +- Makefile | 171 ++-- NEWS | 51 ++ aclocal.m4 | 4 + auth/auth.c | 6 +- boot/Makefile | 35 +- boot/boot.c | 976 +++++++++++---------- boot/frank1.ld | 94 -- boot/frankemul.ld | 107 --- boot/mach-crt0.c | 158 ---- libnetfs/get-source.c => boot/mig-decls.h | 21 +- libnetfs/get-source.c => boot/mig-mutate.h | 21 +- libnetfs/get-source.c => boot/private.h | 19 +- boot/sigvec.S | 23 - boot/syscall.S | 35 - boot/userland-boot.c | 261 +++++- boot/ux.c | 303 ------- boot/ux.h | 114 --- config.make.in | 5 +- configure.ac | 11 +- console-client/Makefile | 11 +- console-client/console.c | 5 +- console-client/driver.c | 6 +- console-client/kbd-repeat.c | 5 +- console-client/ncursesw.c | 16 +- console-client/pc-kbd.c | 8 +- console-client/pc-mouse.c | 5 +- console-client/trans.c | 4 +- console-client/vga-dynacolor.c | 10 +- console-client/vga-dynafont.c | 6 +- console-client/vga-support.c | 4 +- console-client/vga.c | 14 +- console-client/xkb/compose.c | 6 +- console-client/xkb/kstoucs.c | 4 +- console-client/xkb/xkbtimer.c | 4 +- console/console.c | 72 +- console/display.c | 31 +- console/pager.c | 32 +- daemons/Makefile | 9 +- daemons/{runsystem.hurd => runsystem.hurd.sh} | 0 daemons/runttys.c | 8 +- defpager/backing.c | 4 +- doc/hurd.texi | 9 +- eth-multiplexer/Makefile | 4 +- eth-multiplexer/dev_stat.c | 139 ++- eth-multiplexer/device_impl.c | 32 +- eth-multiplexer/ethernet.c | 88 +- eth-multiplexer/ethernet.h | 7 +- eth-multiplexer/util.h | 16 +- eth-multiplexer/vdev.c | 44 +- eth-multiplexer/vdev.h | 7 + exec/elfcore.c | 18 +- exec/exec.c | 76 +- exec/hashexec.c | 14 +- exec/hostarch.c | 2 +- exec/main.c | 14 +- exec/priv.h | 2 +- ext2fs/Makefile | 3 +- ext2fs/balloc.c | 10 +- ext2fs/dir.c | 68 +- ext2fs/ext2_fs.h | 3 +- ext2fs/ext2_fs_i.h | 1 - ext2fs/ext2fs.c | 26 + ext2fs/ext2fs.h | 81 +- ext2fs/getblk.c | 2 +- ext2fs/hyper.c | 4 +- ext2fs/ialloc.c | 10 +- ext2fs/inode.c | 260 ++++-- ext2fs/pager.c | 113 +-- ext2fs/pokel.c | 12 +- ext2fs/truncate.c | 4 +- ext2fs/xattr.c | 876 ++++++++++++++++++ ext2fs/xattr.h | 85 ++ fatfs/dir.c | 36 +- fatfs/fat.c | 28 +- fatfs/inode.c | 20 +- fatfs/main.c | 6 +- fatfs/pager.c | 29 +- fatfs/virt-inode.c | 8 +- ftpfs/conn.c | 4 +- ftpfs/dir.c | 32 +- ftpfs/node.c | 10 +- hostmux/leaf.c | 2 +- hostmux/mux.c | 6 +- hurd/auth_request.defs | 2 +- hurd/crash.defs | 6 +- hurd/default_pager.defs | 9 + hurd/default_pager_reply.defs | 2 + hurd/default_pager_types.h | 2 + hurd/fs.defs | 20 +- hurd/fsys.defs | 25 +- hurd/hurd_types.defs | 20 +- hurd/hurd_types.h | 3 + hurd/io_request.defs | 2 +- hurd/paths.h | 1 + hurd/process.defs | 6 +- hurd/process_reply.defs | 8 +- hurd/process_request.defs | 12 +- include/sys/procfs.h | 3 +- init/init.c | 2 +- isofs/inode.c | 2 +- isofs/isofs.h | 1 + isofs/lookup.c | 4 +- isofs/main.c | 13 +- isofs/pager.c | 28 +- isofs/rr.c | 10 +- libbpf/Makefile | 4 +- libbpf/{Makefile => Makefile~HEAD} | 0 libbpf/{Makefile => Makefile~HEAD_0} | 0 libbpf/bpf_impl.c | 62 +- libbpf/queue.c | 36 +- libcons/cons-switch.c | 4 +- libcons/dir-changed.c | 8 +- libcons/file-changed.c | 4 +- libcons/vcons-close.c | 4 +- libcons/vcons-refresh.c | 2 +- libcons/vcons-remove.c | 4 +- libdiskfs/Makefile | 6 +- libdiskfs/boot-start.c | 158 ++-- libdiskfs/console.c | 6 +- libdiskfs/dir-clear.c | 8 +- libdiskfs/dir-init.c | 4 +- libdiskfs/dir-link.c | 2 +- libdiskfs/dir-lookup.c | 243 +++-- libdiskfs/dir-renamed.c | 12 +- libdiskfs/dir-rmdir.c | 2 +- libdiskfs/disk-pager.c | 10 +- libdiskfs/diskfs-pager.h | 2 +- libdiskfs/diskfs.h | 17 +- libdiskfs/file-get-children.c | 96 -- libdiskfs/file-get-trans.c | 8 +- libdiskfs/file-getfh.c | 2 +- libdiskfs/file-set-trans.c | 23 +- libdiskfs/file-syncfs.c | 35 +- libdiskfs/file-utimes.c | 3 + libdiskfs/fsys-get-children.c | 74 ++ libdiskfs/{file-get-source.c => fsys-get-source.c} | 28 +- libdiskfs/fsys-getfile.c | 3 +- libdiskfs/fsys-getroot.c | 16 +- libdiskfs/fsys-goaway.c | 9 +- libdiskfs/fsys-options.c | 50 +- libdiskfs/fsys-syncfs.c | 40 +- libdiskfs/get-source.c | 2 +- libdiskfs/init-init.c | 14 +- libdiskfs/init-main.c | 4 +- libdiskfs/init-startup.c | 42 +- libdiskfs/io-map-cntl.c | 2 +- libdiskfs/io-reauthenticate.c | 2 +- libdiskfs/io-restrict-auth.c | 2 - libdiskfs/io-seek.c | 8 + libdiskfs/io-stubs.c | 8 +- libdiskfs/io-write.c | 2 +- libdiskfs/lookup.c | 2 +- libdiskfs/name-cache.c | 4 +- libdiskfs/node-cache.c | 10 +- libdiskfs/node-drop.c | 6 +- libdiskfs/node-lastref.c | 49 ++ libdiskfs/node-nput.c | 24 +- libdiskfs/node-nrele.c | 12 +- libdiskfs/opts-std-startup.c | 5 + libdiskfs/priv.h | 6 +- libdiskfs/protid-make.c | 6 +- libdiskfs/rdwr-internal.c | 9 +- libdiskfs/shutdown.c | 45 +- libdiskfs/trans-callback.c | 6 +- libfshelp/fetch-control.c | 15 +- libfshelp/fetch-root.c | 49 +- libfshelp/fshelp.h | 46 +- libfshelp/get-identity.c | 4 +- libfshelp/lock-acquire.c | 12 +- libfshelp/start-translator-long.c | 164 +++- libfshelp/translator-list.c | 207 +++-- libftpconn/unix.c | 9 +- libhurd-slab/slab.c | 10 +- libihash/ihash.c | 40 +- libihash/ihash.h | 11 + libnetfs/Makefile | 8 +- libnetfs/dir-lookup.c | 291 +++--- libnetfs/dir-mkfile.c | 2 +- libnetfs/drop-node.c | 1 - libnetfs/file-get-children.c | 110 --- libnetfs/file-set-translator.c | 8 +- libnetfs/file-syncfs.c | 23 +- libnetfs/fsstubs.c | 6 +- libnetfs/fsys-get-children.c | 74 ++ libnetfs/{file-get-source.c => fsys-get-source.c} | 28 +- libnetfs/fsys-getroot.c | 7 +- libnetfs/fsys-set-options.c | 53 +- libnetfs/fsys-syncfs.c | 22 + libnetfs/fsysstubs.c | 10 +- libnetfs/get-source.c | 2 +- libnetfs/init-init.c | 2 - libnetfs/io-reauthenticate.c | 2 +- libnetfs/io-restrict-auth.c | 3 - libnetfs/iostubs.c | 20 +- libnetfs/make-node.c | 2 +- libnetfs/netfs.h | 55 +- libnetfs/nput.c | 27 +- libnetfs/nref.c | 10 +- libnetfs/nrele.c | 37 +- libnetfs/shutdown.c | 45 +- libnetfs/trans-callback.c | 6 +- libpager/data-return.c | 6 +- libpager/data-unlock.c | 2 +- libpager/demuxer.c | 11 +- libpager/pager-attr.c | 2 +- libpager/pager-create.c | 50 +- libpager/pager-memcpy.c | 31 +- libpager/pager.h | 8 + libpager/stubs.c | 15 +- libpipe/pipe.c | 9 +- libports/Makefile | 2 +- libports/claim-right.c | 4 +- libports/complete-deallocate.c | 6 +- libports/create-internal.c | 6 +- libports/destroy-right.c | 4 +- libports/get-right.c | 4 +- libports/get-send-right.c | 4 +- libports/import-port.c | 4 +- libports/interrupt-on-notify.c | 4 +- libports/interrupt-rpcs.c | 8 +- libports/manage-multithread.c | 9 +- libports/manage-one-thread.c | 2 +- libports/port-deref-deferred.c | 12 +- libports/port-deref-weak.c | 2 +- libports/port-deref.c | 2 +- libports/port-ref-weak.c | 2 +- libports/port-ref.c | 2 +- libports/ports.h | 28 +- libports/reallocate-from-external.c | 14 +- libports/reallocate-port.c | 14 +- libports/resume-all-rpcs.c | 4 +- libports/resume-bucket-rpcs.c | 4 +- libports/resume-class-rpcs.c | 4 +- libports/resume-port-rpcs.c | 4 +- libports/transfer-right.c | 10 +- libps/context.c | 2 +- libps/filters.c | 2 +- libps/fmt.c | 13 +- libps/host.c | 2 +- libps/proclist.c | 10 +- libps/procstat.c | 12 +- libps/spec.c | 7 +- libps/tty.c | 2 +- libps/user.c | 2 +- libshouldbeinlibc/Makefile | 2 + libshouldbeinlibc/assert-backtrace.c | 79 ++ libshouldbeinlibc/assert-backtrace.h | 62 ++ libshouldbeinlibc/cacheq.c | 2 +- libshouldbeinlibc/idvec-verify.c | 4 +- libshouldbeinlibc/idvec.c | 6 +- libshouldbeinlibc/refcount.h | 59 +- libshouldbeinlibc/timefmt.c | 2 +- libshouldbeinlibc/wire.c | 144 +-- libshouldbeinlibc/wire.h | 4 +- libstore/Makefile | 5 +- libstore/argp.c | 4 +- libstore/derive.c | 6 +- libstore/device.c | 6 +- libstore/memobj.c | 9 +- libstore/mvol.c | 3 +- libstore/part.c | 8 +- libthreads/cancel-cond.c | 4 +- libthreads/cprocs.c | 4 +- libthreads/rwlock.h | 6 +- libtreefs/dir-lookup.c | 13 +- libtreefs/fsys-startup.c | 2 +- libtreefs/treefs.h | 10 +- libtreefs/xinl.c | 2 + libtrivfs/Makefile | 5 +- libtrivfs/dir-lookup.c | 2 +- libtrivfs/file-get-children.c | 36 - libtrivfs/file-set-size.c | 4 +- libtrivfs/fsys-get-children.c | 41 + libtrivfs/{file-get-source.c => fsys-get-source.c} | 22 +- libtrivfs/fsys-getroot.c | 18 +- libtrivfs/fsys-stubs.c | 8 +- libtrivfs/get-source.c | 2 +- libtrivfs/io-async-icky.c | 2 +- libtrivfs/io-async.c | 2 +- libtrivfs/io-map.c | 2 +- libtrivfs/io-modes-get.c | 2 +- libtrivfs/io-modes-off.c | 4 +- libtrivfs/io-modes-on.c | 4 +- libtrivfs/io-modes-set.c | 4 +- libtrivfs/io-owner-get.c | 2 +- libtrivfs/io-owner-mod.c | 2 +- libtrivfs/io-read.c | 4 +- libtrivfs/io-readable.c | 4 +- libtrivfs/io-reauthenticate.c | 7 +- libtrivfs/io-restrict-auth.c | 4 +- libtrivfs/io-seek.c | 4 +- libtrivfs/io-select.c | 6 +- libtrivfs/io-stubs.c | 18 +- libtrivfs/io-write.c | 4 +- libtrivfs/open.c | 2 +- libtrivfs/priv.h | 9 + libtrivfs/startup.c | 2 +- libtrivfs/times.c | 22 +- libtrivfs/trivfs.h | 14 +- login/utmp.c | 4 +- m4/libgcrypt.m4 | 143 +++ mach-defpager/Makefile | 2 +- mach-defpager/default_pager.c | 248 ++++-- mach-defpager/kalloc.c | 49 +- mach-defpager/main.c | 4 +- mach-defpager/priv.h | 1 + mach-defpager/setup.c | 16 +- mach-defpager/wiring.c | 67 +- mach-defpager/wiring.h | 1 - nfs/cache.c | 45 +- nfs/main.c | 11 +- nfs/ops.c | 18 +- nfs/rpc.c | 12 +- nfs/storage-info.c | 6 +- nfsd/cache.c | 9 +- pfinet/dummy.c | 2 +- pfinet/ethernet.c | 18 +- pfinet/glue-include/linux/interrupt.h | 6 +- pfinet/glue-include/linux/kernel.h | 8 +- pfinet/glue-include/linux/sched.h | 14 +- pfinet/glue-include/linux/socket.h | 6 +- pfinet/glue-include/linux/types.h | 2 +- pfinet/io-ops.c | 4 +- pfinet/linux-src/include/linux/ext2_fs_i.h | 1 - pfinet/linux-src/include/net/tcp.h | 1 - pfinet/linux-src/include/net/udp.h | 2 - pfinet/linux-src/net/ipv4/tcp_ipv4.c | 4 +- pfinet/linux-src/net/ipv4/udp.c | 12 +- pfinet/linux-src/net/ipv6/tcp_ipv6.c | 3 +- pfinet/linux-src/net/ipv6/udp_ipv6.c | 9 +- pfinet/main.c | 5 +- pfinet/socket-ops.c | 6 +- pfinet/socket.c | 6 +- pfinet/tunnel.c | 12 +- pflocal/Makefile | 6 +- pflocal/connq.c | 20 +- libtrivfs/io-seek.c => pflocal/fs.c | 39 +- pflocal/io.c | 111 +-- pflocal/mig-mutate.h | 6 + pflocal/sock.c | 8 +- pflocal/sock.h | 6 +- pflocal/socket.c | 14 +- pflocal/sserver.c | 2 + proc/host.c | 19 +- proc/info.c | 232 ++++- proc/main.c | 106 ++- proc/mgt.c | 150 +++- proc/mig-mutate.h | 9 + proc/msg.c | 44 +- proc/pgrp.c | 104 ++- proc/proc.h | 6 +- proc/stubs.c | 6 +- proc/wait.c | 3 +- procfs/ChangeLog | 6 - procfs/Makefile | 2 +- procfs/main.c | 36 +- procfs/main.h | 1 - procfs/netfs.c | 8 +- procfs/procfs.c | 2 +- procfs/proclist.c | 4 +- procfs/rootdir.c | 197 ++++- random/Makefile | 30 - random/TODO | 11 - random/gnupg-bithelp.h | 41 - random/gnupg-glue.h | 40 - random/gnupg-random.c | 810 ----------------- random/gnupg-random.h | 47 - random/gnupg-rmd.h | 38 - random/gnupg-rmd160.c | 655 -------------- random/random.h | 32 - release/servers.boot | 2 +- startup/Makefile | 9 +- startup/startup.c | 526 +++++++---- storeio/dev.c | 15 +- storeio/pager.c | 4 +- storeio/storeio.c | 2 +- sutils/MAKEDEV.sh | 8 +- sutils/Makefile | 10 +- sutils/bless.c | 96 ++ sutils/fsck.c | 6 +- sutils/fstab.c | 2 +- sutils/swapon.c | 115 ++- term/devio.c | 20 +- term/hurdio.c | 2 +- term/main.c | 2 +- term/munge.c | 13 +- term/term.h | 7 +- term/users.c | 9 +- tmpfs/dir.c | 18 +- tmpfs/node.c | 28 +- tmpfs/tmpfs.c | 2 +- trans/Makefile | 18 +- trans/crash.c | 210 ++++- trans/fakeroot.c | 121 ++- trans/fifo.c | 2 - trans/firmlink.c | 7 + trans/ifsock.c | 2 +- trans/magic.c | 8 +- trans/mtab.c | 263 +++--- trans/new-fifo.c | 12 +- trans/null.c | 6 +- trans/password.c | 6 +- trans/proxy-defpager.c | 15 +- {random => trans}/random.c | 500 ++++++----- trans/remap.c | 7 + trans/streamio.c | 26 +- trans/symlink.c | 59 -- usermux/leaf.c | 2 +- usermux/mux.c | 6 +- utils/Makefile | 2 + utils/fakeauth.c | 8 +- utils/fakeroot.sh | 3 + utils/login.c | 6 +- utils/msgids.c | 5 +- utils/ps.c | 2 +- utils/rpctrace.c | 87 +- utils/settrans.c | 91 +- utils/shd.c | 8 +- utils/vmallocate.c | 4 +- 421 files changed, 7995 insertions(+), 6834 deletions(-) diff --cc Makefile index c97c1d7,119f130..9efd547 --- a/Makefile +++ b/Makefile @@@ -29,12 -29,9 +29,13 @@@ include ./Makecon lib-subdirs = libshouldbeinlibc libihash libiohelp libports libthreads \ libpager libfshelp libdiskfs libtrivfs libps \ libnetfs libpipe libstore libhurdbugaddr libftpconn libcons \ - libhurd-slab + libhurd-slab \ + libbpf \ +ifneq ($(LIBPCIACCESS),no) +lib-subdirs += libmachdev libddekit +endif + # Hurd programs prog-subdirs = auth proc exec term \ ext2fs isofs tmpfs fatfs \ @@@ -48,6 -44,7 +48,8 @@@ startup \ init \ devnode \ + eth-multiplexer \ ++ proc_proxy \ ifeq ($(HAVE_SUN_RPC),yes) prog-subdirs += nfs nfsd @@@ -162,17 -169,44 +178,44 @@@ ChangeLog_specs += .PHONY: gen-ChangeLog gen-ChangeLog: $(AM_V_GEN)if test -d $(top_srcdir)/.git; then \ + rm -f $(ChangeLog_files) && \ (cd $(top_srcdir)/ && \ ./gitlog-to-changelog --strip-tab \ - $(gen_start_commit).. && \ - echo) >> $(distdir)/cl-t && \ - for f in $(ChangeLog_files); do \ + $(gitlog-to-changelog_rev) && \ + echo) >> ChangeLog && \ - (cd $(top_srcdir)/ && \ + (cd $(top_srcdir)/ && \ - git show $(gen_start_commit):$$f) >> $(distdir)/cl-t && \ - rm -f $(distdir)/$$f && \ - mv $(distdir)/cl-t $(distdir)/$$f \ + ./gitlog-to-changelog --strip-tab \ + edb4593c38d421b5d538b221a991b50c36fdba15..aac4aaf42372f61c78061711916c81a9d5bcb42d~1 && \ + echo) >> procfs/ChangeLog && \ + rm -f random/ChangeLog-1 && \ + (cd $(top_srcdir)/ && \ + ./gitlog-to-changelog --strip-tab \ + ac38884dc9ad32a11d09f55ba9fe399cd0a48e2f..1ba2ed95690396bf081d0af043d878b26b8563c2~1 && \ + echo) >> random/ChangeLog-1 && \ + for cs in $(ChangeLog_specs); do \ + f=$${cs%%:*} && \ + s=$${cs#$$f:} && s_f=$$s:$$f && s=$${s_f/*:*:*/$$s} && \ + (cd $(top_srcdir)/ && \ + git show $$s) >> $$f \ || exit $$?; \ - done; \ + done && \ + rm -f random/ChangeLog_ && \ + (cd $(top_srcdir)/ && \ + git ls-tree --name-only \ + ac38884dc9ad32a11d09f55ba9fe399cd0a48e2f) >> random/ChangeLog_ && \ + rm -f random/ChangeLog-2 && \ + perl \ + -e 'print "2011-08-18 Gaƫl Le Mignot <kilobug\@freesurf.fr>\n\n"; while(<>){s%^%\t* %;s%$$%: New file.%;print;}' \ + < random/ChangeLog_ > random/ChangeLog-2 && \ + cat random/ChangeLog-* > random/ChangeLog && \ + rm random/ChangeLog?* && \ + sed \ + -e 's%\* [ ]*%* procfs/%' \ + -e s%procfs/procfs/%procfs/% \ + -i procfs/ChangeLog && \ + sed \ + -e 's%\* [ ]*%* random/%' \ + -i random/ChangeLog; \ fi $(dist-version).tar: HEAD.tar $(addsuffix /dist-hook,hurd/.. $(subdirs)) ChangeLog.tar diff --cc config.make.in index 20ab344,dfbf0c1..6687bf6 --- a/config.make.in +++ b/config.make.in @@@ -101,9 -96,9 +99,12 @@@ libblkid_LIBS = @libblkid_LIBS # Whether Sun RPC support is available. HAVE_SUN_RPC = @HAVE_SUN_RPC@ + # Whether we found libgcrypt. + HAVE_LIBGCRYPT = @HAVE_LIBGCRYPT@ + +# Whether libpciaccess is available. +LIBPCIACCESS = @LIBPCIACCESS@ + # Installation tools. INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ diff --cc libfshelp/start-translator-long.c index fe4a332,e1aea3c..1a7254e --- a/libfshelp/start-translator-long.c +++ b/libfshelp/start-translator-long.c @@@ -22,9 -20,13 +22,11 @@@ #include <hurd.h> #include <mach/notify.h> -#include <mach.h> #include <errno.h> -#include <unistd.h> #include <fcntl.h> - #include <assert.h> + #include <stdint.h> + #include <string.h> + #include <assert-backtrace.h> #include "fshelp.h" diff --cc pfinet/ethernet.c index c8d3ac8,1b3b5d0..bc3e630 --- a/pfinet/ethernet.c +++ b/pfinet/ethernet.c @@@ -400,56 -397,5 +400,56 @@@ setup_ethernet_device (char *name, stru initializes its `ifindex' member (which matters!), and tells the protocol stacks about the device. */ err = - register_netdevice (dev); - assert_perror (err); + assert_perror_backtrace (err); } + +#ifdef HAVE_PCAP + +int +ethernet_reset_filter (struct device *dev, char *filter_str) +{ + error_t err; + struct ether_device *edev = (struct ether_device *) dev->priv; + int len; + struct bpf_insn *insn; + + insn = trans_filter_program (filter_str, 0, &len); + if (insn == NULL) + return -1; + + /* if the device isn't initialized */ + if (edev->readpt == NULL) + return -1; + + err = device_set_filter (edev->ether_port, ports_get_right (edev->readpt), + MACH_MSG_TYPE_MAKE_SEND, 0, (short *)insn, len); + if (err) + error (2, err, "ethernet_reset_filter: %s", dev->name); + + free (insn); + return 0; +} + +int ethernet_reset_ipfilter (struct device *dev, struct in_addr addr) +{ + char ip_str[INET_ADDRSTRLEN]; + char filter_str[128]; + + if (inet_ntop (AF_INET, &addr, ip_str, INET_ADDRSTRLEN) == NULL) + { + perror ("inet_ntop"); + return -1; + } + snprintf (filter_str, sizeof (filter_str), "arp or (ip host %s)", ip_str); + return ethernet_reset_filter (dev, filter_str); +} + +#else /* not HAVE_PCAP */ + +int ethernet_reset_ipfilter (struct device *dev, struct in_addr addr) +{ + return 0; +} + +#endif /* not HAVE_PCAP */ + diff --cc trans/Makefile index d257a84,8048d6f..9f8693d --- a/trans/Makefile +++ b/trans/Makefile @@@ -27,8 -27,8 +27,8 @@@ SRCS = ifsock.c symlink.c magic.c null. fakeroot.c proxy-defpager.c remap.c mtab.c OBJS = $(SRCS:.c=.o) fsysServer.o ifsockServer.o passwordServer.o \ crashServer.o crash_replyUser.o msgServer.o \ - default_pagerServer.o default_pagerUser.o \ + ourdefault_pagerServer.o ourdefault_pagerUser.o \ - device_replyServer.o elfcore.o + device_replyServer.o elfcore.o startup_notifyServer.o HURDLIBS = ports netfs trivfs iohelp fshelp pipe ihash shouldbeinlibc LDLIBS += -lpthread password-LDLIBS = -lcrypt @@@ -62,9 -73,8 +76,9 @@@ vpath elfcore.c $(top_srcdir)/exe crash: crashServer.o crash_replyUser.o msgServer.o elfcore.o ifsock: ifsockServer.o - mtab: fsUser.o + mtab: fsysUser.o password: passwordServer.o +proxy-defpager: ourdefault_pagerServer.o ourdefault_pagerUser.o proxy-defpager: default_pagerServer.o default_pagerUser.o streamio: device_replyServer.o symlink: fsysServer.o diff --cc utils/settrans.c index b177639,9c9f087..7e1e51f --- a/utils/settrans.c +++ b/utils/settrans.c @@@ -95,166 -93,46 +100,204 @@@ static char *args_doc = "NODE [TRANSLAT static char *doc = "Set the passive/active translator on NODE." "\vBy default the passive translator is set."; + /* Authentication of the current process. */ + uid_t *uids; + gid_t *gids; + size_t uids_len, gids_len; + + /* Initialize and populate the uids and gids vectors. */ + error_t + get_credentials (void) + { + /* Fetch uids... */ + uids_len = geteuids (0, 0); + if (uids_len < 0) + return errno; + + uids = malloc (uids_len * sizeof (uid_t)); + if (! uids) + return ENOMEM; + + uids_len = geteuids (uids_len, uids); + if (uids_len < 0) + return errno; + + /* ... and gids. */ + gids_len = getgroups (0, 0); + if (gids_len < 0) + return errno; + + gids = malloc (gids_len * sizeof (gid_t)); + if (! uids) + return ENOMEM; + + gids_len = getgroups (gids_len, gids); + if (gids_len < 0) + return errno; + + return 0; + } + /* ---------------------------------------------------------------- */ +/* Callback that should set the translator CONTROL to some file. + TASK is the task port to the translator. */ +typedef error_t (*settrans_fn_t) (fsys_t control, mach_port_t task, + void *cookie); + +/* Start a thread that services `fsys_startup' RPCs. + Calls UNDERLYING_OPEN_FN with UNDERLYING_OPEN_COOKIE to open the + underlying file, and SETTRANS_FN with SETTRANS_COOKIE to set the + translator. Returns the thread in THREAD, and the bootstrap port + that should be passed to starting translators in BOOTSTRAP. */ +static error_t +start_interactive_translator_service (fshelp_open_fn_t underlying_open_fn, + void *underlying_open_cookie, + settrans_fn_t settrans_fn, + void *settrans_cookie, + cthread_t *thread, + mach_port_t *bootstrap) +{ + struct thread_args + { + fshelp_open_fn_t underlying_open_fn; + void *underlying_open_cookie; + settrans_fn_t settrans_fn; + void *settrans_cookie; + mach_port_t bootstrap; + }; + + struct thread_args *thread_args; + mach_port_t prev_notify; + error_t err; + + /* Create a bootstrap port for the translator. */ + err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, + bootstrap); + if (err) + return err; + + /* Get a notification when there are no more send rights once 1 or + more has been allocated. */ + err = + mach_port_request_notification (mach_task_self (), + *bootstrap, MACH_NOTIFY_NO_SENDERS, 1, + *bootstrap, MACH_MSG_TYPE_MAKE_SEND_ONCE, + &prev_notify); + if (err) + goto lose; + + thread_args = malloc (sizeof (struct thread_args)); + if (thread_args == NULL) + { + err = errno; + goto lose; + } + + *thread_args = (struct thread_args) + { + underlying_open_fn, underlying_open_cookie, + settrans_fn, settrans_cookie, + *bootstrap + }; + + void *thread_routine (void *arg) + { + struct thread_args *args = arg; + fsys_t control = MACH_PORT_NULL; /* Only set to quiet gcc. */ + error_t err; + + do + { + /* Rendezvous with PID. */ + err = fshelp_service_fsys_startup (args->underlying_open_fn, + args->underlying_open_cookie, + args->bootstrap, 0, + MACH_PORT_NULL, &control); + if (err) + continue; + + settrans_fn (control, MACH_PORT_NULL, settrans_cookie); + mach_port_deallocate (mach_task_self (), control); + } + while (err != EDIED); + + free (args); + return (void *) err; + } + *thread = cthread_fork (thread_routine, thread_args); + if (*thread == NO_CTHREAD) + { + free (thread_args); + err = errno; + } + +lose: + if (err) + mach_port_destroy (mach_task_self (), *bootstrap); + + return err; +} + +/* Fork the process, pass BOOTSTRAP to the child, and store the child's + PID in PID. BOOTSTRAP must have a receive right. This call clears + the bootstrap special port as a side-effect. */ +static error_t +fork_interactive_translator (mach_port_t bootstrap, pid_t *pid) +{ + error_t err; + + /* We can't just set _hurd_ports[INIT_PORT_BOOTSTRAP] since port names + with receive rights are recreated in the forked child, so it will + get a different port. */ + + /* task_set_bootstrap_port needs a send right to copy. */ + err = mach_port_insert_right (mach_task_self (), bootstrap, bootstrap, + MACH_MSG_TYPE_MAKE_SEND); + if (err) + return err; + + task_set_bootstrap_port (mach_task_self (), bootstrap); + mach_port_deallocate (mach_task_self (), bootstrap); + + *pid = fork (); + if (*pid == -1) + err = errno; + + if (*pid == 0) + { + /* Destroy recreated bootstrap port. */ + mach_port_destroy (mach_task_self (), bootstrap); + + /* Use parent's instead. */ + task_get_bootstrap_port (mach_task_self (), &bootstrap); + _hurd_port_set (&_hurd_ports[INIT_PORT_BOOTSTRAP], bootstrap); + return 0; + } + + task_set_bootstrap_port (mach_task_self (), MACH_PORT_NULL); + return err; +} + +/* Exec the translator command stored in ARGZ and ARGZ_LEN. + Search PATH for exectutable. */ +static error_t +exec_interactive_translator (char *argz, int argz_len) +{ + char **argv; + + argv = malloc ((argz_count (argz, argz_len) + 1) * sizeof (char *)); + if (argv == NULL) + return errno; + argz_extract (argz, argz_len, argv); + + execvp (argz, argv); + + /* Only reached on error. */ + free (argv); + return errno; +} + int main(int argc, char *argv[]) { @@@ -279,8 -157,9 +322,9 @@@ /* Various option flags. */ int passive = 0, active = 0, keep_active = 0, pause = 0, kill_active = 0, - orphan = 0; + orphan = 0, interactive = 0; int start = 0; + int stack = 0; char *pid_file = NULL; int excl = 0; int timeout = DEFAULT_TIMEOUT * 1000; /* ms */ @@@ -317,8 -198,12 +363,13 @@@ start = 1; active = 1; /* start implies active */ break; + case OPT_STACK: + stack = 1; + active = 1; /* stack implies active */ + orphan = 1; /* stack implies orphan */ + break; case 'p': passive = 1; break; + case 'i': interactive = 1; break; case 'k': keep_active = 1; break; case 'g': kill_active = 1; break; case 'x': excl = 1; break; @@@ -395,7 -271,15 +451,15 @@@ argp_parse (&argp, argc, argv, ARGP_IN_ORDER, 0, 0); + if (stack) + { + underlying_node_name = node_name; + underlying_lookup_flags = lookup_flags && ~O_NOTRANS; + } + else + underlying_lookup_flags = lookup_flags; + - if (!active && !passive && !chroot_command) + if (!active && !passive && !chroot_command && !interactive) passive = 1; /* By default, set the passive translator. */ if (passive) -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hurd/hurd.git
