]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
QNX Porting support for unbound branch-1.24.1 (#1388)
authornnarayanamurthy <nnarayanamurthy@blackberry.com>
Wed, 21 Jan 2026 12:12:13 +0000 (17:42 +0530)
committerGitHub <noreply@github.com>
Wed, 21 Jan 2026 12:12:13 +0000 (13:12 +0100)
* qnx Porting support for version release-1.24.1

* updating __QNXNTO__ with __QNX__

compat/arc4random.c
compat/getentropy_linux.c
services/outside_network.h
testcode/replay.h
testcode/unitldns.c
testcode/unitmsgparse.c
testcode/unitverify.c
testcode/unitzonemd.c
util/data/msgreply.h
util/timehist.h

index 486ab89c68d894269b111d95db401a30e95c849f..50d87beac98b93c916af72426b0acfb623bf9a42 100644 (file)
@@ -38,6 +38,9 @@
 #ifndef UB_ON_WINDOWS
 #include <sys/mman.h>
 #endif
+#ifdef __QNX__
+#include "util/log.h"
+#endif /* __QNX__ */
 
 #define KEYSTREAM_ONLY
 #include "chacha_private.h"
@@ -187,7 +190,11 @@ _rs_stir(void)
                if(errno != ENOSYS ||
                        fallback_getentropy_urandom(rnd, sizeof rnd) == -1) {
 #ifdef SIGKILL
+#ifndef __QNX__
                        raise(SIGKILL);
+#else /* !__QNX__ */
+                       fatal_exit("failed to getentropy");
+#endif /* __QNX__ */
 #else
                        exit(9); /* windows */
 #endif
index 82cdb78b80474b9e77351f37bc6c4d276ec5d82b..1a91c99ed50a5ecdf504937e6e60a56894434737 100644 (file)
@@ -29,7 +29,9 @@
 #include <sys/param.h>
 #include <sys/ioctl.h>
 #include <sys/resource.h>
+#ifndef __QNX__
 #include <sys/syscall.h>
+#endif /* !__QNX__ */
 #ifdef SYS__sysctl
 #include <linux/sysctl.h>
 #endif
@@ -42,7 +44,9 @@
 #include <stdlib.h>
 #include <stdint.h>
 #include <stdio.h>
+#ifndef __QNX__
 #include <link.h>
+#endif /* __QNX__ */
 #include <termios.h>
 #include <fcntl.h>
 #include <signal.h>
 #define SHA512_Final(r, c)     sha512_digest(c, SHA512_DIGEST_SIZE, r)
 #endif
 
+#ifndef __QNX__
 #include <linux/types.h>
 #include <linux/random.h>
 #ifdef HAVE_GETAUXVAL
 #include <sys/auxv.h>
 #endif
 #include <sys/vfs.h>
+#endif /* !__QNX__ */
 #ifndef MAP_ANON
 #define MAP_ANON MAP_ANONYMOUS
 #endif
@@ -94,8 +100,10 @@ static int getentropy_urandom(void *buf, size_t len);
 #ifdef SYS__sysctl
 static int getentropy_sysctl(void *buf, size_t len);
 #endif
+#ifndef __QNX__
 static int getentropy_fallback(void *buf, size_t len);
 static int getentropy_phdr(struct dl_phdr_info *info, size_t size, void *data);
+#endif /* !__QNX__ */
 
 int
 getentropy(void *buf, size_t len)
@@ -178,6 +186,7 @@ getentropy(void *buf, size_t len)
         * sysctl ABI, or consider providing a new failsafe API which
         * works in a chroot or when file descriptors are exhausted.
         */
+#ifndef __QNX__
 #undef FAIL_INSTEAD_OF_TRYING_FALLBACK
 #ifdef FAIL_INSTEAD_OF_TRYING_FALLBACK
        raise(SIGKILL);
@@ -185,6 +194,9 @@ getentropy(void *buf, size_t len)
        ret = getentropy_fallback(buf, len);
        if (ret != -1)
                return (ret);
+#else /* !__QNX__ */
+       fatal_exit("failed to read from /dev/urandom");
+#endif /* __QNX__ */
 
        errno = EIO;
        return (ret);
@@ -214,7 +226,11 @@ getentropy_urandom(void *buf, size_t len)
 {
        struct stat st;
        size_t i;
+#ifndef __QNX__
        int fd, cnt, flags;
+#else /* !__QNX__ */
+       int fd, flags;
+#endif /* __QNX__ */
        int save_errno = errno;
 
 start:
@@ -241,10 +257,12 @@ start:
                close(fd);
                goto nodevrandom;
        }
+#ifndef __QNX__
        if (ioctl(fd, RNDGETENTCNT, &cnt) == -1) {
                close(fd);
                goto nodevrandom;
        }
+#endif /* !__QNX__ */
        for (i = 0; i < len; ) {
                size_t wanted = len - i;
                ssize_t ret = read(fd, (char *)buf + i, wanted);
@@ -265,6 +283,7 @@ nodevrandom:
        return (-1);
 }
 
+#ifndef __QNX__
 #ifdef SYS__sysctl
 static int
 getentropy_sysctl(void *buf, size_t len)
@@ -537,3 +556,4 @@ getentropy_fallback(void *buf, size_t len)
        errno = save_errno;
        return (0);             /* satisfied */
 }
+#endif /* !__QNX__ */
index 0a77e3388ddc97242d554357b38442f1d17736c7..7404d462f0051408651f31336872fac93d90d338 100644 (file)
 #include "util/regional.h"
 #include "util/netevent.h"
 #include "dnstap/dnstap_config.h"
+#ifdef __QNX__
+/* For struct timeval */
+#include <sys/time.h>
+#endif /* __QNX__ */
 struct pending;
 struct pending_timeout;
 struct ub_randstate;
index 809e8ee397780d005ebe6e349709a08b92993780..42a56a1c466e51791c40b80996bb57b614539b49 100644 (file)
 #include "util/netevent.h"
 #include "testcode/testpkts.h"
 #include "util/rbtree.h"
+#ifdef __QNX__
+/* For struct timeval */
+#include <sys/time.h>
+#endif /* __QNX__ */
 struct replay_answer;
 struct replay_moment;
 struct replay_range;
index f8409fec71b15398b1e911f8721d49878ec53903..07d001a792e1a24a3c1f112a0beac921384e3a1f 100644 (file)
@@ -207,7 +207,11 @@ rr_test_file(const char* input, const char* check)
 #define xstr(s) str(s)
 #define str(s) #s
 
+#ifndef __QNX__
 #define SRCDIRSTR xstr(SRCDIR)
+#else /* !__QNX__ */
+#define SRCDIRSTR "."
+#endif /* __QNX__ */
 
 /** read rrs to and from string, to and from wireformat */
 static void
index a87314019d1fddbf2a2fe9069647bf5fbbc3365b..d65b7dd02de32b90385f79b797dcc638cc658d47 100644 (file)
@@ -498,7 +498,11 @@ testfromdrillfile(sldns_buffer* pkt, struct alloc_cache* alloc,
 #define xstr(s) str(s)
 #define str(s) #s
 
+#ifndef __QNX__
 #define SRCDIRSTR xstr(SRCDIR)
+#else /* !__QNX__ */
+#define SRCDIRSTR "."
+#endif /* __QNX__ */
 
 void msgparse_test(void)
 {
index a101c528fc1fc775eff22d39185d83c2bfc14753..fcf2e2ffe3d14a39bc0cee8ae042390b2696c38d 100644 (file)
@@ -513,8 +513,11 @@ nsec3_hash_test(const char* fname)
 #define xstr(s) str(s)
 #define str(s) #s
 
+#ifndef __QNX__
 #define SRCDIRSTR xstr(SRCDIR)
-
+#else /* !__QNX__ */
+#define SRCDIRSTR "."
+#endif /* __QNX__ */
 #if defined(HAVE_SSL) && defined(USE_SHA1)
 /* Detect if openssl is configured to disable RSASHA1 signatures,
  * with the rh-allow-sha1-signatures disabled. */
index 0420b036159009e5cfa2234ef8466820ca1a0582..c98dcf3959c9fc23f21f535675034fb50121244b 100644 (file)
 
 #define xstr(s) str(s)
 #define str(s) #s
+#ifndef __QNX__
 #define SRCDIRSTR xstr(SRCDIR)
+#else /* !__QNX__ */
+#define SRCDIRSTR "."
+#endif /* __QNX__ */
 
 /** Add zone from file for testing */
 struct auth_zone* authtest_addzone(struct auth_zones* az, const char* name,
index 87eebb2b9ef6404bac7c389d51324bf6d2b6745c..e7c688e97a3a3783c48e86968a8ff4a3ee85e041 100644 (file)
 #include "util/storage/lruhash.h"
 #include "util/data/packed_rrset.h"
 #include "sldns/rrdef.h"
+#ifdef __QNX__
+/* For struct timeval */
+#include <sys/time.h>
+#endif /* __QNX__ */
 struct sldns_buffer;
 struct comm_reply;
 struct alloc_cache;
index 5f88a38a9fdf6640d125f9b0367eb4635591218b..12855f94bdaa87e4b11e2456f5f7141c583d7339 100644 (file)
 #ifndef UTIL_TIMEHIST_H
 #define UTIL_TIMEHIST_H
 
+#ifdef __QNX__
+/* For struct timeval */
+#include <sys/time.h>
+#endif /* __QNX__ */
 /** Number of buckets in a histogram */
 #define NUM_BUCKETS_HIST 40