[pacman-dev] Checking free space before transaction
Allan McRae
allan at archlinux.org
Fri Nov 12 10:09:42 CET 2010
On 12/11/10 12:22, Nezmer wrote:
> On Fri, Nov 12, 2010 at 11:07:14AM +1000, Allan McRae wrote:
>> So, looking into this further:
>>
>> getmntent:
>> used by glibc, uclibc, cygwin
>>
>> getmntinfo with statfs:
>> used by bsd4.4 (FreeBSD, OpenBSD, OSX)
>>
>> getmntinfo with statvfs:
>> NetBSD
>>
>> I can work with that... the mount point struct can hold a statfs or
>> statvfs object depending on what function we are using. Given the
>> entries that we need to access are available in both structs, the
>> rest should be transparent.
>>
>> So what I need to do is:
>> 1) figure out how to distinguish between the two getmntinfo versions...
>
> Wouldn't this work?:
>
> #ifndef __NetBSD__
> /* use statfs */
> #else
> /* use statvfs */
> #endif
>
Sure, but that would be broken if some other BSD uses the same method as
NetBSD so we are better off just doing the check properly in the first
place.
More information about the pacman-dev
mailing list