summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-02-05trans/fakeroot: rework node cachingRichard Braun
Instead of the FAKE_REFERENCE flag, rework node caching so that nodes are retained only if their attributes are actually changed. In addition, don't remove unreferenced nodes from the hash table at protid release, since their reference counter is unstable. Do it on node destruction, once the reference counter has reached 0. This means lookups can return nodes not referenced (other than by the hash table), a condition for which a check is added. By never acquiring a reference on such nodes, their counter is guaranteed to remain stable once unreferenced. * trans/fakeroot.c (FAKE_REFERENCE): Remove macro. (FAKE_DEFAULT): New macro. (set_default_attributes): New function. (set_faked_attribute): Likewise. (netfs_node_norefs): Remove node from hash table, properly taking care of all the locks involved. (fakeroot_netfs_release_protid): Remove node handling code, merely call netfs_release_protid. (netfs_S_dir_lookup): Handle unreferenced nodes, call set_default_attributes on node creation, remove call to netfs_attempt_chown. (netfs_attempt_chown): Call set_faked_attribute instead of accessing faked flags directly. (netfs_attempt_chauthor): Likewise. (netfs_attempt_chmod): Likewise. (main): Likewise.
2014-02-05trans/fakeroot: fix chmodRichard Braun
Unconditionally relay chmod requests instead of filtering those that don't change the executable bit. * trans/fakeroot.c (netfs_attempt_chmod): Unconditionally call file_chmod with an unaltered mode.
2014-02-05Revert "trans: fix locking issue in fakeroot"Richard Braun
This reverts commit 672005782e57e049c7c8f4d6d0b2a80c0df512b4. That change is apparently not needed and introduced a deadlock. * trans/fakeroot.c (netfs_attempt_mkfile): Unlock directory node before creating new node.
2014-02-05trans/fakeroot: fix right leakRichard Braun
* trans/fakeroot.c (netfs_S_dir_lookup): Deallocate rights to intermediate file systems.
2014-02-05daemons/getty: always print a newline before the bannerJustus Winter
* daemons/getty.c (load_banner): Drop first newline from default banner. (print_banner): Print a newline.
2014-02-02exec: connect std{in,out,err} to the mach consoleJustus Winter
* exec/main.c (S_exec_init): Get the device master port and connect std{in,out,err} to the mach console.
2014-01-31daemons/getty: display /etc/issue if availableJustus Winter
Previously, a banner was hardcoded in Hurds getty. Load /etc/issue instead. Fall back to a hardcoded version if that fails. Expand common \char sequences. If no /etc/issue is provided, the old behavior is retained. * daemons/getty.c (load_banner): New function. (print_banner): Expand \char sequences.
2014-01-30Fix crash on fsysopts when pfinet has no IPv6Samuel Thibault
* pfinet/options.c (add_dev_opts): Use a for loop over `idev->addr_list' instead of a while loop which assumes that it is not empty.
2014-01-29pfinet: really deallocate device portSamuel Thibault
* pfinet/ethernet.c (ethernet_close): Call mach_port_deallocate on device port.
2014-01-28Also re-open Ethernet device on EMIG_SERVER_DIEDSamuel Thibault
* pfinet/ethernet.c (ethernet_xmit): Also call ethernet_close then ethernet_open on EMIG_SERVER_DIED error.
2014-01-28Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurdSamuel Thibault
2014-01-28Make pfinet re-open ethernet device on transmission errorSamuel Thibault
* pfinet/ethernet.c (ethernet_close): New function. (ethernet_xmit): On EMACH_SEND_INVALID_DEST error, call ethernet_close and ethernet_open again to re-open ethernet device.
2014-01-26libnetfs: fix file locking on peropen releaseRichard Braun
* libnetfs/release-peropen.c (netfs_release_peropen): Release the lock on the underlying node if the peropen status indicates it's not unlocked.
2014-01-20proc: fix the receiver lookup in S_proc_exception_raiseJustus Winter
* proc/mgt.c (S_proc_exception_raise): Update accordingly. * proc/mig-decls.h: New file. * proc/proc_exc.defs: Add translation functions.
2014-01-20utils: include the mig-generated server headers in fakeauth.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * utils/fakeauth.c: Include the mig-generated server headers.
2014-01-20auth: include the mig-generated server headers in auth.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * auth/auth.c: Include the mig-generated server headers.
2014-01-20pflocal: include the mig-generated server headersJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * pflocal/demuxer.c: Include the mig-generated server headers. * pflocal/sserver.c: Likewise.
2014-01-20pfinet: include the mig-generated server headers in main.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * pfinet/main.c: Include the mig-generated server headers.
2014-01-20proc: include the mig-generated server headers in main.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * proc/main.c: Include the mig-generated server headers.
2014-01-20exec: include the mig-generated server headers in main.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * exec/main.c: Include the mig-generated server headers.
2014-01-20libtrivfs: include the mig-generated server headers in demuxer.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * libtrivfs/demuxer.c: Include the mig-generated server headers.
2014-01-20libnetfs: include the mig-generated server headers in demuxer.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * libnetfs/demuxer.c: Include the mig-generated server headers.
2014-01-20libdiskfs: include the mig-generated server headers in demuxer.cJustus Winter
GNU MIG recently gained support for emitting x_server_routine declarations in the generated server header file. Using this declaration, the x_server_routine functions can be inlined into the demuxer function. * libdiskfs/demuxer.c: Include the mig-generated server headers.
2014-01-20trans: fix the receiver lookup in passwordJustus Winter
Use translation functions instead of doing the lookup manually. * trans/Makefile (password-MIGSFLAGS): Add mutators. * trans/password.c (S_password_check_user): Update accordingly. (S_password_check_group): Likewise.
2014-01-19Rename variables with the name "error" to "err".Justus Winter
The canonical name for variables of the type error_t is err. There are, however, places where the variable is called error instead. This is unfortunate, as this shadows the error function. Rename such variables to err. For reference, this is accomplished using the following semantic patch: @@ expression E; @@ -error_t error = E; +error_t err = E; <... -error +err ...> @@ @@ -error_t error; +error_t err; <... -error +err ...> * libdiskfs/dir-link.c: Rename error to err. * libdiskfs/dir-unlink.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-get-transcntl.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/fsys-getroot.c: Likewise. * libshouldbeinlibc/wire.c: Likewise.
2014-01-16libps: fix task/thread times fetchingRichard Braun
Introduce PSTAT_TIMES to force the retrieval of both PSTAT_TASK_BASIC and PSTAT_THREAD_BASIC. Task basic info contain the user and system times of terminated threads which the code wrongly assumes is always present along with process info. * libps/procstat.c (add_preconditions): Set both PSTAT_TASK_BASIC and PSTAT_THREAD_BASIC as preconditions for PSTAT_TIMES. (summarize_thread_basic_info): Add terminated threads times only if task basic info are available. (set_procinfo_flags): Provide summarize_thread_basic_info with flags of available info. (proc_stat_set_flags): Set PSTAT_TIMES as available if it was needed and any of PSTAT_TASK_BASIC or PSTAT_THREAD_BASIC could be fetched. * libps/ps.h (PSTAT_TIMES): New macro. * libps/spec.c (ps_get_usr_time): Indicate the getter needs PSTAT_TIMES instead of PSTAT_THREAD_BASIC. (ps_sys_time_getter): Likewise. (ps_tot_time_getter): Likewise.
2014-01-12libnetfs: register passive translator startupsJustus Winter
Detect passive translator startup and add the resulting active translator to the list of active translators. * libnetfs/dir-lookup.c (netfs_S_dir_lookup): Detect and register passive translator startup.
2014-01-12libdiskfs: register passive translator startupsJustus Winter
Detect passive translator startup and add the resulting active translator to the list of active translators. Note that newpi is properly deallocated in the function epilogue. * libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Detect and register passive translator startup.
2014-01-12libfshelp: fix the api of fshelp_set_active_translatorJustus Winter
To detect if an active translator goes away, we need to register for dead name notifications. Those notifications have to be sent to a port known to the ports library, as the ports library handles the dead name notifications. The most straight forward way is to use the port to the underlying node for that. To that end, a reference to the port_info struct is handed in and kept in the list of active translators. This commit also moves the registration of dead name notifications to libfshelp. * libfshelp/fshelp.h (fshelp_set_active_translator): Add port_info argument. * libfshelp/translator-list.c (struct translator): Add port_info pointer. (translator_ihash_cleanup): Dereference port_info object. (fshelp_set_active_translator): Register dead name notifications. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Update accordingly. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likewise.
2014-01-12trans/mtab: do not include non-filesystem translators by defaultJustus Winter
Traditionally, /proc/mounts includes only filesystem mount points. Previously though, the mtab translator included any kind of translator, like all /hurd/storeio translators. This causes problems with umount --all as this would remove the passive translator records from nodes in /dev. Fix this by only listing filesystem-like translators by default. Filesystem-like translators are identified by their response to dir_readdir messages sent to their root node. * trans/mtab.c (all_translators): New variable. (options): Add flag to preserve the old behavior. (parse_opt): Handle the new flag. (is_filesystem_translator): New function. (mtab_populate): Skip non-filesystem translators by default.
2014-01-12trans/mtab: make the translator multithreadedJustus Winter
* trans/mtab.c (main): Use ports_manage_port_operations_multithread.
2014-01-12trans/mtab: properly lock mtab objectsJustus Winter
* trans/mtab.c (struct mtab): Add lock. (open_hook): Initialize lock. (close_hook): Destroy lock. (trivfs_S_io_read): Lock mtab object, adjust error handling accordingly. (trivfs_S_io_seek): Likewise. (trivfs_S_io_readable): Likewise.
2014-01-12trans/mtab: remove the loop detection logicJustus Winter
Previously the mtab detector tried to detect whether it talks to itself by comparing the control port of the translator it currently visits with its own. This was done to prevent deadlocks. However, this did not detect non-trivial loops, i.e. two mtab translators would still dead-lock each other. Now that it is safe to actually file_name_lookup the root node of a mtab translator without triggering the generation of content, this logic can just be omitted. * trans/mtab.c (mtab_populate): Remove the loop detection logic.
2014-01-12trans/mtab: populate mtab objects on demandJustus Winter
Previously the mtab content was generated in the open hook. Delay this until the data is needed. A follow up patch will take advantage of this to both simplify the logic in mtab_populate and make it more robust at the same time. * trans/mtab.c (open_hook): Do not eagerly populate the mtab. (trivfs_S_io_read): Populate the mtab struct on demand. (trivfs_S_io_seek): Likewise. (trivfs_S_io_readable): Likewise.
2013-12-30libps: fix process user and system timesRichard Braun
Include the run time of terminated threads in the user and system times of processes.
2013-12-28libports: remove the threadvars stack size hackRichard Braun
Setting the stack size should now correctly be supported by libpthread. * libports/manage-multithread.c (__pthread_stack_default_size): Remove global variable.
2013-12-19trans/fakeroot: shutdown the translator if the last client is goneJustus Winter
Previously, fakeroot would not exit if a process outlived the original process started by settrans. This caused bugs like this: % fakeroot-hurd /bin/sh -c 'sleep 1&' 2>&1 | tee <hangs> Fix this by exiting if the last client of fakeroot goes away. If noone has a right to any control or protid port, noone can ever reacquire any such right. So it is safe to shutdown the fakeroot translator in that case. * trans/fakeroot.c (fakeroot_netfs_release_protid): Shutdown the translator if the last protid object is destroyed and no control port is around either.
2013-12-16utils/rpctrace: fix output so that replies can be attributed to requestsJustus Winter
Currently, it is impossible to properly attribute response messages to requests. Even though rpctrace is single-threaded, its tracee may not. Or there might be more than one tracee. In any such case it is not guaranteed that the reply message we just processed is for the request we just printed. Fix this by printing ellipsis with the port name, so that reply messages can be properly attributed: task129(pid3312)->mach_port_allocate (3) ...134 task129(pid3312)->mach_port_deallocate (pn{ 1}) ...160 134... = 0 pn{ 30} 160... = 0 * utils/rpctrace.c (last_reply_port): New variable. (print_ellipsis): New function. (print_request_header): Optionally print ellipsis and update last_reply_port. (print_reply_header): Likewise.
2013-12-16utils/rpctrace: escape non-printable characters in stringsJustus Winter
* utils/rpctrace.c (escape_sequences): New char array mapping characters to their escape sequence. (print_data): Escape non-printable characters when printing strings.
2013-12-16utils/rpctrace: handle MACH_MSG_TYPE_PORT_SEND rights in trace_and_forwardJustus Winter
This allows one to rpctrace processes doing select(2). * utils/rpctrace.c (trace_and_forward): Handle MACH_MSG_TYPE_PORT_SEND rights.
2013-12-16utils/rpctrace: generalize tracing codeJustus Winter
Currently, rpctrace dies if a tracee uses select(2) because it asserts that reply_type is a MACH_MSG_TYPE_PORT_SEND_ONCE right. Generalize the code surrounding the failing assertion. * utils/rpctrace.c (trace_and_forward): Generalize code by switching over reply_type.
2013-12-16utils/rpctrace: generalize code in rewrite_rightJustus Winter
* utils/rpctrace.c (rewrite_right): Generalize the code so we can use rewrite_right to rewrite MACH_MSG_TYPE_PORT_SEND rights for non-rpc ports.
2013-12-13utils/mount: fix autodetection of fat file systemsJustus Winter
mount uses libblkid (if available) to detect the file system type when using mount -t auto. libblkid calls fat file systems "vfat", our fat translator is called "fatfs". Fix this discrepancy in mount. * utils/mount.c (do_mount): Fix autodetection of fat file systems.
2013-12-10trans/fakeroot: remove dead codeJustus Winter
* trans/fakeroot.c (netfs_S_dir_lookup): Remove dead code.
2013-12-10trans/fakeroot: remove dead codeJustus Winter
* trans/fakeroot.c (netfs_S_dir_lookup): Remove dead code.
2013-12-10trans/fakeroot: drop elseJustus Winter
* trans/fakeroot.c (netfs_S_dir_lookup): Drop else.
2013-12-10trans/fakeroot: fix ownership of newly created filesJustus Winter
Previously, files created in the fakeroot environment were created with the uid and gid of the user running fakeroot: % fakeroot-hurd /bin/sh -c 'touch /tmp/$$; stat --format=%u:%g /tmp/$$' 1000:1000 * trans/fakeroot.c (netfs_S_dir_lookup): Fix ownership of newly created files.
2013-12-10utils/settrans: fix the teardown of chrooted environmentsJustus Winter
Previously, settrans --chroot would just exec the target. Create a new process for that purpose. Wait for its completion, then ask the translator (nicely by default) to go away. If it refuses with EBUSY, it might be because some process has daemonized inside the chrooted environment. This fixes the following bug when settrans is used with fakeroot: % fakeroot-hurd /bin/true 2>&1 | tee <hangs> Here, fakeroot-hurd execs settrans with --chroot, settrans execs /hurd/fakeauth which will eventually exec the target /bin/true. When true terminates, it will close its stdout and stderr. But /hurd/fakeroot's stderr is also connected to tee's stdin, preventing tee from exiting. * utils/settrans.c (main): Fix the teardown of chrooted environments.
2013-12-09console-client: remove spurious pthread_spin_unlocksJustus Winter
* console-client/trans.c (netfs_attempt_mkfile): Remove spurious pthread_spin_unlock. (netfs_node_norefs): Likewise.
2013-12-09trans: unlock nodes with faked attributes in fakerootJustus Winter
When a node has faked attributes, we cannot drop our node. Reinitialize the lock box as if the node was dropped. This fixes the following bug: % fakeroot-hurd /bin/sh -c 'touch /tmp/$$.lock chown 0 /tmp/$$.lock l(){ flock /tmp/$$.lock true; }; l; l' <hangs> * trans/fakeroot.c (fake_node_dropweak): Unlock the node if the last real reference is dropped but we keep a fake one.