Re: [libvirt] [PATCH 2/9] remove duplicate *SetCloseExec and *SetNonBlock functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Daniel P. Berrange" <berrange@xxxxxxxxxx> wrote:
> On Mon, Feb 02, 2009 at 06:08:15PM +0100, Jim Meyering wrote:
>> From: Jim Meyering <meyering@xxxxxxxxxx>
>>
>> * src/qemu_driver.c: Use virSetCloseExec and virSetNonBlock,
>> rather than qemuSet* functions.  Suggested by Daniel P. Berrange.
>> * src/util.c (virSetCloseExec): Compile unconditionally.
>> * src/util.h (virSetCloseExec): Declare
>>
>> diff --git a/qemud/Makefile.am b/qemud/Makefile.am
>> index a0c161a..372b931 100644
>> --- a/qemud/Makefile.am
>> +++ b/qemud/Makefile.am
>> @@ -107,6 +107,7 @@ libvirtd_LDADD =					\
>>  if ! WITH_DRIVER_MODULES
>>  if WITH_QEMU
>>  libvirtd_LDADD += ../src/libvirt_driver_qemu.la
>> +libvirtd_LDADD += ../src/libvirt_util.la
>>  endif
>
>
> This is not required. All the functions in util.c are provided
> in the libvirt.so, and exported with LIBVIRT_PRIVATE_X_X_X
> tag.
>
> This patch is missing the change to libvirt_private.sym to
> actually add the virSetCloseExec function though.

Ah. forgot about that.
Done.

>> @@ -182,10 +182,7 @@ int virSetNonBlock(int fd) {
>>      return 0;
>>  }
>>
>> -
>> -#ifndef WIN32
>> -
>> -static int virSetCloseExec(int fd) {
>> +int virSetCloseExec(int fd) {
>>      int flags;
>>      if ((flags = fcntl(fd, F_GETFD)) < 0)
>>          return -1;
>> @@ -195,6 +192,8 @@ static int virSetCloseExec(int fd) {
>>      return 0;
>>  }
>>
>> +#ifndef WIN32
>> +
>>  static int
>>  __virExec(virConnectPtr conn,
>>            const char *const*argv,
>
> Why this change ?  AFAIK, there is no close-on-exec flag in Win32,
> since it doesn't have any concept of exec(). The QEMU driver isn't
> built on Win32, so we shouldn't need to expose virSetCloseExec
> there anyway.

Looked like it'd be portable enough to compile even there,
plus the general preference to avoid ifdef'd code in libraries.
I've read up a little and see that there really is no point,
so have put it back.

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]