summaryrefslogtreecommitdiffstats
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* lib/tty: don't hardcode terminal fd in get_terminal_name()Karel Zak2013-05-131-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add colormode_or_err()Karel Zak2013-05-071-0/+1
| | | | | | ... to make the code easy to use in utils. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/colors: add support for auto, always and never modesKarel Zak2013-05-061-1/+12
| | | | | | ... to implement --color[=<when>] Signed-off-by: Karel Zak <kzak@redhat.com>
* include: add close_fd() for noticing write errors before close()Sami Kerola2013-04-261-0/+19
| | | | | | | | | | | Essentially this helper function is similar to close_stream(), but for file descriptors. When a file descriptors are close()'d status of write is often overlooked. The close_fd() will try to determine what happen to writes with fsync() before closing the file descriptor. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: fix SYS_{unshare,nsenter} usageKarel Zak2013-04-171-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: arch independent minix detectionKarel Zak2013-04-151-3/+6
| | | | | | | It seems that on-disk MINIX FS superblock is native-endian. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=833841 Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/xalloc: add xstrndup()Karel Zak2013-04-101-0/+15
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* loopdev: sync capacity after setting itJeff Mahoney2013-04-091-0/+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>
* include/fileutils: use O_CLOEXEC for mktemp stuffKarel Zak2013-04-031-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/c: add macro UL_CLOEXECSTRKarel Zak2013-04-031-0/+8
| | | | | | ... to make "e" for fopen() portable to systems without O_CLOEXEC. Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/xalloc: fix mamory leak in xgethostname() [coverity scan]Karel Zak2013-03-271-2/+4
| | | | 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>
* docs: arch is gone, use delpart as usage() function exampleSami Kerola2013-03-261-1/+1
| | | | | | The arch.c was removed in commit 27abd809. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* remove duplicate includesKarel Zak2013-03-201-2/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/mbsalign: correct license header from GPLv[23] to LGPLv2+Pádraig Brady2013-03-201-2/+2
| | | | | | * lib/mbsalign.c: s/GPLv3/LGPLv2+/ * include/mbsalign.h: s/GPLv2/LGPLv2+/ * README.licensing: Remove mention GPLv3 as it's not actually used.
* dmesg: more colors, more funKarel Zak2013-03-181-1/+1
| | | | | | | | * colorize subsystem prefix * colorize time * colorize by keywords (now "segfault" only) Signed-off-by: Karel Zak <kzak@redhat.com>
* namespace.h: Fix typo: s/CLONE_NEWSNS/CLONE_NEWNS/Josh Triplett2013-03-131-1/+1
| | | | | | | | | | | This typo causes namespace.h to always unconditionally define CLONE_NEWNS rather than using the system definition. Bug present since the initial version of unshare in commit 4205f1fda1ac32046125a2e0f3937b666186bfab. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Anton Cherkashyn <mail@antonc.com>
* include/timer: return setitimer return valueKarel Zak2013-03-131-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/optutils: make collisions detection between options more robustKarel Zak2013-03-131-4/+12
| | | | | | | - don't rely on the correct ul_excl_t usage - don't print --(null) for non-existing long options Signed-off-by: Karel Zak <kzak@redhat.com>
* include: add timer.hKarel Zak2013-03-132-0/+32
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: add strtotimeval_or_err()Karel Zak2013-03-131-0/+3
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/procutils: add simple API to scan /proc/PID/*Karel Zak2013-03-121-0/+18
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: rename in sun_disklabel for compatibility with fdiskKarel Zak2013-03-111-8/+10
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* inlude/pt-sun: add flags and tagsKarel Zak2013-03-111-7/+23
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libblkid: move sun PT definition to include/Karel Zak2013-03-112-1/+74
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/strutils: simplify strtosize(), return info about suffixKarel Zak2013-03-111-0/+21
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add callback for ask-numbers APIKarel Zak2013-03-111-0/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: add exec_shell.h to distributionBernhard Voelker2013-03-041-0/+1
| | | | Signed-off-by: Bernhard Voelker <mail@bernhard-voelker.de>
* Merge branch 'patch-1' of https://github.com/dtrebbien/util-linuxKarel Zak2013-02-201-0/+3
|\ | | | | | | | | * 'patch-1' of https://github.com/dtrebbien/util-linux: Implement mempcpy() in terms of memcpy() if mempcpy() is unavailable
| * Implement mempcpy() in terms of memcpy() if mempcpy() is unavailableDaniel Trebbien2013-01-311-0/+3
| |
* | lib/tty: don't truncate output on non-terminalsKarel Zak2013-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | for example: $ findmnt | cat $ lslocks > foo the output should not be truncated. Signed-off-by: Karel Zak <kzak@redhat.com>
* | unshare,nsenter: spawn shell by defaultZbigniew Jędrzejewski-Szmek2013-02-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | build-sys: add namespace.h to distributionSami Kerola2013-02-061-0/+1
| | | | | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* | setpriv: move paths to pathnames.hKarel Zak2013-02-051-0/+8
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* nsenter: fix indentationSami Kerola2013-01-251-28/+27Star
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include: add missing values to sysfs_cxt initializer definitionSami Kerola2013-01-241-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* unshare,nsenter: Move the old libc handling into a common header namespace.hEric W. Biederman2013-01-171-0/+43
| | | | | | | | | | | | | | Move the defitions of CLONE_NEWNS, CLONE_NEWUTS, CLONE_NEWIPC, CLONE_NEWNET, CLONE_NEWUSER, CLONE_NEWPID into namespace.h in case sched.h does not provide those definitions. Are there systems around that are old enough that still need this? Move the definitions of unshare() and setns() into namespace.h for supporting old versions of libc that does not provice these. I have tested this support with setns as I still have systems old enough that glibc does not wrap setns. Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
* build-sys: add files to distributionSami Kerola2013-01-101-0/+1
| | | | | | | To fix 'make distcheck' compilation. The fdisks/Makemodule.am has one new entry 'dos_part_types.h', the rest is about sorting the list. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* include/ttyutils: add default chardataWerner Fink2013-01-081-0/+24
| | | | | | | | | | | | this one moves the init_chardata to include/ttyutils.h as well as to lib/include/ttyutils.c. Also the macros CTL/CTRL are fixed in agetty.c and sulogin.c to use the XOR variant CTL. [kzak@redhat.com: use macro rather than global variable for default chardata] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* include: cleanup copyright headersKarel Zak2013-01-088-0/+50
| | | | | | | We use the code from include/ and lib/ on many places, so use public domain if possible or LGPL for code copied from libs. Signed-off-by: Karel Zak <kzak@redhat.com>
* include/bitopts: Use the operating system byteswapping functionsKarel Zak2013-01-081-63/+97
| | | | | | | The swap macros are already in libc. Co-Author: Cristian Rodríguez <crrodriguez@opensuse.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* build-sys: remove consoles.hKarel Zak2012-12-271-1/+0Star
| | | | | Reported-by: Bernhard Voelker <mail@bernhard-voelker.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* sulogin: remove consoles.c from libcommonKarel Zak2012-12-232-51/+9Star
| | | | | | | | - 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>
* sulogin: make usleep() workaround workWerner Fink2012-12-181-3/+7
| | | | | | Simply fix a compile problem found during debugging console.c Signed-off-by: Werner Fink <werner@suse.de>
* sulogin: use the linked lists from list.h for consoles listWerner Fink2012-12-181-2/+4
| | | | | | | | | | with this the double linked list feature from util-linux is used instead of the single linked list. [kzak@redhat.com: use list_last_entry() and list INIT macros] Signed-off-by: Werner Fink <werner@suse.de> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list: add list_last_entry()Karel Zak2012-12-181-2/+5
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* include/list: fix undefined behavior in list_entry() macroSami Liedes2012-12-171-2/+3
| | | | | | | | | | | | | Update list_entry() macro, which is basically the same as the container_of() macro in the kernel, to use offsetof() to fix undefined behavior. Caught using clang -fsanitize=undefined. [kzak@redhat.com: port from e2fsprogs] Signed-off-by: Sami Liedes <sami.liedes@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* lib/canonicalize: add canonicalize_path_restricted() to canonicalize without ↵Karel Zak2012-11-261-0/+1
| | | | | | suid permisssions 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>