1
0
Fork 0
forked from fun/fun

Small fix to compile on FreeBSD. (0.37.25)

This commit is contained in:
Johannes Findeisen 2025-12-28 19:24:00 +01:00
commit e1890a5b89
3 changed files with 19 additions and 3 deletions

View file

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.10)
project(fun VERSION 0.37.24 LANGUAGES C)
project(fun VERSION 0.37.25 LANGUAGES C)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)

View file

@ -24,8 +24,9 @@
#if defined(_WIN32) || defined(_WIN64)
#include <windows.h>
#include <bcrypt.h>
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
#include <stdlib.h>
#include <sys/random.h>
#elif defined(__unix__)
#if __has_include(<sys/random.h>)
#include <sys/random.h>
@ -85,7 +86,7 @@ case OP_RANDOM_NUMBER: {
NTSTATUS st = BCryptGenRandom(NULL, raw, (ULONG)len, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
ok = (st == 0);
}
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#elif defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
{
arc4random_buf(raw, (size_t)len);
ok = 1;

View file

@ -13,6 +13,21 @@
#include <fcntl.h>
#include <termios.h>
#include <unistd.h>
/* Fallbacks for baud rates that might be missing on some systems */
#ifndef B57600
#define B57600 0010001
#endif
#ifndef B115200
#define B115200 0010002
#endif
#ifndef B230400
#define B230400 0010003
#endif
#ifndef O_NDELAY
#define O_NDELAY O_NONBLOCK
#endif
#endif
case OP_SERIAL_OPEN: {