Skip to content

Commit 8d008a1

Browse files
committed
Fix the problem that there is no fdatasync symbol on the macOS platform
1 parent 5474cf7 commit 8d008a1

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/coroutine/hook.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,10 @@ using swoole::Iouring;
4949
static std::unordered_map<int, std::shared_ptr<Socket>> socket_map;
5050
static std::mutex socket_map_lock;
5151

52-
#ifdef __APPLE__
53-
extern int fdatasync(int);
52+
#if defined(__APPLE__) || defined(__MACH__)
53+
static int fdatasync(int fd) {
54+
return fcntl(fd, F_FULLFSYNC);
55+
}
5456
#endif
5557

5658
static sw_inline bool is_no_coro() {

0 commit comments

Comments
 (0)