mirror of
https://github.com/warmcat/libwebsockets.git
synced 2025-03-30 00:00:16 +01:00
OpenBSD: various api ports
This commit is contained in:
parent
8e5f8491db
commit
dc051fb2ae
6 changed files with 55 additions and 11 deletions
17
.sai.json
17
.sai.json
|
@ -91,6 +91,10 @@
|
||||||
"freebsd-12/x86_64-amd/llvm": {
|
"freebsd-12/x86_64-amd/llvm": {
|
||||||
"build": "mkdir build destdir;cd build;export LD_LIBRARY_PATH=../destdir/usr/local/share/libwebsockets-test-server/plugins:../destdir/usr/local/lib;export CCACHE_DISABLE=1;cmake .. ${cmake} && make -j3 && rm -rf ../destdir && make -j3 DESTDIR=../destdir install"
|
"build": "mkdir build destdir;cd build;export LD_LIBRARY_PATH=../destdir/usr/local/share/libwebsockets-test-server/plugins:../destdir/usr/local/lib;export CCACHE_DISABLE=1;cmake .. ${cmake} && make -j3 && rm -rf ../destdir && make -j3 DESTDIR=../destdir install"
|
||||||
},
|
},
|
||||||
|
"openbsd/x86_64-amd/llvm": {
|
||||||
|
"build": "mkdir build destdir;cd build;export CCACHE_DISABLE=1;cmake .. ${cmake};make -j4 && rm -rf ../destdir && make -j3 DESTDIR=../destdir install && ctest -j3 --output-on-failure",
|
||||||
|
"default": false
|
||||||
|
},
|
||||||
"netbsd/aarch64BE-bcm2837-a53/gcc": {
|
"netbsd/aarch64BE-bcm2837-a53/gcc": {
|
||||||
"build": "mkdir build destdir;cd build;export LD_LIBRARY_PATH=../destdir/usr/local/share/libwebsockets-test-server/plugins:../destdir/usr/local/lib;export CCACHE_DISABLE=1;cmake .. ${cmake};make -j6 && rm -rf ../destdir && make -j6 DESTDIR=../destdir install && /usr/pkg/bin/ctest -j3 --output-on-failure",
|
"build": "mkdir build destdir;cd build;export LD_LIBRARY_PATH=../destdir/usr/local/share/libwebsockets-test-server/plugins:../destdir/usr/local/lib;export CCACHE_DISABLE=1;cmake .. ${cmake};make -j6 && rm -rf ../destdir && make -j6 DESTDIR=../destdir install && /usr/pkg/bin/ctest -j3 --output-on-failure",
|
||||||
"default": false
|
"default": false
|
||||||
|
@ -100,7 +104,7 @@
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"default": {
|
"default": {
|
||||||
"cmake": "",
|
"cmake": "",
|
||||||
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, freertos-linkit/arm32-m4-mt7697-usi/gcc, linux-ubuntu-2004/aarch64-a72-bcm2711-rpi4/gcc, w10/x86_64-amd/mingw32, w10/x86_64-amd/mingw64, netbsd/aarch64BE-bcm2837-a53/gcc, w10/x86_64-amd/wmbedtls-msvc"
|
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, freertos-linkit/arm32-m4-mt7697-usi/gcc, linux-ubuntu-2004/aarch64-a72-bcm2711-rpi4/gcc, w10/x86_64-amd/mingw32, w10/x86_64-amd/mingw64, netbsd/aarch64BE-bcm2837-a53/gcc, w10/x86_64-amd/wmbedtls-msvc, openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
"default-noudp": {
|
"default-noudp": {
|
||||||
"cmake": "-DLWS_WITH_UDP=0",
|
"cmake": "-DLWS_WITH_UDP=0",
|
||||||
|
@ -143,7 +147,7 @@
|
||||||
},
|
},
|
||||||
"default-examples": {
|
"default-examples": {
|
||||||
"cmake": "-DLWS_WITH_MINIMAL_EXAMPLES=1",
|
"cmake": "-DLWS_WITH_MINIMAL_EXAMPLES=1",
|
||||||
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, linux-ubuntu-2004/aarch64-a72-bcm2711-rpi4/gcc, netbsd/aarch64BE-bcm2837-a53/gcc"
|
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, linux-ubuntu-2004/aarch64-a72-bcm2711-rpi4/gcc, netbsd/aarch64BE-bcm2837-a53/gcc, openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
"h1only-examples": {
|
"h1only-examples": {
|
||||||
"cmake": "cmake .. -DLWS_WITH_HTTP2=0 -DLWS_WITH_MINIMAL_EXAMPLES=1",
|
"cmake": "cmake .. -DLWS_WITH_HTTP2=0 -DLWS_WITH_MINIMAL_EXAMPLES=1",
|
||||||
|
@ -160,15 +164,15 @@
|
||||||
# WARN_DEPRECATED disabled for openssl v3 case on windows
|
# WARN_DEPRECATED disabled for openssl v3 case on windows
|
||||||
"lws_system": {
|
"lws_system": {
|
||||||
"cmake": "-DLWS_SUPPRESS_DEPRECATED_API_WARNINGS=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=RELEASE -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1",
|
"cmake": "-DLWS_SUPPRESS_DEPRECATED_API_WARNINGS=1 -DLWS_WITH_ACME=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DCMAKE_BUILD_TYPE=RELEASE -DLWS_WITH_GENCRYPTO=1 -DLWS_WITH_JOSE=1 -DLWS_WITH_SYS_ASYNC_DNS=1 -DLWS_WITH_SYS_NTPCLIENT=1",
|
||||||
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc"
|
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
"secure-streams": {
|
"secure-streams": {
|
||||||
"cmake": "-DLWS_WITH_SECURE_STREAMS=1",
|
"cmake": "-DLWS_WITH_SECURE_STREAMS=1",
|
||||||
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc"
|
"platforms": "w10/x86_64-amd/msvc, w10/x86_64-amd/noptmsvc, openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
"secure-streams-proxy": {
|
"secure-streams-proxy": {
|
||||||
"cmake": "-DLWS_WITH_SECURE_STREAMS=1 -DLWS_WITH_SECURE_STREAMS_PROXY_API=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITH_SECURE_STREAMS_AUTH_SIGV4=1",
|
"cmake": "-DLWS_WITH_SECURE_STREAMS=1 -DLWS_WITH_SECURE_STREAMS_PROXY_API=1 -DLWS_WITH_MINIMAL_EXAMPLES=1 -DLWS_WITH_SECURE_STREAMS_AUTH_SIGV4=1",
|
||||||
"platforms": "not w10/x86_64-amd/msvc, netbsd/aarch64BE-bcm2837-a53/gcc"
|
"platforms": "not w10/x86_64-amd/msvc, netbsd/aarch64BE-bcm2837-a53/gcc, openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
|
|
||||||
"distro_recommended": { # minimal examples also needed for ctest
|
"distro_recommended": { # minimal examples also needed for ctest
|
||||||
|
@ -213,7 +217,8 @@
|
||||||
"cmake": "-DLWS_WITH_LIBEV=ON"
|
"cmake": "-DLWS_WITH_LIBEV=ON"
|
||||||
},
|
},
|
||||||
"libevent": {
|
"libevent": {
|
||||||
"cmake": "-DLWS_WITH_LIBEVENT=ON"
|
"cmake": "-DLWS_WITH_LIBEVENT=ON",
|
||||||
|
"platforms": "openbsd/x86_64-amd/llvm"
|
||||||
},
|
},
|
||||||
"libglib": {
|
"libglib": {
|
||||||
"cmake": "-DLWS_WITH_GLIB=ON"
|
"cmake": "-DLWS_WITH_GLIB=ON"
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
#include <sys/siginfo.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/** \defgroup misc Miscellaneous APIs
|
/** \defgroup misc Miscellaneous APIs
|
||||||
* ##Miscellaneous APIs
|
* ##Miscellaneous APIs
|
||||||
*
|
*
|
||||||
|
|
|
@ -192,13 +192,22 @@ lws_plat_set_socket_options(struct lws_vhost *vhost, int fd, int unix_skt)
|
||||||
|
|
||||||
static const int ip_opt_lws_flags[] = {
|
static const int ip_opt_lws_flags[] = {
|
||||||
LCCSCF_IP_LOW_LATENCY, LCCSCF_IP_HIGH_THROUGHPUT,
|
LCCSCF_IP_LOW_LATENCY, LCCSCF_IP_HIGH_THROUGHPUT,
|
||||||
LCCSCF_IP_HIGH_RELIABILITY, LCCSCF_IP_LOW_COST
|
LCCSCF_IP_HIGH_RELIABILITY
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
|
, LCCSCF_IP_LOW_COST
|
||||||
|
#endif
|
||||||
}, ip_opt_val[] = {
|
}, ip_opt_val[] = {
|
||||||
IPTOS_LOWDELAY, IPTOS_THROUGHPUT, IPTOS_RELIABILITY, IPTOS_MINCOST
|
IPTOS_LOWDELAY, IPTOS_THROUGHPUT, IPTOS_RELIABILITY
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
|
, IPTOS_MINCOST
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#if !defined(LWS_WITH_NO_LOGS)
|
#if !defined(LWS_WITH_NO_LOGS)
|
||||||
static const char *ip_opt_names[] = {
|
static const char *ip_opt_names[] = {
|
||||||
"LOWDELAY", "THROUGHPUT", "RELIABILITY", "MINCOST"
|
"LOWDELAY", "THROUGHPUT", "RELIABILITY"
|
||||||
|
#if !defined(__OpenBSD__)
|
||||||
|
, "MINCOST"
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,11 @@
|
||||||
#include "private-lib-core.h"
|
#include "private-lib-core.h"
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
#include <sys/resource.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
lws_spawn_timeout(struct lws_sorted_usec_list *sul)
|
lws_spawn_timeout(struct lws_sorted_usec_list *sul)
|
||||||
{
|
{
|
||||||
|
@ -146,6 +151,10 @@ lws_spawn_reap(struct lws_spawn_piped *lsp)
|
||||||
lsp_cb_t cb = lsp->info.reap_cb;
|
lsp_cb_t cb = lsp->info.reap_cb;
|
||||||
struct lws_spawn_piped temp;
|
struct lws_spawn_piped temp;
|
||||||
struct tms tms;
|
struct tms tms;
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
struct rusage rusa;
|
||||||
|
int status;
|
||||||
|
#endif
|
||||||
int n;
|
int n;
|
||||||
|
|
||||||
if (lsp->child_pid < 1)
|
if (lsp->child_pid < 1)
|
||||||
|
@ -154,7 +163,14 @@ lws_spawn_reap(struct lws_spawn_piped *lsp)
|
||||||
/* check if exited, do not reap yet */
|
/* check if exited, do not reap yet */
|
||||||
|
|
||||||
memset(&lsp->si, 0, sizeof(lsp->si));
|
memset(&lsp->si, 0, sizeof(lsp->si));
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
n = wait4(lsp->child_pid, &status, WNOHANG, &rusa);
|
||||||
|
if (!n)
|
||||||
|
return 0;
|
||||||
|
lsp->si.si_code = WIFEXITED(status);
|
||||||
|
#else
|
||||||
n = waitid(P_PID, (id_t)lsp->child_pid, &lsp->si, WEXITED | WNOHANG | WNOWAIT);
|
n = waitid(P_PID, (id_t)lsp->child_pid, &lsp->si, WEXITED | WNOHANG | WNOWAIT);
|
||||||
|
#endif
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
lwsl_info("%s: child %d still running\n", __func__, lsp->child_pid);
|
lwsl_info("%s: child %d still running\n", __func__, lsp->child_pid);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -212,7 +228,15 @@ lws_spawn_reap(struct lws_spawn_piped *lsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
temp = *lsp;
|
temp = *lsp;
|
||||||
|
#if defined(__OpenBSD__)
|
||||||
|
n = wait4(lsp->child_pid, &status, WNOHANG, &rusa);
|
||||||
|
if (!n)
|
||||||
|
return 0;
|
||||||
|
lsp->si.si_code = WIFEXITED(status);
|
||||||
|
temp.si.si_status = status & 0xff;
|
||||||
|
#else
|
||||||
n = waitid(P_PID, (id_t)lsp->child_pid, &temp.si, WEXITED | WNOHANG);
|
n = waitid(P_PID, (id_t)lsp->child_pid, &temp.si, WEXITED | WNOHANG);
|
||||||
|
#endif
|
||||||
temp.si.si_status &= 0xff; /* we use b8 + for flags */
|
temp.si.si_status &= 0xff; /* we use b8 + for flags */
|
||||||
lwsl_info("%s: waitd says %d, process exit %d\n",
|
lwsl_info("%s: waitd says %d, process exit %d\n",
|
||||||
__func__, n, temp.si.si_status);
|
__func__, n, temp.si.si_status);
|
||||||
|
@ -435,7 +459,7 @@ lws_spawn_piped(const struct lws_spawn_piped_info *i)
|
||||||
if (lsp->info.disable_ctrlc)
|
if (lsp->info.disable_ctrlc)
|
||||||
/* stops non-daemonized main processess getting SIGINT
|
/* stops non-daemonized main processess getting SIGINT
|
||||||
* from TTY */
|
* from TTY */
|
||||||
#if defined(__FreeBSD__) || defined(__NetBSD__)
|
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
|
||||||
setpgid(0, 0);
|
setpgid(0, 0);
|
||||||
#else
|
#else
|
||||||
setpgrp();
|
setpgrp();
|
||||||
|
|
|
@ -67,7 +67,9 @@ int BN_bn2binpad(const BIGNUM *a, unsigned char *to, int tolen)
|
||||||
int i;
|
int i;
|
||||||
BN_ULONG l;
|
BN_ULONG l;
|
||||||
|
|
||||||
|
#if !defined(LIBRESSL_VERSION_NUMBER)
|
||||||
bn_check_top(a);
|
bn_check_top(a);
|
||||||
|
#endif
|
||||||
i = BN_num_bytes(a);
|
i = BN_num_bytes(a);
|
||||||
|
|
||||||
/* Add leading zeroes if necessary */
|
/* Add leading zeroes if necessary */
|
||||||
|
|
|
@ -179,7 +179,7 @@ lws_genhmac_init(struct lws_genhmac_ctx *ctx, enum lws_genhmac_types type,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ctx->evp_type = 0;
|
ctx->evp_type = 0;
|
||||||
ctx->type = type;
|
ctx->type = (uint8_t)type;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case LWS_GENHMAC_TYPE_SHA256:
|
case LWS_GENHMAC_TYPE_SHA256:
|
||||||
|
|
Loading…
Add table
Reference in a new issue