diff options
-rw-r--r-- | meson.build | 5 | ||||
-rw-r--r-- | src/posix/filesystem_posix.c | 4 | ||||
-rw-r--r-- | src/zix_config.h | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/meson.build b/meson.build index d4b9fcd..96a6d27 100644 --- a/meson.build +++ b/meson.build @@ -308,6 +308,11 @@ int main(void) { sem_t s; struct timespec t; return sem_timedwait(&s, &t); }''', continue endif + if cc.get_id() == 'emscripten' and name in ['flock', 'fileno'] + message('Ignoring emscripten stub @0@'.format(name)) + continue + endif + if cc.links(check_code, args: check_c_args, name: name) platform_c_args += ['-DHAVE_@0@'.format(name.to_upper())] endif diff --git a/src/posix/filesystem_posix.c b/src/posix/filesystem_posix.c index 2ee323a..bb398c1 100644 --- a/src/posix/filesystem_posix.c +++ b/src/posix/filesystem_posix.c @@ -349,7 +349,7 @@ zix_canonical_path(ZixAllocator* const allocator, const char* const path) ZixStatus zix_file_lock(FILE* const file, const ZixFileLockMode mode) { -#if !defined(__EMSCRIPTEN__) && USE_FLOCK && USE_FILENO +#if USE_FLOCK && USE_FILENO return zix_posix_status( flock(fileno(file), (mode == ZIX_FILE_LOCK_BLOCK) ? LOCK_EX : (LOCK_EX | LOCK_NB))); @@ -364,7 +364,7 @@ zix_file_lock(FILE* const file, const ZixFileLockMode mode) ZixStatus zix_file_unlock(FILE* const file, const ZixFileLockMode mode) { -#if !defined(__EMSCRIPTEN__) && USE_FLOCK && USE_FILENO +#if USE_FLOCK && USE_FILENO return zix_posix_status( flock(fileno(file), (mode == ZIX_FILE_LOCK_BLOCK) ? LOCK_UN : (LOCK_UN | LOCK_NB))); diff --git a/src/zix_config.h b/src/zix_config.h index abcd11e..460b712 100644 --- a/src/zix_config.h +++ b/src/zix_config.h @@ -116,7 +116,7 @@ // Classic UNIX: flock() # ifndef HAVE_FLOCK -# if defined(__APPLE__) || defined(__unix__) +# if (defined(__APPLE__) || defined(__unix__)) && !defined(__EMSCRIPTEN__) # define HAVE_FLOCK 1 # endif # endif |