Skip to content

Commit

Permalink
Merge pull request #12 from pandax381/porting-osx
Browse files Browse the repository at this point in the history
Build: porting Mac OS X (and othrer BSD systems).
edsiper committed Jun 4, 2015
2 parents 0a591a3 + 6bcbeb2 commit 0251287
Showing 7 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/fluent-bit/flb_network.h
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@
#define FLB_NETWORK_H

#include <netinet/tcp.h>
#include <sys/socket.h>

#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23
1 change: 1 addition & 0 deletions lib/mk_core/mk_event_kqueue.c
Original file line number Diff line number Diff line change
@@ -184,6 +184,7 @@ static inline int _mk_event_timeout_create(struct mk_event_ctx *ctx,
* FIXME: the timeout event is not triggered when using libkqueue, need
* to confirm how it behave on native OSX.
*/
event->mask = MK_EVENT_READ;

return fd;
}
1 change: 1 addition & 0 deletions plugins/out_fluentd/fluentd.c
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>

#include <fluent-bit/flb_output.h>
3 changes: 2 additions & 1 deletion plugins/out_td/td.c
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <errno.h>

@@ -74,7 +75,7 @@ int cb_td_flush(void *data, size_t bytes, void *out_context,
{
int n;
char buf[1024];
size_t w_bytes;
ssize_t w_bytes;
size_t out_len;
char *request;
struct flb_out_td_config *ctx = out_context;
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -16,6 +16,9 @@ include_directories(
${extra_headers}
)

include(CheckSymbolExists)
check_symbol_exists(accept4 "sys/socket.h" HAVE_ACCEPT4)

# Let the core aware about TLS/SSL if enabled
if(WITH_SSL_TLS)
add_definitions(-DHAVE_SSL_TLS)
2 changes: 1 addition & 1 deletion src/flb_engine.c
Original file line number Diff line number Diff line change
@@ -125,7 +125,7 @@ static int flb_engine_handle_event(int fd, int mask, struct flb_config *config)
struct mk_list *head;
struct flb_input_collector *collector;

if (mask & FLB_ENGINE_READ) {
if (mask & MK_EVENT_READ) {
/* Check if we need to flush */
if (config->flush_fd == fd) {
consume_byte(fd);
9 changes: 9 additions & 0 deletions src/flb_network.c
Original file line number Diff line number Diff line change
@@ -35,6 +35,10 @@
#include <fluent-bit/flb_network.h>
#include <fluent-bit/flb_utils.h>

#ifndef SOL_TCP
#define SOL_TCP IPPROTO_TCP
#endif

int flb_net_socket_reset(int sockfd)
{
int status = 1;
@@ -207,8 +211,13 @@ int flb_net_accept(int server_fd)
struct sockaddr sock_addr;
socklen_t socket_size = sizeof(struct sockaddr);

#ifdef HAVE_ACCEPT4
remote_fd = accept4(server_fd, &sock_addr, &socket_size,
SOCK_NONBLOCK | SOCK_CLOEXEC);
#else
remote_fd = accept(server_fd, &sock_addr, &socket_size);
flb_net_socket_nonblocking(remote_fd);
#endif

if (remote_fd == -1) {
perror("accept4");

0 comments on commit 0251287

Please sign in to comment.