From 6c414409d404457fe067780c1d010fa6f915519f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Tue, 23 Jun 2020 09:29:57 +0000 Subject: libtokencap Haiku support --- libtokencap/libtokencap.so.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'libtokencap/libtokencap.so.c') diff --git a/libtokencap/libtokencap.so.c b/libtokencap/libtokencap.so.c index 5a7cf3aa..88b5c041 100644 --- a/libtokencap/libtokencap.so.c +++ b/libtokencap/libtokencap.so.c @@ -34,7 +34,8 @@ #include "../config.h" #if !defined __linux__ && !defined __APPLE__ && !defined __FreeBSD__ && \ - !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ + !defined __OpenBSD__ && !defined __NetBSD__ && !defined __DragonFly__ && \ + !defined(__HAIKU__) #error "Sorry, this library is unsupported in this platform for now!" #endif /* !__linux__ && !__APPLE__ && ! __FreeBSD__ && ! __OpenBSD__ && \ !__NetBSD__*/ @@ -49,6 +50,8 @@ #include #endif #include +#elif defined __HAIKU__ + #include #endif #include @@ -230,6 +233,18 @@ static void __tokencap_load_mappings(void) { } munmap(buf, len); + #elif defined __HAIKU__ + image_info ii; + int32_t group = 0; + + while (get_next_image_info(0, &group, &ii) == B_OK) { + + __tokencap_ro[__tokencap_ro_cnt].st = ii.text; + __tokencap_ro[__tokencap_ro_cnt].en = ((char *)ii.text) + ii.text_size; + + if (++__tokencap_ro_cnt == MAX_MAPPINGS) break; + + } #endif } -- cgit 1.4.1