summaryrefslogtreecommitdiffstats
path: root/include/pathnames.h
Commit message (Collapse)AuthorAgeFilesLines
* initial support for xloopxloop-hackJonathan Bauer2020-05-291-2/+2
|
* wdctl; read from /sys if necessaryKarel Zak2019-06-171-0/+1
| | | | | | | | | | | | The device can be inaccessible for non-root user or busy (already used by another process). In this case it seems better to read information from /sys. Note that /sys does not provide struct watchdog_info.options, so we cannot print list of supported watchdog features. Addresses: https://github.com/karelzak/util-linux/issues/804 Signed-off-by: Karel Zak <kzak@redhat.com>
* wdctl: default to /dev/watchdog0Karel Zak2019-06-171-3/+0Star
| | | | | | | Let's use miscdev /dev/watchdog as fallback only. We need (if possible) cdev /dev/watchdog0 as this device has entry in /sys/class/watchdog. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: introduce get_terminal_stdfd()Karel Zak2019-05-271-0/+2
| | | | | | Let's use separate function to detect what is the current terminal. Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use sscanf() for swaps parsingKarel Zak2019-04-081-1/+0Star
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: don't use sscanf() for mountinfo parsingKarel Zak2019-04-081-1/+1
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/780 Signed-off-by: Karel Zak <kzak@redhat.com>
* rtcwake: use poweroff if shutdown is not foundJustin Chen2018-11-061-0/+1
| | | | | | | Some systems do not have the shutdown command. Use poweroff as an alternative. Signed-off-by: Justin Chen <justinpopo6@gmail.com>
* Add built in fallbacks for motd fileLudwig Nussel2018-09-071-1/+1
| | | | | | | | | | | | | | | Use several locations for built in default for motd to allow for e.g. run time generated motd without having to modify config files. login.c already splits by colon. /usr/share/misc/motd - chould be shipped by distributions /run/motd - potentially run time created file with dynamic information /etc/motd - for the admin fill with local information Signed-off-by: Ludwig Nussel <ludwig.nussel@suse.de>
* lib/canonicalize: fix truncation warningSami Kerola2018-05-101-0/+2
| | | | | | | | | | | | | | | | | | lib/canonicalize.c: In function ‘canonicalize_dm_name’: lib/canonicalize.c:42:45: warning: ‘%s’ directive output may be truncated writing up to 255 bytes into a region of size 244 [-Wformat-truncation=] snprintf(path, sizeof(path), "/dev/mapper/%s", name); Notice that this warnign fix does not improve code enormously. The earlier snprintf() truncation will not happen a bit earlier when fgets() is called. In that sense this change merely makes one easy to silence warning to disappear, and therefore improve change of noticing useful messaging as such crops up. [kzak@redhat.com: - use macro rather than hardcoded string for mapper path] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: add support for /etc/issue.dKarel Zak2017-11-071-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | The /etc/issue file has been originally designed to inform users about the system (version, name, etc.). In last years is growing number of additional tools (containers, maintenance tools and interfaces, ...) and many admins and downstream maintainer want to add some tool specific hints to the issue file, but it mess to share one file between more packages and/or scripts. The solution is /etc/issue.d directory. The directory is extension to the standard system /etc/issue. The /etc/issue file has to exist, otherwise the directory will be ignored. It means "rm /etc/issue" (or --onissue) is still the way how keep our system silent independently on 3rd-party installed files in the /etc/issue.d directory. The content of the files in the directory are printed after content of the /etc/issue. The files are printed in version-sort order and .issue file extension is required (00-foo.issue 01-bar.issue ...). The change is backwardly compatible. Signed-off-by: Karel Zak <kzak@redhat.com>
* rfkill: make programming style to match util-linux projectSami Kerola2017-08-301-0/+4
| | | | | | | | Use the usual facilities, add translation strings, move global variables at the beginning of the file, make usage() look as expected, add standard command-line option parsing. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build: use --runstatedir instead of --localstatedirAndreas Henriksson2017-07-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The util-linux code was previously aligned to use @localstatedir@ and the util-linux build system was set to override the default to use /run. Current GNU Coding Standards introduced the @runstatedir@ variable for this purpose. Lets use that instead. The GNU default for @runstatedir@ is ${localstatedir}/run so util-linux still override the default to be /run to preserve the status quo from before. The only difference is that you'll now pass --runstatedir to override the location on the command line instead of --localstatedir. (FWIW, Debhelper in compat 11 will automatically start passing --runstatedir=/run to all autotools configured builds. It already passes --localstatedir=/var (to avoid it ending up with the GNU default /usr/local/var) which breaks the util-linux build system code that tries to default it to /run. This change will thus allow util-linux and debhelper to work better together and avoid the need for a package-specific override.) Relevant historic commits: * commit 07a16b9d1e5a48550a0d19abb9a900853433ffa2 "build-sys: change --localstatedir to /run" * commit 80c51185d50f00a2701f9379f10fc48a0f885dfc "uuidd: use run configured state directory" * commit 01c5b787947aeaffc7e56000827e3edefa357c59 "agetty: use configured run state directory" [kzak@redhat.com: - add $runstatedir fallback for autoconf < 2.70 - check for unmodified $localstatedir] CC: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Andreas Henriksson <andreas@fatal.se> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: update pathnames.hJ William Piggott2017-06-211-24/+12Star
| | | | | | | | | | | | | | | | * use /dev/rtc0 (/dev/rtc was for the 'old' driver) * remove hwclock Award workaround and alpha cmos paths * relocate _PATH_BTMP from hwclock to login-utils * add a comment for _PATH_BTMP and fix other login-utils comments * add a comment for proc/cpuinfo * remove empty shutdown.c comment from 4d43977f Review changes * remove 'used in' comments * white space fixes Reviewed-by: Karel Zak <kzak@redhat.com> Signed-off-by: J William Piggott <elseifthen@gmx.com>
* hwclock: improve coding styleSami Kerola2017-02-051-0/+4
| | | | | | | | | Make string constants to be symbolical declarations. Use longer variable name for rtc and cmos function pointer values. Exclude code that is architecture specific with preprocessor directives. And remove message duplication. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: remove obsolete HAVE_UPDWTMP fallbackRuediger Meier2016-12-071-2/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* pathnames: guard clashing definitions on FreeBSDFranco Fichtner2016-08-111-0/+4
|
* misc: remove path name definitions that are unusedSami Kerola2016-03-091-18/+0Star
| | | | | | | | | | | | | | | | | | | | | | After this commit the following produces zero matches. $ for i in \ _PATH_DEV_TTY \ _PATH_INITTAB \ _PATH_MNTTAB_DIR \ _PATH_MOUNTED_LOCK \ _PATH_MOUNTED_TMP \ _PATH_RC \ _PATH_REBOOT \ _PATH_SECURE \ _PATH_SECURETTY \ _PATH_SHUTDOWN_CONF \ _PATH_SINGLE \ _PATH_UMOUNT \ _PATH_USERTTY do git grep $i; done Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* ctrlaltdel: display setting when ran without argumentsSami Kerola2015-10-181-0/+3
| | | | | | This is more useful than printing an error. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* agetty: support /usr/lib/os-release tooKarel Zak2015-03-051-1/+3
| | | | | | | | | | | | http://www.freedesktop.org/software/systemd/man/os-release.html The file /etc/os-release takes precedence over /usr/lib/os-release. Applications should check for the former, and exclusively use its data if it exists, and only fall back to /usr/lib/os-release if it is missing. Reported-by: Dimitri John Ledkov <dimitri.j.ledkov@intel.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add --enable-usrdir-pathKarel Zak2015-03-031-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | The directories /{sbin,bin} are symliks to /usr/{sbin,bin} on many systems. This patch add new ./configure option to remove the non-usr paths from the default $PATH environment variable. The default $PATH is hardcoded in login(1) and can be overwritten by /etc/login.defs. default: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin --enable-usrdir-path: ./test_pathnames | grep DEFPATH _PATH_DEFPATH /usr/local/bin:/usr/bin _PATH_DEFPATH_ROOT /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin This patch does not modify install paths, you still have to care about --{bin,lib}dir configure options. Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: move /dev/log to pathnames.hSami Kerola2015-02-241-0/+3
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* unshare: Fix --map-root-user to work on new kernelsEric W. Biederman2015-01-091-0/+1
| | | | | | | | | | | | | | | In rare cases droping groups with setgroups(0, NULL) is an operation that can grant a user additional privileges. User namespaces were allwoing that operation to unprivileged users and that had to be fixed. Update unshare --map-root-user to disable the setgroups operation before setting the gid_map. This is needed as after the security fix gid_map is restricted to privileged users unless setgroups has been disabled. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* lslogins: use hardcoded paths from pathnames.hSami Kerola2014-12-191-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: support ./configure ADJTIME_PATH=Karel Zak2014-06-191-0/+4
| | | | | | | .. to override the default /etc/adjtime path. Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add support for @term and /home/kzakKarel Zak2014-05-131-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: check for /etc/terminal-colors.d/[util].disableOndrej Oprala2014-03-111-0/+3
| | | | | | | | [kzak@redhat.com: - move paths to pathnames.h, - use static path buffer] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare: Add possibility to add mapping into root user in user namespaceLubomir Rintel2014-01-071-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it very convenient to use make use of privileged actions on CONFIG_USER_NS enabled kernels, without having to manually tinker with uid_map and gid_map to obtain required credentials (as those given upon unshare() vanish with call to execve() and lot of userspace checks for euid==0 anyway). Usage example: $ unshare --uts unshare: unshare failed: Operation not permitted $ unshare --user --uts [nfsnobody@odvarok ~]$ hostname swag hostname: you must be root to change the host name $ unshare -r --uts [root@odvarok util-linux]# hostname swag [root@odvarok util-linux]# [kzak@redhat.com: - move code to map_id() - use all-io.h - add paths to pathnames.h] Signed-off-by: Lubomir Rintel <lkundrak@v3.sk> Signed-off-by: Karel Zak <kzak@redhat.com>
* nologin: add new commandKarel Zak2013-09-301-0/+2
| | | | | | | Currently it's maintained as distro specific (or people use impolite /bin/false way). Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: add \S to output /etc/os-release dataKarel Zak2013-09-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch allows to use a new \S or \S{VARNAME} sequence in the /etc/issue file. The sequence prints data from /etc/os-release. The reason is to keep /etc/issue file distribution and release independent. The \S{ANSI_COLOR} is converted to the real terminal escape seq. For example: \S Kernel \r on an \m (\l) or more complex example: Welcome to \S{ANSI_COLOR}\S{NAME}0m \S{VERSION} Report bugs at \S{BUG_REPORT_URL}. See http://www.freedesktop.org/software/systemd/man/os-release.html fr more details about /etc/issue. Based on patch from Bill Nottingham <notting@redhat.com>. Signed-off-by: Karel Zak <kzak@redhat.com>
* lscpu: detect more hypervisor vendorsOndrej Oprala2013-05-201-0/+2
| | | | | | | | [kzak@redhat.com: - cleanup coding style, - use path_exist()] Signed-off-by: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/pathnames: rename _PATH_ADJPATH to _PATH_ADJTIMEKarel Zak2013-03-261-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* setpriv: move paths to pathnames.hKarel Zak2013-02-051-0/+8
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: determine ipc limits from /procSami Kerola2012-11-231-0/+1
| | | | | | | | | | | | Some of the limit values are not dynamic. Like in kernel these values are #defined. [kzak@redhat.com: - use better names for functions, - add ipcutils.{c,h} - read also shmmax from /proc] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* ipcs: add /proc and /sys path definitionsSami Kerola2012-11-231-0/+11
| | | | | | | | | | | The necessary proc and sysfs files are tested to be present. When information files are missing the ipcs will use obsolted system calls, and data structures, as fallback. [kzak@redhat.com: - fix #define _PATH_PROC_IPC_MSG "/proc/sys/kernel/sem" typo] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* libmount: add private mnt_get_kernel_cmdline_option()Karel Zak2012-11-081-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: add SCSI link functionsKarel Zak2012-10-231-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* agetty: use configured run state directorySami Kerola2012-07-101-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* wdctl: align with other util-linux commandsSami Kerola2012-05-031-0/+2
| | | | | | | | | * Add watchdog device path to pathnames.h * Check output stream status at exit. * Adjust usage() notation to follow howto file. * Retire numeric return value. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* libblkid: add support for PARTUUID= and PARTLABEL=Karel Zak2012-04-191-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'eject'Karel Zak2012-04-051-0/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * eject: (47 commits) tests: use eject --force eject: use BUILD_EJECT, move to sys-utils eject: clean up usage() eject: clean up man page eject: add --force option eject: check for hotplug/removable attribute eject: remove obsolete code, use EXIT_* macros tests: add umount-by-eject tests eject: improve work with partitioned devices lib/sysfs: improve sysfs_is_partition_dirent() eject: call umount <mountpoint> rather than <device> eject: use libmount to detect if cdrom is mounted eject: make the code robust eject: use SG_IO ioctl for scsi eject: support CDIOCEJECT ioctl eject: new close_tray code from Fedora eject: new auto_eject code from Fedora eject: add -X from Fedora eject: add --manualeject from fedora eject: clean up devname usage ...
| * eject: add -X from FedoraKarel Zak2012-03-271-0/+1
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* | raw: use pathnames.h for file locationsSami Kerola2012-03-301-0/+7
|/ | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* pathnames: clean up various user database pathsSami Kerola2012-03-181-13/+4Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* chsh: use pathnames.h for pathsSami Kerola2012-03-181-0/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: add /proc/locks path to pathnamesDavidlohr Bueso2012-02-291-0/+1
| | | | | Signed-off-by: Davidlohr Bueso <dave@gnu.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib,loopdev: add LOOP_CTL_GET_FREE supportKarel Zak2011-11-071-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login: add login.defs code and testsKarel Zak2011-10-261-0/+2
| | | | | | | | | | The new logindefs.c file contains /etc/login.defs parser and functions for searching in the list of the login default variables. The patch also contains a new regression test for the code. Based on pam_login-4.0 from Suse. Signed-off-by: Karel Zak <kzak@redhat.com>
* login: improve hushed mode (merge suse changes)Karel Zak2011-10-261-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* login: move _PATH_BTMP to pathnames.hKarel Zak2011-10-261-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* hwclock: move path definitions to pathnames.hSami Kerola2011-07-261-0/+9
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>