-
Notifications
You must be signed in to change notification settings - Fork 20
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
macos: basic support for darwin builds #20
base: mariadb-4.x
Are you sure you want to change the base?
Changes from all commits
15693ae
aa6f9ab
b52c519
78dfe02
5afb256
1abe2d1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,102 @@ | |
#include <memory> | ||
#include <string> | ||
|
||
#ifdef __APPLE__ | ||
|
||
struct tcp_info { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if tcp_info is here https://developer.apple.com/documentation/kernel/tcp_info - what does it mean? So this is a copied list from somewhere? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Speaking of this one, I thought to just reimplement There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only usage in " gcomm::SocketStats gcomm::AsioTcpSocket::stats" includes a small subset namely the
If you find a compatible structure you could alias it, but if there's a difference fields create a minimal structure of only what's needed an populate that. I haven't found the macos function that does this. |
||
uint8_t tcpi_state; | ||
uint8_t tcpi_ca_state; | ||
uint8_t tcpi_retransmits; | ||
uint8_t tcpi_probes; | ||
uint8_t tcpi_backoff; | ||
uint8_t tcpi_options; | ||
uint8_t tcpi_snd_wscale : 4, tcpi_rcv_wscale : 4; | ||
uint8_t tcpi_delivery_rate_app_limited:1, tcpi_fastopen_client_fail:2; | ||
|
||
uint32_t tcpi_rto; | ||
uint32_t tcpi_ato; | ||
uint32_t tcpi_snd_mss; | ||
uint32_t tcpi_rcv_mss; | ||
|
||
uint32_t tcpi_unacked; | ||
uint32_t tcpi_sacked; | ||
uint32_t tcpi_lost; | ||
uint32_t tcpi_retrans; | ||
uint32_t tcpi_fackets; | ||
|
||
/* Times. */ | ||
uint32_t tcpi_last_data_sent; | ||
uint32_t tcpi_last_ack_sent; /* Not remembered, sorry. */ | ||
uint32_t tcpi_last_data_recv; | ||
uint32_t tcpi_last_ack_recv; | ||
|
||
/* Metrics. */ | ||
uint32_t tcpi_pmtu; | ||
uint32_t tcpi_rcv_ssthresh; | ||
uint32_t tcpi_rtt; | ||
uint32_t tcpi_rttvar; | ||
uint32_t tcpi_snd_ssthresh; | ||
uint32_t tcpi_snd_cwnd; | ||
uint32_t tcpi_advmss; | ||
uint32_t tcpi_reordering; | ||
|
||
uint32_t tcpi_rcv_rtt; | ||
uint32_t tcpi_rcv_space; | ||
|
||
uint32_t tcpi_total_retrans; | ||
|
||
uint64_t tcpi_pacing_rate; | ||
uint64_t tcpi_max_pacing_rate; | ||
uint64_t tcpi_bytes_acked; /* RFC4898 tcpEStatsAppHCThruOctetsAcked */ | ||
uint64_t tcpi_bytes_received; /* RFC4898 tcpEStatsAppHCThruOctetsReceived */ | ||
uint32_t tcpi_segs_out; /* RFC4898 tcpEStatsPerfSegsOut */ | ||
uint32_t tcpi_segs_in; /* RFC4898 tcpEStatsPerfSegsIn */ | ||
|
||
uint32_t tcpi_notsent_bytes; | ||
uint32_t tcpi_min_rtt; | ||
uint32_t tcpi_data_segs_in; /* RFC4898 tcpEStatsDataSegsIn */ | ||
uint32_t tcpi_data_segs_out; /* RFC4898 tcpEStatsDataSegsOut */ | ||
|
||
uint64_t tcpi_delivery_rate; | ||
|
||
uint64_t tcpi_busy_time; /* Time (usec) busy sending data */ | ||
uint64_t tcpi_rwnd_limited; /* Time (usec) limited by receive window */ | ||
uint64_t tcpi_sndbuf_limited; /* Time (usec) limited by send buffer */ | ||
|
||
uint32_t tcpi_delivered; | ||
uint32_t tcpi_delivered_ce; | ||
|
||
uint64_t tcpi_bytes_sent; /* RFC4898 tcpEStatsPerfHCDataOctetsOut */ | ||
uint64_t tcpi_bytes_retrans; /* RFC4898 tcpEStatsPerfOctetsRetrans */ | ||
uint32_t tcpi_dsack_dups; /* RFC4898 tcpEStatsStackDSACKDups */ | ||
uint32_t tcpi_reord_seen; /* reordering events seen */ | ||
|
||
uint32_t tcpi_rcv_ooopack; /* Out-of-order packets received */ | ||
|
||
uint32_t tcpi_snd_wnd; /* peer's advertised receive window after | ||
* scaling (bytes) | ||
*/ | ||
uint32_t tcpi_rcv_wnd; /* local advertised receive window after | ||
* scaling (bytes) | ||
*/ | ||
|
||
uint32_t tcpi_rehash; /* PLB or timeout triggered rehash attempts */ | ||
|
||
uint16_t tcpi_total_rto; /* Total number of RTO timeouts, including | ||
* SYN/SYN-ACK and recurring timeouts. | ||
*/ | ||
uint16_t tcpi_total_rto_recoveries; /* Total number of RTO | ||
* recoveries, including any | ||
* unfinished recovery. | ||
*/ | ||
uint32_t tcpi_total_rto_time; /* Total time spent in RTO recoveries | ||
* in milliseconds, including any | ||
* unfinished recovery. | ||
*/ | ||
}; | ||
|
||
#endif | ||
|
||
namespace gu | ||
{ | ||
// URI schemes for networking | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -248,11 +248,11 @@ int gu_barrier_init_SYS (gu_barrier_t_SYS *barrier, | |
errno = EINVAL; | ||
return -1; | ||
} | ||
if(gu_mutex_init_SYS (&barrier->mutex, 0) < 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. unclear why you swapped arguments here. pthread_mutex_init seems to be the same on both, mutex then mutex attributed. If there as need to swap them make the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there was a patch 09848b6 by Jan from 2021-11-11 14:22:24 +0200 that swapped the order of the arguments to the macros, if you mean There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the patch replaced There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if(gu_mutex_init_SYS (NULL, &barrier->mutex) < 0) | ||
{ | ||
return -1; | ||
} | ||
if(gu_cond_init_SYS (&barrier->cond, 0) < 0) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also consistent order in pthread_cond_init There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
if(gu_cond_init_SYS (NULL, &barrier->cond) < 0) | ||
{ | ||
gu_mutex_destroy_SYS (&barrier->mutex); | ||
return -1; | ||
|
@@ -279,13 +279,13 @@ int gu_barrier_wait_SYS (gu_barrier_t_SYS *barrier) | |
barrier->count = 0; | ||
gu_cond_broadcast_SYS (&barrier->cond); | ||
gu_mutex_unlock_SYS (&barrier->mutex); | ||
return GU_BARRIER_THREAD_SYS; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why this change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it was introduced by dabe053 8 years ago, but I suppose it never compiled as at that moment there were no GU_BARRIER_THREAD_SYS. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it is synonymous to PTHREAD_BARRIER_SERIAL_THREAD that is must return something non-usual on success (here its -1) for a thread synced with a barrier as per POSIX https://linux.die.net/man/3/pthread_barrier_wait
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (there is no such a constant in the code GU_BARRIER_THREAD_SYS) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
return GU_BARRIER_SERIAL_THREAD_SYS; | ||
} | ||
else | ||
{ | ||
gu_cond_wait_SYS (&barrier->cond, &(barrier->mutex)); | ||
gu_mutex_unlock_SYS (&barrier->mutex); | ||
return !GU_BARRIER_THREAD_SYS; | ||
return !GU_BARRIER_SERIAL_THREAD_SYS; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,8 +11,6 @@ | |
|
||
#include "gu_types.h" // bool | ||
|
||
#if __unix__ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could do There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, I will fix that, it was a hack There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
#include <pthread.h> | ||
#include <assert.h> | ||
|
||
|
@@ -318,8 +316,6 @@ typedef pthread_barrier_t gu_barrier_t_SYS; | |
|
||
#endif /* native POSIX barriers */ | ||
|
||
#endif /* __unix__ */ | ||
|
||
/** | ||
* Depending on compile-time flags application will either use | ||
* normal or debug version of the API calls | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this strictly isn't a linux problem, but a gnu linker?
Know why https://github.com/freebsd/freebsd-ports/blob/main/databases/galera26/Makefile is unaffected?
https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_LINKER_ID.html
IF(CMAKE_CXX_LINKER_ID STREQUAL "GNU")
....There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree, will fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure, but probably FreeBSD moved to LLVM linker in 12.0 (12.0 (December 11, 2018)) https://man.freebsd.org/cgi/man.cgi?query=ld&apropos=0&sektion=1&manpath=FreeBSD+12.0-RELEASE&arch=default&format=html since when they do fine and this patch codership@e907ec1 landed only in 2019. But I did not check to be sure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MacOS ld does not support this flag