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

Build: porting Mac OS X (and othrer BSD systems). #12

Merged
merged 2 commits into from
Jun 4, 2015
Merged
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
1 change: 1 addition & 0 deletions include/fluent-bit/flb_network.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#define FLB_NETWORK_H

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

#ifndef TCP_FASTOPEN
#define TCP_FASTOPEN 23
Expand Down
1 change: 1 addition & 0 deletions lib/mk_core/mk_event_kqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,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;
}
Expand Down
1 change: 1 addition & 0 deletions plugins/out_fluentd/fluentd.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

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

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

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

Expand Down Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/flb_engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions src/flb_network.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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");
Expand Down