C Library For Filesystem information?

This is a discussion on C Library For Filesystem information? within the C Programming forums, part of the General Programming Boards category; Hey all, I was looking for a C library to give me filesystem information just like the "df -h" command ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    6

    C Library For Filesystem information?

    Hey all,
    I was looking for a C library to give me filesystem information just like the "df -h" command does. I don't want to shell out and call it with system() to make it as efficient as possible. Are there any libraries that will allow me to do this? My OS is Solaris.

    Thanks,
    Scott

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm pretty sure there is a system service that provides that somehow. Have you tried doing "strace df -h" to see what it actually does [it may of course do LOTS of irrelevant stuff, but somewhere, probably close to the write(1, ...) bit that output the result, you will most likely see a system call or such that figures out what space is available on the disk.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,659
    You could just look at the source code for df......in open solaris anyway.
    http://cvs.opensolaris.org/source/xr.../cmd/fs.d/df.c

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. standrad library
    By sarahr202 in forum C++ Programming
    Replies: 11
    Last Post: 05-18-2009, 08:50 PM
  2. Replies: 6
    Last Post: 07-07-2008, 07:48 AM
  3. Game Programming FAQ
    By TechWins in forum Game Programming
    Replies: 5
    Last Post: 09-29-2004, 02:00 AM
  4. Accessing C++ library from C code
    By nipun in forum C Programming
    Replies: 1
    Last Post: 06-10-2004, 11:23 AM
  5. Going out of scope
    By nickname_changed in forum C++ Programming
    Replies: 9
    Last Post: 10-12-2003, 06:27 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21