Commit Graph

798 Commits

Author SHA1 Message Date
Johannes Nixdorf 70c364b4db build-sys: fix crypt() detection without -lcrypt
The check tested whether code using crypt() links without -lcrypt, but
didn't set have_crypt to yes if it succeeded.

This fixes the check erroneously failing when compiling against musl
libc.

Signed-off-by: Johannes Nixdorf <mixi@shadowice.org>
2019-01-23 12:20:47 +01:00
Karel Zak 8229ed2f5c build-sys: do not require crypt()
The function is necessary only for newgrp and sulogin.

Addresses: https://github.com/karelzak/util-linux/issues/584
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-03 11:23:33 +01:00
Karel Zak a68ed87ffe build-sys: do not require dirfd()
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>
2018-12-03 11:23:33 +01:00
Karel Zak 3001923ba1 build-sys: improve error message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-03 11:23:33 +01:00
Karel Zak 6df5acf970 lib/timer: add fallback if timer_create() not available
* add struct ul_timer as API abstraction to hide differences between
timer_create() and setitimer()

* add setitimer() detection to ./configure.ac

* add fallback code to use setitimer() if timer_create() not available
  (for example on OSX)

Addresses: https://github.com/karelzak/util-linux/issues/584
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-03 11:23:33 +01:00
Karel Zak 9a558f9cf6 build-sys: make sure HAVE_TIMER_CREATE defined
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-12-03 11:23:33 +01:00
Carlos Santos 9c7431fd18 build-sys: make fdisk, sfdisk, cfdisk optional (enabled by default)
Useful for embedded systems, on which only few utilities are required.

