Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upstream some patches for OpenBSD #661

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libs/mysql/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void psock_init() {

PSOCK psock_create() {
PSOCK s = socket(AF_INET,SOCK_STREAM,0);
# if defined(OS_MAC) || defined(OS_BSD)
# if defined(OS_MAC) || (defined(OS_BSD) && !defined(__OpenBSD__))
if( s != INVALID_SOCKET )
setsockopt(s,SOL_SOCKET,SO_NOSIGPIPE,NULL,0);
# endif
Expand Down Expand Up @@ -121,7 +121,7 @@ PHOST phost_resolve( const char *host ) {
PHOST ip = inet_addr(host);
if( ip == INADDR_NONE ) {
struct hostent *h;
# if defined(OS_WINDOWS) || defined(OS_MAC) || defined(OS_CYGWIN)
# if defined(OS_WINDOWS) || defined(OS_MAC) || defined(OS_CYGWIN) || defined(__OpenBSD__)
h = gethostbyname(host);
# else
struct hostent hbase;
Expand Down
4 changes: 2 additions & 2 deletions src/std/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ HL_PRIM int hl_host_resolve( vbyte *host ) {
ip = inet_addr((char*)host);
if( ip == INADDR_NONE ) {
struct hostent *h;
# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE)
# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined (HL_CYGWIN) || defined(HL_CONSOLE) || defined(__OpenBSD__)
h = gethostbyname((char*)host);
# else
struct hostent hbase;
Expand All @@ -226,7 +226,7 @@ HL_PRIM vbyte *hl_host_to_string( int ip ) {
HL_PRIM vbyte *hl_host_reverse( int ip ) {
struct hostent *h;
hl_blocking(true);
# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined(HL_CYGWIN) || defined(HL_CONSOLE)
# if defined(HL_WIN) || defined(HL_MAC) || defined(HL_IOS) || defined(HL_TVOS) || defined(HL_CYGWIN) || defined(HL_CONSOLE) || defined(__OpenBSD__)
h = gethostbyaddr((char *)&ip,4,AF_INET);
# elif defined(__ANDROID__)
hl_error("hl_host_reverse() not available for this platform");
Expand Down
7 changes: 7 additions & 0 deletions src/std/thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@
typedef struct _hl_semaphore hl_semaphore;
typedef struct _hl_condition hl_condition;

#ifdef __OpenBSD__
#include <pthread_np.h>
#define pthread_setname_np(a,b) pthread_set_name_np(a,b)
#endif

#if !defined(HL_THREADS)

struct _hl_mutex {
Expand Down Expand Up @@ -811,6 +816,8 @@ HL_PRIM int hl_thread_id() {
return (pid_t)tid64;
#elif defined(SYS_gettid) && !defined(HL_TVOS)
return syscall(SYS_gettid);
#elif defined(__OpenBSD__)
return getthrid();
#else
return -1;
#endif
Expand Down