summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
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.
2014-08-31include: detect use-after-free errors using the reference countsJustus Winter
* include/refcount.h (refcount_init): There must be at least one reference at initialization time. (refcounts_init): Likewise. (refcount_unsafe_ref): New function retaining the previous functionality of refcount_ref. It is occasionally useful to raise the reference count again after it dropped to zero. (refcounts_unsafe_ref): Likewise. (refcounts_unsafe_weak_ref): Likewise. (refcount_ref): Detect use-after-free errors. (refcounts_ref): Likewise. (refcounts_ref_weak): Likewise. * libtrivfs/protid-clean.c (trivfs_clean_protid): Use refcount_unsafe_ref.
2014-08-31hurd: fix semantic of file_get_childrenJustus Winter
When first introduced as fsys_get_children, it made sense to return the list of children using paths relative to the root of the filesystem that was queried. Making the get_children method part of the fsys protocol was a mistake that has since been corrected in 9366d6b2. Instead of returning paths relative to the root of the translator, return paths relative to the path of the receiving node. This fixes a problem with the mtab translator. Previously, the mtab translator invoked on a target that was not the root directory of a translator would compute invalid paths, e.g.: /hurd/mtab: /any/path/servers/socket/26 No such file or directory * hurd/fs.defs (file_get_children): Update comment. * libfshelp/translator-list.c (fshelp_get_active_translators): Add argument PREFIX. Filter entries not beginning with PREFIX if non-NULL, and omit PREFIX from the returned paths. * libfshelp/fshelp.h (fshelp_get_active_translators): Update comment accordingly. Also clarify that both FILTER and PREFIX can be NULL. * libdiskfs/file-get-children.c (diskfs_S_file_get_children): Update comment, pass prefix to fshelp_get_active_translators. * libnetfs/file-get-children.c (netfs_S_file_get_children): Likewise.
2014-08-31libihash: fix comparison between signed and unsigned integerJustus Winter
* libihash/ihash.h (HURD_IHASH_ITERATE): Fix comparison between signed and unsigned integer expressions.
2014-08-31trans/mtab: use setnullauth to drop privilegesJustus Winter
* trans/mtab.c (main): Use setnullauth to drop privileges.
2014-08-31libtrivfs: fix typoJustus Winter
* libtrivfs/protid-clean.c (trivfs_clean_protid): Fix typo.
2014-08-31libdiskfs: fix reference counting of peropen objectsJustus Winter
Previously, peropen objects were created with a reference count of zero. Therefore, if diskfs_create_protid fails, passing such an object to diskfs_release_peropen would lead to a reference count underflow. * libdiskfs/peropen-make.c (diskfs_peropen_make): Initialize reference count to one. * libdiskfs/protid-make.c (diskfs_start_protid): And consume this reference on success. Update comment. (diskfs_create_protid): Update comment. * libdiskfs/diskfs.h: Update comments. * libdiskfs/io-duplicate.c (diskfs_S_io_duplicate): Adjust reference counting accordingly. * libdiskfs/io-reauthenticate.c (diskfs_S_io_reauthenticate): Likewise. * libdiskfs/io-restrict-auth.c (diskfs_S_io_restrict_auth): Likewise. * doc/hurd.texi (Diskfs Internals): Update accordingly.
2014-08-26Fix ifsock permission checkSamuel Thibault
POSIX requires write access to the socket, not read access, to be able to connect to it. * trans/ifsock.c (S_ifsock_getsockaddr): Test for O_WRITE instead of O_READ.
2014-08-25sutils: add urandom device target to MAKEDEVDavid Michael
* sutils/MAKEDEV.sh (urandom): New target. (std): Add urandom to the standard devices list.
2014-08-23Add missing linefeedSamuel Thibault
* libpager/object-terminate.c (_pager_seqnos_memory_object_terminate): Add missing linefeed in error message.
2014-08-19Make settrans return value returned by chroot commandSvante Signell
* utils/settrans.c (main): In case of chroot_command, get status from waitpid() call, and call error() appropriately.
2014-07-17Make the ncursesw driver of the console client compile properlyMarek Benc
* console-client/Makefile (NCURSESW_SO_SRCS): Move definition to after inclusion of Makeconf.
2014-06-30libpipe: fix spurious calls to pipe_sendRichard Braun
* libpipe/pipe.c (pipe_send): Skip processing if there is nothing to send.
2014-06-28Revert "libpipe: fix calls to pipe_send with no data"Richard Braun
This reverts commit 6f856c62613ffc82bf3572a372d2851638c2fb90. As the comment right above the change says, "this [sending control packets] depends on the fact that we always write a data packet".
2014-06-28libpipe: fix calls to pipe_send with no dataRichard Braun
* libpipe/pipe.c (pipe_send): Check that there actually is any data to send before calling the pipe write operation.
2014-06-23ext2fs: use correct type for block numbersJustus Winter
* ext2fs/dir.c (count_dirents): Use block_t for nb. (diskfs_get_directs): Likewise for blkno, nblks.
2014-06-23libdiskfs: fix deadlockJustus Winter
Previously, libdiskfs would deadlock on contention on renamedirlock due to the lock being taken spuriously. Found using fsstress from the Linux Test Project. * libdiskfs/dir-rename.c (diskfs_S_dir_rename): Remove spurious pthread_mutex_lock.
2014-06-22libdiskfs: expose the ST_NOATIME flagPino Toscano
Expose ST_NOATIME as flag (if available in glibc) if diskfs is set in noatime mode. * libdiskfs/file-statfs.c (diskfs_S_file_statfs): Set ST_NOATIME if _DISKFS_NOATIME is set.
2014-06-18libdiskfs: add permission check to file_chflagsJustus Winter
Only root is allowed to change the high 16 bits. The TODO entry says otherwise, but that must be a mistake. For reference, see the glibc sources, sysdeps/mach/hurd/bits/stat.h. * libdiskfs/file-chflags.c (diskfs_S_file_chflags): Add permission check. * TODO (libdiskfs): Remove entry.
2014-06-18libports: avoid realloc(3) corner caseJustus Winter
If the size argument is 0, realloc may either return NULL, or return a pointer that is only valid for use with free(3). In either case, the memory is freed. So if realloc would return NULL (it does not on GNU), the current code would double free p. Found using the Clang Static Analyzer. * libports/bucket-iterate.c (_ports_bucket_class_iterate): Avoid calling realloc if no ports were matched.
2014-06-18trans/fakeroot: fix error handlingJustus Winter
Found using the Clang Static Analyzer. * trans/fakeroot.c (new_node): Do not leak a pointer to freed memory. Store NULL at *np instead. This fixes a node use-after-free in netfs_S_dir_lookup.
2014-06-18libshouldbeinlibc: fix dead initialization in fmt_named_intervalJustus Winter
Found using the Clang Static Analyzer. * libshouldbeinlibc/timefmt.c (fmt_named_interval): Fix dead initialization.
2014-06-18ftpfs: fix error handling in refresh_dirJustus Winter
Found using the Clang Static Analyzer. * ftpfs/dir.c (refresh_dir): Fix error handling.
2014-06-17Add mach_debug defs rulesDavid Michael
* Makeconf (mach_debug_defs_names,mach_debug_defs): New variables. * Makeconf: Add rule to generate local $(mach_debug_defs) files. * procfs/Makefile: Remove vpath for mach_debug defs.
2014-06-15Add the procfs translator to prog-subdirsJustus Winter
* Makefile (prog-subdirs): Add procfs.
2014-06-15Merge procfs into the Hurd repositoryJustus Winter
2014-06-15Prepare the procfs translator to be merged into the Hurd sourcesJustus Winter
Move the procfs translator to its own subdirectory 'procfs'. This is the last commit to this repository. Development of the procfs translator will continue in the main Hurd repository. * procfs/Makefile: Replace the standalone Makefile with the one from the Debian packaging repository.
2014-06-15Merge branch 'merge-random'Justus Winter
2014-06-15utils/settrans: implement settrans --startJustus Winter
Start the translator specified by the NODE's passive translator record and set it as NODE's active translator. This is the equivalent of doing: % settrans --active /node $(showtrans /node) * utils/settrans.c (argp_option): Add --start. (parse_opt): Handle --start. (main): Retrieve the passive translator record if --start is given.
2014-06-15hurd: fix receiver lookup in termctty_open_terminalJustus Winter
* hurd/hurd_types.h (ctty_t): New type definition. * hurd/term.defs (ctty_t): New type definition. * term/mig-decls.h: New file. * term/mig-mutate.h: Add mutators, includes. * term/term.h: Add include guards. * term/users.c (S_termctty_open_terminal): Fix receiver lookup. * boot/boot.c (S_termctty_open_terminal): Likewise.
2014-06-15term: improve the demuxerJustus 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. * term/main.c (demuxer): Improve the demuxer function.
2014-06-09Add the random translator to prog-subdirsJustus Winter
* Makefile (prog-subdirs): Add random.