[kzak@redhat.com: - rename to --disable-fdisks
                  - use $enable_{c,s,}fdisk in code]

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-29 11:33:27 +01:00
Ruediger Meier 04ae85a7e5 hardlink: enable build with and without pcre2
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-11-12 19:40:33 +01:00
Karel Zak 06993ebb11 build-sys: release++ (v2.33)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-11-06 12:08:46 +01:00
Karel Zak 3f7e7e4d3c build-sys: release++ (v2.33-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-19 12:19:32 +02:00
Karel Zak 7a3b35b966 build-sys: add USE_LIBMOUNT_SUPPORT_NAMESPACES
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-10-05 11:02:26 +02:00
Karel Zak ed02256387 build-sys: release++ (v2.33-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-25 11:26:58 +02:00
Karel Zak f40e316f5e build-sys: default to /lib64 for ${exec_prefix}/lib64
We already default to /lib for the default $exec_prefix, but the current
configure does not care about /lib64 although the use-case is exactly
same as for /lib.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-09-04 11:42:19 +02:00
Karel Zak 75efef98d4 su: add --whitelist-environment
* usable with --login to whitelist specified environment variables

* the list is ignored for the core variables like HOME, SHELL, USER,
  LOGNAME and PATH (su --login always resets these variables)

Note that su(1) requires password and after successful authentication
user has full control over the session, so he can set arbitrary
environment variables. The whitelist makes things more user friendly
only.

The patch removes unnecessary optimization when allocate environ[]. It
seems better to keep all in glibc hands and just reset the environment
array only.

Addresses: https://github.com/karelzak/util-linux/issues/221
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-08-15 13:03:21 +02:00
Karel Zak 17666c8760 build-sys: add -Wdiscarded-qualifiers
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-20 12:15:31 +02:00
Karel Zak 4f9d999a97 build-sys: add -Wno-cast-function-type for python
libmount/python/pylibmount.c:158:19: warning: cast between incompatible function types
   from ‘PyObject * (*)(PyObject *)’ {aka ‘struct _object * (*)(struct _object *)’}
     to ‘PyObject * (*)(PyObject *, PyObject *)’ {aka ‘struct _object * (*)(struct _object *, struct _object *)’}
   [-Wcast-function-type]

This is generic problem in all Python C code and gcc v8. The another
possible (and probably more correct) way is to add unused argument to
all API functions. Unfortunately, this solution is pretty invasive. The
question is if gcc is not too paranoid in this case.

For more details see https://bugs.python.org/issue33012. It seems
Python guys also prefer CFLAGS modification for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-07-18 10:23:51 +02:00
Karel Zak 95a89bd313 build-sys: cleanup --with/--without help strings
--with-     means disabled by default or modify any default path
--without-  means enabled by default

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-03 10:16:11 +02:00
Karel Zak 7a95313c31 build-sys: --without-systemd disables --with-systemdsystemunitdir
Make sure --without-systemd disables also --with-systemdsystemunitdir.

Reported-by: L A Walsh <lkml@tlinx.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-05-03 09:56:35 +02:00
Karel Zak bf2603c73a build-sys: extend "Could not locate the pkg-config" error message
Addresses: https://github.com/karelzak/util-linux/issues/631
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-30 09:43:32 +02:00
Karel Zak 0dadc8bcf4 Merge branch 'choom' 2018-04-16 13:03:25 +02:00
Karel Zak 8fa223daba choom: new command to adjust OOM-killer score value
Let's provide command line tool, man page with OOM description and
bash-completion. It seems better than force end-users to use "echo"
to /proc.

Addresses: https://github.com/karelzak/util-linux/issues/609
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-04-16 12:53:39 +02:00
G.raud Meyer 0dba6b6f19 rename: test availability of __fpurge() and fpurge() 2018-04-09 17:21:17 +02:00
Karel Zak 475ecbad15 build-sys: release++ (v2.32)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-21 15:01:28 +01:00
Karel Zak a0357292b5 fstrim: fix fs.h and mount.h collision
Unfortunately, old version of the file linux/fs.h defines MS_*
macros, so the file cannot be included together with sys/mount.h.

We include sys/mount.h from libmount.h now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-20 11:42:34 +01:00
Karel Zak e04d89e95b build-sys: release++ (v2.32-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-03-01 14:15:49 +01:00
Karel Zak 2e20500a44 build-sys: forgot update NEWS for v2.32-rc1
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-02-22 13:04:46 +01:00
Ruediger Meier 73afd3f8e8 misc: fix typos using codespell
Some more funny typos, please review carefully.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-02-16 11:12:52 +01:00
Ruediger Meier 316795fcb3 build-sys: disable bz2 tarball and fix some am warnings
Nobody needs the .bz2 tarball. We dont't even upload it to
kernel.org.

BTW we fix dozens of these automake warnings:

    automake-1.13/am/ltlibrary.am: warning: 'libblkid.la': linking libtool libraries using a non-POSIX
    automake-1.13/am/ltlibrary.am: archiver requires 'AM_PROG_AR' in 'configure.ac'

So we can remove -Wno-portability. The only warning left is this
last GNU-make'ism which somebody may fix when reading it:

   sys-utils/Makemodule.am:191: warning: addprefix sys-utils/,$(SETARCH_LINKS: non-POSIX variable name
   sys-utils/Makemodule.am:191: (probably a GNU make extension)
   Makefile.am:90:   'sys-utils/Makemodule.am' included from here

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-02-15 21:30:32 +01:00
Mike Frysinger 2afbcec561 build-sys: (configure) fix bashisms
The `test` command only recognizes =, not ==.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2018-01-30 12:22:16 +01:00
Rafal Luzynski 4e12a62e88 cal: Use ALTMON_* correctly
cal: use ALTMON_* and _NL_ABALTMON_* constants to display
months in a standalone form correctly.  These constants have just
been newly added to glibc.  ALTMON_x has been used in BSD family
since 1990s and has been accepted as the future POSIX extension.
_NL_ABALTMON_* is exclusively a GNU extension but it is expected
to be added to POSIX in future.

More info: https://sourceware.org/bugzilla/show_bug.cgi?id=10871
2018-01-22 11:50:50 +01:00
Karel Zak cf9b16f1d4 build-sys: don't check for swapon() number of arguments
The syscall swapon() with two arguments is supported since Linux 1.3.2
and it's really long time ago... Let's assume that all libc header files
have been already fixed.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-18 13:57:20 +01:00
Karel Zak 4b328279ce build-sys: lsns requires libmount
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-27 17:44:43 +01:00
Masatake YAMATO 4195756e03 lsns: add netnsid column
Linux network subsystem assigns an unique integer to a network
namespace.

  term0# ip netns add UTIL-LINUX-LSNS-TEST-NS
  term0# ip netns list
  UTIL-LINUX-LSNS-TEST-NS
  term0# ip link add name lsns-vetha type veth peer name lsns-vethb
  term0 # ip link set lsns-vethb netns UTIL-LINUX-LSNS-TEST-NS
  term0# ip netns list
  UTIL-LINUX-LSNS-TEST-NS (id: 0)
  term0# ip link show dev lsns-vetha
  230: lsns-vetha@if229: <BROADCAST,MULTICAST> mtu 1500 qdisc noop ...
         link/ether 3e:27:68:ba:b3:95 brd ff:ff:ff:ff:ff:ff link-netnsid 0
In this example 0 is assigned to UTIL-LINUX-LSNS-TEST-NS net namespace.
The name, UTIL-LINUX-LSNS-TEST-NS, and it semantics is given and defined
by iproute2 in userland; and nothing to do with util-linux.

However, the id, 0, is managed in linux kernel. If lsns can show
the ids, it helps users understand the state of network namespaces.

This commit adds NETNSID column to the output.

Here is an example of session:

  term0# ip netns exec UTIL-LINUX-LSNS-TEST-NS cat

  (Open another terminal)

  term1# ./lsns --type net
          NS TYPE NPROCS   PID USER     NETNSID COMMAND
  4026531993 net     383     1 root  unassigned /usr/lib/systemd/...
  4026532433 net       1  1219 rtkit unassigned /usr/libexec/rtkit-daemon
  4026532562 net       1 18201 root           0 cat

0 is shown as NETNSID for the cat process.

For the initial name space, "unassigned" is printed.
For the namespaces other type than net, "n/a" is printed.
If an error occurred during getting the id, "n/a" is printed.

Changes in V2:

* Remove wrongly used & operators.
* Make netnsid field empty if value for the column is not available.
  Suggested by Karel Zak.
* Remove redundant condtion for checking the avaiablebility of netlink
  socket. Suggested by Karel Zak.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2017-11-27 15:54:49 +01:00
Karel Zak b97cc9a829 build-sys: add --enable-asan and --memcheck-asan for tests
The command ./configure --enable-asan adds -fsanitize=address
to the compiler command line. In the regression tests leaks detection
is disabled by default. You have to use --memcheck-asan on test
command line to enable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-11-23 14:59:05 +01:00
Karel Zak c08396c769 libmount: use eacess() rather than open() to check mtab/utab
The open() syscall is probably the most strong way how to check write
accessibility in all situations, but it's overkill and on some
paranoid systems with enabled audit/selinux. It fills logs with
"Permission denied" entries. Let's use eaccess() if available.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-20 12:37:04 +02:00
Karel Zak 27e66e59a3 build-sys: release++ (v2.31)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-19 13:08:49 +02:00
Karel Zak bb305629d7 build-sys: release++ (v2.31-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-10-03 17:53:33 +02:00
Karel Zak 47ba6dc411 build-sys: release++ (v2.31-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-22 12:03:15 +02:00
Karel Zak 271552c72a build-sys: make rfkill optional (and enabled by default)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-19 13:22:31 +02:00
Karel Zak ad442a818c build-sys: add libtinfow check
It seems some systems differentiate between tinfo and tinfow. And it
seems that mix ncursesw and tinfo (wide vs. non-wide char) is problem
for the systems.

Note that for example Fedora have ncursesw as well as ncurses, but
only one tinfo library. So, we need fallback this scenario.

Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-09-19 12:55:49 +02:00
Karel Zak 3d47ab0549 build-sys: add --disable-rfkill
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-31 11:40:51 +02:00
Sami Kerola b3849c66d3
rfkill: use libsmartcols output
This also makes the rfkill to output status when executed without arguments.
That is believed ot be more useful than usage() output.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Sami Kerola 367f40806e
rfkill: make programming style to match util-linux project
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>
2017-08-30 20:32:48 +01:00
Sami Kerola c0d78c90be
rfkill: make command to build in util-linux project
After this commit the command merely builds, but does not confirm style used
in util-linux project.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-08-30 20:32:48 +01:00
Karel Zak 49a3d609ed build-sys: define dependence between chsh and getusershell 2017-08-30 11:30:41 +02:00
Karel Zak 87c26ce5b6 build-sys: support ncursesw without headers in ncursesw/ directory
Let's check always for alone ncurses.h and term.h if the preferred
variant with ncursesw/ subdirectory is not available.

The patch also minimize number of HAVE_...NCURSES_H macros in
config.h. We don't need to check for ncurses.h if ncurses/ncurses.h is
available.

Reported-by: Carlos Santos <casantos@datacom.ind.br>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-08-01 14:36:25 +02:00
Andreas Henriksson 8df545592d build: use --runstatedir instead of --localstatedir
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 07a16b9d1e
   "build-sys: change --localstatedir to /run"
 * commit 80c51185d5
   "uuidd: use run configured state directory"
 * commit 01c5b78794
   "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>
2017-07-31 15:24:46 +02:00
Andreas Henriksson c9ab738706 whereis: include native multiarch path in lib search paths
This includes atleast the native multiarch path in the paths to search.
(Maybe also other multiarch paths should also be searched? But atleast
this is a first step.)

Before this change (on Debian):
$ whereis libc
libc: /usr/share/man/man7/libc.7.gz

After this change:
$ whereis libc
libc: /usr/lib/x86_64-linux-gnu/libc.so /usr/lib/x86_64-linux-gnu/libc.a /usr/share/man/man7/libc.7.gz

Addresses: https://bugs.debian.org/856968
Signed-off-by: Andreas Henriksson <andreas@fatal.se>
2017-07-31 13:48:04 +02:00
Sami Kerola 31f85fce55
ldattach: simplify debugging function when vwarnx(3) is available
The vwarnx(3) is probably not available in all libc implementations, in such
cases use the earlier printout as a fallback.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-07-15 22:02:53 +01:00
Sami Kerola 8e58889065
reset: remove script from the package
This script requires ncurses to work, and the ncurses provides reset so
there should not be need to keep this script hanging around.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-07-15 22:02:53 +01:00
Karel Zak d9921b2a12 wipefs: use libsmartcols
The old output is horrible and useless when more devices specified.
The old format is also too tricky if more signatures detected. The new
output uses one line for each signature, prefixed by device name.

For example my workstation:

	# wipefs /dev/sda* /dev/sdb*
	DEVICE OFFSET       TYPE UUID                                 LABEL
	sda    0x1fe        PMBR
	sda    0x37e4895e00 gpt
	sda    0x200        gpt
	sda1   0x1fe        vfat F2BC-BFEC                            EFI
	sda1   0x0          vfat F2BC-BFEC                            EFI
	sda1   0x36         vfat F2BC-BFEC                            EFI
	sda2   0x438        ext4 c5490147-2a6c-4c8a-aa1b-33492034f927 BOOT
	sda3   0x438        ext4 196972ad-3b13-4bba-ac54-4cb3f7b409a4 HOME
	sda4   0x438        ext4 d834bc84-0089-4be1-9013-cd8bf35d5ffa ROOT
	sda5   0x438        ext4 e8ce5375-29d4-4e2f-a688-d3bae4b8d162 WINE
	sda6   0xff6        swap 210337c6-f8b5-4d65-aab5-a0f343fa9ad4 SWAP
	sdb    0x200        gpt
	sdb    0x1fe        dos
	sdb1   0x438        ext4 6467a684-0d10-4f61-a301-67bb26934d90

This patch add --noheadings, --json and --output.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-29 11:59:38 +02:00
Sami Kerola 83893f2678 uuidparse: add new command
This command will analyze and print information about UUID's.  The command
is based on libuuid/src/uuid_time.c but modified to use libsmartcol.

[kzak@redhat.com: - minor coding style changes]

Reference: http://marc.info/?l=util-linux-ng&m=149735980715600&w=2
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-26 14:46:35 +02:00
Karel Zak dd9bae58ae build-sys: release++ (v2.30)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-06-02 12:22:29 +02:00
Karel Zak 3947ca4ca9 build-sys: ncurses headers cleanup
* assume ncursesw headers in ncursesw/ directory only
* prefer long paths, <term.h> and <ncurses.h> should be last
  possibility
* fix typos

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-31 11:01:46 +02:00
Karel Zak 8a931412e3 build-sys: require kernel headers on Linux
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-31 09:35:32 +02:00
Karel Zak 3cc8a9f42a build-sys: make ncurses detection more robust
It seems Debina 8 is a little bit incompatible with us:

* ncurses-config is packaged in ncurses-bin where is *no* any
  development files! It means the script returns paths to not installed
  files (IMHO packaging bug)

  Fixed, we need to check for header files too.

* term.h is "everywhere" on Fedora:

	<term.h>
	<ncurses/term.h>
	<ncursesw/term.h>

  Debian is more strict and uses <ncurses[w]/term.h> only.

  Fixed, we need #ifdef storm to use the correct path

 * libtinfo-dev does not contains any header files

 Fixed, we have to always require installed ncurses devel stuff to compile,
 but we can link with -ltinfo only (cal, ul, more, ...)

 * we don't use termcap for more(1)

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-30 17:08:36 +02:00
Karel Zak 47cd0ae081 build-sys: release++ (v2.30-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-23 12:20:27 +02:00
Karel Zak c604411fdf build-sys: release++ (v2.30-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-12 13:33:41 +02:00
Karel Zak f69eba1734 build-sys: add AC_STRUCT_TIMEZONE
new datetime parsing code assumes macros:

	lib/parse-date.c : HAVE_STRUCT_TM_TM_ZONE
	lib/parse-date.c : HAVE_TZNAME

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-12 11:16:56 +02:00
Karel Zak 8b7f00a8bb build-sys: fix lsmem dependence
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-03 12:00:20 +02:00
Karel Zak 38d691921c column: split old and new code
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-05-02 12:17:59 +02:00
Sami Kerola 70ca1a7772
tailf: remove deprecated utility
March 2017 is gone, it is time to remove this utility as scheduled in
earlier commit, and promised in manual page.

Reference: 3f8478a71c
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-04-02 16:51:00 +01:00
Karel Zak 3e37d7b773 fincore: use libsmartcols
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-23 14:09:20 +01:00
Masatake YAMATO a921a7dea9 fincore: new command for counting pages of file contents in core
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-03-23 12:46:09 +01:00
Karel Zak 30d7f61f4f build-sys: add parse-date.y
* 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>
2017-03-04 11:01:56 -05:00
Karel Zak 22fae330d9 blkreport, blkreset: remove in favour of blkzone
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 17:03:26 +01:00
Karel Zak 1ad8ef9187 blkzone: add new command (merge blkreport and blkreset)
This new command is based on the original implementation of blkreport
and blkreset command.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-23 16:43:51 +01:00
Karel Zak fc72f51e1f build-sys: simplify UL_ENABLE_ALIAS() semantic
Let's follow only $enable_ variables. In this case the MASTERNAME
(e.g. [schedutils] for --enable-schedutils) has to be without
UL_BUILD_INIT.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-21 11:00:19 +01:00
Karel Zak 6f2eb03433 build-sys: fix --disable-all-programs --enable-schedutils
* add UL_ENABLE_ALIAS(NAME, MASTERNAME) to initialize $enable_<name>
  according to MASTERNAME. Note that we have to use $build_<mastername>,
  the $enable_<mastername> is just AC_ARG_ENABLE() stuff only. The
  $build_ is evaluated and modified by our UL_...() functions.

* add enable-schedutils.conf to have build-system regression test for
  this use-case

Addresses: https://github.com/karelzak/util-linux/issues/415
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-20 14:17:37 +01:00
Shaun Tancheff 70bb534511 blkzonecmd, blkreport: Add new commands for ZAC/ZBC drives
This patch adds:
 - blkreset to issue Reset (Write Pointer) zone commands
 - blkreport to retrieve drive zone information

[kzak@redhat.com: - cleanup man page and usage()
                  - remove command line options aliases,
                  - use strtosize_or_err()
                  - remove unnecessary -ludev
                  - use blkdev.h stuff]

Signed-off-by: Shaun Tancheff <shaun@tancheff.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-02-09 13:19:44 +01:00
Karel Zak 1dc2aaadba Merge branch 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit
* 'hwclock-jwp-reviewed' of git://github.com/kerolasa/lelux-utiliteetit: (25 commits)
  hwclock: remove --compare option
  hwclock: remove trailing dot from messages that include system error message
  hwclock: make --date=argument less prone to injection
  hwclock: fix rtc atexit registration
  hwclock: clarify cmos inb and outb preprocessor directives
  hwclock: try RTCGET and RTCSET only when normal rtc fails
  hwclock: stream line synchronize_to_clock_tick_rtc()
  hwclock: improve coding style
  hwclock: remove division by zero [asan]
  hwclock: add debugging to open_rtc()
  hwclock: remove magic constants from interpret_date_string()
  hwclock: use symbolic magic values passed in between functions
  hwclock: initialize struct adjtime members
  hwclock: alloate date_resp parsing buffer in interpret_date_string()
  hwclock: simplify save_adjtime() execution flow
  hwclock: remove dead code and other minor fixes
  hwclock: move error messages to determine_clock_access_method()
  hwclock: clarify set_cmos_epoch() code
  hwclock: move command-line options to control structure
  hwclock: remove unnecessary type casts
  ...
2017-02-09 11:35:50 +01:00
Carlos Santos 4953018e23 build-sys: improve detection of the "isnan" function in uClibc
Since commit beceb14b45, MATH_LIBS is set
to "-lm" when the isnan function is detected. In uClibc, however, isnan
is a macro that calls __isnan, __isnanf, or __isnanl, depending on the
size of the argument (double, float or long double).

Fixes:
  http://autobuild.buildroot.net/results/2c2/2c29a78ed81ca844a87dcd076ab3e14ea080296d/
  http://autobuild.buildroot.net/results/404/404b10f359b2ae8a7216729fa1bab37fed2d3d4c/

Signed-off-by: Carlos Santos <casantos@datacom.ind.br>
2017-02-09 11:31:49 +01:00
Sami Kerola b72a75e993
lib: add timegm() portability function to lib/timeutils.c
Local timegm() is a replacement function in cases it is missing from libc
implementation.  Hopefully the replacement is never, or very rarely, used.

CC: Ruediger Meier <ruediger.meier@ga-group.nl>
Reviewed-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-02-03 22:31:18 +00:00
Denis Chaplygin 833f9a7aae fallocate: Added posix_fallocate() support.
No all filesystems support Linux fallocate. The new option allow use
posix implementation if necessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-31 12:51:28 +01:00
Karel Zak feda4342df build-sys: use -lm for scriptreplay if necessary
Reported-by: Bert van Hall <bert.vanhall@avionic-design.de>
Addresses: https://github.com/karelzak/util-linux/pull/397
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-01-18 13:17:21 +01:00
Sami Kerola 875834381d newgrp: use libc explicit_bzero() when it is available
This currently new function will be part of glibc 2.25.

Reference: https://sourceware.org/git/?p=glibc.git;a=commit;h=ea1bd74defcf9d5291d14972e63105168ca9eb4f
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2017-01-16 12:30:09 +01:00
Karel Zak 963f7dfb82 Merge branch 'getrandom' of git://github.com/kerolasa/lelux-utiliteetit
* 'getrandom' of git://github.com/kerolasa/lelux-utiliteetit:
  lib/randutils: use getrandom(2) when it is available
2016-12-22 15:27:25 +01:00
Sami Kerola cc01c2dca4
lib/randutils: use getrandom(2) when it is available
System call getrandom(2) is relatively new, available since kernel 3.17 but
not supported by glibc 2.24.  That in mind autotools is made to check
availability of this function and keep old code as fallback.  It is
reasonable assume it will take years before the syscall(2) and fallback are
unproblematic to remove.

One might ask why bother using getrandom(2).  Main reason is to avoid
unnecessary system calls to achieve exactly same end result.  That
demonstrated with 'strace -c ./mcookie' showing 36 calls before, and 32
after this change.  Secondly the getrandom(2) function got to kernel with
promise it can be used to avoid file descriptor run down, and since uuidd
uses random_get_bytes() it should fulfill it's promise here.

Reference: http://man7.org/linux/man-pages/man2/getrandom.2.html
Reference: https://lwn.net/Articles/606141/
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-12-11 11:46:54 +00:00
Karel Zak 0a14cc8bcc libmount: revert X-* and x-* meaning
Let's hope this is last change necessary to cleanup x-* usage:

  x-*  persistent option, stored in utab, available for umount, etc.
  X-*  fstab comment only

mount(8) supports x-mount.mkdir= as well as newly recommended X-mount.mkdir=

Advantages:

 * less invasive
 * does not require exception for x-systemd
 * does not require rename x-initrd to X-initrd

The systemd and dracut users will get the new (=fixed) functionality without a
change in fstab configuration. This is the primary goal.

Disadvantages:

 * not 100% compatible libmount behavior, x-* options have not been
   previously stored in utab. The API is the same, options will be still
   available, but on x-* libmount will write to /run/mount/utab. For now
   it seems only systemd uses x-*, and they like this behavior, so...

Addresses: https://github.com/systemd/systemd/pull/4515
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-09 15:36:14 +01:00
Karel Zak 5c493bd92f libmount: use x-systemd options as X-*
The previous patch introduces X-* options namespace for options
that have to be maintained in user space.

Unfortunately, systemd users already use mount options that are
necessary by umount or another operations. The conclusion from
discussion with systemd guys is to store all the systemd options
in userspace.

It seems better to add one line exception to libmount than force all
fstab users to rename x-systemd to X-systemd.

Addresses: https://github.com/systemd/systemd/pull/3904
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-12-08 15:27:24 +01:00
Ruediger Meier 809869ca8c build-sys: disable tailf by default
It's deprecated since 3f8478a7, so we shouldn't build it by default.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 77835be273 agetty: re-add utmp.h for Debian GNU/kFreeBSD
It's needed there to get login_tty(). On normal FreeBSD we would
need libutil.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 227ebea75c build-sys: check for POSIX utmpx usage
We simply check for utmpxname and updwtmpx functions to disable
all programs which are not POSIX utmpx compatible, even though
last(1) and utmpdump(1) does not use them, see below.

utmpx.h is used in:
  login agetty write lslogins last runuser su utmpdump wall

Non-Posix utmpx usage:
   utmpxname        -> login agetty write lslogins
   updwtmpx         -> login agetty                     runuser su
   _PATH_.TMP       -> login agetty write lslogins last runuser su
   utmpx.ut_addr_v6 -> login                       last            utmpdump

POSIX utmpx usage:
   wall

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier b4b919fe5e login-utils: switch to utmpx.h
Now the build will fail on many non-Linux systems because
utmpx.h is available everywhere but we still use non-POSIX
features. We'll fix this next commit.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 81580f79fa agetty: remove obsolete HAVE_UPDWTMP fallback
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier 6578ced75c login: re-add lastlog.h header
This include was removed in a365953a but we will need it again
when we move from utmp.h to utmpx.h.

On Linux (glibc, musl) the struct lastlog is defined in utmp.h
and lastlog.h just includes utmp.h.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>

Conflicts:
	login-utils/login.c

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-12-07 12:35:24 +01:00
Ruediger Meier a341a5e2e4 build-sys: cosmetics, avoid useless m4 quotes
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 12:42:11 +01:00
Ruediger Meier 0f0972ac6b build-sys: cosmetics PACKAGE_VERSION_MINOR
This should changes nothing.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier b5511797f2 build-sys: update package release number during development
Now we use
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.5)
instead of
   v2.29-5-g8ffab30  -> 2.29.5-8ffa   (libblkid 2.29.0)

otherwise the bugfix releases (2.29.1) would look newer that latest HEAD.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Ruediger Meier c42a6d4d34 build-sys: fix empty package release number
Was broken for major releases since b0e6b25e:
  $ blkid -V
  blkid from util-linux 2.28  (libblkid 2.28., 12-Apr-2016)

Now we also set 0 in this case, like:
  $ blkid -V
  blkid from util-linux 2.30  (libblkid 2.30.0, 12-Apr-2016)

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-11-29 10:47:11 +01:00
Karel Zak bdfe4601c3 build-sys: mark lsmem and chmem as Linux only
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-09 10:02:32 +01:00
Heiko Carstens 30e1ea8ba1 chmem: new tool
Move the s390 specific chmem tool to util-linux.

The chmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html

Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.

This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.

The chmem tool can be used to set memory online or offline. This can
be achieved by specifying a memory range:

Memory Block 19 (0x0000000130000000-0x000000013fffffff) disabled

or by specifying a size where chmem will automatically select memory
blocks:

Memory Block 21 (0x0000000150000000-0x000000015fffffff) disable failed
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled

or by specifying memory block numbers instead of address ranges:

Memory Block 15 (0x00000000f0000000-0x00000000ffffffff) disabled
Memory Block 16 (0x0000000100000000-0x000000010fffffff) disabled
Memory Block 17 (0x0000000110000000-0x000000011fffffff) disabled
Memory Block 18 (0x0000000120000000-0x000000012fffffff) disabled

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-11-09 10:02:32 +01:00
Heiko Carstens cad2d1ac92 lsmem: new tool
Move the s390 specific lsmem tool to util-linux.

The lsmem tool was originally written in perl and is part of the
s390-tools package which can be found here:
https://www.ibm.com/developerworks/linux/linux390/s390-tools.html

Given that the tool is architecture independent, there is no reason to
keep it in an s390 specific repository. It seems to be useful for
other architectures as well.

This patch converts the tool to C and adds it to util-linux, while the
command line options stay compatible. The only exception is the option
"-v" which used to be the short form of "--version". That got changed
to "-V" so it behaves like most other tools contained within
util-linux.

The lsmem tool inspect the contents of /sys/devices/system/memory and
prints a summary output similar to what lscpu does:

RANGE                                 SIZE STATE   REMOVABLE BLOCK
0x0000000000000000-0x000000005fffffff 1,5G online  yes       0-5
0x0000000060000000-0x000000007fffffff 512M online  no        6-7
0x0000000080000000-0x000000013fffffff   3G online  yes       8-19
0x0000000140000000-0x000000014fffffff 256M offline -         20
0x0000000150000000-0x000000017fffffff 768M online  no        21-23

Memory block size   :     256M
Total online memory :     5,8G
Total offline memory:     256M

In order to keep the output small the tool merges subsequent address
ranges where the attributes are identical. To avoid merging of line
the "-a" option can be used.

The lsmem tool also has "--extendend" and "--parsable" option which
can be used to customize the output, e.g.  limit the output to
specified columns. This is quite similar to what the lscpu tool does.

This is based on a patch from Clemens von Mann.

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
2016-11-09 10:02:32 +01:00
Karel Zak 5bd2b14de4 build-sys: release++ (v2.29)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-11-08 11:35:40 +01:00
Ruediger Meier 4b439e2d00 build-sys: fix missing ncursesw message
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-10-20 18:32:21 +02:00
Karel Zak e5cc93b5a8 build-sys: use ncurses-config rather than pkg-config
It's painful, but ncurses upstream does not distribute .pc files by
default and it seems that ncurses{6,5}-config is the preferred solution.

For better compatibility lets use ncurses-config.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-20 16:52:31 +02:00
Karel Zak d7b32ebe12 build-sys: release++ (v2.29-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-10-19 14:33:55 +02:00
Karel Zak 23f7509326 Revert "su,runuser: add libseccomp based workaround for TIOCSTI ioctl"
This reverts commit 8e49250168.

Stupid hack...
2016-10-03 16:56:56 +02:00
Karel Zak 37301faa01 build-sys: release++ (v2.29-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-30 11:24:42 +02:00
Karel Zak 8e49250168 su,runuser: add libseccomp based workaround for TIOCSTI ioctl
This patch add libseccomp based syscalls filter to disable TIOCSTI
ioctl in su/runuser children.

IMHO it is not elegant solution due to dependence on libseccomp
(--without-seccomp if hate it)... but there is nothing better for now.

Addresses: CVE-2016-2779
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-29 16:32:33 +02:00
Karel Zak 169b4a8cd5 findmnt: (verify) add source verification
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-09-23 13:21:02 +02:00
Karel Zak f319e301a9 build-sys: add parisc to define ARCH_
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-08-16 13:39:07 +02:00
Sami Kerola 00971cca8a
pg: stop building the command by default
The pg command is marked deprecated in POSIX since 1997, and this project
has thought the same since Feb 2013.  Time has come to stop shipping this
binary by default.

Reference: 956e582874
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-08-14 13:30:36 +01:00
Karel Zak 3d7cad18e7 build-sys: remove global dependence between widechar and ncursesw
It seems that globally defined dependence between ncursesw and
wide-char support is overkill, because in some cases (e.g. cal(1)) we
can use ncurses independently on wide-char support.

It would be better to care about relation between wide-char and
ncurses individually (per util).

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-09 12:39:44 +02:00
Karel Zak db4e264574 build-sys: workaround for autoconf "present but cannot be compiled"
See also:
https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Present-But-Cannot-Be-Compiled.html

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 13:38:48 +02:00
Karel Zak dfe177dadb build-sys: add non-action for ncurses pkg-cong test
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 12:24:10 +02:00
Karel Zak 18dae5d879 build-sys: clean up relation between ncurses[w] and wide-char support
* error if wide-char enabled/supported, but (non-wide) ncurses
  explicitly requested

* disable ncurses at all if widechar enabled/supported, but ncursesw
  not found

Reported-by: Stanislav Brabec <sbrabec@suse.cz>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 12:03:15 +02:00
Karel Zak 4ffcc7a93e build-sys: cleanup --with-ncurses
* don't use UL_CHECK_LIB(), only use pkg-config to avoid complexity

 * split --with-ncursesw and --with-ncurses; ncurses (widechar) is the
   default, check for ncurses only if ncursesw disabled/unavailabled

 * don't use generic placeholders, just have_ncursesw and have_ncurses

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-08 11:31:31 +02:00
Waldemar Brodkorb bac7fbdb2d build-sys: fix uClibc-ng scanf check
uClibc-ng tries to be compatible with GNU libc and defines
__GLIBC__ and pretend to be version 2.2.
We once changed it to 2.10, but then some hard to fix problems
in different software packages (gcc) occured.
It would be better if we disable the special GNU libc checks
for uClibc-ng here. uClibc-ng implements the required scanf
functionality.

Signed-off-by: Waldemar Brodkorb <wbx@uclibc-ng.org>
2016-06-06 10:04:25 +02:00
Karel Zak d67f61c06d build-sys: use UL_DEFAULT_ENABLE() only for programs
The UL_DEFAULT_ENABLE modifies $enable_<name> according to the global
--enable-all-programs. This makes sense only for programs, but not for
any built-in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-03 13:42:40 +02:00
Karel Zak 4cb6fea5cc build-sys: add --disable-widechar
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-06-03 13:41:51 +02:00
Karel Zak 1eb16fd780 build-sys: add --disable-plymouth-support
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>
2016-05-26 15:08:53 +02:00
Sami Kerola cf582a2e86
build-sys: test functions does not return void
Found using scan-build.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-04-19 21:27:54 +01:00
Karel Zak e778642a9e libmount: don't support /etc/mtab by default
The file mtab is evil and already unused by mainstream distributions.

Now libmount is able to detect mtab->/proc/mounts and use
/proc/self/mountinfo if necessary. This heuristic seems overkill in
many cases. It's also dangerous on systems where mountinfo is strongly
required (systemd based distros).

This patch #ifdefs mtab code and forces libmount to always use
/proc/self/mountinfo.

The new configure option --enable-libmount-support-mtab is necessary
to enable old behavior to support mtab.

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-14 14:26:54 +02:00
Ruediger Meier 3e584e8576 build-sys: add --enable-libuuid-force-uuidd
To build libuuid with uuidd support even though the daemon is
disabled (--disable-uuidd).

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-04-14 12:56:12 +02:00
Karel Zak 44338f7fe6 build-sys: release++ (v2.28)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-12 12:33:03 +02:00
Mike Frysinger 801afcb09b build-sys: fix cap-ng configure flag handling
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2016-04-12 11:33:15 +02:00
Ruediger Meier 50e6f15bb3 build-sys: add --disable-logger and --disable-lslogins
Now we are able to disable all programs which have systemd/journald
support. This feature is needed by openSUSE packagers who are building
util-linux in 2 stages to avoid build cycles.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-04-06 13:46:34 +02:00
Karel Zak 30fbf2f679 getopt: make sure setprogname provided by non-Linux system
based on suggestion from Ruediger Meier.

Reported-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-04-04 10:41:37 +02:00
Karel Zak 50359e9794 build-sys: happy new year...
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-29 12:52:15 +02:00
Karel Zak fb637d6d09 build-sys: release++ (v2.28-rc2)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-29 10:47:40 +02:00
Ruediger Meier 651b25cd7f build-sys: improve uuidd and script build conditions
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-13 21:48:16 +01:00
Ruediger Meier 18336d16d9 build-sys: use AC_PROG_MKDIR_P and remove a few gnuisms
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-13 21:48:09 +01:00
Ruediger Meier 9dd55a048e build-sys: add missing "not found" strings
Otherwise configure output looks like this:
  configure: WARNING:  not found; not building cfdisk

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-13 21:48:06 +01:00
Ruediger Meier 544d406921 build-sys: fix again UL_SCANF_TYPE_MODIFIER
This reverts commit c8494d88:
  "build-sys: fix UL_SCANF_TYPE_MODIFIER for icc"

plus fix the check prog, because it found "%as" to be valid on
systems where "%a" is used for float conversion.

icc warns about "%ms" but it works anyways. Our AC_RUN_IFELSE prog
should do it right now regardless of compiler warnings.

Note "%ms" is POSIX.1-2008 standard but still not available on
many systems. Maybe it's time to remove "%as" fallback for old
glibc which is even less portable.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-13 21:47:57 +01:00
Karel Zak 8c97556ecf build-sys: release++ (v2.28-rc1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-03-11 11:41:05 +01:00
Ruediger Meier dc0495166f build-sys: add and use openat build conditionals
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-03-07 15:37:25 +01:00
Ruediger Meier 4d751c008e lib: provide fallback if mkostemp(3) missing
It's missing on OSX.

CC: Yuriy M. Kaminskiy <yumkam@gmail.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:18 +01:00
Ruediger Meier ee20c303ac build-sys: chrt requires a sched_set* function
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:15 +01:00
Ruediger Meier 42a4a15250 build-sys: add --disable-ipcrm --disable-ipcs
ipcs's source history looks like some people are using it on BSD
but it won't build on most non-Linux systems. That's why it's nice
let "./configure --disable-ipcrm --disable-ipcs" work.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:11 +01:00
Ruediger Meier d00c10edb8 build-sys: disable login-utils if shadow.h or utmp.h is missing
Actually we could have also used UL_REQUIRES_LINUX because our
utmp usage and the shadow.h header is unlikely to be portable.
However only requiring these headers may help others who are
curious what needs to be done to port something.

Note, we could easily make the utmp stuff more portable by using
utmpx which is POSIX standard and on LINUX (glibc) basically just
renaming work. See getutxent(3).

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:08 +01:00
Ruediger Meier c12fc5e1cd build-sys: build_init should check for flock
To let a plain ./configure work on systems without create_timer().
see 254743e4

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:05:03 +01:00
Ruediger Meier eaac9f88f9 misc: fix some includes
features.h:  any glibc header includes this already
libgen.h:    was unused there
sys/uio.h:   for writev(3p)
sys/queue.h  seems like it was never used

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-29 13:04:56 +01:00
Ruediger Meier 2013b33f40 build-sys: disable unused parameter warnings for some test progs
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-23 03:20:22 +01:00
Romain Naour 7944a03cef build-sys: fix typo
When timer_create is available have_timer must be
set to "yes". But instead have_time is used.

Replace have_time by have_timer.

Fixes:
http://autobuild.buildroot.net/results/993/9935cd0522d4f978ba2e788a690f66790686b76b

Signed-off-by: Romain Naour <romain.naour@gmail.com>
2016-02-22 09:50:22 +01:00
Ruediger Meier ac1c53e451 lib: fix ismounted includes for FreeBSD
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:32 +01:00
Ruediger Meier 66daee0765 include: check for sys/sysmacros.h
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:17 +01:00
Ruediger Meier 40733239a7 include: provide MAP_ANONYMOUS on OSX
Hope there are no side effect when defining _DARWIN_C_SOURCE
globally.

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 16:54:05 +01:00
Ruediger Meier 3719bf8de9 build-sys: check linker support for version scripts
The macro AX_CHECK_VSCRIPT was taken from gnu autoconf archive.
http://www.gnu.org/software/autoconf-archive/

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2016-02-18 12:53:48 +01:00
Filipe Brandenburger 324330aca6 build-sys: Properly order install dependencies of pylibmount
Introduce a dependency so that libmount.so is installed before
pylibmount.so, so that when libtool tries to relink it, it can find
libmount.so in the destdir.

We introduce this additional make rule through an AC_SUBST variable, to
prevent automake from trying to interpret that.  This trick has been
suggested in http://stackoverflow.com/a/8643550.

This fixes a failure of `make install DESTDIR=...` when trying to relink
pylibmount against libmount.la.  libtool will look for libmount.so under
${DESTDIR}/${libdir} in that case, but if it is not yet present there,
libtool assumes it is a system installed library and use -lmount
instead, which causes the following failure if libmount is not installed
on the base system yet:

  libtool: install: warning: relinking `pylibmount.la'
  libtool: install: (... libtool --mode=relink gcc -o pylibmount.la \
        -rpath /usr/lib/python2.7/dist-packages/libmount \
        libmount/python/*.lo libmount.la ... -lpython2.7 \
        -inst-prefix-dir /path/to/destdir)
  /usr/bin/ld: cannot find -lmount
  collect2: error: ld returned 1 exit status
  libtool: install: error: relink `pylibmount.la' ...
  make[3]: *** [install-pylibmountexecLTLIBRARIES] Error 1

This seems to be a previously encountered issue, since automake includes
a hack to insert such a dependency rule to install all libLTLIBRARIES
before attempting to install binPROGRAMS, initially introduced in the
commit below:
http://git.savannah.gnu.org/cgit/automake.git/commit/?id=bd4a1d5ad1a72fa780a8b7fd6c365a5dad2e6220

Also related bug from Ubuntu tracker:
https://bugs.launchpad.net/ubuntu/+source/util-linux/+bug/1442076

Tested that `make install` starts working again after this commit, even
when libmount-dev is not installed on the system.  Also confirmed that
`make distcheck` is now functional.

Confirmed that the all the files expected in the Python directory (both
__init__.py and pylibmount.so) are present after an install.

Tested that parallel install works, the dependency is always respected
since it's explicit.

Inspected the generated Makefile and confirmed that the definition of
install-pylibmountexecLTLIBRARIES (generated by automake) and the
explicit dependency we introduced are both present.

Signed-off-by: Filipe Brandenburger <filbranden@google.com>
2016-02-05 11:03:09 -08:00
Lada Trimasova bf6be9f523 buildsys: fix static configuration and building
In case of uClibc librt depends on libpthread. In particular
timer_create() function uses pthread_XXX(). That means in case of static
builds it's required to link not librt alone but together with libpthread. So
if checking timer_create function in librt fails, it is necessary to check if
timer_create function successfully links with "-lpthread".

That issues was spotted in Buldroot autobuilder failures:
http://autobuild.buildroot.net/results/759/75960db671807091fe9155aee9e46a6245e32590/
http://autobuild.buildroot.org/results/112/112e8b85783f5aaba42a937a6eb064317615a21b/

Signed-off-by: Lada Trimasova <ltrimas@synopsys.com>
2016-01-26 18:34:50 +03:00
Karel Zak 5a9713293d libmount: consolidate btrfs stuff, make it more portable
- add --with-btrfs (enabled by default)
- check for linux/btrfs.h
- add "btrfs" to libmount features list (see mount -V)
- #ifdef HAVE_BTRFS_SUPPORT for all btrfs stuff in libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-26 14:39:13 +01:00
Sami Kerola b4566a8a8d build-sys: remove libtermcap support
It is unlikely anyone is going to build this project on system where
libtermcap is available.  Fedora project obsoleted libtermcap 2007-12-12 in
favour of ncurses.  Debian made same move 2005.

Reference: https://fedoraproject.org/wiki/Deprecated_packages
Reference: https://www.debian.org/doc/manuals/debian-faq/ch-compat.en.html#s-termcap
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2016-01-26 11:45:14 +01:00
Karel Zak 2f09ae9d5d libsmartcols: add samples directory
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-25 13:17:43 +01:00
Karel Zak 15167589fb chrt: use sched_setattr() if available
Signed-off-by: Karel Zak <kzak@redhat.com>
2016-01-20 12:44:27 +01:00
Karel Zak f07a82c9d8 build-sys: fix typo and more all RT to the same place
typo : s/timer_createx/timer_create/

Signed-off-by: Karel Zak <kzak@redhat.com>
2015-12-08 11:52:13 +01:00
Sukadev Bhattiprolu bd9b94d12a lscpu: Print physical cpu information
lscpu currently prints information for CPUs configured in the system.
In case of KVM or other virtualized guest operating systems, this
refers to the virtual system, and bears no relation to the physical
topology of the system.

It would be useful if lscpu could also display the physical topology
info when available:

	$ ./lscpu
	Architecture:          ppc64le
	Byte Order:            Little Endian
	CPU(s):                16
	On-line CPU(s) list:   0-15
	Thread(s) per core:    1
	Core(s) per socket:    1
	Socket(s):             16
	NUMA node(s):          1
	Model:                 IBM pSeries (emulated by qemu)
	Hypervisor vendor:     KVM
	Virtualization type:   para
	L1d cache:             64K
	L1i cache:             32K
	NUMA node0 CPU(s):     0-15
	Physical sockets:      2		<<< New
	Physical chips:        4		<<< New
	Physical cores/chip:   4		<<< New

For now, physical topology information is available on platforms that
support the following RTAS (Real time abstraction service) call provided
by librtas:

	rtas_get_sysparm(PROCESSOR_MODULE_INFO).

Currently this call is available to the PowerVM (pHYP) guests on PowerPC.
With a patch propoosed to PowerKVM, this RTAS call would also be available
to PowerKVM guests.

Based on input from Nishanth Aravamudan and Karel Zak.

Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
2015-12-02 11:33:58 +01:00
Karel Zak 8a2045620e lsns: new command
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-26 14:09:45 +01:00
Casper Ti. Vector e52b58e627 ctrlaltdel: use reboot() provided by libc, assuming it is 1-adic. 2015-11-19 12:07:04 +01:00
Karel Zak b0e6b25e64 build-sys: bump also PACKAGE_VERSION_RELEASE number
Now we bump only PACKAGE_VERSION_MAJOR and PACKAGE_VERSION_MINOR
numbers. The PACKAGE_VERSION_RELEASE is always zero.

These numbers are used for LIBxxx_VERSION strings and Version: field
in the .pc files.

Unfortunately, if we keep PACKAGE_VERSION_RELEASE= always zero then
our bugfix releases are invisible for pkg-config.

(Although I don't think it's good idea to depend in code on any
 library bugfix release, code should be about APIs).

Addresses: https://github.com/systemd/systemd/pull/1754
Signed-off-by: Karel Zak <kzak@redhat.com>
2015-11-04 17:19:41 +01:00