mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2024-11-23 18:24:13 +08:00
util/fossilize_db: fix macOS inotify build error
require <sys/inotify.h> for fossilize_db
Fixes: 3b69b67545
("util/fossilize_db: add runtime RO foz db loading via FOZ_DBS_DYNAMIC_LIST")
Signed-off-by: Juston Li <justonli@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20755>
This commit is contained in:
parent
357340953a
commit
1709590439
@ -1252,7 +1252,7 @@ if not ['linux'].contains(host_machine.system())
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'sys/shm.h',
|
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)
|
if cc.check_header(h)
|
||||||
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
|
pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
|
||||||
endif
|
endif
|
||||||
|
@ -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
|
static bool
|
||||||
check_file_already_loaded(struct foz_db *foz_db,
|
check_file_already_loaded(struct foz_db *foz_db,
|
||||||
FILE *db_file,
|
FILE *db_file,
|
||||||
@ -483,6 +484,7 @@ foz_dbs_list_updater_init(struct foz_db *foz_db, char *list_filename)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Here we open mesa cache foz dbs files. If the files exist we load the index
|
/* 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
|
* 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)
|
if (foz_dbs_ro)
|
||||||
load_foz_dbs_ro(foz_db, foz_dbs_ro);
|
load_foz_dbs_ro(foz_db, foz_dbs_ro);
|
||||||
|
|
||||||
|
#ifdef FOZ_DB_UTIL_DYNAMIC_LIST
|
||||||
char *foz_dbs_list =
|
char *foz_dbs_list =
|
||||||
getenv("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST");
|
getenv("MESA_DISK_CACHE_READ_ONLY_FOZ_DBS_DYNAMIC_LIST");
|
||||||
if (foz_dbs_list)
|
if (foz_dbs_list)
|
||||||
foz_dbs_list_updater_init(foz_db, foz_dbs_list);
|
foz_dbs_list_updater_init(foz_db, foz_dbs_list);
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
@ -541,6 +545,7 @@ fail:
|
|||||||
void
|
void
|
||||||
foz_destroy(struct foz_db *foz_db)
|
foz_destroy(struct foz_db *foz_db)
|
||||||
{
|
{
|
||||||
|
#ifdef FOZ_DB_UTIL_DYNAMIC_LIST
|
||||||
struct foz_dbs_list_updater *updater = &foz_db->updater;
|
struct foz_dbs_list_updater *updater = &foz_db->updater;
|
||||||
if (updater->thrd) {
|
if (updater->thrd) {
|
||||||
inotify_rm_watch(updater->inotify_fd, updater->inotify_wd);
|
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);
|
thrd_join(updater->thrd, NULL);
|
||||||
close(updater->inotify_fd);
|
close(updater->inotify_fd);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (foz_db->db_idx)
|
if (foz_db->db_idx)
|
||||||
fclose(foz_db->db_idx);
|
fclose(foz_db->db_idx);
|
||||||
|
@ -37,6 +37,10 @@
|
|||||||
#define FOZ_DB_UTIL 1
|
#define FOZ_DB_UTIL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_SYS_INOTIFY_H
|
||||||
|
#define FOZ_DB_UTIL_DYNAMIC_LIST 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
Loading…
Reference in New Issue
Block a user