Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fstat doesn't work on pipes #16414

Open
hoodmane opened this issue Mar 3, 2022 · 1 comment
Open

fstat doesn't work on pipes #16414

hoodmane opened this issue Mar 3, 2022 · 1 comment

Comments

@hoodmane
Copy link
Collaborator

hoodmane commented Mar 3, 2022

Consider the following simple program:

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdio.h>

int fd[2];

int main(){
    struct stat statbuf;
    pipe(fd);
    int status = fstat(fd[0], &statbuf);
    printf("status: %d\n", status);
	return status;
}

If I compile it with gcc and run it, it will print status: 0. If I compile it with emcc and run it with node, it will print status: -1.

@tiran
Copy link
Contributor

tiran commented Mar 8, 2022

NODERAWFS's fstat() does not seem to work on any fd that is not backed by a physical file on the file system. I also noticed that fstat() fails after the backing file is unlink()ed. python-wasm ticket emmatyping/python-wasm#66 has a reproducer in Python. Both issues could be related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants