Skip to content

Commit 56c57e8

Browse files
fix freebsd compile error (#5918)
1 parent 38aa50f commit 56c57e8

File tree

2 files changed

+5
-13
lines changed

2 files changed

+5
-13
lines changed

‎ext-src/php_swoole_cxx.h‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,11 @@ bool php_swoole_name_resolver_add(zval *zresolver);
177177
const swoole::Allocator *sw_php_allocator();
178178
const swoole::Allocator *sw_zend_string_allocator();
179179

180-
#ifdef __APPLE__
180+
#if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__)
181181
#define SOL_TCP IPPROTO_TCP
182+
#endif
183+
184+
#ifdef __APPLE__
182185
#define TCP_INFO TCP_CONNECTION_INFO
183186
using tcp_info = tcp_connection_info;
184187
#endif

‎include/swoole.h‎

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
#include <unistd.h>
5252
#include <sched.h> /* sched_yield() */
5353
#include <pthread.h>
54+
#include <inttypes.h>
5455

5556
#include <sys/uio.h>
5657
#include <sys/utsname.h>
@@ -64,18 +65,6 @@
6465

6566
typedef unsigned long ulong_t;
6667

67-
#ifndef PRId64
68-
#define PRId64 "lld"
69-
#endif
70-
71-
#ifndef PRIu64
72-
#define PRIu64 "llu"
73-
#endif
74-
75-
#ifndef PRIx64
76-
#define PRIx64 "llx"
77-
#endif
78-
7968
#if defined(__GNUC__)
8069
#if __GNUC__ >= 3
8170
#define sw_inline inline __attribute__((always_inline))

0 commit comments

Comments
 (0)