diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-04-25 15:57:36 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-04-25 15:57:36 -0400 |
commit | 47005cf1cf3a3602b6793973959a0e86fd295eab (patch) | |
tree | 1d3563704bb669cc6abbc504e06c4ec83b86a2df /src/basic/fs-util.c | |
parent | 61837e19c6abe9470846674d921b88516c5ec2f9 (diff) | |
parent | 52051dd84c45c745ca877d8893be6f71aa27bf97 (diff) |
Merge pull request #3109 from poettering/journal-by-fd
rework "journalctl -M"
Diffstat (limited to 'src/basic/fs-util.c')
-rw-r--r-- | src/basic/fs-util.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c index 51268828af..e24e7036f7 100644 --- a/src/basic/fs-util.c +++ b/src/basic/fs-util.c @@ -38,6 +38,7 @@ #include "mkdir.h" #include "parse-util.h" #include "path-util.h" +#include "stdio-util.h" #include "string-util.h" #include "strv.h" #include "time-util.h" @@ -493,3 +494,17 @@ int get_files_in_directory(const char *path, char ***list) { return n; } + +int inotify_add_watch_fd(int fd, int what, uint32_t mask) { + char path[strlen("/proc/self/fd/") + DECIMAL_STR_MAX(int) + 1]; + int r; + + /* This is like inotify_add_watch(), except that the file to watch is not referenced by a path, but by an fd */ + xsprintf(path, "/proc/self/fd/%i", what); + + r = inotify_add_watch(fd, path, mask); + if (r < 0) + return -errno; + + return r; +} |