diff options
author | Rahat Mahmood <rahat@google.com> | 2019-08-29 14:29:43 -0700 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-08-29 14:30:41 -0700 |
commit | 863e11ac4d6a49787cd5e5f6fe1cd771d0ceb100 (patch) | |
tree | 93c781bcce55dec62f4acd0725ff4d0192ca8054 /test/util/fs_util.cc | |
parent | 0789b9cc08249f8d0d6efcb25029efd271e47a9d (diff) |
Implement /proc/net/udp.
PiperOrigin-RevId: 266229756
Diffstat (limited to 'test/util/fs_util.cc')
-rw-r--r-- | test/util/fs_util.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/util/fs_util.cc b/test/util/fs_util.cc index ae49725a0..f7d231b14 100644 --- a/test/util/fs_util.cc +++ b/test/util/fs_util.cc @@ -105,6 +105,15 @@ PosixErrorOr<struct stat> Stat(absl::string_view path) { return stat_buf; } +PosixErrorOr<struct stat> Fstat(int fd) { + struct stat stat_buf; + int res = fstat(fd, &stat_buf); + if (res < 0) { + return PosixError(errno, absl::StrCat("fstat ", fd)); + } + return stat_buf; +} + PosixErrorOr<bool> Exists(absl::string_view path) { struct stat stat_buf; int res = stat(std::string(path).c_str(), &stat_buf); |