Make nixio compile on OpenSolaris
This commit is contained in:
parent
30b7bc7c62
commit
589e680970
4 changed files with 12 additions and 12 deletions
|
@ -6,8 +6,6 @@ AXTLS_VERSION = 1.2.1
|
||||||
AXTLS_DIR = axTLS
|
AXTLS_DIR = axTLS
|
||||||
AXTLS_FILE = $(AXTLS_DIR)-$(AXTLS_VERSION).tar.gz
|
AXTLS_FILE = $(AXTLS_DIR)-$(AXTLS_VERSION).tar.gz
|
||||||
NIXIO_TLS ?= axtls
|
NIXIO_TLS ?= axtls
|
||||||
EXTRA_CFLAGS = -std=c99
|
|
||||||
NIXIO_CFLAGS = -D_XOPEN_SOURCE=500
|
|
||||||
|
|
||||||
NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \
|
NIXIO_OBJ = src/nixio.o src/socket.o src/sockopt.o src/bind.o src/address.o \
|
||||||
src/poll.o src/io.o src/file.o src/splice.o src/process.o \
|
src/poll.o src/io.o src/file.o src/splice.o src/process.o \
|
||||||
|
@ -24,10 +22,6 @@ ifeq ($(NIXIO_TLS),openssl)
|
||||||
TLS_LDFLAGS = -lssl
|
TLS_LDFLAGS = -lssl
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(OS),Linux)
|
|
||||||
NIXIO_CFLAGS = -D_GNU_SOURCE
|
|
||||||
endif
|
|
||||||
|
|
||||||
%.o: %.c
|
%.o: %.c
|
||||||
$(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $<
|
$(COMPILE) $(NIXIO_CFLAGS) $(LUA_CFLAGS) $(FPIC) -c -o $@ $<
|
||||||
|
|
||||||
|
@ -55,7 +49,7 @@ $(AXTLS_DIR)/.prepared:
|
||||||
touch $@
|
touch $@
|
||||||
|
|
||||||
src/libaxtls.a: $(AXTLS_DIR)/.prepared
|
src/libaxtls.a: $(AXTLS_DIR)/.prepared
|
||||||
$(MAKE) -C $(AXTLS_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(EXTRA_CFLAGS) $(FPIC) '-Dalloca(size)=__builtin_alloca(size)' -Wall -pedantic -I../config -I../ssl -I../crypto" LDFLAGS="$(LDFLAGS)" OS="$(OS)" clean all
|
$(MAKE) -C $(AXTLS_DIR) CC=$(CC) CFLAGS="$(CFLAGS) $(EXTRA_CFLAGS) $(FPIC) -Wall -pedantic -I../config -I../ssl -I../crypto" LDFLAGS="$(LDFLAGS)" OS="$(OS)" clean all
|
||||||
cp -p $(AXTLS_DIR)/_stage/libaxtls.a src
|
cp -p $(AXTLS_DIR)/_stage/libaxtls.a src
|
||||||
|
|
||||||
clean: luaclean
|
clean: luaclean
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
#include <signal.h>
|
||||||
|
|
||||||
static int nixio_fork(lua_State *L) {
|
static int nixio_fork(lua_State *L) {
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#include <errno.h>
|
||||||
#include "nixio.h"
|
#include "nixio.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +125,11 @@ static int nixio__getsetsockopt(lua_State *L, int set) {
|
||||||
} else if (!strcmp(option, "sndbuf")) {
|
} else if (!strcmp(option, "sndbuf")) {
|
||||||
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_SNDBUF, set);
|
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_SNDBUF, set);
|
||||||
} else if (!strcmp(option, "priority")) {
|
} else if (!strcmp(option, "priority")) {
|
||||||
|
#ifdef SO_PRIORITY
|
||||||
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_PRIORITY, set);
|
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_PRIORITY, set);
|
||||||
|
#else
|
||||||
|
return nixio__pstatus(L, !(errno = ENOPROTOOPT));
|
||||||
|
#endif
|
||||||
} else if (!strcmp(option, "broadcast")) {
|
} else if (!strcmp(option, "broadcast")) {
|
||||||
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_BROADCAST, set);
|
return nixio__gso_int(L, sock->fd, SOL_SOCKET, SO_BROADCAST, set);
|
||||||
} else if (!strcmp(option, "linger")) {
|
} else if (!strcmp(option, "linger")) {
|
||||||
|
|
|
@ -82,11 +82,11 @@ static int nixio_tls_sock_recv(lua_State *L) {
|
||||||
t->pbufsiz -= req;
|
t->pbufsiz -= req;
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
char *axbuf;
|
uint8_t *axbuf;
|
||||||
int axread;
|
size_t axread;
|
||||||
|
|
||||||
/* while handshake pending */
|
/* while handshake pending */
|
||||||
while ((axread = ssl_read(sock, (uint8_t**)&axbuf)) == SSL_OK);
|
while ((axread = ssl_read(sock, &axbuf)) == SSL_OK);
|
||||||
|
|
||||||
if (t->pbufsiz) {
|
if (t->pbufsiz) {
|
||||||
lua_pushlstring(L, t->pbufpos, t->pbufsiz);
|
lua_pushlstring(L, t->pbufpos, t->pbufsiz);
|
||||||
|
@ -111,7 +111,7 @@ static int nixio_tls_sock_recv(lua_State *L) {
|
||||||
int stillwant = req - t->pbufsiz;
|
int stillwant = req - t->pbufsiz;
|
||||||
if (stillwant < axread) {
|
if (stillwant < axread) {
|
||||||
/* we got more data than we need */
|
/* we got more data than we need */
|
||||||
lua_pushlstring(L, axbuf, stillwant);
|
lua_pushlstring(L, (char *)axbuf, stillwant);
|
||||||
if(t->pbufsiz) {
|
if(t->pbufsiz) {
|
||||||
lua_concat(L, 2);
|
lua_concat(L, 2);
|
||||||
}
|
}
|
||||||
|
@ -130,7 +130,7 @@ static int nixio_tls_sock_recv(lua_State *L) {
|
||||||
t->pbufpos = t->pbuffer;
|
t->pbufpos = t->pbuffer;
|
||||||
memcpy(t->pbufpos, axbuf + stillwant, t->pbufsiz);
|
memcpy(t->pbufpos, axbuf + stillwant, t->pbufsiz);
|
||||||
} else {
|
} else {
|
||||||
lua_pushlstring(L, axbuf, axread);
|
lua_pushlstring(L, (char *)axbuf, axread);
|
||||||
if(t->pbufsiz) {
|
if(t->pbufsiz) {
|
||||||
lua_concat(L, 2);
|
lua_concat(L, 2);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue