Skip to content
Open
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
4 changes: 4 additions & 0 deletions include/nn/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include <poll.h>
#include <sys/select.h>
#include <sys/socket.h>
#include <poll.h>

namespace nn {
class TimeSpan;
Expand Down Expand Up @@ -60,6 +61,9 @@ s32 GetSockName(int, sockaddr*, u32*);
s32 GetSockOpt(int, int, int, void*, u32*);
s32 Listen(int, int);
s32 SetSockOpt(s32 socket, s32 socketLevel, s32 option, const void*, u32 len);
s32 Poll(pollfd *fds, unsigned long nfds, s32 timeout);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can the unsigned long just be nfds_t as to match how poll is done in UNIX
https://man7.org/linux/man-pages/man2/poll.2.html

Copy link
Author

Choose a reason for hiding this comment

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

@ThePixelGamer no, the mangled name won't link if you use nfds_t, i tried

Copy link
Collaborator

Choose a reason for hiding this comment

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

mangled name? the type should exist seeing how you're including poll.h, am I missing something?

Choose a reason for hiding this comment

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

Also, nfds_t is a typedef so it won't even show up in the mangled symbol.

Copy link
Author

Choose a reason for hiding this comment

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

@leoetlino it's typedefed as an unsigned int and not an unsigned long, so the mangled name changes

Choose a reason for hiding this comment

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

musl (which is the libc NintendoSDK uses) typedefs it to an unsigned long.

Copy link
Author

Choose a reason for hiding this comment

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

@leoetlino i tried, and it seemed to mangle it as j and not m. not sure why

Choose a reason for hiding this comment

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

		 ::= j	# unsigned int
		 ::= l	# long
		 ::= m	# unsigned long

Sounds like your header include path is set up incorrectly and you might be using your host system's poll.h (which typedefs it to unsigned int?) rather than the one from musl.

s32 Fcntl(s32 fd, s32 cmd, ...);
u64 Send(s32 socket, const void* buffer, u64 bufferLength, s32 flags);
s32 SockAtMark(int);
s32 Shutdown(int, int);
s32 ShutdownAllSockets(bool);
Expand Down