[pacman-dev] Checking free space before transaction
Nezmer
git at nezmer.info
Fri Nov 12 14:11:40 CET 2010
On Fri, Nov 12, 2010 at 07:09:42PM +1000, Allan McRae wrote:
> 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.
>
>
>
Obviously, you know this stuff better than me.
Using __FreeBSD__ __OpenBSD__ __NetBSD__ and __DragonFly__ seems to be
the default way to distinguish BSDs though. Look at 'lib/isc/unix/net.c'
in BIND sources for an example.
More information about the pacman-dev
mailing list