Skip to content

macOS Support & Page Refresh#157

Draft
adozenlines wants to merge 41 commits intoOCEAN-xyz:masterfrom
adozenlines:master
Draft

macOS Support & Page Refresh#157
adozenlines wants to merge 41 commits intoOCEAN-xyz:masterfrom
adozenlines:master

Conversation

@adozenlines
Copy link

macOS Support & Page Refresh

adozenlines added 30 commits May 9, 2025 21:02
…event

# Conflicts:
#	.idea/workspace.xml
#	cmake-build-debug/.ninja_deps
#	cmake-build-debug/.ninja_log
#	cmake-build-debug/Testing/Temporary/LastTest.log
@adozenlines adozenlines marked this pull request as draft October 14, 2025 03:14
#define IO_MAX_EVENTS 32

static inline int datum_io_create() {
return kqueue();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing a return value check for kqueue()

}

static inline int portable_mutex_timedlock(pthread_mutex_t *mutex, const struct timespec *timeout) {
while (nanosleep(timeout, NULL) == -1 && errno == EINTR) continue;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this use of portable_mutex_timedlock() will work for Apple/BSD since this is using a sleep loop instead of proper timeout handling.

#ifdef __linux__
int wait_ms = 5;
#elif defined(__APPLE__) || defined(__BSD__)
int wait_ms = 5000;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is there a massive difference between Linux and Apple/BSD behavior for wait_ms?

#ifdef __linux__
if (events[0].events & (EPOLLERR | EPOLLHUP)) {
#elif defined(__APPLE__) || defined(__BSD__)
if (events[0].flags & EVFILT_EXCEPT) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be using EV_ERROR?

#ifdef __linux__
if (events[0].events & EPOLLIN) {
#elif defined(__APPLE__) || defined(__BSD__)
if (events[0].flags & EV_ADD) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be using EVFILT_READ?

my->ev.data.u64 = i; // store client index... duh
if (epoll_ctl(my->epollfd, EPOLL_CTL_ADD, my->client_data[i].fd, &my->ev) < 0) {
#elif defined(__APPLE__) || defined(__BSD__)
my->ev.flags = EV_ADD | EV_ONESHOT | EV_ERROR;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of setting flags, shouldn't this be setting filter and events?

static inline int datum_io_delete(IO_HANDLE kq, uintptr_t fd, struct kevent *evSet)
{
if (evSet) {
evSet->ident = fd;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For datum_io_delete and datum_io_modify, what happens if the parameter is NULL? Seems like this just sets it without checking...


include(GNUInstallDirs)

if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't CMake already provide platform detection without you having to define them here explicitly?

int val;
if (var_name_len_2 == 3 && 0 == strncmp(var_start_2, "*ro", 3)) {
if (var_name_len_2 == 16 && 0 == strncmp(var_start_2, "time_out_in_secs", 16))
{

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing else-if chaining could cause unnecessary string comparisons.

// the ePIC control boards can handle almost any size coinbase
// UA starts with: PowerPlay-BM/
if (strstr(m->useragent, "PowerPlay-BM/") == m->useragent) {
else if (strstr(m->useragent, "PowerPlay-BM/") == m->useragent) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed if/return pattern to if/else-if without return, could be changing logic here?

@luke-jr luke-jr added enhancement New feature or request portability Issues relating to running DATUM Gateway on new platforms labels Dec 15, 2025
@luke-jr
Copy link
Contributor

luke-jr commented Dec 15, 2025

Probably should split this up into multiple PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request portability Issues relating to running DATUM Gateway on new platforms

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants