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

Backwards compatibility with linux pre 2.6.33 #19

Merged
merged 3 commits into from
Jan 6, 2024

Conversation

drok
Copy link
Contributor

@drok drok commented Jan 5, 2024

This series of 3 commits implements:

  • Compatibility with kernels older than 2.6.33

    • prior to this, instead of "anon_inode:inotify" linux used "inotify" as filename in /proc/.../fd
  • Compatibility with kernels older than 3.8

    • prior to this, the /proc/.../fdinfo/... files did not include a list of inotify watches
    • the "Watches" column is omitted on older kernels
  • Compatibility with GCC older than 7.1

    • prior to this, GCC did not support the -Wimplicit-fallthrough= argument

This PR also resolves my concern in #10 (comment) about missing info on old kernels

Please merge this PR rather than rebase.

drok added 3 commits January 5, 2024 01:56
Support for listing inotify watches in a /proc/{}/fdinfo/{} file
was added in linux kernel 3.8; this utility relies on that information
to count the number of watches in use.

This commit detects when the inotify info is not provided in fdinfo and
ommits the "Watches" column and stats when printing the found info.

Author-Rebase-Consent: https://No-rebase.github.io
Starting with kernel 2.6.33, inotify descriptors were listed as in
/proc/{}/fd as "anon_inode:inotify". Prior to this version, they
were listed as "inotify"

This commit allows both nomenclatures, making the utility compatible
with kernels older than 2.6.33

Author-Rebase-Consent: https://No-rebase.github.io
The -Wimplicit-fallthrough=2 warning was first implemented in GCC 7.1.
This would cause compiling with earlier GCC to fail.

This warning (albeit with =3 format) was included in -Wall which is more
stringent. This incantation requires fall-through case statements to be
specified case sensitively. In any case, the codebase here does not
include any fall-through waivers, so changing to -Wall does not require
any other adaptations.

This commit removes the -Wimplicit-fallthrough argument from the
Makefile, and replaces it with -Wall which is more stringent, and
allows old GCC's to successfully compile the utility.

Author-Rebase-Consent: https://No-rebase.github.io
@drok drok mentioned this pull request Jan 5, 2024
@mikesart mikesart merged commit a7ff6fa into mikesart:master Jan 6, 2024
@mikesart
Copy link
Owner

mikesart commented Jan 6, 2024

Thanks Radu!

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.

2 participants