From 1709590439945c2ab64f0cb42967f70ecde02fee Mon Sep 17 00:00:00 2001 From: Juston Li Date: Tue, 17 Jan 2023 12:57:48 -0800 Subject: [PATCH] util/fossilize_db: fix macOS inotify build error require for fossilize_db Fixes: 3b69b67545b ("util/fossilize_db: add runtime RO foz db loading via FOZ_DBS_DYNAMIC_LIST") Signed-off-by: Juston Li Part-of: --- meson.build | 2 +- src/util/fossilize_db.c | 6 ++++++ src/util/fossilize_db.h | 4 ++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 8a26ebc2f89..17669575dc2 100644 --- a/meson.build +++ b/meson.build @@ -1252,7 +1252,7 @@ if not ['linux'].contains(host_machine.system()) endif foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h', - 'cet.h', 'pthread_np.h', 'renderdoc_app.h'] + 'cet.h', 'pthread_np.h', 'renderdoc_app.h', 'sys/inotify.h'] if cc.check_header(h) pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify()) endif diff --git a/src/util/fossilize_db.c b/src/util/fossilize_db.c index 25f4decba98..16daec4777d 100644 --- a/src/util/fossilize_db.c +++ b/src/util/fossilize_db.c @@ -325,6 +325,7 @@ load_foz_dbs_ro(struct foz_db *foz_db, char *foz_dbs_ro) } } +#ifdef FOZ_DB_UTIL_DYNAMIC_LIST static bool check_file_already_loaded(struct foz_db *foz_db, FILE *db_file, @@ -483,6 +484,7 @@ foz_dbs_list_updater_init(struct foz_db *foz_db, char *list_filename) return true; } +#endif /* Here we open mesa cache foz dbs files. If the files exist we load the index * db into a hash table. The index db contains the offsets needed to later @@ -525,10 +527,12 @@ foz_prepare(struct foz_db *foz_db, char *cache_path) if (foz_dbs_ro) load_foz_dbs_ro(foz_db, foz_dbs_ro); +#ifdef FOZ_DB_UTIL_DYNAMIC_LIST char *foz_dbs_list = getenv("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST"); if (foz_dbs_list) foz_dbs_list_updater_init(foz_db, foz_dbs_list); +#endif return true; @@ -541,6 +545,7 @@ fail: void foz_destroy(struct foz_db *foz_db) { +#ifdef FOZ_DB_UTIL_DYNAMIC_LIST struct foz_dbs_list_updater *updater = &foz_db->updater; if (updater->thrd) { inotify_rm_watch(updater->inotify_fd, updater->inotify_wd); @@ -550,6 +555,7 @@ foz_destroy(struct foz_db *foz_db) thrd_join(updater->thrd, NULL); close(updater->inotify_fd); } +#endif if (foz_db->db_idx) fclose(foz_db->db_idx); diff --git a/src/util/fossilize_db.h b/src/util/fossilize_db.h index 90ebe526045..4e24e3ff6af 100644 --- a/src/util/fossilize_db.h +++ b/src/util/fossilize_db.h @@ -37,6 +37,10 @@ #define FOZ_DB_UTIL 1 #endif +#ifdef HAVE_SYS_INOTIFY_H +#define FOZ_DB_UTIL_DYNAMIC_LIST 1 +#endif + #include #include #include