summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-11-21Makeconf: handle the gnumach protocolJustus Winter
* Makeconf (mach_defs_names): Add `gnumach'.
2014-11-21startup: bind the startup server to /servers/startupJustus Winter
Previously, the Hurd (ab)used the fact that the startup server speaks all protocols on its message port. Any server that wished to register for shutdown notifications would use proc_getmsgport to get a port to the startup server. This hardcodes the PID of /hurd/startup, and does not allow one to point a server to ones own startup server (e.g. using remap). Bind the startup server to /servers/startup instead. Use this to contact the startup server. * exec/main.c (S_exec_init): Use /servers/startup. Fall back to the old method so that the system still boots when the node /servers/startup is missing. * hurd/paths.h (_SERVERS_STARTUP): New macro. * libdiskfs/boot-start.c (diskfs_S_fsys_init): Use /servers/startup. * libdiskfs/init-startup.c (_diskfs_init_completed): Likewise. * pfinet/main.c (arrange_shutdown_notification): Likewise. * startup/Makefile (OBJS): Add fsysServer.o. * startup/startup.c (demuxer): Handle the fsys protocol. (main): Bind to /servers/startup. (S_fsys_getroot): Implement fsys_getroot. Stub out the rest.
2014-11-21startup: fix the declaration of the *_server functionsJustus Winter
* startup/startup.c (demuxer): Fix the declaration of the server functions.
2014-11-21startup: be more specific in the shutdown messageJustus Winter
Use the BOOT macro to print either halt or reboot instead of the generic shutdown in the event of an system shutdown. * startup/startup.c (reboot_system): Use more specific message.
2014-11-21startup: do not pass signals on to the childJustus Winter
Formerly /hurd/startup would forward all signals to the child it started (e.g. /libexec/runsystem). The motivation for doing so is not revealed in the comments, nor it is mentioned in the history of the version control system. This patch removes the forwarding of signals to the child. * startup/startup.c (process_signal): Do not pass signals on to the child. * startup/stubs.c: Remove file. * startup/Makefile: Remove stubs.c.
2014-11-21init: add a minimalist init programJustus Winter
This patch adds a minimalist init program. It is somewhat lacking in features, but is able to bring up a Hurd system with the runsystem and rc scripts. In fact, it roughly does what the former /hurd/init did, modulo all the very early bootstrapping stuff and the startup protocol. It is started when all the essential servers are up and running, so it can make use of most of the POSIX goodies, making its implementation much simpler. * Makefile (prog-subdirs): Add init. * daemons/runsystem.sh: Generalize runsystem so that it can start any init as specified on the kernel command line. By default, it starts /hurd/init. * daemons/runsystem.hurd: This is a verbatim copy of runsystem.sh. It is started by /hurd/init. * daemons/rc.sh: Do not start /hurd/mach-defpager as it is already started in runsystem.sh. * daemons/Makefile (SRCS): Add runsystem.hurd. * init/Makefile: New file. * init/init.c: Likewise.
2014-11-21startup: rename /hurd/init to /hurd/startupJustus Winter
This patch series splits /hurd/init into two programs. As a first step, this patch renames /hurd/init to /hurd/startup. It is called startup because it speaks the startup protocol. * startup: Rename init to startup. Adjust accordingly. * Makefile (prog-subdirs): Likewise. * doc/hurd.texi (Server Bootstrap): Likewise. * hurd/paths.h (_HURD_STARTUP): Likewise. * libdiskfs/boot-start.c (diskfs_boot_init_program): Likewise. * libdiskfs/opts-std-startup.c (startup_options): Likewise.
2014-11-21procfs: do not hard-code the default argument valuesJustus Winter
* procfs/main.c (common_options): If possible, do not hard-code the default values.
2014-11-21Add proc_set_init_task, make runsystem pid 1Justus Winter
* hurd/process.defs (proc_set_init_task): New procedure. * hurd/process_reply.defs (proc_set_init_task): Likewise. * hurd/process_request.defs (proc_set_init_task): Likewise. * include/pids.h: Add HURD_PID_INIT as 1, adjust others accordingly. * init/init.c (start_child): Register the child task. * proc/proc.h (init_proc): New variable. (create_startup_proc): Rename to create_init_proc. * proc/main.c (main): Create placeholder proc object for pid 1. * proc/mgt.c: Use init_proc instead of startup_proc, as the former is the new root of the process tree. (create_startup_proc): Rename to create_init_proc. (S_proc_set_init_task): New function. * doc/hurd.texi (Server Bootstrap): Update accordingly. * procfs/main.c: Do not hard-code kernel pid, use pids.h instead.
2014-11-21trans/mtab: avoid firmlink loopsJustus Winter
* trans/mtab.c (struct mtab): Add a hash table to keep track of seen ports. (mtab_mark_as_seen): New function that records the identity port of a given node in the hash table and reports whether it has been there before. (mtab_populate): Use the new function to avoid running in circles. (main, open_hook): Initialize hash table. (close_hook): Free ports and destroy hash table.
2014-11-21Always canonicalize fstab entries with realpathSamuel Thibault
To avoid spurious ./, /, symlinks, etc. * sutils/fstab.c (fs_set_mntent): Try to call realpath on mnt_fsname and mnt_dir field of `mntent'. (fstab_find_mount): Try to call realpath on `name' parameter. (fstab_find): Do not try to call realpath. (fstab_read): Reset errno to zero before calling getmntent. * utils/umount.c (main): Do not warn about missing fstab entries for active translators.
2014-11-21Fix compiler warningSamuel Thibault
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Initialize register_translator to 0, otherwise it may be used uninitialized in case of non-ENOENT errors.
2014-11-21Fix recording complete path of passive relative translatorsSamuel Thibault
* libnetfs/dir-lookup.c (netfs_S_dir_lookup): Prepend current path to the relative path before recording the active translator.
2014-11-21Fix recording complete path of passive relative translatorsSamuel Thibault
* libdiskfs/dir-lookup.c (diskfs_S_dir_lookup): Prepend current path to the relative path before recording the active translator.
2014-11-21Let pty readers always read end of writer outputSamuel Thibault
* term/ptyio.c (pty_io_read): Do not return EIO when there is no writer any more but some output remains in the pipe.
2014-11-12utils/rpctrace: fix crash while printing messagesJustus Winter
% fakeroot rpctrace install [...] 63<--66(pid5363)->io_read (-1 8192) = 0 [... rpctrace crashes] /bin/fakeauth: Segmentation fault for child 5362 /bin/settrans: Error 139 for child 5361 * utils/rpctrace.c (print_data): Fix this by guarding the code escaping non-printable characters introduced in 84932431 against `data' being NULL.
2014-11-11Make procfs appear in /proc/mountsSamuel Thibault
d-i needs to be able to check whether /proc is mounted or not. * procfs/main.c (netfs_get_source): New function.
2014-11-10Fix mach-defpager's kalloc valuesSamuel Thibault
* mach-defpager/kalloc.c (MINSIZE): Set to sizeof(vm_offset_t) instead of hardcoded 4. (kalloc_init): Set kalloc_max to MINSIZE << (KLIST_MAX-1) instead of hardcoded 16384. (kalloc, kfree): Use the cache for the maximum size too.
2014-11-10Avoid hitting VM_MAX_ADDRESSSamuel Thibault
* libpager/pager-memcpy.c (pager_memcpy): Reset address passed to vm_map on each loop, to avoid potentially monotonically increasing up to VM_MAX_ADDRESS.
2014-11-09Deal with odd kernel behaviorSamuel Thibault
Some versions of gnumach actually take address as a mapping hint, and would fail if the hint is bogus. Make sure to pass 0 for those versions. * libstore/memobj.c (memobj_read): Make sure to set *buf to 0 before calling vm_map.
2014-11-09Deal with odd kernel behaviorSamuel Thibault
Some versions of gnumach actually take address as a mapping hint, and would fail if the hint is bogus. Make sure to pass 0 for those versions. * console/pager.c (user_pager_create): Make sure to set *user to 0 before calling vm_map. * libdiskfs/disk-pager.c (diskfs_start_disk_pager): Make sure to set *image to 0 before calling vm_map. * libpager/pager-memcpy.c (pager_memcpy): Set window to 0 before calling vm_map. * tmpfs/node.c (diskfs_get_filemap): Make sure to set np->dn->u.reg.memref to 0 before calling vm_map.
2014-11-03libpager: use a fixed number of threadsJustus Winter
Previously, libpager used an unbounded number of threads to receive messages from the pager bucket. It used sequence barriers to execute the requests to order requests to each object. The sequence barriers are implemented in seqnos.c. A server function uses _pager_wait_for_seqno to wait for its sequence number and _pager_release_seqno to release it, or it uses _pager_update_seqno to do both operations in one step. These sequence barriers divide each server function in three parts: A, B, and C. A_i happens "before" the sequence barrier i, B_i happens "in order", C_i happens "after" the sequence barrier. This partial order < has the following properties: * This order is *per object*. Requests to different objects are not ordered. * A_i < B_i, B_i < C_i (due to the structure of the code) * B_i < B_{i+1} (this is due to the sequence barriers) * Note that only the B parts are ordered by the sequence numbers, we are free to execute C_i and C_{i+1} in any possible order. The same argument applies to the A parts. The sequence barriers are implemented using a very simple ticket algorithm. Every request, even the invalid ones, is processed by a thread, and waits until the ticket count reaches its seqno, does some work in-order, then increments the ticket and awakes all threads that have piled up up to this moment. All of them except one will then discover that it's not their turn yet and go to sleep again. Creating one thread per request has proven to be problematic as memory_object requests often arrive in large batches. This patch does two things: * Use a single thread to receive messages from the port bucket. All incoming request are put into a queue. * Use a fixed-number of threads (though even one is actually enough) to execute the the server functions. If multiple threads are used, a work-delegation mechanism ensures that the per object order < is preserved. For reference, I used the following command to create workloads that highlight the problem this patch is addressing: % settrans t .../ext2fs --sync=30 /dev/sd2s1 ... % /usr/bin/time zsh -c 'for ((i=0; i < 1500; i++)); do dd if=/dev/zero of=t/src/$i bs=4k count=290 2>/dev/null echo -n . if ((i % 100 == 0)) ; then echo -n $i; fi done' * libpager/queue.h: New file. * libpager/demuxer.c: Manage a queue of requests received from the port bucket. (pager_demuxer): Just decode the server function and enqueue the request. (worker_func): New function that consumes and executes the requests from the queue. (service_paging_requests): New function. (pager_start_workers): Likewise. * libpager/data-request.c: Remove the seqno barriers. * libpager/data-return.c: Likewise. * libpager/data-unlock.c: Likewise. * libpager/chg-compl.c: Likewise. * libpager/lock-completed.c: Likewise. * libpager/no-senders.c: Likewise. * libpager/notify-stubs.c: Likewise. * libpager/object-init.c: Likewise. * libpager/object-terminate.c: Likewise. * libpager/seqnos.c: Remove file. * libpager/stubs.c: Likewise. * libpager/pager.h (pager_demuxer): Drop declaration. (pager_start_workers): New declaration. * libpager/priv.h: Remove the _pager_seqno declarations. * libpager/Makefile (SRCS): Drop seqnos.c. * console/pager.c (user_pager_init): Call pager_start_workers. * libdiskfs/disk-pager.c: Likewise. * storeio/pager.c: Likewise. * ext2fs/pager.c (service_paging_requests): Remove function. (create_disk_pager): Start separate file pager using `pager_start_workers'. * fatfs/pager.c (service_paging_requests): Remove function. (create_fat_pager): Start separate file pager using `pager_start_workers'.
2014-11-03mach-defpager: use protected payloads for object lookupsJustus Winter
* mach-defpager/default_pager.c (pager_port_list_insert): Set protected payload. (pager_port_list_delete): Clear protected payload. * mach-defpager/mig-decls.h (begin_using_default_pager_payload): New function. * mach-defpager/mig-mutate.h: Add mutator.
2014-11-03Fix optional definitions in static binariesSamuel Thibault
* libcons/extra-version.c (cons_extra_version): Add weak attribute. * libcons/vcons-add.c (cons_vcons_add): Likewise. * libcons/vcons-remove.c (cons_vcons_remove): Likewise. * libdiskfs/extra-version.c (diskfs_extra_version): Likewise. * libdiskfs/get-source.c (diskfs_get_source): Likewise. * libdiskfs/readonly-changed.c (diskfs_readonly_changed): Likewise. * libdiskfs/sync-default.c (diskfs_default_sync_interval): Likewise. * libdiskfs/validate-author.c (diskfs_validate_author_change): Likewise. * libdiskfs/validate-flags.c (diskfs_validate_flags_change): Likewise. * libdiskfs/validate-group.c (diskfs_validate_group_change): Likewise. * libdiskfs/validate-mode.c (diskfs_validate_mode_change): Likewise. * libdiskfs/validate-owner.c (diskfs_validate_owner_change): Likewise. * libdiskfs/validate-rdev.c (diskfs_validate_rdev_change): Likewise. * libnetfs/file-get-storage-info-default.c (netfs_file_get_storage_info): Likewise. * libnetfs/get-source.c (netfs_get_source): Likewise. * libnetfs/set-get-trans.c (netfs_set_translator, netfs_get_translator): Likewise. * libtrivfs/get-source.c (trivfs_get_source): Likewise.
2014-11-03Use a mere weak attribute instead of a weak aliasSamuel Thibault
We don't need to call the original function, so a weak attribute is enough. * libports/dead-name.c (ports_dead_name): Remove weak alias. (__ports_dead_name): Rename back to ports_dead_name, but add weak attribute.
2014-11-02Fix dead name notification in static binariesSamuel Thibault
When linking statically, the libports definition would come before the libdiskfs definition, defeating the purpose of the ports_dead_name callback. * libports/dead-name.c (ports_dead_name): Rename into __ports_dead_name. (ports_dead_name): Add weak alias for __ports_dead_name.
2014-11-02Fix unlocking translator listSamuel Thibault
* libfshelp/translator-list.c (fshelp_set_active_translator): Use common out path to unlock translator_ihash_lock before exitting on error.
2014-11-02Fix actual procinfo_t typeSamuel Thibault
* exec/elfcore.c (dump_core): Use procinfo_t, which is already a pointer, instead of procinfo_t*.
2014-11-02Fix proc_getprocinfo callsSamuel Thibault
The deallocation also needs to be fixed. Also, fetch_procinfo already took care of the conversion. * exec/elfcore.c (dump_core): Fix procinfoCnt taken from proc_getprocinfo. * utils/login.c (check_owned): Likewise. * libps/procstat.c (merge_procinfo): Remove conversion between bytes and int, already handled by fetch_procinfo.
2014-11-02Fix proc_getprocinfo callsSamuel Thibault
The procinfoCnt argument is the number of elements of the procinfo_t array, not its size in bytes. * exec/elfcore.c (dump_core): Fix procinfoCnt given to proc_getprocinfo. * libps/procstat.c (merge_procinfo): Likewise. * utils/login.c (check_owned): Likewise.
2014-10-31pfinet: fix path in commentJustus Winter
* pfinet/main.c: Fix path in comment.
2014-10-05libports: lock-less reference counting for port_info objectsJustus Winter
* libports/ports.h (struct port_info): Use the new type. * libports/lookup-port.c: No need to lock _ports_lock anymore. * libports/bucket-iterate.c: Likewise. * libports/complete-deallocate.c: Check if someone reacquired a reference through a hash table lookup. * libports/create-internal.c: Use the new reference counting primitives. * libports/get-right.c: Likewise. * libports/import-port.c: Likewise. * libports/port-deref-weak.c: Likewise. * libports/port-deref.c: Likewise. * libports/port-ref-weak.c: Likewise. * libports/port-ref.c: Likewise. * libports/reallocate-from-external.c: Likewise. * libports/transfer-right.c: Likewise. * utils/rpctrace.c: Likewise.
2014-10-05utils/mount: add mount options to create firmlinks.Gabriele Giacone
* utils/mount.c (parse_opt): Add -B/--bind/--firmlink/-o bind mount options. (do_mount): Do not pass bind mount option to settrans, set firmlink fstype. (main): Likewise.
2014-10-04utils/umount: clean upGabriele Giacone
According to f2640263468aced5c91ac5fc1f15bb5691f7eb20, passive translators are no longer removed. * utils/umount.c (do_umount) Remove -p option from verbose message. (passive_flags): Remove.
2014-09-29libdiskfs: remove code counting cache missesJustus Winter
* libdiskfs/lookup.c (cache_misses): Remove. (cm_lock): Likewise. (diskfs_lookup): Do not count cache misses.
2014-09-29libports: use a global hash table for the lookupsJustus Winter
Previously, libports used a hash table per port bucket. This makes looking up a port difficult if one does not know the port bucket, as one has to iterate over all buckets and do a hash table lookup each. Having to iterate over the buckets makes it necessary to keep a list of all buckets, which has to be updated and protected by a lock as well. Also, the current code in _ports_bucket_class_iterate iterates over the hash table associated with the bucket given. When ports_class_iterate calls this common function, it obtains a reference to the bucket from one of the ports in the given class. This will not work if a class contains ports in different port buckets. This limitation is not documented as far as I can see. Again, having to maintain this list has its cost and requires serialization. Use a global hash table for lookups instead. Keep the per-bucket hash tables for efficient iteration over buckets. Furthermore, serialize access to all hash tables using a separate lock. Remove the linked lists of all buckets and all ports in a class. * libports/bucket-iterate.c (ports_bucket_iterate): Acquire _ports_htable_lock. Also, generalize ports_bucket_iterate so that it takes a pointer to a hash table as first argument. (ports_bucket_iterate): Ajust call to former function accordingly. * libports/class-iterate.c (ports_class_iterate): Just call the generalized _ports_bucket_class_iterate with the global hash table as argument. * libports/ports.h (struct port_info): Remove the port class links. (struct port_bucket): Remove the hash table, and the all buckets link. (_ports_all_buckets): Remove declaration. (_ports_htable): New global hash table. (_ports_htable_lock): Protected by this lock. * libports/claim-right.c: Adjust accordingly. * libports/complete-deallocate.c: Likewise. * libports/create-bucket.c: Likewise. * libports/create-class.c: Likewise. * libports/create-internal.c: Likewise. * libports/destroy-right.c: Likewise. * libports/import-port.c: Likewise. * libports/lookup-port.c: Likewise. * libports/reallocate-from-external.c: Likewise. * libports/reallocate-port.c: Likewise. * libports/transfer-right.c: Likewise. * libports/inhibit-all-rpcs.c: Iterate over the hash table. * libports/inhibit-bucket-rpcs.c: Likewise, but filter using bucket. * libports/inhibit-class-rpcs.c: Likewise, but filter using class. * libports/init.c (_ports_htable): Initialize. (_ports_htable_lock): Likewise.
2014-09-29procfs: reorganize rootdir.cJustus Winter
* procfs/rootdir.c: Move the translator linkage code to the appropriate location.
2014-09-29procfs: generalize the translator linkage codeJustus Winter
Generalize the translator linkage code previously introduced for the `mounts' node. * procfs/rootdir.c (struct procfs_translated_node_ops): New specialized node operations structure for translated nodes. (rootdir_mounts_make_node): Generalize and rename to rootdir_make_translated_node. Also, pass the entry_hook to procfs_make_node so that... (rootdir_mounts_get_translator): ... can be generalized to rootdir_translated_node_get_translator and read the argz vector from the hooked structure. (ROOTDIR_DEFINE_TRANSLATED_NODE): New convenience macro to define translated nodes. (rootdir_entries): Use the new code for the `mounts' node.
2014-09-29procfs: do not test whether /hurd/mtab existsJustus Winter
Now that procfs is merged into the Hurd repository we can just assume that the mtab translator exists. * procfs/rootdir.c (rootdir_mounts_exists): Drop function. (rootdir_entries): Adjust accordingly.
2014-09-29procfs: implement /proc/filesystemsJustus Winter
* procfs/rootdir.c (rootdir_gc_filesystems): New function. (rootdir_entries): Use the new function to implement /proc/filesystems.
2014-09-29procfs: implement /proc/N/mapsJustus Winter
Fixes https://savannah.gnu.org/bugs/?32770 . * procfs/process.c (process_file_gc_maps): New function. (entries): Use the new function to implement /proc/N/maps.
2014-09-29exec: redzone page zero before loading anythingJustus Winter
This prevents load_section from mapping any sections to page zero. * exec/exec.c (do_exec): Redzone page zero before loading anything.
2014-09-29exec: add proper argument parsing, add --device-master-portJustus Winter
If the device master port is given, a boot-time exec server can print diagnostic messages earlier. * exec/main.c (opt_device_master): New variable. (OPT_DEVICE_MASTER_PORT): New macro. (options): New set of options. (parse_opt): New function. (trivfs_append_args): Likewise. (argp): Pull the argp definition out of main. (trivfs_runtime_argp): Set, so that we respond properly to fsysopts. (open_console): Pull the code out of S_exec_init and generalize it. (main): Call open_console if a device master port is given. (S_exec_init): Call open_console.
2014-09-28BSD apps want sin_zero cleared in sys_getname.Alexey Kuznetsov
Cherry-picked from Linux c1e9dcb37795b08a1f50b8de7b2ad5efcb15728f * pfinet/linux-src/net/ipv4/af_inet.c (inet_getname): Clear `sin_zero' part of `sin'.
2014-09-24Update NEWS fileJustus Winter
2014-09-22hurd: add symbolic name for the mtab translatorJustus Winter
* hurd/paths.h (_HURD_MTAB): New macro. * procfs/rootdir.c (rootdir_mounts_get_translator): Use the new macro. (rootdir_mounts_exists): Likewise.
2014-09-18procfs: fix typo in commentJustus Winter
* procfs/process.c (process_stat_make_node): Fix typo in comment.
2014-09-05trans/hello{,-mt}: properly escape contents in trivfs_append_argsJustus Winter
Fixes https://savannah.gnu.org/bugs/?15806 . * trans/hello-mt.c (trivfs_append_args): Escape contents. * trans/hello.c (trivfs_append_args): Likewise.
2014-09-04hurd: make memory_object parameter polymorphicJustus Winter
Make the memory_object parameter of default_pager_object_create polymorphic. This fixes https://savannah.gnu.org/bugs/?26751 . * hurd/default_pager.defs (default_pager_object_create): Make memory_object parameter polymorphic. * mach-defpager/default_pager.c (S_default_pager_object_create): Adjust accordingly. * trans/proxy-defpager.c (S_default_pager_object_create): Likewise.
2014-09-02libdiskfs: fix /servers/exec lookupJustus Winter
* libdiskfs/boot-start.c (diskfs_start_bootstrap): Pass retry_name to dir_lookup, which is later checked to be the empty string.