libvirt/src/util
Michal Privoznik 432faf259b virCommand: use procfs to learn opened FDs
When spawning a child process, between fork() and exec() we close
all file descriptors and keep only those the caller wants us to
pass onto the child. The problem is how we do that. Currently, we
get the limit of opened files and then iterate through each one
of them and either close() it or make it survive exec(). This
approach is suboptimal (although, not that much in default
configurations where the limit is pretty low - 1024). We have
/proc where we can learn what FDs we hold open and thus we can
selectively close only those.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-07-16 13:47:49 +02:00
..
iohelper.c iohelper: Remove remaining newlines from error messages 2019-02-20 08:51:39 +01:00
Makefile.inc.am util: Drop virsexpr module 2019-07-09 10:27:20 +02:00
viralloc.c util: alloc: Add automatic cleanup/disposal of strings 2019-04-03 11:58:10 +02:00
viralloc.h util: alloc: use #pragma once 2019-06-19 17:12:31 +02:00
virarch.c util: add RISC-V architectures 2018-08-24 13:23:36 +02:00
virarch.h util: arch.h: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virarptable.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virarptable.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
viratomic.c
viratomic.h util: atomic: use #pragma once 2019-06-19 17:12:31 +02:00
viraudit.c internal: Move <stdio.h> include to internal.h 2018-09-20 10:16:38 +02:00
viraudit.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virauth.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virauth.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virauthconfig.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virauthconfig.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virautoclean.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virbitmap.c util: Introduce virBitmapUnion() 2019-06-04 09:29:35 +02:00
virbitmap.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virbuffer.c virBuffer: Try harder to free buffer 2019-05-06 09:33:10 +02:00
virbuffer.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
vircgroup.c util: vircgroupv2: stop enabling missing controllers with systemd 2019-06-28 15:17:37 +02:00
vircgroup.h util: cgroup: use #pragma once in headers 2019-06-19 17:12:32 +02:00
vircgroupbackend.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
vircgroupbackend.h util: vircgroupv2: stop enabling missing controllers with systemd 2019-06-28 15:17:37 +02:00
vircgrouppriv.h util: vircgroup: move virCgroupGetValueStr out of virCgroupGetValueForBlkDev 2019-06-21 14:35:57 +02:00
vircgroupv1.c Revert "util: vircgroup: pass parent cgroup into virCgroupDetectControllersCB" 2019-06-28 15:17:26 +02:00
vircgroupv1.h util: cgroup: use #pragma once in headers 2019-06-19 17:12:32 +02:00
vircgroupv2.c util: vircgroupv2: stop enabling missing controllers with systemd 2019-06-28 15:17:37 +02:00
vircgroupv2.h util: cgroup: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virclosecallbacks.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virclosecallbacks.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
vircommand.c virCommand: use procfs to learn opened FDs 2019-07-16 13:47:49 +02:00
vircommand.h util: remove code spawning with systemd activation env vars 2019-07-12 16:55:40 +01:00
vircommandpriv.h util: command: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virconf.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virconf.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
vircrypto.c Fix minor typos in messages and docs 2018-12-05 10:39:54 +01:00
vircrypto.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virdbus.c util: eliminate duplicate function virDBusMessageRead 2019-04-15 12:47:44 -04:00
virdbus.h util: dbus: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virdbuspriv.h util: dbus: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virdevmapper.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virdevmapper.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virdnsmasq.c lib: Don't use virReportSystemError() if virCommandRun() fails 2019-04-12 15:56:28 +02:00
virdnsmasq.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virebtables.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virebtables.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virendian.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virenum.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virenum.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virerror.c Revert "error: Add VIR_ERR_DEPRECATED error code" 2019-06-27 14:47:10 +01:00
virerror.h util: error: Add API for prefixing last set error with a string 2019-06-20 17:10:24 +02:00
virerrorpriv.h util: error: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virevent.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virevent.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
vireventpoll.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
vireventpoll.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virfcp.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virfcp.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virfdstream.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virfdstream.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virfile.c virFileRemoveXAttr: Report error on failure 2019-07-03 08:36:03 +02:00
virfile.h virfile: Make virFileGetXAttr report errors 2019-07-03 08:36:03 +02:00
virfilecache.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virfilecache.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virfirewall.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virfirewall.h util: firewall: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virfirewalld.c util: eliminate duplicate function virDBusMessageRead 2019-04-15 12:47:44 -04:00
virfirewalld.h util: firewall: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virfirewalldpriv.h util: firewall: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virfirewallpriv.h util: firewall: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virfirmware.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virfirmware.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virgettext.c internal: Move <stdio.h> include to internal.h 2018-09-20 10:16:38 +02:00
virgettext.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virgic.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virgic.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virhash.c util: hash: Append to hash buckets when adding new entries 2019-04-25 13:28:16 +02:00
virhash.h util: hash: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virhashcode.c Use ATTRIBUTE_FALLTHROUGH 2017-06-12 19:11:30 -04:00
virhashcode.h util: hash: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virhook.c network: convert hook script to take a network port XML 2019-06-17 15:19:54 +01:00
virhook.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virhostcpu.c util: Add virHostCPUGetTscInfo 2019-06-03 18:07:16 +02:00
virhostcpu.h util: host: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virhostcpupriv.h util: host: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virhostdev.c virhostdev: Use VIR_AUTOPTR more 2019-06-20 10:29:54 +02:00
virhostdev.h util: host: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virhostmem.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virhostmem.h util: host: use #pragma once in headers 2019-06-19 17:12:32 +02:00
viridentity.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
viridentity.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virinitctl.c virinitctl: Provide a stub list of init fifos for non-Linux 2019-02-07 16:17:56 +01:00
virinitctl.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
viriptables.c network: split setup of ipv4 and ipv6 top level chains 2019-03-19 10:01:53 +00:00
viriptables.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
viriscsi.c util: Fix misaligned arguments and misaligned conditions for [if|while|...] 2018-09-24 10:02:40 +02:00
viriscsi.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virjson.c util: json: Use VIR_APPEND_ELEMENT in virJSONValueObjectAppend 2019-04-10 16:34:57 +02:00
virjson.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virkeycode.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virkeycode.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virkeyfile.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virkeyfile.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virkmod.c util: kmod: use VIR_AUTOPTR for aggregate types 2018-07-27 17:21:25 +02:00
virkmod.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virlease.c Remove EMPTY_STR macro 2019-02-14 14:09:38 +01:00
virlease.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virlockspace.c Revert "virlockspace: Allow caller to specify start and length offset in virLockSpaceAcquireResource" 2018-11-16 13:42:39 +01:00
virlockspace.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virlog.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virlog.h util: log: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virmacaddr.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virmacaddr.h util: mac: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virmacmap.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virmacmap.h util: mac: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virmdev.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virmdev.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virmodule.c Fix minor typos in messages and docs 2018-12-05 10:39:54 +01:00
virmodule.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virnetdev.c Revert "Include unistd.h directly by files using it" 2019-04-10 12:26:32 +02:00
virnetdev.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevbandwidth.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virnetdevbandwidth.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevbridge.c util: Fix uninitalized variable to avoid garbage value. 2019-04-30 09:44:21 +02:00
virnetdevbridge.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevip.c Revert "Include unistd.h directly by files using it" 2019-04-10 12:26:32 +02:00
virnetdevip.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevmacvlan.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virnetdevmacvlan.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevmidonet.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virnetdevmidonet.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevopenvswitch.c test: Introduce virnetdevopenvswitchtest 2019-07-16 13:42:39 +02:00
virnetdevopenvswitch.h test: Introduce virnetdevopenvswitchtest 2019-07-16 13:42:39 +02:00
virnetdevtap.c util: add helper method for re-attaching a tap device to a bridge 2019-04-16 14:44:53 +01:00
virnetdevtap.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevveth.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virnetdevveth.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevvlan.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virnetdevvlan.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetdevvportprofile.c util: add API for copying virtual port profile data 2019-04-17 14:12:56 +01:00
virnetdevvportprofile.h util: netdev: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virnetlink.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virnetlink.h util: netlink: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virnodesuspend.c nodesuspend: report unsupported if systemd & pm-utils aren't available 2019-06-17 15:02:24 +01:00
virnodesuspend.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virnuma.c util: Propagate numad failures correctly 2019-06-04 10:13:07 +02:00
virnuma.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virobject.c object: Add sanity check on correct parent class 2019-03-15 11:10:12 -05:00
virobject.h util: object: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virpci.c virpci: report dev->name in virPCIGetHeaderType error message 2019-06-24 18:06:59 +02:00
virpci.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virperf.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virperf.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virpidfile.c Revert "Include unistd.h directly by files using it" 2019-04-10 12:26:32 +02:00
virpidfile.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virpolkit.c lib: Avoid double close when passing FDs with virCommandPassFD() 2019-05-17 16:01:11 +02:00
virpolkit.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virportallocator.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virportallocator.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virprobe.h util: virprobe.h: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virprocess.c util: assume modern CPU_ALLOC macros always exist 2019-07-09 18:44:19 +01:00
virprocess.h qemusecuritymock: Mock virProcessRunInFork 2019-07-03 08:36:03 +02:00
virqemu.c util: Fix misaligned arguments and misaligned conditions for [if|while|...] 2018-09-24 10:02:40 +02:00
virqemu.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virrandom.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virrandom.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virresctrl.c virresctrl: Sort resctrl array correctly in virResctrlMonitorGetStats() 2019-05-13 14:38:58 +02:00
virresctrl.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virresctrlpriv.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virrotatingfile.c lib: Use more of VIR_STEAL_PTR() 2019-01-28 14:46:58 +01:00
virrotatingfile.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virscsi.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virscsi.h util: scsi: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virscsihost.c
virscsihost.h util: scsi: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virscsivhost.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virscsivhost.h util: scsi: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virseclabel.c
virseclabel.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virsecret.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virsecret.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virsocketaddr.c util: add API for resolving socket service names 2019-07-11 14:13:03 +01:00
virsocketaddr.h util: add API for resolving socket service names 2019-07-11 14:13:03 +01:00
virstorageencryption.c Require a semicolon for VIR_ENUM_IMPL calls 2019-02-03 17:46:29 -05:00
virstorageencryption.h util: storage: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virstoragefile.c util: storage: Fix virStorageSourceGetActualType if volume was not translated 2019-06-26 12:28:31 +02:00
virstoragefile.h util: storage: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virstoragefilebackend.c Fix names for abs_top_{src,build}dir variables 2019-03-14 10:05:28 +01:00
virstoragefilebackend.h util: storage: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virstring.c util: Introduce virStringParseYesNo helper 2019-03-13 14:24:18 +01:00
virstring.h util: string: use #pragma once in headers 2019-06-19 17:12:32 +02:00
virsysinfo.c virSysinfoReadARM: Try reading DMI table 2019-06-03 17:59:38 +02:00
virsysinfo.h util: sysinfo: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virsysinfopriv.h util: sysinfo: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virsystemd.c util: move code for getting listen FDs into systemd module 2019-07-12 16:55:40 +01:00
virsystemd.h util: add APIs for facilitating use of systemd activation FDs 2019-07-12 16:55:39 +01:00
virsystemdpriv.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virthread.c util: gettid() is Linux-specific 2017-12-05 11:28:19 +01:00
virthread.h util: thread: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virthreadjob.c Require a semicolon for VIR_ONCE_GLOBAL_INIT calls 2019-02-03 17:46:29 -05:00
virthreadjob.h util: thread: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virthreadpool.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virthreadpool.h util: thread: use #pragma once in headers 2019-06-19 17:12:31 +02:00
virtime.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virtime.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virtpm.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
virtpm.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virtypedparam.c Always put _LAST enums on second line of VIR_ENUM_IMPL 2019-04-11 12:47:23 -04:00
virtypedparam.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
viruri.c Use NULLSTR_EMPTY 2019-02-14 14:09:38 +01:00
viruri.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virusb.c util: Don't include 'viralloc.h' into other header files 2019-04-10 09:12:04 +02:00
virusb.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virutil.c util: remove unused helper for getting UNIX socket path 2019-07-12 16:55:40 +01:00
virutil.h util: remove unused helper for getting UNIX socket path 2019-07-12 16:55:40 +01:00
viruuid.c Remove all Author(s): lines from source file headers 2018-12-13 16:08:38 +00:00
viruuid.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virvhba.c
virvhba.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virvsock.c util: create virvsock.c 2018-05-29 15:42:03 +02:00
virvsock.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virxdrdefs.h util: misc: use #pragma once in headers 2019-06-19 17:12:33 +02:00
virxml.c util: XML: Introduce automatic reset of XPath's current node 2019-03-04 13:04:20 +01:00
virxml.h util: xml: use #pragma once in headers 2019-06-19 17:12:33 +02:00