diff options
Diffstat (limited to 'sys-utils')
-rw-r--r-- | sys-utils/.gitignore | 11 | ||||
-rw-r--r-- | sys-utils/Makemodule.am | 38 | ||||
-rw-r--r-- | sys-utils/losetup.c | 4 | ||||
-rw-r--r-- | sys-utils/lscpu-dmi.c | 2 | ||||
-rw-r--r-- | sys-utils/mount.8 | 2 | ||||
-rw-r--r-- | sys-utils/setarch.c | 20 | ||||
-rw-r--r-- | sys-utils/switch_root.c | 3 | ||||
-rw-r--r-- | sys-utils/umount.8 | 4 | ||||
-rw-r--r-- | sys-utils/umount.c | 4 |
9 files changed, 67 insertions, 21 deletions
diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore index bcd6e0271..d378b1d2f 100644 --- a/sys-utils/.gitignore +++ b/sys-utils/.gitignore @@ -1,21 +1,22 @@ +fstrim.service i386.8 ia64.8 linux32.8 linux64.8 -mips.8 mips32.8 mips64.8 -parisc.8 +mips.8 parisc32.8 parisc64.8 -ppc.8 +parisc.8 ppc32.8 ppc64.8 +ppc.8 s390.8 s390x.8 -sparc.8 sparc32.8 sparc32bash.8 sparc64.8 +sparc.8 +uname26.8 x86_64.8 -fstrim.service diff --git a/sys-utils/Makemodule.am b/sys-utils/Makemodule.am index 9d69bc60e..a2a1d6df2 100644 --- a/sys-utils/Makemodule.am +++ b/sys-utils/Makemodule.am @@ -1,38 +1,50 @@ - +if BUILD_FLOCK usrbin_exec_PROGRAMS += flock dist_man_MANS += sys-utils/flock.1 flock_SOURCES = sys-utils/flock.c flock_LDADD = $(LDADD) libcommon.la +endif +if BUILD_IPCMK usrbin_exec_PROGRAMS += ipcmk dist_man_MANS += sys-utils/ipcmk.1 ipcmk_SOURCES = sys-utils/ipcmk.c ipcmk_LDADD = $(LDADD) libcommon.la +endif +if BUILD_IPCRM usrbin_exec_PROGRAMS += ipcrm dist_man_MANS += sys-utils/ipcrm.1 ipcrm_SOURCES = sys-utils/ipcrm.c ipcrm_LDADD = $(LDADD) libcommon.la +endif +if BUILD_IPCS usrbin_exec_PROGRAMS += ipcs dist_man_MANS += sys-utils/ipcs.1 ipcs_SOURCES = sys-utils/ipcs.c \ sys-utils/ipcutils.c \ sys-utils/ipcutils.h ipcs_LDADD = $(LDADD) libcommon.la +endif - +if BUILD_RENICE usrbin_exec_PROGRAMS += renice dist_man_MANS += sys-utils/renice.1 renice_SOURCES = sys-utils/renice.c +endif +if BUILD_SETSID usrbin_exec_PROGRAMS += setsid dist_man_MANS += sys-utils/setsid.1 setsid_SOURCES = sys-utils/setsid.c +endif +if BUILD_READPROFILE usrsbin_exec_PROGRAMS += readprofile dist_man_MANS += sys-utils/readprofile.8 readprofile_SOURCES = sys-utils/readprofile.c +endif if BUILD_TUNELP usrsbin_exec_PROGRAMS += tunelp @@ -56,44 +68,52 @@ endif # BUILD_FSTRIM PATHFILES += sys-utils/fstrim.service EXTRA_DIST += sys-utils/fstrim.timer -if LINUX -# -# Linux-only utils with no another dependencies. All another dependencies have -# to be resolved in configure.ac end exported to makefiles by BUILD_*. -# +if BUILD_DMESG bin_PROGRAMS += dmesg dist_man_MANS += sys-utils/dmesg.1 dmesg_SOURCES = sys-utils/dmesg.c lib/boottime.c dmesg_LDADD = $(LDADD) libcommon.la -lrt +endif +if BUILD_CTRLALTDEL sbin_PROGRAMS += ctrlaltdel dist_man_MANS += sys-utils/ctrlaltdel.8 ctrlaltdel_SOURCES = sys-utils/ctrlaltdel.c +endif +if BUILD_FSFREEZE sbin_PROGRAMS += fsfreeze dist_man_MANS += sys-utils/fsfreeze.8 fsfreeze_SOURCES = sys-utils/fsfreeze.c +endif +if BUILD_BLKDISCARD sbin_PROGRAMS += blkdiscard dist_man_MANS += sys-utils/blkdiscard.8 blkdiscard_SOURCES = sys-utils/blkdiscard.c blkdiscard_LDADD = $(LDADD) libcommon.la +endif +if BUILD_LDATTACH usrsbin_exec_PROGRAMS += ldattach dist_man_MANS += sys-utils/ldattach.8 ldattach_SOURCES = sys-utils/ldattach.c ldattach_LDADD = $(LDADD) libcommon.la +endif +if BUILD_RTCWAKE usrsbin_exec_PROGRAMS += rtcwake dist_man_MANS += sys-utils/rtcwake.8 rtcwake_SOURCES = sys-utils/rtcwake.c rtcwake_LDADD = $(LDADD) libcommon.la +endif +if BUILD_SETARCH usrbin_exec_PROGRAMS += setarch dist_man_MANS += sys-utils/setarch.8 setarch_SOURCES = sys-utils/setarch.c -SETARCH_LINKS = linux32 linux64 +SETARCH_LINKS = uname26 linux32 linux64 if ARCH_S390 SETARCH_LINKS += s390 s390x @@ -140,7 +160,7 @@ uninstall-hook-setarch: INSTALL_EXEC_HOOKS += install-exec-hook-setarch UNINSTALL_HOOKS += uninstall-hook-setarch -endif # LINUX +endif # BUILD_SETARCH if BUILD_EJECT diff --git a/sys-utils/losetup.c b/sys-utils/losetup.c index f6b8685a3..6ad94be4c 100644 --- a/sys-utils/losetup.c +++ b/sys-utils/losetup.c @@ -77,7 +77,6 @@ static struct colinfo infos[] = { static int columns[NCOLS] = {-1}; static int ncolumns; -static int verbose; static int get_column_id(int num) { @@ -543,7 +542,6 @@ int main(int argc, char **argv) showdev = 1; break; case 'v': - verbose = 1; break; case 'V': printf(UTIL_LINUX_VERSION); @@ -662,7 +660,7 @@ int main(int argc, char **argv) res = loopcxt_setup_device(&lc); if (res == 0) break; /* success */ - if (errno == EBUSY) + if (errno == EBUSY && !hasdev) continue; /* errors */ diff --git a/sys-utils/lscpu-dmi.c b/sys-utils/lscpu-dmi.c index c82bfc134..251d4acc4 100644 --- a/sys-utils/lscpu-dmi.c +++ b/sys-utils/lscpu-dmi.c @@ -168,6 +168,7 @@ done: return rc; } +#if defined(__x86_64__) || defined(__i386__) static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem) { if (!checksum(buf, 0x0F)) @@ -177,6 +178,7 @@ static int hypervisor_decode_legacy(uint8_t *buf, const char *devmem) WORD(buf + 0x0C), devmem); } +#endif static int hypervisor_decode_smbios(uint8_t *buf, const char *devmem) { diff --git a/sys-utils/mount.8 b/sys-utils/mount.8 index be3c39393..efa1ae8dd 100644 --- a/sys-utils/mount.8 +++ b/sys-utils/mount.8 @@ -569,7 +569,7 @@ Mount all filesystems (of the given types) mentioned in .I fstab (except for those whose line contains the .B noauto -keyword). +keyword). The filesystems are mounted following their order in fstab. .IP "\fB\-F, \-\-fork\fP" (Used in conjunction with .BR \-a .) diff --git a/sys-utils/setarch.c b/sys-utils/setarch.c index 957bb2b03..4cce877be 100644 --- a/sys-utils/setarch.c +++ b/sys-utils/setarch.c @@ -146,6 +146,7 @@ set_arch(const char *pers, unsigned long options, int list) int perval; const char *target_arch, *result_arch; } transitions[] = { + {UNAME26, "uname26", NULL}, {PER_LINUX32, "linux32", NULL}, {PER_LINUX, "linux64", NULL}, #if defined(__powerpc__) || defined(__powerpc64__) @@ -201,9 +202,25 @@ set_arch(const char *pers, unsigned long options, int list) {PER_LINUX, "alphaev6", "alpha"}, {PER_LINUX, "alphaev67", "alpha"}, #endif + {-1, NULL, NULL}, /* place holder, eventually filled up at runtime */ {-1, NULL, NULL} }; + /* Add the trivial transition {PER_LINUX, machine, machine} if no such + target_arch is hardcoded yet. */ + uname(&un); + for (i = 0; transitions[i].perval >= 0; i++) + if(!strcmp(un.machine, transitions[i].target_arch)) + break; + if (transitions[i].perval < 0) { + unsigned long wrdsz = CHAR_BIT * sizeof(void*); + if (wrdsz == 32 || wrdsz == 64) { + transitions[i].perval = wrdsz == 32 ? PER_LINUX32 : PER_LINUX; + transitions[i].target_arch = un.machine; + transitions[i].result_arch = un.machine; + } + } + if (list) { for(i = 0; transitions[i].target_arch != NULL; i++) printf("%s\n", transitions[i].target_arch); @@ -356,6 +373,9 @@ int main(int argc, char *argv[]) if (set_arch(p, options, 0)) err(EXIT_FAILURE, _("Failed to set personality to %s"), p); + /* flush all output streams before exec */ + fflush(NULL); + if (!argc) { execl("/bin/sh", "-sh", NULL); err(EXIT_FAILURE, _("failed to execute %s"), "/bin/sh"); diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c index dac946f8c..6822a5d0c 100644 --- a/sys-utils/switch_root.c +++ b/sys-utils/switch_root.c @@ -181,7 +181,8 @@ static int switchroot(const char *newroot) if (pid <= 0) { struct statfs stfs; if (fstatfs(cfd, &stfs) == 0 && - (stfs.f_type == STATFS_RAMFS_MAGIC || stfs.f_type == STATFS_TMPFS_MAGIC)) + (stfs.f_type == (__SWORD_TYPE)STATFS_RAMFS_MAGIC || + stfs.f_type == (__SWORD_TYPE)STATFS_TMPFS_MAGIC)) recursiveRemove(cfd); else warn(_("old root filesystem is not an initramfs")); diff --git a/sys-utils/umount.8 b/sys-utils/umount.8 index 94a13f77d..c9e2aca96 100644 --- a/sys-utils/umount.8 +++ b/sys-utils/umount.8 @@ -70,7 +70,9 @@ filesystem is not unmounted.) Unmount all mountpoints in the current namespace for the specified filesystem. The filesystem could be specified by one of the mountpoints or device name (or UUID, etc.). This option could be used together with \fB\-\-recursive\fR then -all nested mounts within the filesystem are recursively unmounted. +all nested mounts within the filesystem are recursively unmounted. The +\fB\-\-all-targets\fR is only supported on systems where /etc/mtab is a symlink +to /proc/mounts. .TP \fB\-c\fR, \fB\-\-no\-canonicalize\fR Do not canonicalize paths. For more details about this option see the diff --git a/sys-utils/umount.c b/sys-utils/umount.c index 0d576595b..1ad9e6aeb 100644 --- a/sys-utils/umount.c +++ b/sys-utils/umount.c @@ -435,7 +435,9 @@ static int umount_alltargets(struct libmnt_context *cxt, const char *spec, int r return mk_exit_code(cxt, rc); /* error */ if (!mnt_fs_get_srcpath(fs) || !mnt_fs_get_devno(fs)) - err(MOUNT_EX_USAGE, _("%s: failed to determine source"), spec); + errx(MOUNT_EX_USAGE, _("%s: failed to determine source " + "(--all-targets is unsupported on systems with " + "regular mtab file)."), spec); itr = mnt_new_iter(MNT_ITER_BACKWARD); if (!itr) |