[Libvir] 0/2: take #3: write(2) may write less than the total requested

Jim Meyering jim at meyering.net
Fri Feb 22 13:58:15 UTC 2008


Jim Meyering <jim at meyering.net> wrote:
> Mark McLoughlin <markmc at redhat.com> wrote:
>> On Wed, 2008-02-20 at 16:42 +0100, Jim Meyering wrote:
>>
>>> If I do as you suggest and move the safewrite definition into util.h,
>>> and make it static inline, then both problems go away.
>>
>> 	Make sure to try and build this with gcc-4.3.0 - remember that we
>> un-inlined xstrtol() because of:
>>
>>   internal.h:272: error: inlining failed in call to 'xstrtol_i': call is unlikely and code size would grow
>>
>> 	Again, the option is to stop using -Winline, but it's probably about
>> time we figured out some proper way of sharing code between libvirt.so
>> and virsh etc. without adding it to the ABI.
>>
>> 	How about a libvirtutil libtool convenience (i.e. static) library?
>
> This does sound like a better idea.
> I'll prepare a patch to does that,
> and probably move at least these into it, too:
>
>         __virStrToLong_i;
>         __virStrToLong_ull;

Actually, it's not so simple.
Using a libtool convenience library would work, but to be useful,
it would have to expose the safewrite function to all users of
libvirt.la.  And, since we seem to want to keep -Winline, we probably
don't want "static inline" functions, so here's what I've done:

#1 Allow safewrite to be used both by library and non-library code:
  Subject: [PATCH] Move safewrite and saferead to a separate file.

#2 Fix the uses of write that started all this:
  Subject: [PATCH] Use safewrite in place of write, in many cases.

Details in the following patches.




More information about the libvir-list mailing list