diff --git a/src/lib/libpipefs.js b/src/lib/libpipefs.js index 48c0d06757593..214852a84d9dc 100644 --- a/src/lib/libpipefs.js +++ b/src/lib/libpipefs.js @@ -20,6 +20,7 @@ addToLibrary({ // refcnt 2 because pipe has a read end and a write end. We need to be // able to read from the read end after write end is closed. refcnt : 2, + timestamp: new Date(), }; pipe.buckets.push({ @@ -60,6 +61,25 @@ addToLibrary({ }; }, stream_ops: { + getattr(stream) { + var node = stream.node; + var timestamp = node.pipe.timestamp; + return { + dev: 14, + ino: node.id, + mode: 0o10600, + nlink: 1, + uid: 0, + gid: 0, + rdev: 0, + size: 0, + atime: timestamp, + mtime: timestamp, + ctime: timestamp, + blksize: 4096, + blocks: 0, + }; + }, poll(stream) { var pipe = stream.node.pipe; diff --git a/test/unistd/pipe.c b/test/unistd/pipe.c index af7b336b060a4..7a7e17b445958 100644 --- a/test/unistd/pipe.c +++ b/test/unistd/pipe.c @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -65,6 +66,10 @@ int test_most() { assert(pipe(fd) == 0); + // Test that pipe is statable + struct stat st; + assert(fstat(fd[0], &st) == 0); + // Test that pipe is not seekable memset(buf, 0, sizeof buf);