IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Instead of doing some 'extern ...' declaration magic to force
proper PyInit_libvirtmod*() symbol exposure in resulting .so we
can use what Python already offers - PyMODINIT_FUNC macro and
call it a day.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
When -Ibuild flag is passed to compiler then build/ can be dropped
from includes. This is safe to do, because the prefix is only on
local includes (#include "") not system ones (#include <>).
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
The generator.py generates a (per module) table of functions it
generated code for and stores it in ${module}-export.c file. The
file is then #include-d in corresponding override.c in the table
of all methods implemented in the module.
Now, problem is with naming of the file because the ".c" suffix
might suggest the file needs to be compiled. Well, it doesn't.
It's way closer to being a header file, so change the suffix to
".c.inc".
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
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>
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>
This fixes regression caused by the 1d39dbaf63
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>
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>
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>
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>
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 the libvirt memory allocation functions, stripping the OOM
testing and error reporting pieces.
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
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>
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>
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.
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>