summaryrefslogtreecommitdiffstats
path: root/lib/Makemodule.am
Commit message (Collapse)AuthorAgeFilesLines
* build-sys: do not require dirfd()Karel Zak2018-12-031-2/+6
| | | | | | | The dirfd() is required on many places, but it should not be required for all utils by ./configure.ac. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/sysfs: new implementationKarel Zak2018-06-211-2/+5
| | | | | | | | | * reuse ul_path_* API * allow to use prefix for sysfs paths, so we can use snapshots from sysfs for regression tests Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/path: new implementationKarel Zak2018-06-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal is to avoid duplicate code in path.c and sysfs.c and make it possible to define prefix for paths for all sysfs and procfs based utils. Now we have /proc snapshots (for tests) for lscpu only. It would be nice to have the same (for sysfs) for lsblk and another tools. * very simple API to read numbers, strings and symlinks * based on openat() pc = ul_new_path("/sys/block/sda"); ul_path_read_u64(pc, &size, "size"); ul_path_read_u64(pc, &lsz, "queue/logical_block_size"); * printf-like API to generate paths, for example: ul_path_readf_u64(pc, &num, "sda%d/size", partno) * allow to define prefix to redirect hardcoded paths to another location, for example: pc = ul_new_path("/sys/block/sda"); ul_path_set_prefix(pc, "/my/regression/dump"); ul_path_read_u64(pc, &num, "size"); to read /my/regression/dump/sys/block/sda/size * allow to extend the API by "dialects", for example for sysfs: pc = ul_new_path(NULL); sysfs_blkdev_init_path(pc, devno, NULL); and use ul_path_* functions to read from @pc initialized by sysfs_blkdev_init_path() * add test_path binary Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: Add simple crc32c() functionJohn Groves2017-11-161-0/+1
| | | | | | | | Source: freebsd/sys/libkern/crc32.c This code is an unmodified fragment from the source. Will fixup comments / naming in next commit Signed-off-by: Karel Zak <kzak@redhat.com>
* kill: Extract signal names into signames.h/signames.cNiklas Hambüchen2017-10-141-1/+2
|
* login: add xgetpwnam()Karel Zak2017-09-181-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libuuid: add support for hash-based UUIDsPhilip Prindeville2017-09-051-1/+2
| | | | | | | | | Adding V3 and V5 UUIDs per RFC-4122. [kzak@redhat.com: - fix symbols file] Signed-off-by: Philip Prindeville <philipp@redfish-solutions.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix library order when linkingRuediger Meier2017-06-011-1/+1
| | | | | | | | | | We got some errors on Alpine Linux where $LTLIBINTL is non-empty: ./.libs/libcommon.a(libcommon_la-blkdev.o): In function `open_blkdev_or_file': lib/blkdev.c:282: undefined reference to `libintl_gettext collect2: error: ld returned 1 exit status Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib/colors: fix test compilationKarel Zak2017-05-311-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: ncurses cleanupKarel Zak2017-05-301-2/+12
| | | | | | | | | * use proper paths to term.h * keep ncurses support optional * link with TINFO_LIBS (-ltinfo), or fallback to NCURSES_LIBS (-ltinfo -lncurses) * don't include unnecessary ncurses.h (term.h is enough) Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add parse-date.yKarel Zak2017-03-041-0/+1
| | | | | | | | | | | | | * add lib/parse-date.y to build system * add necessary autotools stuff to generate .c on the fly (autotools are smart enough to add generated file to tarball) * check for bison version by ./autogen.sh * add non-wanted junk to .gitignore With some modification by J William Piggott with regard to moving the parse-date API into timeutils.h Signed-off-by: J William Piggott <elseifthen@gmx.com>
* lib/mbsedit: add simple buffer editorKarel Zak2017-02-161-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: test_linux_version is Linux onlyKarel Zak2017-01-041-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: use unique ifdefs for testsKarel Zak2017-01-041-11/+11
| | | | | | | Let's use unique TEST_PROGRAM_<NAME> ifdefs to make build system more robust. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/linux_version: add test for manual testingKarel Zak2017-01-021-0/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add --disable-plymouth-supportKarel Zak2016-05-261-1/+4
| | | | | | | | The plymouth support depends on Linux specific SOCK_* flags and all the feature is probably unnecessary in some cases (non-plymouth distros, etc.) Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: agetty: use the plymouth local protocol instead the plymouth binaryWerner Fink2016-05-201-0/+1
| | | | | | | | | | | | | for stopping plymouthd. That do not depend on the existence of the plymouth binary if it e.g. becomes uninstalled or an other service is providing plymouthd facilities. [kzak@redhat.com: - fix compiler warnings [-Wpointer-sign] - use sizeof() for write_all() - cast to char* for read_all] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/timeutils: add strxxx_iso() functionsKarel Zak2016-05-111-1/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: Update for newer bcache superblocksKent Overstreet2016-03-231-1/+0Star
| | | | | | | | Later version of bcache add different checksum types, and allow for superblocks greater than 4k - skipping the checksum check (as in most other probes) is the easiest solution. Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
* build-sys: add and use openat build conditionalsRuediger Meier2016-03-071-4/+10
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib: move fopen_at() to fileutils.h, remove at.hRuediger Meier2016-03-071-2/+1Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* lib: remove openat fallback functions (include/at.h)Ruediger Meier2016-03-071-4/+0Star
| | | | | | | | | | | | | | I have validated that we are still compatible at least back to - openSUSE 11.4 - SLE 11 - RHEL/CentOS 6 - OSX 10.10.x, (Xcode 6.3) - FreeBSD 10.2 Confirmed incompatibility: - OSX 10.9.x, (Xcode 6.2) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always add AM_CFLAGSRuediger Meier2016-02-231-14/+14
| | | | | | | | We were missing our nice compliler warnings for many programs and libs. See next commits how many trivial and non-trival warnings have to be fixed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always use global LDADDRuediger Meier2016-02-231-4/+4
| | | | | | | | This was a major showstopper when building on a system where LTLIBINTL libs are needed (e.g. OSX). Maybe there are a few test programs which wouldn't need LDADD ... never mind. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* namei: move icache to lib/Karel Zak2015-11-271-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: fix test_colors buildKarel Zak2015-07-241-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libsmartcols: don't link with tinfoKarel Zak2015-07-241-1/+2
| | | | | | | Let's move color names to sequence translation to separate file to make it usable without all the stuff in lib/colors.c. Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: merge read_utmp() codeKarel Zak2015-07-161-2/+1Star
| | | | | | | The code is used only in lslogins, so it does not make sense to maintain it in libcommon. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strv: add new functions (from systemd)Karel Zak2015-05-151-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: use libtinfo to check terminal capabilityKarel Zak2015-02-271-2/+12
| | | | | | | | | | | | | | | The current implementation assumes that all terminals supports colors and users are forcet to use terminal-colors.d/ to disable colors for some terminals. This patch checks for maximal supported colors for the current terminal and colors are automatically disabled for terminals like vt100. The patch moves lib/colors.c from libcommon.la to libtcolors.la to avoid collisions with another utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/loopdev: remove test programKarel Zak2014-11-041-5/+0Star
| | | | | | | All is already covered by losetup and mount. The test program has never been used in our regression tests. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: remove xgetpass()Sami Kerola2014-09-191-1/+0Star
| | | | | | | This function is not in use, and it has reference to obsoleted getpass(). Reference: http://man7.org/linux/man-pages/man3/getpass.3.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* tests: remove test_wholediskKarel Zak2014-06-171-5/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove obsolete wholedisk.cKarel Zak2014-06-171-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lslogins: add functionalityOndrej Oprala2014-05-151-1/+2
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* lib/tt.c: Goodbye!Ondrej Oprala2014-04-031-6/+0Star
| | | | Signed-off-by: Ondrej Oprala <ooprala@redhat.com>
* lib/colors: add info to man pages, add terminal-colors.d.5Karel Zak2014-03-111-0/+2
| | | | | Co-Author: Ondrej Oprala <ooprala@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: add crc64()Karel Zak2013-09-111-0/+1
| | | | | | Based on bcache code from Rolf Fokkens. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib: rename time-util.c to timeutils.c, fix headersKarel Zak2013-09-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/time-util: copy time parsing functions from systemdSami Kerola2013-08-291-0/+1
| | | | | | | | The functions are copied nearly as-is. Coding style has been modified to match with util-linux project, while the functionality remains untouched. CC: Lennart Poettering <lennart@poettering.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* lib/colors: add support for auto, always and never modesKarel Zak2013-05-061-0/+4
| | | | | | ... to implement --color[=<when>] Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: sync capacity after setting itJeff Mahoney2013-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I recently tried to mount an hfsplus file system from an image file with a partition table by using the loop offset and sizelimit options to specify the location of the file system. hfsplus stores some metadata at a set offset from the end of the partition, so it's sensitive to the device size reported by the kernel. It worked with this: But failed with this: /dev/loop0: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000 /dev/loop1: [0089]:2 (<imagefile>), offset 32768, sizelimit 102400000 /proc/partitions shows the correct number of blocks to match the sizelimit. But if I set a breakpoint in mount before the mount syscall, I could see: 102400000 102432768 The kernel loop driver will set the gendisk capacity of the device at LOOP_SET_STATUS64 but won't sync it to the block device until one of two conditions are met: All open file descriptors referring to the device are closed (and it will sync when re-opened) or if the LOOP_SET_CAPACITY ioctl is called to sync it. Since mount opens the device and passes it directly to the mount syscall after LOOP_SET_STATUS64 without closing and reopening it, the sizelimit argument is effectively ignroed. The capacity needs to be synced immediately for it to work as expected. This patch adds the LOOP_SET_CAPACITY call to loopctx_setup_device since the device isn't yet released to the user, so it's safe to sync the capacity immediately. [kzak@redhat.com: - port to the current git HEAD, - use uint64_t] Signed-off-by: Jeff Mahoney <jeffm@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/procutils: add simple API to scan /proc/PID/*Karel Zak2013-03-121-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* unshare,nsenter: spawn shell by defaultZbigniew Jędrzejewski-Szmek2013-02-141-1/+2
| | | | | | | | | | | | | The behaviour mimics chroot. Possibly it would have been nicer to to query the password database in the new namepace and run the shell of the user there, but it's hard to do correctly. getpwuid() might need to load nss plugins, and the arch in the new namespace might be different (in case of NEWNS mounts), or the hostname might be different, etc. So in general it's not possible to do it reliably. Signed-off-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
* sulogin: remove consoles.c from libcommonKarel Zak2012-12-231-6/+0Star
| | | | | | | | - move struct chardata to include/ttyutils.h - move console.{h,c} to login-utils/sulogin-* (it's sulogin specific) - fix sulogin and agetty includes Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ismounted: basic support for loop devicesKarel Zak2012-12-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | # losetup -a /dev/loop0 /dev/loop0: [2053]:1048578 (/home/fs-images/filesystems/ext2.img) # findmnt /dev/loop0 TARGET SOURCE FSTYPE OPTIONS /mnt/test /dev/loop0 ext3 rw,relatime,data=ordered old version: ./test_ismounted /home/fs-images/filesystems/ext2.img not mounted new version: ./test_ismounted /home/fs-images/filesystems/ext2.img mounted on /mnt/test Reported-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: add test programKarel Zak2012-11-221-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/ttyutils: create .c fileKarel Zak2012-11-221-0/+1
| | | | | | | | Well, now all tty stuff are incline functions in include/ttyutils.h. It's seems more elegant to create regular lib/ttyutils.c for libcommon and write test program. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: add test programKarel Zak2012-11-091-0/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/consoles: add code to detect all system consolesWerner Fink2012-11-081-0/+1
| | | | Signed-off-by: Werner Fink <werner@suse.de>