summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Opalach <andrew@akon.city> 2024-01-08 16:32:23 -0500
committerAndrew Opalach <andrew@akon.city> 2024-01-08 16:32:23 -0500
commit4e9c4b8ec81e612b03477fcc68def4b8878cf3ac (patch)
treef1d1d35a3c760a461c71ed16a790d190462fbdef
parentb0bc1aa86410d43ea6b8e3dc7ba7f51d6dd3edfb (diff)
downloadlibnaunet-4e9c4b8ec81e612b03477fcc68def4b8878cf3ac.tar.gz
libnaunet-4e9c4b8ec81e612b03477fcc68def4b8878cf3ac.tar.bz2
libnaunet-4e9c4b8ec81e612b03477fcc68def4b8878cf3ac.zip
Partially fix windows build
Signed-off-by: Andrew Opalach <andrew@akon.city>
-rw-r--r--include/aki/fs_event.h2
-rw-r--r--meson.build6
-rw-r--r--src/fs_event/fs_event.h (renamed from src/fs_event.h)7
-rw-r--r--src/fs_event/fs_event_inotify.c (renamed from src/fs_event.c)3
-rw-r--r--src/winwrap.c9
-rw-r--r--src/winwrap.h4
6 files changed, 19 insertions, 12 deletions
diff --git a/include/aki/fs_event.h b/include/aki/fs_event.h
index 76db88a..61f75df 100644
--- a/include/aki/fs_event.h
+++ b/include/aki/fs_event.h
@@ -1,3 +1,3 @@
#pragma once
-#include "../src/fs_event.h"
+#include "../src/fs_event/fs_event.h"
diff --git a/meson.build b/meson.build
index 3ee5e95..103f4d3 100644
--- a/meson.build
+++ b/meson.build
@@ -35,7 +35,6 @@ if get_option('event-loop').enabled()
akiyo_src += [
'src/loop.c',
'src/poll.c',
- 'src/fs_event.c',
'src/timer.c',
'src/signal.c',
'src/packet_pool.c',
@@ -96,6 +95,11 @@ if host_machine.system() != 'windows'
'src/util/file/file_linux.c',
'src/socket/socket_linux.c'
]
+ if get_option('event-loop').enabled()
+ akiyo_src += [
+ 'src/fs_event/fs_event_inotify.c'
+ ]
+ endif
akiyo_args += ['-D_GNU_SOURCE']
akiyo_has_mmap = true
else
diff --git a/src/fs_event.h b/src/fs_event/fs_event.h
index d45d7af..0240e6f 100644
--- a/src/fs_event.h
+++ b/src/fs_event/fs_event.h
@@ -1,11 +1,12 @@
#pragma once
#include <al/str.h>
-#include <sys/inotify.h>
-#include "socket/socket.h"
+#ifndef _WIN32
+#include <sys/inotify.h>
+#endif
-#include "loop.h"
+#include "../loop.h"
struct aki_fs_event {
s32 fd;
diff --git a/src/fs_event.c b/src/fs_event/fs_event_inotify.c
index 8edce13..0fc19b4 100644
--- a/src/fs_event.c
+++ b/src/fs_event/fs_event_inotify.c
@@ -1,6 +1,7 @@
#include <al/log.h>
-#include "util/error.h"
+#include "../util/error.h"
+#include "../socket/socket.h"
#include "fs_event.h"
diff --git a/src/winwrap.c b/src/winwrap.c
index a0a1229..b1ab115 100644
--- a/src/winwrap.c
+++ b/src/winwrap.c
@@ -9,14 +9,11 @@ void aki_windows_init(void)
WSAStartup(MAKEWORD(2,2), &data);
ULONG actual_resolution;
- NTSTATUS(__stdcall *ZwSetTimerResolution)(
- IN ULONG RequestedResolution, IN BOOLEAN Set, OUT PULONG ActualResolution) = (
- NTSTATUS(__stdcall*)(ULONG, BOOLEAN, PULONG))GetProcAddress(
- GetModuleHandleW(L"ntdll"), "ZwSetTimerResolution");
+ NTSTATUS(__stdcall *ZwSetTimerResolution)(IN ULONG RequestedResolution, IN BOOLEAN Set, OUT PULONG ActualResolution);
+ ZwSetTimerResolution = (NTSTATUS(__stdcall *)(ULONG, BOOLEAN, PULONG))GetProcAddress(GetModuleHandleW(L"ntdll"), "ZwSetTimerResolution");
ZwSetTimerResolution(1, TRUE, &actual_resolution);
- NtDelayExecution = (NTSTATUS(__stdcall*)(BOOL, PLARGE_INTEGER))GetProcAddress(
- GetModuleHandleW(L"ntdll"), "NtDelayExecution");
+ NtDelayExecution = (NTSTATUS(__stdcall *)(BOOL, PLARGE_INTEGER))GetProcAddress(GetModuleHandleW(L"ntdll"), "NtDelayExecution");
QueryPerformanceFrequency(&performance_frequency);
#endif
diff --git a/src/winwrap.h b/src/winwrap.h
index 83cf7ea..8a6b90d 100644
--- a/src/winwrap.h
+++ b/src/winwrap.h
@@ -6,7 +6,11 @@
#include <winsock2.h>
#include <ws2tcpip.h>
#include <io.h>
+#define WIN32_NO_STATUS
#include <windows.h>
+#undef WIN32_NO_STATUS
+#include <winternl.h>
+#include <ntstatus.h>
extern NTSTATUS(__stdcall *NtDelayExecution)(BOOL Alertable, PLARGE_INTEGER DelayInterval);
extern LARGE_INTEGER performance_frequency;
#endif