1
0
Fork 0

Merging upstream version 0.0.3.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 15:21:10 +01:00
parent 5a3ffa62e4
commit cb2e838cdf
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
7 changed files with 41 additions and 21 deletions

2
.dockerignore Normal file
View file

@ -0,0 +1,2 @@
_release
_debug

View file

@ -24,29 +24,35 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- run: sudo apt-get install -y build-essential
- run: make CFG=${{ matrix.cfg}} -j$(nproc)
- run: _${{ matrix.cfg }}/inotify-info
- run: make VERBOSE=1 CFG=${{ matrix.cfg}} -j$(nproc)
- run: |
_${{ matrix.cfg }}/inotify-info --version
_${{ matrix.cfg }}/inotify-info
build-with-zig:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: {fetch-depth: 0}
- uses: actions/cache@v4
with:
key: zig-sdk-and-cache-${{ hashFiles('.github/workflows/ci.yaml') }}
path: ~/.cache/zig
- run: |
wget --progress=dot:mega \
https://ziglang.org/download/0.12.0/zig-linux-$(uname -m)-0.12.0.tar.xz
https://ziglang.org/download/0.13.0/zig-linux-$(uname -m)-0.13.0.tar.xz
tar -xJf zig-linux-*.tar.xz
rm zig-linux-*.xz
mv zig-linux-* zig-sdk
- run: |
make -j$(nproc) \
make VERBOSE=1 -j$(nproc) \
CC="zig-sdk/zig cc -target $(uname -m)-linux-musl" \
CXX="zig-sdk/zig c++ -target $(uname -m)-linux-musl"
- run: _release/inotify-info
- run: |
_release/inotify-info --version
_release/inotify-info
build-with-docker:
runs-on: ubuntu-latest

View file

@ -8,15 +8,10 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Archive
run: make inotify-info-${{ github.ref_name }}.tar.gz
- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
files: inotify-info-${{ github.ref_name }}.tar.gz
generate_release_notes: true
draft: true
prerelease: true

View file

@ -8,7 +8,7 @@ COPY . .
RUN CC="zig cc -target $(uname -m)-linux-musl" \
CXX="zig c++ -target $(uname -m)-linux-musl" \
make
make VERBOSE=1
FROM scratch
COPY --from=0 /inotify-info/_release/inotify-info /inotify-info

View file

@ -20,6 +20,9 @@ ifeq ($(CFG), debug)
ASAN ?= 1
endif
PREFIX ?= /usr/local
BINDIR := $(PREFIX)/bin
LD = $(CC)
RM = rm -f
MKDIR = mkdir -p
@ -121,6 +124,16 @@ clean:
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.d)
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.dwo)
.PHONY: install
install: all
install -D $(PROJ) $(BINDIR)/$(NAME)
.PHONY: uninstall
uninstall:
$(RM) $(BINDIR)/$(NAME)
define RELEASE_RULES
inotify-info-$(TAG).tar.gz:
git archive --prefix=inotify-info-$(TAG)/ v$(TAG) | gzip -n > $$@

View file

@ -23,10 +23,10 @@ Linking _debug/inotify-info...
```
## Install
You are free to copy the resulting executable to any suitable location in your `$PATH`.
```
cp _release/inotify-info /usr/local/bin/
```
The resulting executable will be at `_release/inotify-info`. You are free to
copy the resulting executable to any suitable location in your `$PATH` or run
`make install` to install to `/usr/local/bin`.
## Run (Prints Summary)
```
@ -154,13 +154,16 @@ Searching '/' for listed inodes... (8 threads)
94111468 [10304h] /home/mikesart/.cache/xfce4/xfce4-appfinder/
```
## Run on Docker
## Run on Docker/podman
```sh
docker build . -t inotify-info
docker run --rm --privileged -v /proc:/proc inotify-info
```
When running under [podman][podman] non-root mode, append `--ulimit
nofile=65535:65535` to the `podman build` command.
## Run on Nix(OS)
```
@ -176,3 +179,4 @@ nix run nixpkgs#inotify-info
[problem2]: https://unix.stackexchange.com/questions/15509/whos-consuming-my-inotify-resources
[lfqueue]: https://github.com/Taymindis/lfqueue
[bsd]: https://github.com/Taymindis/lfqueue/blob/master/LICENSE
[podman]: https://podman.io/

View file

@ -389,7 +389,7 @@ struct statx mystatx(const char* filename, unsigned int mask = 0)
int flags = AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC;
if (statx(0, filename, flags, mask, &statxbuf) == -1) {
printf("ERROR: statx-ino( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: statx-ino( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
memset(&statxbuf, 0, sizeof(statxbuf));
}
@ -418,7 +418,7 @@ static dev_t stat_get_dev_t(const char* filename)
int ret = stat(filename, &statbuf);
if (ret == -1) {
printf("ERROR: stat-dev_t( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: stat-dev_t( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
return 0;
}
return statbuf.st_dev;
@ -430,7 +430,7 @@ static uint64_t stat_get_ino(const char* filename)
int ret = stat(filename, &statbuf);
if (ret == -1) {
printf("ERROR: stat-ino( %s ) failed. Errno: %d\n", filename, errno);
printf("ERROR: stat-ino( %s ) failed. Errno: %d (%s)\n", filename, errno, strerror(errno));
return 0;
}
@ -543,7 +543,7 @@ int thread_info_t::parse_dirqueue_entry()
}
if (spew_error) {
printf("ERROR: sys_getdents64 failed on '%s': %d errno:%d\n", path, ret, errno);
printf("ERROR: sys_getdents64 failed on '%s': %d errno: %d (%s)\n", path, ret, errno, strerror(errno));
}
break;
}
@ -631,7 +631,7 @@ static bool init_inotify_proclist(std::vector<procinfo_t>& inotify_proclist)
DIR* dir_proc = opendir("/proc");
if (!dir_proc) {
printf("ERROR: opendir /proc failed: %d\n", errno);
printf("ERROR: opendir /proc failed: %d (%s)\n", errno, strerror(errno));
return false;
}