diff options
| author | Khem Raj <raj.khem@gmail.com> | 2022-12-20 11:27:17 -0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2022-12-23 08:52:22 -0800 |
| commit | 562413e6863b6bab8563389b0ace91aa450ee50d (patch) | |
| tree | 0b28381fd2a108f0d46f34cd083cd5618a92ff96 | |
| parent | a71c6b16b6c3dd6222501c760ddead782e6761e2 (diff) | |
| download | meta-openembedded-562413e6863b6bab8563389b0ace91aa450ee50d.tar.gz | |
inotify-tools: Fix build on musl and lfs64
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 150 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch b/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch new file mode 100644 index 0000000000..3b195aae4f --- /dev/null +++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | From 6a57ff26d695aaad096b798879a5dbc5af2cedf5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 20 Dec 2022 10:46:50 -0800 | ||
| 4 | Subject: [PATCH] configure: Add AC_SYS_LARGEFILE autoconf macro | ||
| 5 | |||
| 6 | This will define _FILE_OFFSET_BITS to be 64 if off_t is 64bit | ||
| 7 | and we do not need to define lfs64 functions | ||
| 8 | |||
| 9 | Upstream-Status: Submitted [https://github.com/inotify-tools/inotify-tools/pull/174] | ||
| 10 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 11 | --- | ||
| 12 | configure.ac | 3 +++ | ||
| 13 | 1 file changed, 3 insertions(+) | ||
| 14 | |||
| 15 | diff --git a/configure.ac b/configure.ac | ||
| 16 | index bddf14d..b89a266 100644 | ||
| 17 | --- a/configure.ac | ||
| 18 | +++ b/configure.ac | ||
| 19 | @@ -17,6 +17,9 @@ AC_PROG_CC | ||
| 20 | AM_INIT_AUTOMAKE | ||
| 21 | LT_INIT | ||
| 22 | |||
| 23 | +# Add option for largefile support | ||
| 24 | +AC_SYS_LARGEFILE | ||
| 25 | + | ||
| 26 | AC_PATH_PROG(DOXYGEN, doxygen, NO_DOXYGEN) | ||
| 27 | |||
| 28 | AC_ARG_ENABLE(doxygen, | ||
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools/0003-replace-stat64-lstat64-with-stat-lstat.patch b/meta-oe/recipes-support/inotify-tools/inotify-tools/0003-replace-stat64-lstat64-with-stat-lstat.patch new file mode 100644 index 0000000000..c0784ecc73 --- /dev/null +++ b/meta-oe/recipes-support/inotify-tools/inotify-tools/0003-replace-stat64-lstat64-with-stat-lstat.patch | |||
| @@ -0,0 +1,119 @@ | |||
| 1 | From c6093ad63b92f5d25e6826d1c49dc7cee86d3747 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 20 Dec 2022 10:48:10 -0800 | ||
| 4 | Subject: [PATCH] replace stat64/lstat64 with stat/lstat | ||
| 5 | |||
| 6 | lfs64 functions are not needed when off_t is 64-bit | ||
| 7 | Additionally this fixes build with musl which does not | ||
| 8 | export these functions without defining _LARGEFILE64_SOURCE | ||
| 9 | |||
| 10 | Upstream-Status: Submitted [https://github.com/inotify-tools/inotify-tools/pull/174] | ||
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 12 | --- | ||
| 13 | libinotifytools/src/inotifytools.c | 8 ++++---- | ||
| 14 | libinotifytools/src/inotifytools/inotify-nosys.h | 5 ----- | ||
| 15 | libinotifytools/src/inotifytools/inotifytools.h | 5 ----- | ||
| 16 | src/common.c | 4 ++-- | ||
| 17 | src/common.h | 6 +----- | ||
| 18 | 5 files changed, 7 insertions(+), 21 deletions(-) | ||
| 19 | |||
| 20 | diff --git a/libinotifytools/src/inotifytools.c b/libinotifytools/src/inotifytools.c | ||
| 21 | index 50f6135..3e17ac6 100644 | ||
| 22 | --- a/libinotifytools/src/inotifytools.c | ||
| 23 | +++ b/libinotifytools/src/inotifytools.c | ||
| 24 | @@ -1750,14 +1750,14 @@ int inotifytools_watch_recursively_with_exclude(char const* path, | ||
| 25 | |||
| 26 | static struct dirent * ent; | ||
| 27 | char * next_file; | ||
| 28 | - static struct stat64 my_stat; | ||
| 29 | + static struct stat my_stat; | ||
| 30 | ent = readdir( dir ); | ||
| 31 | // Watch each directory within this directory | ||
| 32 | while ( ent ) { | ||
| 33 | if ( (0 != strcmp( ent->d_name, "." )) && | ||
| 34 | (0 != strcmp( ent->d_name, ".." )) ) { | ||
| 35 | nasprintf(&next_file,"%s%s", my_path, ent->d_name); | ||
| 36 | - if ( -1 == lstat64( next_file, &my_stat ) ) { | ||
| 37 | + if ( -1 == lstat( next_file, &my_stat ) ) { | ||
| 38 | error = errno; | ||
| 39 | free( next_file ); | ||
| 40 | if ( errno != EACCES ) { | ||
| 41 | @@ -1840,9 +1840,9 @@ int inotifytools_error() { | ||
| 42 | * @internal | ||
| 43 | */ | ||
| 44 | static int isdir( char const * path ) { | ||
| 45 | - static struct stat64 my_stat; | ||
| 46 | + static struct stat my_stat; | ||
| 47 | |||
| 48 | - if ( -1 == lstat64( path, &my_stat ) ) { | ||
| 49 | + if ( -1 == lstat( path, &my_stat ) ) { | ||
| 50 | if (errno == ENOENT) return 0; | ||
| 51 | fprintf(stderr, "Stat failed on %s: %s\n", path, strerror(errno)); | ||
| 52 | return 0; | ||
| 53 | diff --git a/libinotifytools/src/inotifytools/inotify-nosys.h b/libinotifytools/src/inotifytools/inotify-nosys.h | ||
| 54 | index 01aa45e..97166d4 100644 | ||
| 55 | --- a/libinotifytools/src/inotifytools/inotify-nosys.h | ||
| 56 | +++ b/libinotifytools/src/inotifytools/inotify-nosys.h | ||
| 57 | @@ -13,11 +13,6 @@ | ||
| 58 | #include <sys/syscall.h> | ||
| 59 | #include <unistd.h> | ||
| 60 | |||
| 61 | -#ifdef __FreeBSD__ | ||
| 62 | -#define stat64 stat | ||
| 63 | -#define lstat64 lstat | ||
| 64 | -#endif | ||
| 65 | - | ||
| 66 | /* | ||
| 67 | * struct inotify_event - structure read from the inotify device for each event | ||
| 68 | * | ||
| 69 | diff --git a/libinotifytools/src/inotifytools/inotifytools.h b/libinotifytools/src/inotifytools/inotifytools.h | ||
| 70 | index 49936ae..2ec4358 100644 | ||
| 71 | --- a/libinotifytools/src/inotifytools/inotifytools.h | ||
| 72 | +++ b/libinotifytools/src/inotifytools/inotifytools.h | ||
| 73 | @@ -1,11 +1,6 @@ | ||
| 74 | #ifndef _inotifytools_H | ||
| 75 | #define _inotifytools_H | ||
| 76 | |||
| 77 | -#ifdef __FreeBSD__ | ||
| 78 | -#define stat64 stat | ||
| 79 | -#define lstat64 lstat | ||
| 80 | -#endif | ||
| 81 | - | ||
| 82 | #ifdef __cplusplus | ||
| 83 | extern "C" | ||
| 84 | { | ||
| 85 | diff --git a/src/common.c b/src/common.c | ||
| 86 | index 5a6fda1..885286e 100644 | ||
| 87 | --- a/src/common.c | ||
| 88 | +++ b/src/common.c | ||
| 89 | @@ -45,9 +45,9 @@ void print_event_descriptions() { | ||
| 90 | } | ||
| 91 | |||
| 92 | int isdir(char const *path) { | ||
| 93 | - static struct stat64 my_stat; | ||
| 94 | + static struct stat my_stat; | ||
| 95 | |||
| 96 | - if (-1 == lstat64(path, &my_stat)) { | ||
| 97 | + if (-1 == lstat(path, &my_stat)) { | ||
| 98 | if (errno == ENOENT) | ||
| 99 | return 0; | ||
| 100 | fprintf(stderr, "Stat failed on %s: %s\n", path, strerror(errno)); | ||
| 101 | diff --git a/src/common.h b/src/common.h | ||
| 102 | index 12d3dde..7f1e34a 100644 | ||
| 103 | --- a/src/common.h | ||
| 104 | +++ b/src/common.h | ||
| 105 | @@ -1,13 +1,9 @@ | ||
| 106 | #ifndef COMMON_H | ||
| 107 | #define COMMON_H | ||
| 108 | |||
| 109 | -#ifdef __FreeBSD__ | ||
| 110 | -#define stat64 stat | ||
| 111 | -#define lstat64 lstat | ||
| 112 | -#ifdef ENABLE_FANOTIFY | ||
| 113 | +#if defined(__FreeBSD__) && defined(ENABLE_FANOTIFY) | ||
| 114 | #error "FreeBSD does not support fanotify" | ||
| 115 | #endif | ||
| 116 | -#endif | ||
| 117 | |||
| 118 | #include <stdbool.h> | ||
| 119 | |||
diff --git a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb index 3d25eecb34..281de522b2 100644 --- a/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb +++ b/meta-oe/recipes-support/inotify-tools/inotify-tools_3.22.6.0.bb | |||
| @@ -9,7 +9,9 @@ SRCREV = "c8bdbc0a2ed822fc7c67c5c3e102d89fe27fb2d0" | |||
| 9 | 9 | ||
| 10 | SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https \ | 10 | SRC_URI = "git://github.com/${BPN}/${BPN};branch=master;protocol=https \ |
| 11 | file://0002-libinotifytools-Bridge-differences-between-musl-glib.patch \ | 11 | file://0002-libinotifytools-Bridge-differences-between-musl-glib.patch \ |
| 12 | " | 12 | file://0002-configure-Add-AC_SYS_LARGEFILE-autoconf-macro.patch \ |
| 13 | file://0003-replace-stat64-lstat64-with-stat-lstat.patch \ | ||
| 14 | " | ||
| 13 | 15 | ||
| 14 | S = "${WORKDIR}/git" | 16 | S = "${WORKDIR}/git" |
| 15 | 17 | ||
