Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ability to detect fsync availablilty in minipal.
  • Loading branch information
lateralusX committed Mar 21, 2025
commit 9875a37857ff37e592b69d24b56cc61efdada0ea
12 changes: 5 additions & 7 deletions src/native/minipal/configure.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@ include(CheckFunctionExists)
include(CheckIncludeFiles)
include(CheckSymbolExists)

check_include_files("windows.h" HAVE_WINDOWS_H)
check_include_files("windows.h;bcrypt.h" HAVE_BCRYPT_H)
check_include_files("sys/auxv.h;asm/hwcap.h" HAVE_AUXV_HWCAP_H)

check_function_exists(sysctlbyname HAVE_SYSCTLBYNAME)
check_function_exists(fsync HAVE_FSYNC)

check_symbol_exists(arc4random_buf "stdlib.h" HAVE_ARC4RANDOM_BUF)
check_symbol_exists(O_CLOEXEC fcntl.h HAVE_O_CLOEXEC)
check_include_files("windows.h" HAVE_WINDOWS_H)
check_include_files("windows.h;bcrypt.h" HAVE_BCRYPT_H)

check_symbol_exists(
clock_gettime_nsec_np
time.h
HAVE_CLOCK_GETTIME_NSEC_NP)
check_symbol_exists(clock_gettime_nsec_np time.h HAVE_CLOCK_GETTIME_NSEC_NP)

if(CMAKE_C_BYTE_ORDER STREQUAL "BIG_ENDIAN")
set(BIGENDIAN 1)
Expand Down
3 changes: 2 additions & 1 deletion src/native/minipal/log.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

#include "minipalconfig.h"
#include "log.h"
#include <string.h>
#include <limits.h>
Expand Down Expand Up @@ -247,7 +248,7 @@ static int sync_file(minipal_log_flags flags)

return errno;
}
#elif defined(HAVE_FSYNC)
#elif HAVE_FSYNC
#include <unistd.h>
static int sync_file(minipal_log_flags flags)
{
Expand Down
1 change: 1 addition & 0 deletions src/native/minipal/minipalconfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@
#cmakedefine01 BIGENDIAN
#cmakedefine01 HAVE_BCRYPT_H
#cmakedefine01 HAVE_WINDOWS_H
#cmakedefine01 HAVE_FSYNC

#endif