summaryrefslogtreecommitdiff
path: root/libvirt-lxc-override.c
Commit message (Collapse)AuthorAgeFilesLines
* debug: Fix bit-rot in debug outputPhilipp Hahn2020-07-271-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Let the compiler optimize out the printf() call instead of doing it with the pre-processor as the later does not catch format string errors or the following case, where NULLSTR() is used but not defined: > libvirt-qemu-override.c: In function ‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’: > libvirt-qemu-override.c:271:34: warning: implicit declaration of function ‘NULLSTR’; did you mean ‘NULL’? [-Wimplicit-function-declaration] > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ^~~~~~~ > libvirt-qemu-override.c:39:28: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~~~~~~~~~ > libvirt-qemu-override.c:270:11: warning: format ‘%s’ expects argument of type ‘char *’, but argument 4 has type ‘int’ [-Wformat=] > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > 271 | pyobj_conn, pyobj_dom, NULLSTR(event), pyobj_cbData, flags); > | ~~~~~~~~~~~~~~ > | | > | int > libvirt-qemu-override.c:39:23: note: in definition of macro ‘DEBUG’ > 39 | while (0) {printf(fmt, __VA_ARGS__);} > | ^~~ > libvirt-qemu-override.c:270:73: note: format string is defined here > 270 | DEBUG("libvirt_qemu_virConnectDomainQemuMonitorEventRegister(%p %p %s %p %x) called\n", > | ~^ > | | > | char * > | %d Copy the definition of NULLSTR from libvirt/src/internal.h to typewrappers.h Signed-off-by: Philipp Hahn <hahn@univention.de>
* Drop support for python 2Daniel P. Berrangé2019-12-041-41/+10
| | | | | | | | | python2 will be end of life by the time of the next libvirt release. All our supported build targets, including CentOS7, have a python3 build available. Reviewed-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
* Fix regression in lxcOpenNamespaceSergei Turchanov2019-06-261-1/+1
| | | | | | | | | | | This fixes regression caused by the 1d39dbaf637db03f6e597ed56b96aa065710b4a1 fdlist[i] erroneously was replaced by fdlist[1] which caused lxcOpenNamespace to return a list with identical elements. Signed-off-by: Sergei Turchanov <turchanov@farpost.com> Reviewed-by: Ján Tomko <jtomko@redhat.com> Signed-off-by: Ján Tomko <jtomko@redhat.com>
* Fix comparisons between signed & unsigned integersDaniel P. Berrange2017-09-261-1/+1
| | | | | | | | | When python3 builds C modules, it adds the -Wsign-compare flag to GCC. This creates lots of warnings where we compare a 'size_t' value against an 'int' value due to signed/unsigned difference. Change all the size_t types to ssize_t to address this. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* use VYR_PY_LIST_SET_GOTO and VIR_PY_LIST_APPEND_GOTOPavel Hrdina2015-10-051-11/+2
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Must check return value for all Py*_New functionsPavel Hrdina2015-10-051-3/+7
| | | | | | If the function fails, we need to cleanup memory and return NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Return NULL if python exception is setPavel Hrdina2015-10-051-1/+1
| | | | | | | There is a rule, python API fails, it also in those cases sets an exception. We should follow those rules and in those cases return NULL. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* fix indentationPavel Hrdina2015-10-051-15/+15
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* indent labels by one spacePavel Hrdina2015-10-051-1/+1
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* cleanup functions definitionPavel Hrdina2015-10-051-1/+2
| | | | | | Follow the libvirt hacking guide and make the code consistent. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Move utils and shared code into libvirt-utilsPavel Hrdina2015-10-051-7/+0
| | | | Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
* Fix rest of unsigned integer handlingPeter Krempa2014-10-221-1/+1
| | | | | As in the previous patch, fix all places where 'flags' is converted as a signed argument to unsigned including the python code generator.
* override: Replace Py{Int,Long}_FromLong with helpersDaniel P. Berrange2013-12-111-1/+1
| | | | | | | | | Replace use of the PyInt_FromLong and PyLong_FromLongLong with libvirt_{int,uint,longlong,ulonglong}Wrap helpers. This isolates the need for Python3 specific code in one place. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* override: Fix native module registration to work with Python3Daniel P. Berrange2013-12-111-18/+55
| | | | | | | The way native modules are registered has completely changed, so the code must be #ifdef'd for Python2 & 3 Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Import VIR_ALLOC / VIR_ALLOC_N / VIR_REALLOC_N functionsDaniel P. Berrange2013-11-221-0/+1
| | | | | | | Import the libvirt memory allocation functions, stripping the OOM testing and error reporting pieces. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Update header file includesDaniel P. Berrange2013-11-221-6/+2
| | | | | | | | We're no longer using automake, so <config.h> files are not required. Also remove of all libvirt internal util header files. Reference generated header files in build/ subdir. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* Fix leaks in python bindingsCVE-2013-4297Ján Tomko2013-09-031-0/+1
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=1003828
* python: Fix a PyList usage mistakev1.1.2-rc2v1.1.2CVE-2013-4292CVE-2013-4291Guan Qiang2013-08-291-1/+1
| | | | | | | | Fix PyList usage mistake in Function libvirt_lxc_virDomainLxcOpenNamespace. https://bugzilla.redhat.com/show_bug.cgi?id=1002383 Signed-off-by: Eric Blake <eblake@redhat.com>
* Convert 'int i' to 'size_t i' in python/ filesDaniel P. Berrange2013-07-101-1/+1
| | | | | | | | | Convert the type of loop iterators named 'i', 'j', k', 'ii', 'jj', 'kk', to be 'size_t' instead of 'int' or 'unsigned int', also santizing 'ii', 'jj', 'kk' to use the normal 'i', 'j', 'k' naming Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
* python: Remove the whitespace before ";"v1.0.6-rc1Osier Yang2013-05-211-2/+2
|
* syntax-check: Only allows to include public headers in external toolsOsier Yang2013-04-181-2/+2
| | | | | | With this patch, include public headers in "" form is only allowed for "internal.h". And only the external tools (examples|tools|python |include/libvirt) can include the public headers in <> form.
* Introduce an LXC specific public API & libraryDaniel P. Berrange2013-01-141-0/+141
This patch introduces support for LXC specific public APIs. In common with what was done for QEMU, this creates a libvirt_lxc.so library and libvirt/libvirt-lxc.h header file. The actual APIs are int virDomainLxcOpenNamespace(virDomainPtr domain, int **fdlist, unsigned int flags); int virDomainLxcEnterNamespace(virDomainPtr domain, unsigned int nfdlist, int *fdlist, unsigned int *noldfdlist, int **oldfdlist, unsigned int flags); which provide a way to use the setns() system call to move the calling process into the container's namespace. It is not practical to write in a generically applicable manner. The nearest that we could get to such an API would be an API which allows to pass a command + argv to be executed inside a container. Even if we had such a generic API, this LXC specific API is still useful, because it allows the caller to maintain the current process context, in particular any I/O streams they have open. NB the virDomainLxcEnterNamespace() API is special in that it runs client side, so does not involve the internal driver API. Signed-off-by: Daniel P. Berrange <berrange@redhat.com>