Skip to content

Add support for Oracle Solaris#4

Merged
ithewei merged 3 commits intomasterfrom
unknown repository
May 5, 2020
Merged

Add support for Oracle Solaris#4
ithewei merged 3 commits intomasterfrom
unknown repository

Conversation

@ghost
Copy link

@ghost ghost commented May 5, 2020

Changes:

  • Fix conflicting declarations which prevent libhv from compiling successfully on Solaris.
  • Add support for I/O multiplexing via Solaris' event ports.

Testing:

  • Tested on latest Solaris 11.4.
  • Built with gcc 7.3.0.
  • Unit tests and examples work as expected.

#ifdef __cplusplus
#include <mutex>
#include <condition_variable>
using std::mutex;
Copy link
Author

Choose a reason for hiding this comment

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

This global scope using-declaration conflicts with another mutex typedef in <sys/mutex.h> on Solaris. Removed as it's not used anywhere in the project.

struct sockaddr sa;
struct sockaddr_in sin;
struct sockaddr_in6 sin6;
} sockaddr_un;
Copy link
Author

Choose a reason for hiding this comment

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

I believe the "un" here means "union", however, in <sys/un.h>, there is a sockaddr_un for Unix domains sockets where "un" means "Unix". On Solaris, <sys/un.h> is included by <sys/socket.h>, resulting in compilation error.

This issue also concerns Linux or BSD if libhv's going to support Unix domain sockets in the future. This conflict is not specific to Solaris, for sockaddr_un conforms to IEEE Std 1003.1-2008, and platforms like Linux and BSD also use that name.

Renaming to sockaddr_u is recommended.

// ms
unsigned int gettick();

#ifndef OS_SOLARIS // Solaris has built-in gethrtime().
Copy link
Author

Choose a reason for hiding this comment

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

Solaris has built-in gethrtime() in <sys/time.h> for high resolution time support, and also returns nanoseconds. Use that instead.

@ithewei ithewei merged commit 81a305d into ithewei:master May 5, 2020
@ithewei
Copy link
Owner

ithewei commented May 5, 2020

Nice work for evport, thanks very much!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants