- 24 6月, 2016 1 次提交
-
-
由 Ján Tomko 提交于
Introduce a helper that only calls closedir if DIR* is non-NULL and sets it to NULL afterwards.
-
- 19 2月, 2016 1 次提交
-
-
由 Peter Krempa 提交于
Use the helper that does not return errors to fix spuriously looking dead return of -1.
-
- 10 2月, 2016 1 次提交
-
-
由 Michal Privoznik 提交于
The virStringListLength function does not ever modify the passed string list. It merely counts the items in it. Make sure that we reflect this bit in the function header. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com> (crobinso: fix up spacing and squash in sheepdog bit suggested by Andrea)
-
- 17 12月, 2015 2 次提交
-
-
由 Andrea Bolognani 提交于
This function can be used to retrieve the current locked memory limit for a process, so that the setting can be later restored. Add a configure check for getrlimit(), which we now use.
-
由 Andrea Bolognani 提交于
The prlimit() function allows both getting and setting limits for a process; expose the same functionality in our wrapper. Add the const modifier for new_limit, in accordance with the prototype for prlimit().
-
- 20 11月, 2015 1 次提交
-
-
由 Andrea Bolognani 提交于
This can be useful for debugging.
-
- 04 11月, 2015 1 次提交
-
-
由 Jiri Denemark 提交于
VIR_DEBUG and VIR_WARN will automatically add a new line to the message, having "\n" at the end or at the beginning of the message results in empty lines. Signed-off-by: NJiri Denemark <jdenemar@redhat.com>
-
- 28 10月, 2015 1 次提交
-
-
由 Pino Toscano 提交于
Use the virProcessGetStartTime implementation also when only the kernel is FreeBSD, such as on GNU/kFreeBSD.
-
- 27 8月, 2015 1 次提交
-
-
由 Michal Privoznik 提交于
So far, the virProcessSetNamespaces() takes an array of FDs that it tries to set namespace on. However, in the very next commit this array may be sparse, having some -1's in it. Teach the function to cope with that. Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 18 8月, 2015 1 次提交
-
-
由 Eric Blake 提交于
Ever since commit e44b0269, 64-bit mingw compilation fails with: ../../src/util/virprocess.c: In function 'virProcessGetPids': ../../src/util/virprocess.c:628:50: error: passing argument 4 of 'virStrToLong_i' from incompatible pointer type [-Werror=incompatible-pointer-types] if (virStrToLong_i(ent->d_name, NULL, 10, &tmp_pid) < 0) ^ In file included from ../../src/util/virprocess.c:59:0: ../../src/util/virstring.h:53:5: note: expected 'int *' but argument is of type 'pid_t * {aka long long int *}' int virStrToLong_i(char const *s, ^ cc1: all warnings being treated as errors Although mingw won't be using this function, it does compile the file, and the fix is relatively simple. * src/util/virprocess.c (virProcessGetPids): Don't assume pid_t fits in int. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 16 6月, 2015 2 次提交
-
-
由 John Ferlan 提交于
Commit id 'e44b0269' in advertently checked !dir before calling closedir
-
由 Cédric Bosdonnat 提交于
This function gets all the PIDs listed in /proc/PID/task. This will be needed at least to move all qmeu-nbd tasks to the container cgroup.
-
- 11 6月, 2015 1 次提交
-
-
由 Peter Krempa 提交于
Store the cpu count in an intermediate variable and reuse it rather than caluclating the index. Additionally add a coverity silencing comment.
-
- 08 6月, 2015 1 次提交
-
-
由 Roman Bogorodskiy 提交于
Commit 825df8c3 refactored virProcess{Set,Get}Affinity routines, however broke BSD implementation because of the incorrect variable name. Fix build by using a proper variable name. Pushing as trivial and build break fix.
-
- 03 6月, 2015 1 次提交
-
-
由 Peter Krempa 提交于
Refactor the function to return the bitmap instead of an integer and the inner workings so that they make more sense. This patch also fixes possible segfault on old systems that was introduced by commit: commit f1a43a8e Author: Hu Tao <hutao@cn.fujitsu.com> Date: Fri Sep 14 15:46:59 2012 +0800 use virBitmap to store cpu affinity info
-
- 02 6月, 2015 1 次提交
-
-
由 Peter Krempa 提交于
-
- 09 4月, 2015 1 次提交
-
-
由 Cédric Bosdonnat 提交于
lxc-enter-namespace stopped working on recent kernels (at least 3.19+) due to /proc/PID/ns/* file descriptors being opened RW. From outside the namespace these can only be opened RO.
-
- 23 3月, 2015 1 次提交
-
-
由 Martin Kletzander 提交于
Wikipedia's list of common misspellings [1] has a machine-readable version. This patch fixes those misspellings mentioned in the list which don't have multiple right variants (as e.g. "accension", which can be both "accession" and "ascension"), such misspellings are left untouched. The list of changes was manually re-checked for false positives. [1] https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machinesSigned-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 13 3月, 2015 1 次提交
-
-
由 Ján Tomko 提交于
A helper that never returns an error and treats bits out of bitmap range as false. Use it everywhere we use ignore_value on virBitmapGetBit, or loop over the bitmap size.
-
- 13 2月, 2015 1 次提交
-
-
由 Pavel Hrdina 提交于
Commit b6a2828e introduced new functions to set process scheduler. There is a small typo in ELSE path for systems where scheduler is not available. Also some of the definitions were introduced later in kernel. For example RHEL-5 is running on kernel 2.6.18, but SCHED_IDLE was introduces in 2.6.23 [1] and SCHED_BATCH in 2.6.16 [1]. We should not count only on existence of function sched_setscheduler(), we must also check for existence of used macros as they might not be defined. [1] see 'man 7 sched' Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 12 2月, 2015 1 次提交
-
-
由 Martin Kletzander 提交于
This function uses sched_setscheduler() function so it works with processes and threads as well (even threads not created by us, which is what we'll need in the future). Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 19 12月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
The code assumes that def->vcpus == nvcpupids, so when we setup fake CPU pids for old QEMU with nvcpupids == 1, we cause the later code to read off the end of the array. This has fun results like sche_setaffinity(0, ...) which changes libvirtd's own CPU affinity, or even better sched_setaffinity($RANDOM, ...) which changes the affinity of a random OS process.
-
- 29 10月, 2014 1 次提交
-
-
由 Eric Blake 提交于
C guarantees that static variables are zero-initialized. Some older compilers (and also gcc -fno-zero-initialized-in-bss) create larger binaries if you explicitly zero-initialize a static variable. * src/libvirt.c: Fix initialization. * src/util/viralloc.c: Likewise. * src/util/virdbus.c: Likewise. * src/util/virevent.c: Likewise. * src/util/virfile.c (safezero): Likewise. * src/util/virlog.c: Likewise. * src/util/virnetlink.c: Likewise. * src/util/virthread.h (VIR_ONCE_GLOBAL_INIT): Likewise. * src/util/virprocess.c (virProcessGetStartTime): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 12 10月, 2014 1 次提交
-
-
由 Martin Kletzander 提交于
The actual origin of this so called typo are two commits. The first one was commit 72f8a7f1 that came up with the following condition: if ((i == 8) & (flags & VIR_QEMU_PROCESS_KILL_FORCE)) Fortunately this succeeded thanks to bool being (int)1 and VIR_QEMU_PROCESS_KILL_FORCE having the value of 1 << 0. The check was then moved and altered in 8fd38231 to current state: if ((i == 50) & force) that will work again (both sides of '&' being booleans), but since this was missed so many times, it may pose a problem in the future in case it gets copy-pasted again. Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
-
- 02 10月, 2014 1 次提交
-
-
由 Eric Blake 提交于
A cygwin build of 1.2.9 fails with: util/virprocess.c:87:27: fatal error: sys/syscall.h: No such file or directory # include <sys/syscall.h> But in reality, the ONLY user of setns() is lxc, which is Linux-only. It's easiest to just limit the setns workarounds to Linux. * src/util/virprocess.c (setns): Limit definition to Linux. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 16 9月, 2014 1 次提交
-
-
由 Michal Privoznik 提交于
Currently, the setns() wrapper is supported only for x86_64 and i686 which leaves us failing to build on other platforms like arm, aarch64 and so on. This means, that the wrapper needs to be extended to those platforms and make to fail on runtime not compile time. The syscall numbers for other platforms was fetched using this command: kernel.git $ git grep "define.*__NR_setns" | grep -e arm -e powerpc -e s390 arch/arm/include/uapi/asm/unistd.h:#define __NR_setns (__NR_SYSCALL_BASE+375) arch/arm64/include/asm/unistd32.h:#define __NR_setns 375 arch/powerpc/include/uapi/asm/unistd.h:#define __NR_setns 350 arch/s390/include/uapi/asm/unistd.h:#define __NR_setns 339 Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
- 11 9月, 2014 1 次提交
-
-
由 Pavel Hrdina 提交于
The build failed because of missing "sys/syscall.h". Signed-off-by: NPavel Hrdina <phrdina@redhat.com>
-
- 10 9月, 2014 2 次提交
-
-
由 Michal Privoznik 提交于
From time to time weird bugreports occur on the list, e.g [1]. Even though the kernel supports setns syscall, there's an older glibc in the system that misses a wrapper over the syscall. Hence, after the configure phase we think there's no setns support in the system, which is obviously wrong. On the other hand, we can't rely on linux distributions to provide newer glibc soon. Therefore we need to introduce the wrapper on or own. 1: https://www.redhat.com/archives/libvir-list/2014-September/msg00492.htmlSigned-off-by: NStephan Sachse <ste.sachse@gmail.com> Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
-
由 Peter Krempa 提交于
virProcessTranslateStatus is used on error paths that should not spoil the returned error. As the errors are ignored, use the quiet versions of virAsprintf to create the message.
-
- 12 8月, 2014 1 次提交
-
-
由 Guido Günther 提交于
This fixes compilation on kFreeBSD which otherwise fails like CC util/libvirt_util_la-virprocess.lo In file included from /usr/include/sys/cpuset.h:35:0, from util/virprocess.c:43: /usr/include/sys/_cpuset.h:49:43: error: 'NBBY' undeclared here (not in a function) long __bits[howmany(CPU_SETSIZE, _NCPUBITS)]; ^ In file included from util/virprocess.c:43:0: /usr/include/sys/cpuset.h:215:12: error: unknown type name 'cpusetid_t' int cpuset(cpusetid_t *); ^ /usr/include/sys/cpuset.h:216:30: error: expected ')' before 'id_t' int cpuset_setid(cpuwhich_t, id_t, cpusetid_t); ^ /usr/include/sys/cpuset.h:217:42: error: expected ')' before 'id_t' int cpuset_getid(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *); ^ /usr/include/sys/cpuset.h:218:48: error: expected ')' before 'id_t' int cpuset_getaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *); ^ /usr/include/sys/cpuset.h:219:48: error: expected ')' before 'id_t' int cpuset_setaffinity(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *); And it's the correct usage as documented in http://www.freebsd.org/cgi/man.cgi?query=cpuset_setid Also change the #ifdef HAVE_BSH_CPU_AFFINITY to #if for consistency.
-
- 27 3月, 2014 1 次提交
-
-
由 Hongwei Bi 提交于
s/forcably/forcibly Signed-off-by: NHongwei Bi <hwbi2008@gmail.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 25 3月, 2014 1 次提交
-
-
由 Ján Tomko 提交于
-
- 18 3月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
Any source file which calls the logging APIs now needs to have a VIR_LOG_INIT("source.name") declaration at the start of the file. This provides a static variable of the virLogSource type. Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
-
- 04 3月, 2014 4 次提交
-
-
由 Eric Blake 提交于
The old semantics of virFork() violates the priciple of good usability: it requires the caller to check the pid argument after use, *even when virFork returned -1*, in order to properly abort a child process that failed setup done immediately after fork() - that is, the caller must call _exit() in the child. While uses in virfile.c did this correctly, uses in 'virsh lxc-enter-namespace' and 'virt-login-shell' would happily return from the calling function in both the child and the parent, leading to very confusing results. [Thankfully, I found the problem by inspection, and can't actually trigger the double return on error without an LD_PRELOAD library.] It is much better if the semantics of virFork are impossible to abuse. Looking at virFork(), the parent could only ever return -1 with a non-negative pid if it misused pthread_sigmask, but this never happens. Up until this patch series, the child could return -1 with non-negative pid if it fails to set up signals correctly, but we recently fixed that to make the child call _exit() at that point instead of forcing the caller to do it. Thus, the return value and contents of the pid argument are now redundant (a -1 return now happens only for failure to fork, a child 0 return only happens for a successful 0 pid, and a parent 0 return only happens for a successful non-zero pid), so we might as well return the pid directly rather than an integer of whether it succeeded or failed; this is also good from the interface design perspective as users are already familiar with fork() semantics. One last change in this patch: before returning the pid directly, I found cases where using virProcessWait unconditionally on a cleanup path of a virFork's -1 pid return would be nicer if there were a way to avoid it overwriting an earlier message. While such paths are a bit harder to come by with my change to a direct pid return, I decided to keep the virProcessWait change in this patch. * src/util/vircommand.h (virFork): Change signature. * src/util/vircommand.c (virFork): Guarantee that child will only return on success, to simplify callers. Return pid rather than status, now that the situations are always the same. (virExec): Adjust caller, also avoid open-coding process death. * src/util/virprocess.c (virProcessWait): Tweak semantics when pid is -1. (virProcessRunInMountNamespace): Adjust caller. * src/util/virfile.c (virFileAccessibleAs, virFileOpenForked) (virDirCreate): Likewise. * tools/virt-login-shell.c (main): Likewise. * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise. * tests/commandtest.c (test23): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Right now, a caller waiting for a child process either requires the child to have status 0, or must use WIFEXITED() and friends itself. But in many cases, we want the middle ground of treating fatal signals as an error, and directly accessing the normal exit value without having to use WEXITSTATUS(), in order to easily detect an expected non-zero exit status. This adds the middle ground to the low-level virProcessWait; the next patch will add it to virCommand. * src/util/virprocess.h (virProcessWait): Alter signature. * src/util/virprocess.c (virProcessWait): Add parameter. (virProcessRunInMountNamespace): Adjust caller. * src/util/vircommand.c (virCommandWait): Likewise. * src/util/virfile.c (virFileAccessibleAs): Likewise. * src/lxc/lxc_container.c (lxcContainerHasReboot) (lxcContainerAvailable): Likewise. * daemon/libvirtd.c (daemonForkIntoBackground): Likewise. * tools/virt-login-shell.c (main): Likewise. * tools/virsh-domain.c (cmdLxcEnterNamespace): Likewise. * tests/testutils.c (virtTestCaptureProgramOutput): Likewise. * tests/commandtest.c (test23): Likewise. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
The documentation of namespace callbacks was inconsistent on whether it preserved positive return values. Now that we have a dedicated EXIT_CANCELED to flag all errors before getting to the callback, it is possible to use positive return values (not that any of the current callers do, but it is better to match the docs). Also, while vircommand.c is careful to close fds that a child should not have, it's still better to be in the practice of setting FD_CLOEXEC up front. * src/util/virprocess.c (virProcessRunInMountNamespace): Tweak return value to pass back non-zero status. Avoid leaking pipe fds to other threads. * src/util/virprocess.h: Fix comment. Signed-off-by: NEric Blake <eblake@redhat.com>
-
由 Eric Blake 提交于
Thanks to namespaces, we have a couple of places in the code base that want to reflect a child exit status, including the ability to detect death by a signal, back to a grandparent. Best to make it a reusable function. * src/util/virprocess.h (virProcessExitWithStatus): New prototype. * src/libvirt_private.syms (util/virprocess.h): Export it. * src/util/virprocess.c (virProcessExitWithStatus): New function. * tests/commandtest.c (test23): Test it. Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 18 2月, 2014 1 次提交
-
-
由 Daniel P. Berrange 提交于
Implement virProcessRunInMountNamespace, which runs callback of type virProcessNamespaceCallback in a container namespace. This uses a child process to run the callback, since you can't change the mount namespace of a thread. This implies that callbacks have to be careful about what code they run due to async safety rules. Idea by Dan Berrange, based on an initial report by Reco <recoverym4n@gmail.com> at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=732394Signed-off-by: NDaniel Berrange <berrange@redhat.com> Signed-off-by: NEric Blake <eblake@redhat.com>
-
- 30 1月, 2014 1 次提交
-
-
由 Roman Bogorodskiy 提交于
Check for presence of sys/cpuset.h header and cpuset_getaffinity() in configure instead of just using #ifdef __FreeBSD__ for that code.
-
- 28 1月, 2014 1 次提交
-
-
由 Roman Bogorodskiy 提交于
Implement virProcess{Get,Set}Affinity() using cpuset_getaffinity() and cpuset_setaffinity() calls. Quick search showed that they are only available on FreeBSD, so placed it inside existing #ifdef blocks for FreeBSD instead of adding configure checks.
-