HD0 and Ram

Hi, Im making a application and I need to know the size of my HDD and Ram memory, for deploying it.

Im using AppBuilder.

Thanks in advance

Do you mean that you need to dynamically find out the size of the HDD and Ram memory or do you mean you need to figure out your requirements?

Hi maschoen,
Im making an application that tells the user the hardware characteristics of his system. I need to find out the size of HDD and Ram memory. For example:


  • HD0 size: 120 gBytes
  • RAM memory size: 2 gBytes.

Thank you.


For HD freespace, that is a little more code. If you don’t mind shelling out to and parsing the output to get the info, you can use “df”.

The source to the filesystem utils is posted

community.qnx.com/svn/repos/file … sk_stuff.c

These 2 devctls to /dev/hd0 should give you enough info

if (devctl(fd,DCMD_CAM_DEVINFO,&dbuf,sizeof(dbuf),NULL) != EOK)
else if (devctl(fd,DCMD_BLK_PARTENTRY,&pbuf,sizeof(pbuf),NULL) != EOK)


Also I think you can just do a “ls -l /dev/hd0” and multiply the size by 512. But this does make and assumption that the blocksize is 512 (which it almost always is on a hard drive)

That’s true if hd0 is really all that is needed. I think the complicated part is figuring out the total non-volatile storage on all mounted devices (or at the mount points that you are interested in). It is complicated further by union mounts. The df utility does quite a bit of hoop jumping to get that right.