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

[LibOS] Add stat() and hstat() callbacks to FIFOs #1897

Merged
merged 1 commit into from
Jun 6, 2024

Conversation

dimakuv
Copy link
Contributor

@dimakuv dimakuv commented Jun 5, 2024

Description of the changes

Previously, FIFO pseudo-files (named pipes) did not have callbacks of stat() (used on FIFO filenames) and hstat() (used on FIFO handles/FDs). This breaks some apps that want to double-check that the file they have opened or want to open is a FIFO, using the stat() or fstat() syscalls. There was no good reason to skip those callbacks, so this commit adds their dummy implementations.

Fixes #1896.

How to test this PR?

Added some sub-tests in LibOS, and activated read03 in LTP.


This change is Reviewable

Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: Intel) (waiting on @dimakuv)


libos/test/regression/mkfifo.c line 23 at r1 (raw file):

    }

    struct stat buf;

I really dislike having buf and buffer in a single function at the same time.

Suggestion:

struct stat stat_buf;

libos/test/regression/mkfifo.c line 46 at r1 (raw file):

        }

        struct stat buf;

ditto, OTOH, you already have a buffer which you could use here, why another one?

Copy link
Contributor Author

@dimakuv dimakuv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: 2 of 3 files reviewed, 2 unresolved discussions, not enough approvals from maintainers (2 more required), not enough approvals from different teams (1 more required, approved so far: Intel), "fixup! " found in commit messages' one-liners (waiting on @mkow)


libos/test/regression/mkfifo.c line 23 at r1 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…

I really dislike having buf and buffer in a single function at the same time.

Done.


libos/test/regression/mkfifo.c line 46 at r1 (raw file):

Previously, mkow (Michał Kowalczyk) wrote…

ditto, OTOH, you already have a buffer which you could use here, why another one?

Done.

Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, all discussions resolved, not enough approvals from maintainers (1 more required), "fixup! " found in commit messages' one-liners

Copy link
Contributor

@kailun-qin kailun-qin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed 2 of 3 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, all discussions resolved, "fixup! " found in commit messages' one-liners

Previously, FIFO pseudo-files (named pipes) did not have callbacks of
`stat()` (used on FIFO filenames) and `hstat()` (used on FIFO
handles/FDs). This breaks some apps that want to double-check that the
file they have opened or want to open is a FIFO, using the `stat()` or
`fstat()` syscalls. There was no good reason to skip those callbacks, so
this commit adds their dummy implementations.

Signed-off-by: Dmitrii Kuvaiskii <dmitrii.kuvaiskii@intel.com>
@dimakuv dimakuv force-pushed the dimakuv/pipes-fifos-add-stat branch from d19c34a to 5169fdb Compare June 6, 2024 13:02
Copy link
Member

@mkow mkow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

Copy link
Contributor

@kailun-qin kailun-qin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved

@dimakuv dimakuv merged commit 5169fdb into master Jun 6, 2024
18 of 20 checks passed
@dimakuv dimakuv deleted the dimakuv/pipes-fifos-add-stat branch June 6, 2024 17:32
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

Successfully merging this pull request may close these issues.

mknod with S_IFIFO fails to create FIFO pipe, function call return success does not throw any error
3 participants