Bugzilla – Attachment 134056 Details for
Bug 60909
Out of space warning ...
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
getFreeSpace source code
getFreeSpace.cpp (text/plain), 844 bytes, created by
drX
on 2017-06-15 23:46:12 UTC
(
hide
)
Description:
getFreeSpace source code
Filename:
MIME Type:
Creator:
drX
Created:
2017-06-15 23:46:12 UTC
Size:
844 bytes
patch
obsolete
> >#include<iostream> > >#include <unistd.h> >#include <sys/types.h> >#include <sys/statvfs.h> >#include <pwd.h> > >unsigned long getFreeSpace() >{ > struct statvfs stat; > std::string conf_path(getpwuid(getuid())->pw_dir); > > > conf_path += "/.config/"; > > > std::cout<< conf_path << std::endl; > > > if (statvfs(conf_path.c_str(), &stat) != 0) return 0; //error!.. > > > //free space size is (f_bsize * f_bavail) > //unsigned long f_bsize; > //fsblkcnt_t f_bavail > return stat.f_bsize * stat.f_bavail; >} > >unsigned long getFreeSpace(std::string conf_path) >{ > struct statvfs stat; > > if (statvfs(conf_path.c_str(), &stat) != 0) return 0; //error!.. > > //free space size is (f_bsize * f_bavail) > //unsigned long f_bsize; > //fsblkcnt_t f_bavail > return stat.f_bsize * stat.f_bavail; >} > >int main() >{ > std::cout<<getFreeSpace(".")<<std::endl; > return 0; >}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 60909
: 134056 |
184569