Merging upstream version 0.0.3.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
5a3ffa62e4
commit
cb2e838cdf
7 changed files with 41 additions and 21 deletions
2
.dockerignore
Normal file
2
.dockerignore
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
_release
|
||||||
|
_debug
|
16
.github/workflows/ci.yaml
vendored
16
.github/workflows/ci.yaml
vendored
|
@ -24,29 +24,35 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with: {fetch-depth: 0}
|
||||||
- run: sudo apt-get install -y build-essential
|
- run: sudo apt-get install -y build-essential
|
||||||
- run: make CFG=${{ matrix.cfg}} -j$(nproc)
|
- run: make VERBOSE=1 CFG=${{ matrix.cfg}} -j$(nproc)
|
||||||
- run: _${{ matrix.cfg }}/inotify-info
|
- run: |
|
||||||
|
_${{ matrix.cfg }}/inotify-info --version
|
||||||
|
_${{ matrix.cfg }}/inotify-info
|
||||||
|
|
||||||
build-with-zig:
|
build-with-zig:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
with: {fetch-depth: 0}
|
||||||
- uses: actions/cache@v4
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
key: zig-sdk-and-cache-${{ hashFiles('.github/workflows/ci.yaml') }}
|
key: zig-sdk-and-cache-${{ hashFiles('.github/workflows/ci.yaml') }}
|
||||||
path: ~/.cache/zig
|
path: ~/.cache/zig
|
||||||
- run: |
|
- run: |
|
||||||
wget --progress=dot:mega \
|
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
|
tar -xJf zig-linux-*.tar.xz
|
||||||
rm zig-linux-*.xz
|
rm zig-linux-*.xz
|
||||||
mv zig-linux-* zig-sdk
|
mv zig-linux-* zig-sdk
|
||||||
- run: |
|
- run: |
|
||||||
make -j$(nproc) \
|
make VERBOSE=1 -j$(nproc) \
|
||||||
CC="zig-sdk/zig cc -target $(uname -m)-linux-musl" \
|
CC="zig-sdk/zig cc -target $(uname -m)-linux-musl" \
|
||||||
CXX="zig-sdk/zig c++ -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:
|
build-with-docker:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
5
.github/workflows/release.yaml
vendored
5
.github/workflows/release.yaml
vendored
|
@ -8,15 +8,10 @@ jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
- name: Archive
|
|
||||||
run: make inotify-info-${{ github.ref_name }}.tar.gz
|
|
||||||
- name: Release
|
- name: Release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
if: startsWith(github.ref, 'refs/tags/v')
|
if: startsWith(github.ref, 'refs/tags/v')
|
||||||
with:
|
with:
|
||||||
files: inotify-info-${{ github.ref_name }}.tar.gz
|
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
draft: true
|
draft: true
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
|
|
@ -8,7 +8,7 @@ COPY . .
|
||||||
|
|
||||||
RUN CC="zig cc -target $(uname -m)-linux-musl" \
|
RUN CC="zig cc -target $(uname -m)-linux-musl" \
|
||||||
CXX="zig c++ -target $(uname -m)-linux-musl" \
|
CXX="zig c++ -target $(uname -m)-linux-musl" \
|
||||||
make
|
make VERBOSE=1
|
||||||
|
|
||||||
FROM scratch
|
FROM scratch
|
||||||
COPY --from=0 /inotify-info/_release/inotify-info /inotify-info
|
COPY --from=0 /inotify-info/_release/inotify-info /inotify-info
|
||||||
|
|
13
Makefile
13
Makefile
|
@ -20,6 +20,9 @@ ifeq ($(CFG), debug)
|
||||||
ASAN ?= 1
|
ASAN ?= 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
BINDIR := $(PREFIX)/bin
|
||||||
|
|
||||||
LD = $(CC)
|
LD = $(CC)
|
||||||
RM = rm -f
|
RM = rm -f
|
||||||
MKDIR = mkdir -p
|
MKDIR = mkdir -p
|
||||||
|
@ -121,6 +124,16 @@ clean:
|
||||||
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.d)
|
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.d)
|
||||||
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.dwo)
|
$(VERBOSE_PREFIX)$(RM) $(OBJS:.o=.dwo)
|
||||||
|
|
||||||
|
.PHONY: install
|
||||||
|
|
||||||
|
install: all
|
||||||
|
install -D $(PROJ) $(BINDIR)/$(NAME)
|
||||||
|
|
||||||
|
.PHONY: uninstall
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
$(RM) $(BINDIR)/$(NAME)
|
||||||
|
|
||||||
define RELEASE_RULES
|
define RELEASE_RULES
|
||||||
inotify-info-$(TAG).tar.gz:
|
inotify-info-$(TAG).tar.gz:
|
||||||
git archive --prefix=inotify-info-$(TAG)/ v$(TAG) | gzip -n > $$@
|
git archive --prefix=inotify-info-$(TAG)/ v$(TAG) | gzip -n > $$@
|
||||||
|
|
14
README.md
14
README.md
|
@ -23,10 +23,10 @@ Linking _debug/inotify-info...
|
||||||
```
|
```
|
||||||
|
|
||||||
## Install
|
## Install
|
||||||
You are free to copy the resulting executable to any suitable location in your `$PATH`.
|
|
||||||
```
|
The resulting executable will be at `_release/inotify-info`. You are free to
|
||||||
cp _release/inotify-info /usr/local/bin/
|
copy the resulting executable to any suitable location in your `$PATH` or run
|
||||||
```
|
`make install` to install to `/usr/local/bin`.
|
||||||
|
|
||||||
## Run (Prints Summary)
|
## Run (Prints Summary)
|
||||||
```
|
```
|
||||||
|
@ -154,13 +154,16 @@ Searching '/' for listed inodes... (8 threads)
|
||||||
94111468 [10304h] /home/mikesart/.cache/xfce4/xfce4-appfinder/
|
94111468 [10304h] /home/mikesart/.cache/xfce4/xfce4-appfinder/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run on Docker
|
## Run on Docker/podman
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
docker build . -t inotify-info
|
docker build . -t inotify-info
|
||||||
docker run --rm --privileged -v /proc:/proc 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)
|
## 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
|
[problem2]: https://unix.stackexchange.com/questions/15509/whos-consuming-my-inotify-resources
|
||||||
[lfqueue]: https://github.com/Taymindis/lfqueue
|
[lfqueue]: https://github.com/Taymindis/lfqueue
|
||||||
[bsd]: https://github.com/Taymindis/lfqueue/blob/master/LICENSE
|
[bsd]: https://github.com/Taymindis/lfqueue/blob/master/LICENSE
|
||||||
|
[podman]: https://podman.io/
|
||||||
|
|
|
@ -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;
|
int flags = AT_NO_AUTOMOUNT | AT_SYMLINK_NOFOLLOW | AT_STATX_DONT_SYNC;
|
||||||
|
|
||||||
if (statx(0, filename, flags, mask, &statxbuf) == -1) {
|
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));
|
memset(&statxbuf, 0, sizeof(statxbuf));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ static dev_t stat_get_dev_t(const char* filename)
|
||||||
|
|
||||||
int ret = stat(filename, &statbuf);
|
int ret = stat(filename, &statbuf);
|
||||||
if (ret == -1) {
|
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 0;
|
||||||
}
|
}
|
||||||
return statbuf.st_dev;
|
return statbuf.st_dev;
|
||||||
|
@ -430,7 +430,7 @@ static uint64_t stat_get_ino(const char* filename)
|
||||||
|
|
||||||
int ret = stat(filename, &statbuf);
|
int ret = stat(filename, &statbuf);
|
||||||
if (ret == -1) {
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -543,7 +543,7 @@ int thread_info_t::parse_dirqueue_entry()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (spew_error) {
|
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;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -631,7 +631,7 @@ static bool init_inotify_proclist(std::vector<procinfo_t>& inotify_proclist)
|
||||||
DIR* dir_proc = opendir("/proc");
|
DIR* dir_proc = opendir("/proc");
|
||||||
|
|
||||||
if (!dir_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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue