FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
node-diskusage/src/diskusage_posix.cpp at master · jduncanator/node-diskusage · GitHub
jduncanator
/
node-diskusage
Public
Notifications
You must be signed in to change notification settings
Fork
54
Star
157
Code
Issues
5
Pull requests
2
Actions
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
node-diskusage
/
src
/
diskusage_posix.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
23 lines (18 loc) · 517 Bytes
Breadcrumbs
node-diskusage
/
src
/
diskusage_posix.cpp
Copy path
File metadata and controls
23 lines (18 loc) · 517 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#
include
"
diskusage.h
"
#
include
<
stdexcept
>
#
include
<
sys/statvfs.h
>
#
include
<
errno.h
>
#
include
<
string.h
>
DiskUsage
GetDiskUsage
(
const
char
* path)
{
struct
statvfs
info = {};
if
(
statvfs
(path, &info)) {
int
errnum = errno;
throw
SystemError
(errnum,
"
statvfs
"
,
strerror
(errnum), path);
}
DiskUsage result;
result.
available
= info.
f_bavail
* info.
f_frsize
;
result.
free
= info.
f_bfree
* info.
f_frsize
;
result.
total
= info.
f_blocks
* info.
f_frsize
;
return
result;
}
Back
|
FazBrowse Home
|
New Git URL