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:
parent
955d8921b9
commit
a9e73d898c
2 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue