Small fix to compile on FreeBSD. (0.37.25)
This commit is contained in:
parent
06e4054e92
commit
e1890a5b89
3 changed files with 19 additions and 3 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
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 99)
|
||||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||||
|
|
|
||||||
|
|
@ -24,8 +24,9 @@
|
||||||
#if defined(_WIN32) || defined(_WIN64)
|
#if defined(_WIN32) || defined(_WIN64)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <bcrypt.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 <stdlib.h>
|
||||||
|
#include <sys/random.h>
|
||||||
#elif defined(__unix__)
|
#elif defined(__unix__)
|
||||||
#if __has_include(<sys/random.h>)
|
#if __has_include(<sys/random.h>)
|
||||||
#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);
|
NTSTATUS st = BCryptGenRandom(NULL, raw, (ULONG)len, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
|
||||||
ok = (st == 0);
|
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);
|
arc4random_buf(raw, (size_t)len);
|
||||||
ok = 1;
|
ok = 1;
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,21 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
#include <unistd.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
|
#endif
|
||||||
|
|
||||||
case OP_SERIAL_OPEN: {
|
case OP_SERIAL_OPEN: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue