From 846ade0088cf0e073650a7a5b2404be56a421934 Mon Sep 17 00:00:00 2001 From: Umer Saleem Date: Mon, 25 Apr 2022 16:58:54 +0500 Subject: [PATCH] ZFS send: Fix -V operation for Linux ZFS send -V sets a per second progress report as process title. For Linux, this functionality depends on libbsd-dev. Adding this library fixes the report being printed on stderr. setproctitle_init is required on Linux so that setproctitle() can function correctly. Signed-off-by: Umer Saleem --- .github/workflows/checkstyle.yaml | 2 +- .github/workflows/zfs-tests-functional.yml | 2 +- .github/workflows/zfs-tests-sanity.yml | 2 +- .github/workflows/zloop.yml | 2 +- cmd/zfs/zfs_main.c | 7 +++++++ contrib/truenas/control | 2 +- lib/libuutil/libuutil.abi | 21 ++------------------- lib/libzfs/libzfs.abi | 1 + lib/libzfs_core/libzfs_core.abi | 21 ++------------------- tests/zfs-tests/cmd/getversion/getversion.c | 1 + 10 files changed, 18 insertions(+), 43 deletions(-) diff --git a/.github/workflows/checkstyle.yaml b/.github/workflows/checkstyle.yaml index 553d5df39796..6b0d47c2d786 100644 --- a/.github/workflows/checkstyle.yaml +++ b/.github/workflows/checkstyle.yaml @@ -15,7 +15,7 @@ jobs: run: | sudo apt-get update sudo apt-get install --yes -qq build-essential autoconf libtool gawk alien fakeroot linux-headers-$(uname -r) - sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi + sudo apt-get install --yes -qq zlib1g-dev uuid-dev libattr1-dev libblkid-dev libselinux-dev libudev-dev libssl-dev libbsd-dev python-dev python-setuptools python-cffi python3 python3-dev python3-setuptools python3-cffi # packages for tests sudo apt-get install --yes -qq parted lsscsi ksh attr acl nfs-kernel-server fio sudo apt-get install --yes -qq mandoc cppcheck pax-utils devscripts diff --git a/.github/workflows/zfs-tests-functional.yml b/.github/workflows/zfs-tests-functional.yml index adcbcb15681a..43aff9dcaa47 100644 --- a/.github/workflows/zfs-tests-functional.yml +++ b/.github/workflows/zfs-tests-functional.yml @@ -25,7 +25,7 @@ jobs: zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ - libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + libpam0g-dev libbsd-dev pamtester python-dev python-setuptools python-cffi \ python3 python3-dev python3-setuptools python3-cffi python3-packaging \ libcurl4-openssl-dev - name: Autogen.sh diff --git a/.github/workflows/zfs-tests-sanity.yml b/.github/workflows/zfs-tests-sanity.yml index c1e257dd1572..294e11124870 100644 --- a/.github/workflows/zfs-tests-sanity.yml +++ b/.github/workflows/zfs-tests-sanity.yml @@ -21,7 +21,7 @@ jobs: zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ - libpam0g-dev pamtester python-dev python-setuptools python-cffi \ + libpam0g-dev libbsd-dev pamtester python-dev python-setuptools python-cffi \ python3 python3-dev python3-setuptools python3-cffi python3-packaging \ libcurl4-openssl-dev - name: Autogen.sh diff --git a/.github/workflows/zloop.yml b/.github/workflows/zloop.yml index cf81ad4bcafc..40835d59440f 100644 --- a/.github/workflows/zloop.yml +++ b/.github/workflows/zloop.yml @@ -21,7 +21,7 @@ jobs: zlib1g-dev uuid-dev libblkid-dev libselinux-dev \ xfslibs-dev libattr1-dev libacl1-dev libudev-dev libdevmapper-dev \ libssl-dev libffi-dev libaio-dev libelf-dev libmount-dev \ - libpam0g-dev \ + libpam0g-dev libbsd-dev \ python-dev python-setuptools python-cffi python-packaging \ python3 python3-dev python3-setuptools python3-cffi python3-packaging - name: Autogen.sh diff --git a/cmd/zfs/zfs_main.c b/cmd/zfs/zfs_main.c index f8c9f2e86b19..9f793ed6171a 100644 --- a/cmd/zfs/zfs_main.c +++ b/cmd/zfs/zfs_main.c @@ -8698,6 +8698,13 @@ main(int argc, char **argv) libzfs_print_on_error(g_zfs, B_TRUE); +#ifdef __linux__ +#ifdef HAVE_PROCTITLE + extern char **environ; + setproctitle_init(argc, argv, environ); +#endif +#endif + /* * Many commands modify input strings for string parsing reasons. * We create a copy to protect the original argv. diff --git a/contrib/truenas/control b/contrib/truenas/control index b5ee7c4a3e31..59a08d25a28a 100644 --- a/contrib/truenas/control +++ b/contrib/truenas/control @@ -2,7 +2,7 @@ Source: openzfs Maintainer: Ryan Moeller Section: truenas Priority: extra -Build-Depends: build-essential, autoconf, automake, libtool, gawk, alien, fakeroot, libblkid-dev, uuid-dev, libudev-dev, libssl-dev, zlib1g-dev, libaio-dev, libattr1-dev, libelf-dev, linux-image-amd64, linux-headers-amd64, python3, python3-dev, python3-setuptools, python3-cffi, python3-packaging, python3-distlib, libffi-dev +Build-Depends: build-essential, autoconf, automake, libtool, gawk, alien, fakeroot, libblkid-dev, uuid-dev, libudev-dev, libssl-dev, zlib1g-dev, libaio-dev, libattr1-dev, libelf-dev, linux-image-amd64, linux-headers-amd64, python3, python3-dev, python3-setuptools, python3-cffi, python3-packaging, python3-distlib, libffi-dev, libbsd-dev Package: openzfs Architecture: amd64 diff --git a/lib/libuutil/libuutil.abi b/lib/libuutil/libuutil.abi index dac5032acdb4..4f01afb945f0 100644 --- a/lib/libuutil/libuutil.abi +++ b/lib/libuutil/libuutil.abi @@ -1,5 +1,6 @@ + @@ -175,8 +176,6 @@ - - @@ -985,26 +984,10 @@ - - - - - - - - - - - - - - - - - + diff --git a/lib/libzfs/libzfs.abi b/lib/libzfs/libzfs.abi index 72c75571a7c3..22b7bed1bc6b 100644 --- a/lib/libzfs/libzfs.abi +++ b/lib/libzfs/libzfs.abi @@ -6,6 +6,7 @@ + diff --git a/lib/libzfs_core/libzfs_core.abi b/lib/libzfs_core/libzfs_core.abi index 544f84ff3487..8a3ed98df967 100644 --- a/lib/libzfs_core/libzfs_core.abi +++ b/lib/libzfs_core/libzfs_core.abi @@ -7,6 +7,7 @@ + @@ -244,8 +245,6 @@ - - @@ -1287,26 +1286,10 @@ - - - - - - - - - - - - - - - - - + diff --git a/tests/zfs-tests/cmd/getversion/getversion.c b/tests/zfs-tests/cmd/getversion/getversion.c index 62c1c5b6abc0..0cee785c1bbc 100644 --- a/tests/zfs-tests/cmd/getversion/getversion.c +++ b/tests/zfs-tests/cmd/getversion/getversion.c @@ -18,6 +18,7 @@ * Linux exposes it instead through an ioctl. */ +#include #include #include #include