Skip to content

Instantly share code, notes, and snippets.

View yrashk's full-sized avatar
🎯
Being productive

Yurii Rashkovskii yrashk

🎯
Being productive
View GitHub Profile
@yrashk
yrashk / api.cpp
Created March 3, 2023 14:18 — forked from RikkaW/api.cpp
Socket send fd
void api::OpenFiles(RiruFile *files, size_t count) {
struct sockaddr_un addr{};
int fd;
socklen_t socklen;
uint8_t *data;
uint32_t data_size;
int32_t reply[count];
uint32_t reply_size;
std::vector<int> fds;
@yrashk
yrashk / SCM_RIGHTS.md
Created March 3, 2023 14:19 — forked from kentonv/SCM_RIGHTS.md
SCM_RIGHTS API quirks

As tested on Linux:

  • An SCM_RIGHTS ancillary message is "attached" to the range of data bytes sent in the same sendmsg() call.
  • However, as always, recvmsg() calls on the receiving end don't necessarily map 1:1 to sendmsg() calls. Messages can be coalesced or split.
  • The recvmsg() call that receives the first byte of the ancillary message's byte range also receives the ancillary message itself.
  • To prevent multiple ancillary messages being delivered