0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-27 07:54:05 +01:00

ircd::fs: Add size(fd) from sys stat().

This commit is contained in:
Jason Volk 2018-05-30 02:12:19 -07:00
parent 955d8921b9
commit a9e73d898c
2 changed files with 10 additions and 0 deletions

View file

@ -14,6 +14,8 @@
namespace ircd::fs
{
struct fd;
size_t size(const fd &);
}
/// Object for maintaining state to an open file or directory. Instances can

View file

@ -274,6 +274,14 @@ namespace ircd::fs
static uint posix_flags(const std::ios::open_mode &mode);
}
size_t
ircd::fs::size(const fd &fd)
{
struct stat stat;
syscall(::fstat, fd, &stat);
return stat.st_size;
};
uint
ircd::fs::posix_flags(const std::ios::open_mode &mode)
{