checking disk space

I’d like to read the used and remaining disk space for a
file system from an application, i.e. do what df does.
How do I do that? I haven’t found any suitable calls.

Cheers / Tomas Hogstrom


Sent via Deja.com http://www.deja.com/
Before you buy.

I found the undocumented call statfs which I got to work, and
it seems to do what I want. But I do not know how to use input
argument 3 and 4. Any good reason why this is undocumented?
QNX4.


Sent via Deja.com http://www.deja.com/
Before you buy.

Check out the disk_space() lib routine.

statfs() is probably part of the unix libs, also distributed by QSSL.
This is to keep compatibility with other Unix flavors. You might find
docs for this function in the man pages from other unices (Linux, BSD,
HP-UX, …).

good luck,

rick

Tomas Hogstrom wrote:

I found the undocumented call statfs which I got to work, and
it seems to do what I want. But I do not know how to use input
argument 3 and 4. Any good reason why this is undocumented?
QNX4.

Sent via Deja.com > http://www.deja.com/
Before you buy.

Thanks. How could I miss that?
/ Tom


Sent via Deja.com http://www.deja.com/
Before you buy.

Try Something like this…
-Paul

GLOBAL LONG glfmsl_DiskFreeSpace( LONG lMinBlocks )
{
long lFree, lTotal; /* Using long not LONG as this is what disk_space()
requires */
LONG lReturn;
int iFd;

/* Access Disk (Read of always existing Root Directory: /. ) */
iFd = open ( “/.”, O_RDONLY );
if ( 0 > iFd )
{
/puts (“glfmsl_DiskFreeSpace(): Notify DS: Could Not Open File”);/
return ( GLE_RC_DISK_ACCESS );
}
lReturn = disk_space ( iFd, &lFree, &lTotal );
close ( iFd );
if ( 0 != lReturn )
{
/puts (“glfmsl_DiskFreeSpace(): Notify DS: Error Checking Disk Space”);/
return ( GLE_RC_DISK_ACCESS );
}

/* Sufficient Disk Space Available? */
if ( lFree >= lMinBlocks )
{
/printf(“Sufficient Space Free: %d %xh \n”, lFree, lFree );/
return ( lFree );
}

return ( GLE_RC_DISK_LOW );
}

Tomas Hogstrom <tomho@my-deja.com> wrote in message
news:8pq749$6gb$1@nnrp1.deja.com

I’d like to read the used and remaining disk space for a
file system from an application, i.e. do what df does.
How do I do that? I haven’t found any suitable calls.

Cheers / Tomas Hogstrom


Sent via Deja.com > http://www.deja.com/
Before you buy.