summaryrefslogtreecommitdiff
path: root/utils
AgeCommit message (Collapse)Author
2015-12-30Add missing libraries to fix link errorsFlavio Cruz
This fixes several linking problems I had in my recent cross-compilation of the Hurd. I added missing static libraries and also organized some of the targets for more concise rules. * console-client/Makefile: Add libiohelp.a and libihash.a. * daemons/Makefile: Add libihash.a and libshouldbeinlibc.a. * devnode/Makefile: Add iohelp and ihash to HURDLIBS. * random/Makefile: Likewise. * trans/Makefile: Reorder targets alphabetically and add libiohelp.a and libihash.a. * utils/Makefile: Add libihash.a.
2015-12-29fix compiler warnings in hurd/utilsFlavio Cruz
utils: Fix compiler warnings. * utils/rpcscan.c (setup_extract_target): Remove name variable. * utils/rpcscan.c (setup_extract_target): Fix bad initializer. * utils/rpctrace.c (new_send_wrapper, wrap_all_threads, wrap_new_thread, wrap_new_task, traced_spawn): Fix format strings. * utils/rpctrace.c (trace_and_forward): Cast to unsigned int. * utils/rpctrace.c (trace_and_forward): Use memcmp instead of pointer dereferencing to compare structures. * utils/rpctrace.c (wrap_all_threads): Cast to vm_address_t. * utils/rpctrace.c (main): Fix bad initializer. * utils/shd.c (run): Initialize save0. * utils/vminfo.c: Fix format strings. * utils/vmstat.c: Remove PSEP macro and expand the code. * utils/w.c (add_utmp_procs): Remove unused pos variable.
2015-09-09umount: Do not report errors on making the device go awaySamuel Thibault
This fixes umounting bind mounts or other mounts for which the device can not be made away. * utils/umount.c (do_umount): When the --force option is not passed, ignore errors from file_set_translator call on the device file.
2015-06-30utils/rpcscan: new utilityJustus Winter
* utils/rpcscan.c: New file. * utils/Makefile: Add `rpcscan'.
2015-06-30utils: split-off the message id parsingJustus Winter
* utils/rpctrace.c: Move all the code handling the message id files... * utils/msgids.c: ... to a new file. * utils/msgids.h: And add the relevand declarations. * utils/Makefile (SRCS): Add the new file.
2015-05-23utils/vmstat: fix integer overflowJustus Winter
Previously, the `vmstat' utility would stop displaying the memory object hit ratio after some time due to an integer overflow. * utils/vmstat.c (get_memobj_hit_ratio): Fix integer overflow.
2015-05-23utils/rpctrace: fix build with -O0Justus Winter
* utils/Makefile: Link against `libshouldbeinlibc'.
2015-03-05Fix space styleSamuel Thibault
2015-01-20utils/rpctrace: fix notification port handlingJustus Winter
* utils/rpctrace.c (new_receiver_info): Fix handling of old notification port.
2014-12-10Replace `bzero' with `memset'Justus Winter
For reference, this patch was created using the following semantic patch, and then manually applying the change in all functions containing nested functions, as those are not supported by Coccinelle. @@ expression A, B; @@ - bzero (A, B) + memset (A, 0, B) * auth/auth.c: Replace `bzero' with `memset'. * boot/boot.c: Likewise. * defpager/defpager.c: Likewise. * exec/exec.c: Likewise. Also, drop `safe_bzero' and just use `hurd_safe_memset' directly. * ext2fs/ext2fs.c: Likewise. * ext2fs/getblk.c: Likewise. * ext2fs/pager.c: Likewise. * fatfs/pager.c: Likewise. * ftpfs/dir.c: Likewise. * ftpfs/netfs.c: Likewise. * isofs/inode.c: Likewise. * isofs/pager.c: Likewise. * libdiskfs/file-getfh.c: Likewise. * libdiskfs/file-statfs.c: Likewise. * libfshelp/fetch-root.c: Likewise. * libfshelp/start-translator.c: Likewise. * libftpconn/create.c: Likewise. * libftpconn/open.c: Likewise. * libftpconn/unix.c: Likewise. * libpipe/pipe.c: Likewise. * libps/procstat.c: Likewise. * libps/spec.c: Likewise. * libshouldbeinlibc/cacheq.c: Likewise. * libshouldbeinlibc/idvec.c: Likewise. * libshouldbeinlibc/ugids.c: Likewise. * libstore/argp.c: Likewise. * libstore/enc.c: Likewise. * libstore/kids.c: Likewise. * libthreads/alpha/thread.c: Likewise. * libtreefs/fsys.c: Likewise. * libtrivfs/file-statfs.c: Likewise. * mach-defpager/default_pager.c: Likewise. * pfinet/glue-include/asm/uaccess.h: Likewise. * pfinet/io-ops.c: Likewise. * pfinet/options.c: Likewise. * pfinet/socket.c: Likewise. * pfinet/timer-emul.c: Likewise. * pflocal/io.c: Likewise. * startup/startup.c: Likewise. * storeio/storeio.c: Likewise. * sutils/fstab.c: Likewise. * usermux/usermux.c: Likewise. * utils/fakeauth.c: Likewise. * utils/frobauth.c: Likewise. * utils/login.c: Likewise. * utils/x.c: Likewise.
2014-12-07utils/rpctrace: make `trace_and_forward' payload-awareJustus Winter
As the protected payloads were retrofitted into the Mach message format, the local port type is lost. * utils/rpctrace.c (is_notification): New function (trace_and_forward): Recover the original local port type.
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-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-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-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-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-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-04-22Merge branch 'master' of git.savannah.gnu.org:/srv/git/hurd/hurdSamuel Thibault
2014-04-22Add TODO about fork() making rpctrace emit an errorSamuel Thibault
* utils/rpctrace.c (rewrite_right): Explain why the unknown send right error happens on fork().
2014-04-22build: Remove configure check for libcrypt.Ludovic Courtès
GNU libc has provided the 'crypt' function in libcrypt for a long time, making this check unnecessary. * configure.ac: Remove libcrypt check and 'LIBCRYPT' substitution. * config.make.in (LIBCRYPT): Remove. * trans/Makefile (password-LDLIBS): Change $(LIBCRYPT) to -lcrypt. * utils/Makefile (login-LDLIBS, addauth-LDLIBS, setauth-LDLIBS): Likewise.
2014-03-01auth: improve the mig mutator functionsJustus Winter
Previously, the mig mutator function auth_port_to_handle was defined in auth.c (fakeauth.c), preventing it from being inlined into the mig-generated server functions. Put it in mig-decls.h instead. Rename authmutations.h to mig-mutate.h, auth_mig.h to mig-decls.h. This is the naming convention used for pflocal. * auth/auth.h: New file. * auth/auth_mig.h: Rename to mig-decls.h, add copyright notice, define mutator functions. * auth/authmutations.h: Rename to mig-mutate.h, restore copyright notice, adjust accordingly. * auth/auth.c: Include auth.h, remove auth_port_to_handle. * utils/fakeauth.c: Likewise. * auth/Makefile: Adjust accordingly. * utils/Makefile: Likewise.
2014-02-25utils/umount: do not remove passive translator recordsJustus Winter
Passive translator records are a Hurd concept. Therefore, the umount compatibility program should not remove them. * utils/umount.c (passive_flags): Unset FS_TRANS_SET. (doc): Adjust accordingly.
2014-02-25Fix fakeroot and remap parsing corner casesSamuel Thibault
Fix case when $PWD contains spaces. Pass directly arguments to command, to directly avoid escaping issues. Based on suggestion by Ivan Shmakov <oneingray@gmail.com> * utils/fakeroot.sh (TARGET): Do not define. (sh): Rather pass PWD and commandline as parameters. * utils/remap.sh: Likewise.
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.
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-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-04utils: improve the auth_demuxer function in fakeauth.cJustus 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. The reply message has already been properly initialized in libports, so there is no need to call mig_reply_setup. * utils/fakeauth.c (auth_demuxer): Improve the demuxer function.
2013-11-21utils: fix dead initializationJustus Winter
Found using the Clang Static Analyzer. * utils/frobauth.c (posix_parse_opt): Fix dead initialization. (no_ugids_parse_opt): Likewise.
2013-11-10utils: implement portinfo --searchJustus Winter
Implement the --search switch of portinfo. The feature was suggested in the source code and partly implemented. portinfo --search locates the target ports (or all ports) in any other process and prints the port mapping and information about the port in the remote process. * utils/Makefile: Link portinfo against libps. * utils/portinfo.c (options): Enable --search option. (search_for_port): New function. (search_for_ports): Likewise. (main): Call search_for_port{,s} as appropiate.
2013-11-09utils: implement settrans --pid-fileJustus Winter
This switch makes settrans write the pid file of the active translator it starts to a file. This makes the pid easily retrievable for test suites. * utils/settrans.c (options): Add --pid-file. (main): Add variable pid_file. (parse_opt): Handle --pid-file switch. (open_node): Write pid file.
2013-09-21Fix spurious port deallocationSamuel Thibault
* utils/storeinfo.c (parse_opt): Do not deallocate `file` port, `store_free` does it already.
2013-09-21Fix sscanf format for c99Samuel Thibault
* utils/rpctrace.c (parse_msgid_list): Use %ms instead of %as in sscanf format.
2013-09-16Add match-options to utils sourcesJustus Winter
* utils/Makefile (SRCS): Add match-options.c
2013-09-10Fix variable namesSamuel Thibault
* utils/Makefile (mount-LDLIBS): Define to libblkid_LIBS instead of libblkid-LIBS (mount-CPPFLAGS): Likewise.
2013-09-09mount: handle -t autoJustus Winter
Use libblkid to detect the filesystem type if "auto" is given as type. Remove the translator localization from main, this is also done in do_mount and any errors are propagated properly. This way "auto" is handled correctly if given on the command line or used as filesystem type in the fstab. * configure.ac: Add check for libblkid. * config.make.in: Make libblkid specific values available. * utils/Makefile: Use libblkid specific values. * utils/mount.c (DEFAULT_FSTYPE): Use "auto" as default type. (do_mount): Detect type using libblkid. (main): Drop translator localization.
2013-08-29Fix buildSamuel Thibault
* utils/umount.c: Do not include useless <blkid/blkid.h>.
2013-08-29Merge branch 'master-merge'Samuel Thibault
2013-08-29umount: add a umount utilityJustus Winter
This adds a umount utility that implements most of the functions that the Linux umount utility provides, especially that subset that is used by the Debian package initscripts. * utils/umount.c: New file.
2013-08-28utils: add nullauth utilityJustus Winter
nullauth drops all authentication credentials and runs the given program. This is also useful to drop privileges on behalf of translators that do not need any credentials in some circumstances, e.g. % settrans -ap /hurd/nullauth -- /hurd/storeio -Tzero makes storeio run without any credentials. * utils/nullauth.c: New file. * utils/Makefile: Build nullauth.
2013-08-28umount: add a umount utilityJustus Winter
This adds a umount utility that implements most of the functions that the Linux umount utility provides, especially that subset that is used by the Debian package initscripts. * utils/umount.c: New file.
2013-08-28mount: ignore mounted filesystems if --all is givenJustus Winter
Linux' mount utility ignores mounted filesystems if mount --all is invoked. This patch makes our mount do the same. utils/mount.c (main): Ignore mounted filesystems if --all is given.
2013-08-28mount: implement -O, --test-optsJustus Winter
--test-opts in combination with --all mounts only those filesystems with options matching the given set of options. Note that the semantic of the inverting "no" prefix differs from --types: While --types=nonfs,ufs means neither nfs nor ufs, --test-opts=nofoo,bar means not foo, but bar. * utils/match-options.h: New file. * utils/match-options.c: Likewise. (test_opts): New variable. (test_opts_len): Likewise. (match_options): New function. * utils/mount.c (parse_opt): Handle -O, --test-opts. (main): Use match_options as filter.