I'm working with VxWorks 5.4, trying to determine how much disk space is
left on the hard drive, to determine whether or not lower priority log
files must be deleted to make room for higher priority ones.
Unfortunately, I see no such command to do this, although I refuse to
believe VxWorks doesn't have it! Even something like the "du" command in
Unix would be acceptable, just to tell me how much space is taken up.
Feel free to tell me that I'm blind, and the command is right in the
user manual, but if anyone knows how to do this, I'd appreciate it if
you could e-mail me. Thanks in advance for any and all help!
Andy Kaiser
Software Engineer
L-3 Communication Systems - East
andy....@l-3com.com
vann...@op.net
Sent via Deja.com
http://www.deja.com/
Andy,
My guess is that VxWorks doesn't have such a command because it
doesn't have a native file system. The closest thing I could find, if your
hard drive is mounted using dosFsLib, is an ioctl call to find the largest
contiguous free space:
status = ioctl (fd, FIONCONTIG, &maxContigBytes);
Please post if you find something better.
HTH,
Markku Kotiaho
Have a look at the statfs() function and the definition of struct statfs in
\Tornado\target\h\stat.h.
Hope this helps…
Matthias
//******************************************************************************
********************
//
*
// function name : diskFreeSpace
*
//
*
// description : find out how much space is left on disk
*
//
*
// passing param. : szDiskName: name of disk to be checked
*
//
*
// return param. : lDiskFreeSpace: -1 in case of error, else available disk
space *
//
*
//******************************************************************************
********************
// 15.04.99 MAG : created
*
//******************************************************************************
********************
// revision history:
*
// -----------------
*
// 15.04.99 XXX :
*
//******************************************************************************
********************
long diskFreeSpace(char *szDiskName)
{
long lDiskFreeSpace;
struct statfs SStatFs;
if (statfs(szDiskName,&SStatFs)==OK)
{
lDiskFreeSpace= SStatFs.f_bsize * SStatFs.f_bavail;
}
else
{
lDiskFreeSpace= -1;
}
return lDiskFreeSpace;
}
"Andy Kaiser" <vann...@op.net> wrote in message
news:949rik$m8d$1...@nnrp1.deja.com...
>
> My guess is that VxWorks doesn't have such a command because it
> doesn't have a native file system. The closest thing I could find, if your
> hard drive is mounted using dosFsLib, is an ioctl call to find the largest
> contiguous free space:
>
> status = ioctl (fd, FIONCONTIG, &maxContigBytes);
>
> Please post if you find something better.
To get file system status of my dos formatted drive, I use the POSIX call
'statfs' from dirLib. i.e.
struct statfs driveStatus;
status = statfs ("/sd1/", &driveStatus);
This will likely give you what you need.
- bob
Andy