Skip to main content

Thread: getfsstat not working in ubuntu(but works in other os)


hello... new one:
code works in freebsd, solaris, mac os x , rhel linux.
on page http://manpages.ubuntu.com/manpages/....2freebsd.html getfsstat standard c library. researched bit , turns out should work in ubuntu.
important project working on getfsstat work properly, , think problem example run fact somewhere ubuntu can't find, or lacks proper library.
thank you.

code:
#include <sys/param.h>  #include <sys/mount.h>     #include <errno.h>  #include <stdio.h>  #include <stdlib.h>     #define max_fs 128     void  print_mounted_fs(void)  {          struct statfs buf[max_fs];          int fs_count;          int i;             fs_count = getfsstat(null, 0, mnt_nowait);          if (fs_count == -1) {                  fprintf(stderr, "error: %d\n", errno);                  exit(1);          }          printf("%d file systems found.", fs_count);             getfsstat(buf, fs_count * sizeof(buf[0]), mnt_nowait);             printf("\n");          (i = 0; < fs_count; ++i) {                  printf("%s\n", buf[i].f_mntonname);          }  }     int  main(void)  {          print_mounted_fs();             return 0;  }

quote posted andreime view post
on page http://manpages.ubuntu.com/manpages/....2freebsd.html getfsstat standard c library.
no, not system-type dependent function. in fact, manual page refer states appeared in bsd 4.4 first. note manual page imported freebsd packaged ubuntu convenience, not reflect ubuntu's actual behaviour.

if want use linux-compatible functions, have here, maybe that's useful you:
http://linux.die.net/man/2/statvfs


Forum The Ubuntu Forum Community Ubuntu Specialised Support Development & Programming Programming Talk getfsstat not working in ubuntu(but works in other os)


Ubuntu

Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial