summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/pipe.cc
diff options
context:
space:
mode:
authorRahat Mahmood <rahat@google.com>2020-08-28 14:29:16 -0700
committergVisor bot <gvisor-bot@google.com>2020-08-28 14:31:11 -0700
commitb4820e598681c61fbf0e8a7f4d3436d2599ce53c (patch)
tree9e7c5770ba0edba0ae77f35300803c13d6914970 /test/syscalls/linux/pipe.cc
parentbdd5996a73b14d6f6600ab7aa00cdaed459cab16 (diff)
Implement StatFS for various VFS2 filesystems.
This mainly involved enabling kernfs' client filesystems to provide a StatFS implementation. Fixes #3411, #3515. PiperOrigin-RevId: 329009864
Diffstat (limited to 'test/syscalls/linux/pipe.cc')
-rw-r--r--test/syscalls/linux/pipe.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/syscalls/linux/pipe.cc b/test/syscalls/linux/pipe.cc
index 34291850d..c097c9187 100644
--- a/test/syscalls/linux/pipe.cc
+++ b/test/syscalls/linux/pipe.cc
@@ -13,7 +13,9 @@
// limitations under the License.
#include <fcntl.h> /* Obtain O_* constant definitions */
+#include <linux/magic.h>
#include <sys/ioctl.h>
+#include <sys/statfs.h>
#include <sys/uio.h>
#include <unistd.h>
@@ -198,6 +200,16 @@ TEST_P(PipeTest, NonBlocking) {
SyscallFailsWithErrno(EWOULDBLOCK));
}
+TEST(PipeTest, StatFS) {
+ int fds[2];
+ ASSERT_THAT(pipe(fds), SyscallSucceeds());
+ struct statfs st;
+ EXPECT_THAT(fstatfs(fds[0], &st), SyscallSucceeds());
+ EXPECT_EQ(st.f_type, PIPEFS_MAGIC);
+ EXPECT_EQ(st.f_bsize, getpagesize());
+ EXPECT_EQ(st.f_namelen, NAME_MAX);
+}
+
TEST(Pipe2Test, CloExec) {
int fds[2];
ASSERT_THAT(pipe2(fds, O_CLOEXEC), SyscallSucceeds());