aboutsummaryrefslogtreecommitdiff
path: root/trans
Commit message (Collapse)AuthorAgeFilesLines
* Modernize code by removing use of old style definitions.Flavio Cruz2023-04-031-1/+1
| | | | | Also add -Werror=old-style-definition to enforce new code. Message-Id: <ZBZ+8xf7GHy2RT/h@jupiter.tail36e24.ts.net>
* trans: Drop spurious derefSamuel Thibault2023-01-011-4/+1
| | | | That was a remnant of manual port lookup.
* Fix types of read write and readables methodsEtienne Brateau2022-08-2910-29/+29
| | | | Message-Id: <20220829193617.13481-1-etienne.brateau@gmail.com>
* file_exec: Homogeneize adding the gratuitous send rightSamuel Thibault2022-08-231-7/+6
|
* Fix spurious EINTR while exec() within fakerootSamuel Thibault2022-08-231-0/+8
| | | | | | | | | | | | | | | | | | | | | | | The scenario is: - process running inside fakeroot exec()s - fakeroot forwards the exec call - exec starts thrashing the previous process, and notably close its ports - the send port that pointed to fakeroot is thus closed - fakeroot thus receives a no-senders notification - its libports thus interrupts the current RPC on it, i.e. the exec(), because it thinks that the caller is no more, but that was exactly the point of the exec()... - exec tries to interrupt its own RPCs, at best the execution will fail, at worse the process is already thrashed and there's nothing better than burying it for good. The symptom is processes running inside fakeroot seeming randomly crashing with SIGKILL. Making fakeroot keep a send right avoids the no-senders notification, thus the whole interruption (which was meaningless).
* mtab: turn part:x:device:y into /dev/ysxSamuel Thibault2022-02-251-1/+17
| | | | | This is needed when using a rumpdisk-based root disk. Otherwise fsck does not properly detect when it is mounted.
* Fix const warningsSamuel Thibault2022-01-174-17/+17
| | | | | Now that the RPCs have const, this forces us cleaning our const-meant functions.
* Make RPC input array parameters constSamuel Thibault2022-01-1613-50/+50
| | | | | This follows mig's cf4bcc3f1435 ("Also add const qualifiers on server side")
* Fix build warningsSamuel Thibault2022-01-015-9/+9
| | | | No actual behavior change.
* random: export __trivfs_server_nameSamuel Thibault2022-01-012-0/+4
| | | | | Making glibc access trivfs_server_name would violate namespace constraints, so we need to use a out-of-standard name.
* random: try opening time from gnumach before from /dev/timeSamuel Thibault2021-12-311-2/+2
| | | | | | | The system-wide random translator can access time from gnumach, while /dev/time comes from storeio, and its libc initialization (starting from glibc 2.34) uses /dev/random, which was thus bringing an initialization loop.
* random: Add a trivfs_server_nameSamuel Thibault2021-12-301-0/+2
| | | | | | | glibc uses /dev/urandom for getrandom(), and from version 2.34 malloc initialization uses it. We need to be able to know whether we are running the random translator itself, in which case we can't read ourself.
* crash: Fix warningSamuel Thibault2020-11-221-1/+1
| | | | * trans/crash.c (template_make_file_name): Fix format for time_t.
* password: Drop unused -lcryptSamuel Thibault2020-01-011-1/+0
| | | | * trans/Makefile (password-LDLIBS): Remove -lcrypt
* remap translator: remap prefixes instead of complete file namesJoan Lledó2019-12-221-8/+17
| | | | | | | | | * trans/remap.c: * trivfs_S_dir_lookup(): * Match and replace prefixes instead of complete file names. This is needed to remap entire file systems, not only trivial ones. Message-Id: <20191220185911.6448-2-jlledom@mailfence.com>
* Use the data_t type defined in hurd_types.h.Flavio Cruz2019-09-0111-18/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * boot/boot.c: Replace char* with data_t. * console-client/trans.c: Likewise. * exec/exec.c: Likewise. * ext2fs/storeinfo.c: Likewise. * fatfs/inode.c: Likewise. * fatfs/main.c: Likewise. * isofs/inode.c: Likewise. * libdiskfs/boot-start.c: Likewise. * libdiskfs/dir-readdir.c: Likewise. * libdiskfs/file-exec.c: Likewise. * libdiskfs/file-get-fs-opts.c: Likewise. * libdiskfs/file-get-trans.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-set-trans.c: Likewise. * libdiskfs/fsys-forward.c: Likewise. * libdiskfs/fsys-getfile.c: Likewise. * libdiskfs/fsys-options.c: Likewise. * libdiskfs/io-read.c: Likewise. * libdiskfs/io-write.c: Likewise. * libnetfs/dir-readdir.c: Likewise. * libnetfs/file-exec.c: Likewise. * libnetfs/file-get-fs-options.c: Likewise. * libnetfs/file-get-storage-info.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * libnetfs/fsstubs.c: Likewise. * libnetfs/fsys-get-options.c: Likewise. * libnetfs/fsys-set-options.c: Likewise. * libnetfs/fsysstubs.c: Likewise. * libnetfs/io-read.c: Likewise. * libnetfs/io-write.c: Likewise. * libtrivfs/dir-readdir.c: Likewise. * libtrivfs/file-get-fs-options.c: Likewise. * libtrivfs/file-get-storage-info.c: Likewise. * libtrivfs/file-get-trans.c: Likewise. * libtrivfs/file-getfh.c: Likewise. * libtrivfs/file-set-trans.c: Likewise. * libtrivfs/fsys-forward.c: Likewise. * libtrivfs/fsys-get-options.c: Likewise. * libtrivfs/fsys-set-options.c: Likewise. * libtrivfs/fsys-stubs.c: Likewise. * libtrivfs/io-read.c: Likewise. * libtrivfs/io-write.c: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/pfinet-ops.c: Likewise. * pfinet/socket-ops.c: Likewise. * pfinet/tunnel.c: Likewise. * pflocal/io.c: Likewise. * pflocal/pf.c: Likewise. * pflocal/socket.c: Likewise. * proc/info.c: Likewise. * startup/startup.c: Likewise. * storeio/io.c: Likewise. * term/users.c: Likewise. * tmpfs/node.c: Likewise. * trans/crash.c: Likewise. * trans/fakeroot.c: Likewise. * trans/fifo.c: Likewise. * trans/firmlink.c: Likewise. * trans/hello-mt.c: Likewise. * trans/hello.c: Likewise. * trans/mtab.c: Likewise. * trans/new-fifo.c: Likewise. * trans/null.c: Likewise. * trans/proxy-defpager.c: Likewise. * trans/streamio.c: Likewise.
* Fix missing gnu_dev_* prototypesSamuel Thibault2019-07-271-0/+1
| | | | | | | | | | | | * isofs/rr.c: Include <sys/sysmacros.h>. * libdiskfs/file-set-trans.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libnetfs/file-get-translator.c: Likewise. * libnetfs/file-set-translator.c: Likewise. * nfs/nfs.c: Likewise. * nfs/ops.c: Likewise. * storeio/storeio.c: Likewise. * trans/fakeroot.c: Likewise.
* random: Do not require the latest gcrypt version, just use a version known ↵Samuel Thibault2018-11-181-1/+1
| | | | | | | | | to work This helps with dependency management of binary packages. * trans/random.c (pool_initialize): Pass "1.8.0" to gcry_check_version instead of GCRYPT_VERSION.
* Hurd patches (fix compilation)Luca Weiss2018-06-131-1/+1
| | | | | | | | | | | | | | | | | | * isofs/rr.c (rrip_work): Use gnu_dev_makedev instead of makedev. * libdiskfs/file-set-trans.c (diskfs_S_file_set_translator): Likewise. * libnetfs/file-set-translator.c (netfs_S_file_set_translator): Likeiwse. * nfs/nfs.c (xdr_decode_fattr): Likewise. * storeio/storeio.c (parse_opt): Likewise. * libfshelp/fetch-root.c (fshelp_short_circuited_callback1): Use gnu_dev_major and gnu_dev_minor instead of major and minor. * libnetfs/file-get-translator.c (netfs_S_file_get_translator): Likewise. * nfs/ops.c (netfs_attempt_link): Likewise. * storeio/storeio.c (trivfs_append_args): Likewise. * trans/fakeroot.c (netfs_attempt_mkdev): Likewise. * pfinet/glue-include/linux/mm.h: Include <mach/vm_param.h>. * term/users.c: Include <signal.h>
* Add file_utimens RPC to use a struct timespecFlávio Cruz2018-03-051-13/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | and update the servers to use UTIME_NOW and UTIME_OMIT. * console-client/trans.c (netfs_attempt_utimes): Do not set current time ourself. * console/console.c (netfs_attempt_utimes): Likewise. * ftpfs/netfs.c (netfs_attempt_utimes): Likewise. * hostmux/node.c (netfs_attempt_utimes): Likewise. * usermux/node.c (netfs_attempt_utimes): Likewise. * nfs/ops.c (netfs_attempt_utimes): Likewise. * doc/hurd.texi (file_utimens): Add documentation. * hurd/fs.defs (file_utimens): Add RPC. * libdiskfs/file-utimes.c (diskfs_S_file_utimes): Move implementation and replace with translation layer with... (diskfs_S_file_utimens): ... new function. * libnetfs/file-utimes.c (netfs_S_file_utimes): Likewise with... (netfs_S_file_utimens): ... new function. * libnetfs/init-init.c: Include <error.h>. (netfs_mtime): New variable. (netfs_init): New function. * libnetfs/netfs.h (netfs_attempt_utimes): Update documentation. * libnetfs/priv.h (netfs_mtime): Declare variable. * libtreefs/s-file.c (treefs_S_file_utimes): Convert time values and call treefs_s_file_utimens instead of treefs_s_file_utimes. * libtreefs/treefs-hooks.h: Replace TREEFS_HOOK_S_FILE_UTIMES with TREEFS_HOOK_S_FILE_UTIMENS. * libtreefs/treefs-s-hooks.h: Replace s_file_utimes with s_file_utimens. * libtrivfs/file-utimes.c (trivfs_S_file_utimens): New function. * libtrivfs/times.c (trivfs_set_atime): Try to use file_utimens before using file_utimes. (trivfs_set_mtime): Likewise. * nfsd/ops.c (complete_setattr): Likewise. * trans/fakeroot.c (netfs_attempt_utimes): Likewise. * nfs/nfs.c (xdr_encode_sattr_times): Do not set atime or mtime when they are NULL. * configure.ac: Look for file_futimens, and define UTIME_NOW/OMIT, for compatibility with old glibcs.
* Fix warningsSamuel Thibault2018-03-052-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libdiskfs/boot-start.c (diskfs_start_bootstrap): Fix printf format. * libfshelp/delegate.c: Include <alloca.h> and <stdlib.h>. * libfshelp/start-translator-long.c: Include <stdlib.h>. * libshouldbeinlibc/ugids-verify-auth.c (server_verify_make_auth): Fix prototypes for password_check_group and password_check_user. * libstore/argp.c: Include <stdlib.h>. * libstore/task.c: Include <stdlib.h>. * exec/exec.c: Include <mach/vm_param.h>. * libbpf/bpf_impl.c: Include <stdlib.h>. * proc/info.c (S_proc_getloginpids): Remove local variables leader_task and leader_sub. * proc/main.c (main): Remove local variable original_argv. * boot/boot.c (task_died, S_mach_notify_new_task): Fix printf format. * exec/elfcore.c: Include <alloca.h> and <mach/vm_param.h>. * trans/crash.c: Include <hurd/msg.h>. * trans/random.c: Include <signal.h>. * utils/login.c: Include <signal.h>. * utils/id.c: Include <hurd/msg.h>. * utils/devprobe.c: Include <stdlib.h>. * utils/addauth.c: Include <hurd/msg.h>. * utils/frobauth-mod.c: Include <hurd/msg.h>. * utils/storeread.c: Include <stdlib.h>. * utils/msgport.c: Include <hurd/msg.h>. * sutils/clookup.c (file_name_lookup_carefully): Fix lookup function prototype, make head and tail const. * utils/rpcscan.c: Include <stdlib.h>. * sutils/bless.c: Include <stdlib.h>. * fstests/fstests.c: Include <stdlib.h>. * startup/startup.c (argz_task_insert_right): Fix printf format. * init/init.c: Include <stdlib.h>.
* Fix warningSamuel Thibault2018-01-281-1/+1
| | | | | * trans/streamio.c (io_select_common): Do not needlessly check that buffer_writable is not NULL, it is a static inline.
* Fix firmlinks showing up in /proc/mountsSamuel Thibault2018-01-161-0/+8
| | | | | | | mtab checks for fsys_get_options. * trans/firmlink.c: Include <argz.h>. (trivfs_append_args): New function.
* Add a file_exec_file_name RPCEmilio Pozuelo Monfort2018-01-081-23/+74
| | | | | | | | | | | | | | | | | | | | | | * hurd/fs.defs (file_exec): Deprecate in favor of... (file_exec_paths): ...this new RPC. * TODO: Update. * doc/hurd.texi: Update RPC name. * hurd/hurd_types.h: Update RPC name. * libdiskfs/boot-start.c: Update RPC name. * configure.ac: Check for presence of RPC stubs file_exec_paths exec_exec_paths. * exec/hashexec.c (check_hashbang): When file_exec_paths is available, use it instead of file_exec. * startup/startup.c (run, run_for_real, start_child): Likewise. * utils/login.c (main): Likewise. * libfshelp/start-translator-long.c (fshelp_start_translator_long): Likewise. * libdiskfs/file-exec.c (diskfs_S_file_exec): Move code to new function diskfs_S_file_exec_paths and call it. (diskfs_S_file_exec_paths): New function, use exec_exec_paths when available instead of exec_exec * libnetfs/file-exec.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * trans/fakeroot.c (netfs_S_file_exec, netfs_S_file_exec_paths): Likewise. * libtrivfs/file-exec.c (trivfs_S_file_exec_paths): New function.
* Traverse translator hierarchies using the fsys protocol.Justus Winter2017-09-122-139/+88
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, we used the fs protocol to traverse the translator hierarchies. This, however, is conceptually flawed, because translators are bound to nodes, and a node can have zero or more links in the file system. Therefore, the previous method of returning a list of paths to the client and expecting them to be able to follow these to reach the child translators was always unreliable. Fix this by using the fsys protocol to traverse the hierarchy, and returning the control ports of all children. This is more robust, and also conceptually cleaner, because the fsys protocol is about translator linkage, hence this is the point to implement traversal. Also move the get source routine over. A per-node source really does not fit the reality of most translators, while a per-translator source makes sense in many cases. * hurd/fs.defs (file_get_children): Drop routine. (file_get_source): Likewise. * hurd/fsys.defs (fsys_get_children): New routine. (fsys_get_source): Likewise. * libdiskfs/Makefile (FSYSSRCS): Remove files, add files. * libdiskfs/file-get-children.c: Remove file. * libdiskfs/fsys-get-children.c: New file. * libdiskfs/file-get-source.c: Remove file. * libdiskfs/fsys-get-source.c: New file. * libfshelp/fshelp.h (fshelp_filter): Remove type. (fshelp_get_active_translators): Remove filter and prefix argument, return list of control ports. * libfshelp/translator-list.c (fshelp_get_active_translators): Likewise. * libnetfs/Makefile (FSSRCS): Move 'get-source.c' too OTHERSRCS. (FSYSSRCS): Remove files, add files. * libnetfs/file-get-children.c: Remove file. * libnetfs/fsys-get-children.c: New file. * libnetfs/file-get-source.c: Remove file. * libnetfs/fsys-get-source.c: New file. * libtrivfs/Makefile: Move 'get-source.c' too OTHERSRCS. (FSYSSRCS): Remove files, add files. * libtrivfs/file-get-children.c: Remove file. * libtrivfs/fsys-get-children.c: New file. * libtrivfs/file-get-source.c: Remove file. * libtrivfs/fsys-get-source.c: Add file. * trans/Makefile (mtab): Build client stubs until the libc has caught on. * trans/mtab.c (target_control): New variable. (insecure): Drop variable. (all_translators): Likewise. (MAX_DEPTH): New macro. (max_depth): New variable. (options): Remove '--insecure' and '--all-translators', add '--depth'. (parse_opt): Adapt accordingly. (trivsfs_append_args): Likewise. (main): Get the control port of the target translator, then drop privileges. (is_filesystem_translator): Remove function. (mtab_mark_as_seen): Simplify. Just check if the control port is known. (mtab_populate): Limit depth of recursion, adapt to traversing over the control ports, simplify. (open_hook): Remove scary comment, it is not applicable anymore because we no longer dir_lookup child translators.
* Remove unused parameter from the 'get_source' machinery.Justus Winter2017-09-011-2/+1
| | | | | | | | | | | | | | | | | | | | | * libdiskfs/diskfs.h (diskfs_get_source): Remove first parameter. * libdiskfs/file-get-source.c (diskfs_S_file_get_source): Adapt callsite. * libdiskfs/get-source.c (diskfs_get_source): Adapt default implementation. * libnetfs/netfs.h (netfs_get_source): Remove first parameter. * libnetfs/file-get-source.c (netfs_S_file_get_source): Adapt callsite. * libnetfs/get-source.c (netfs_get_source): Adapt default implementation. * libtrivfs/trivfs.h (trivfs_get_source): Remove first parameter. * libtrivfs/file-get-source.c (trivfs_S_file_get_source): Adapt callsite. * libtrivfs/get-source.c (trivfs_get_source): Adapt default implementation. * nfs/main.c (netfs_get_source): Adapt implementation. * procfs/main.c (netfs_get_source): Likewise. * trans/firmlink.c (trivfs_get_source): Likewise.
* trans/mtab: Fix warnings.Justus Winter2017-09-011-16/+20
| | | | | | * trans/mtab.c (get_credentials): Fix error handling. (mtab_populate): Fix type. (trivfs_S_io_seek): Avoid implicit fallthrough warnings.
* trans/symlink: Use default server stubs.Justus Winter2017-08-252-59/+1
| | | | | * trans/Makefile (fsysServer-CFLAGS): Use default server stubs. * trans/symlink.c: Remove all the fsys stubs.
* Use our own variant of 'assert' and 'assert_perror'.Justus Winter2017-08-057-31/+31
| | | | | Our variants print stack traces on failures. This will make locating errors much easier.
* Fix harmless indentation errors tripping [-Wmisleading-indentation].Justus Winter2017-08-051-1/+1
| | | | | * trans/new-fifo.c (main): Fix indentation. * utils/rpctrace.c (discover_receive_right): Likewise.
* trans/fakeroot: Obey O_NOFOLLOW.Justus Winter2017-06-201-1/+59
| | | | | * trans/fakeroot.c (netfs_S_dir_lookup): Do not follow symlinks if the client used O_NOFOLLOW.
* trans: Fix parallel build race around MIG-generated headersDavid Michael2017-06-101-0/+1
| | | | | | | This causes random.d to be generated which makes random.o depend on mach_debug_U.h, ensuring it exists before random.c is compiled. * trans/Makefile: Add random.c to SRCS when gcrypt is used.
* trans: Conditionally build the random translator.Justus Winter2017-06-041-4/+13
| | | | | | | | | | | | Only build the random translator if we find a suitable version of libgcrypt. This helps to reduce the build dependencies to bootstrap the Hurd. * aclocal.m4: Include 'libgcrypt.m4'. * config.make.in (HAVE_LIBGCRYPT): New variable. * configure.ac: Check for a suitable libgcrypt. * m4/libgcrypt.m4: New file. * trans/Makefile: Conditionally build the random translator.
* trans: New random translator.Justus Winter2017-06-032-3/+730
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, the Hurd included a translator providing /dev/random and /dev/urandom based on a source copy of the random number generator found in classic GnuPG. The new random translator is using the SHAKE128 algorithm from the SHA-3 family as the underlying cryptographic primitive. Being a sponge construction, it allows the extraction of arbitrary amounts of pseudorandom data. It is continuously fed entropy by hashing system state that is hard to predict. * Makefile (prog-subdirs): Remove 'random'. * NEWS: Update. * random/Makefile: Delete file. * random/TODO: Likewise. * random/gnupg-bithelp.h: Likewise. * random/gnupg-glue.h: Likewise. * random/gnupg-random.c: Likewise. * random/gnupg-random.h: Likewise. * random/gnupg-rmd.h: Likewise. * random/gnupg-rmd160.c: Likewise. * random/random.h: Likewise. * sutils/MAKEDEV.sh (random): Create node. (urandom): The new translator is both secure and non-blocking. Create a link from urandom to random for compatibility with Linux. * trans/Makefile (targets): Add 'random'. * trans/random.c: Move the skeleton of the old random translator here, but replace the PRNG with SHAKE128. Remove all dubious attempts of accounting for entropy. Do not block ever.
* trans/crash: Fix setting core file template at runtime.Justus Winter2016-10-051-1/+21
| | | | | | | * trans/crash.c (corefile_template_lock): New variable. (S_crash_dump_task): Serialize access to 'corefile_template'. (parse_opt): Likewise. Also strdup the template. (trivfs_append_args): Serialize access to 'corefile_template'.
* trans/crash: Use empty core file templates to disable the feature.Justus Winter2016-10-051-1/+4
| | | | | * trans/crash.c (parse_opt): Use empty core file templates to disable the feature.
* Avoid fatal error handling in option parsers.Justus Winter2016-10-052-2/+9
| | | | | | | * trans/crash.c (parse_opt): Avoid 'error' in favor of the appropriate argp error reporting mechanism. * trans/remap.c (parse_opt): Likewise. * utils/msgids.c (parse_opt): Likewise.
* typoSamuel Thibault2016-08-281-1/+1
|
* remap: Refuse non-absolute pathsSamuel Thibault2016-08-281-0/+3
| | | | * trans/remap.c (parse_opt): Error out if some path is not absolute.
* trans/crash: core file name templatesJustus Winter2016-08-091-2/+164
| | | | | | | | | | | | | | | | | | | Add an option to specify a template used to construct core file names. This way core files can be collected at a predictable central location. * hurd/crash.defs (crash_dump_task): Return EEXIST if the core file has been written elsewhere. * trans/crash.c (corefile_template): New variable. (template_valid): New function. (template_make_file_name): Likewise. (S_crash_dump_task): Use the template to construct a name, open the file, and write the core dump there instead of the handle provided by the caller. (argp_option): New option. (doc): Document the format. (parse_opt): Handle new option (trivfs_append_args): Likewise.
* trans/crash: fix blunderJustus Winter2016-06-071-1/+1
| | | | * trans/crash.c (S_crash_dump_task): Fix error handling.
* Do not make io_select return errors on unsupported READ/WRITE modeSamuel Thibault2016-06-045-21/+5
| | | | | | | | | | | | | | The descriptor is valid, it is just the mode which is not available. * console-client/kbd-repeat.c (repeater_select): Drop SELECT_URG flag from `type'. Return 0 instead of EINVAL if `type' contains SELECT_WRITE. * console-client/pc-mouse (repeater_select): Likewise. * trans/mtab.c (trivfs_S_io_select): Return 0 instead of EBADF when the openmodes do not match the requested modes in `type'. * trans/new-fifo.c (io_select_common): Likewise. * trans/fifo.c (io_select_common): Likewise. * trans/null.c (trivfs_S_io_select): Likewise. * trans/streamio.c (io_select_common): Likewise.
* trans/crash: fix resource leaksJustus Winter2016-06-041-6/+11
| | | | | | | | | | | | Previously, 'task', 'core_file', and 'ctty_id' were not deallocated if crash was configured to write core files, and 'ctty_id' was leaked if the crashing task was suspended. This lead to resources not being released in the kernel, the filesystem, and the terminal subsystem, and could very well be responsible for making the Debian/Hurd shutdown hang. * trans/crash.c (S_crash_dump_task): Properly deallocate 'task', 'core_file', and 'ctty_id'.
* Fix buildSamuel Thibault2016-05-031-0/+1
| | | | * trans/crash.c: Include <assert.h>.
* Unify and document the way fsids are handled in trivfs translatorsJustus Winter2016-04-282-3/+1
| | | | | | | | * doc/hurd.texi: Clarify what happens if 'trivfs_fsid' is zero. * login/utmp.c: Leave 'trivfs_fsid' at zero. * pfinet/main.c: Likewise. * trans/ifsock.c: Likewise. * trans/proxy-defpager.c: Likewise.
* netfs: Remove global reference count lock.Flavio Cruz2016-03-211-18/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * libnetfs/drop-node.c: Remove use of netfs_node_refcnt_lock. * libnetfs/init-init.c: Remove netfs_node_refcnt_lock. * libnetfs/make-node.c: Initialize refcounts in refcounts_init. * libnetfs/netfs.h: Use refcounts_t for tracking node references. Remove netfs_node_refcnt_lock. Add netfs_nref_light, netfs_nrele_light and handler netfs_try_dropping_softrefs. Adjust comments. * libnetfs/nput.c: Use refcounts_t. Call netfs_try_dropping_softrefs to remove any soft reference that the translator might have acquired during the lifetime of the node. Implement empty netfs_try_dropping_softrefs. * libnetfs/nref.c: Implement netfs_nref_light. * libnetfs/nrele.c: Use refcounts_t and netfs_try_dropping_softrefs. Implement netfs_nrele_light. * ftpfs/dir.c: Use netfs_nref without locking the old netfs_node_refcnt_lock. * ftpfs/node.c: Likewise. * usermux/mux.c: Use netfs_nref to increase hard references of the node. * hostmux/mux.c: Use netfs_nref to increase hard references of the node. * trans/fakeroot.c (new_node): Use a light reference when storing a node in the hash table. * trans/fakeroot.c (netfs_try_dropping_softrefs): Implement netfs_try_dropping_softrefs to remove the node from the hash table. * trans/fakeroot.c (netfs_node_norefs): Remove code to remove the node from the hash table. * trans/fakeroot.c (netfs_S_dir_lookup): Simplify lookup code since we don't need to lock netfs_node_refcnt_lock anymore. * procfs/netfs.c: Remove use of netfs_node_refcnt_lock. * nfs/cache.c: Add mutex to handle exclusive access to nodehash. This replaces the use of netfs_node_refcnt_lock. * nfs/cache.c (lookup_handle): Use nodehash_ihash_lock when accessing nodehash. Use netfs_nref_light to add one soft reference to the node just added to nodehash. * nfs/cache.c (netfs_node_norefs): Use netfs_nref. Don't use netfs_node_refcnt_lock and don't remove the node from nodehash here. * nfs/cache.c (netfs_try_dropping_softrefs): Drop the light reference when the node has no more hard references. * nfs/cache.c (recache_handle): Use nodehash_ihash_lock instead. * nfs/ops.c (netds_attempt_unlink): Use refcounts_references. * console/console.c (netfs_node_norefs): Use a soft reference to store a node in dir_node, cons_node, disp_node, inp_node. * console/console.c (netfs_try_dropping_softrefs): When dropping all soft references remove node pointer from the fields above.
* Add getting swap information from swapon and procfsSamuel Thibault2016-03-161-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | * hurd/default_pager.defs (default_pager_storage_info): New RPC. * hurd/default_pager_reply.defs: Skip default_pager_storage_info RPC. * hurd/default_pager_types.h: Include <mach/machine/vm_types.h>. (vm_size_array_t): New type. * mach-defpager/priv.h (part): Add `name' field. * mach-defpager/default_pager.c (new_partition): Allocate and fill `part->name' field. Free it on error. (destroy_paging_partition): Free `part->name' field. (S_default_pager_storage_info): New function. * procfs/Makefile (SRCS): Add default_pagerUser.c. * procfs/rootdir.c: Include "default_pager_U.h". (rootdir_gc_swaps): New function. (rootdir_entries): Add "swaps" entry. * sutils/swapon.c: Include <argz.h> (show): New variable. (options): Add --show/-S option. (def_pager, dev_master): New variables (swaponoff): Move getting `def_pager' to... (get_def_pager): ... new function. (main): Support 'S' option. * trans/proxy-defpager.c (S_default_pager_storage_info): New function.
* Show firmlink mounts to mount pointsSamuel Thibault2016-03-151-13/+13
| | | | | * trans/mtab.c (mtab_populate): Always open the underlying node, and pass it to mtab_mark_as_seen instead of the translated node.
* Add get_source support to firmlinkSamuel Thibault2016-03-151-0/+8
| | | | * trans/firmlink.c (trivfs_get_source): New function.
* trans/crash: fix suspending taskJustus Winter2016-02-211-1/+1
| | | | * trans/crash.c (S_crash_dump_task): Fix looking up 'user_proc'.