Skip to content

Instantly share code, notes, and snippets.

View kentonv's full-sized avatar

Kenton Varda kentonv

View GitHub Profile
@kentonv
kentonv / SCM_RIGHTS.md
Last active October 17, 2024 19:11
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

Keybase proof

I hereby claim:

  • I am kentonv on github.
  • I am kentonv (https://keybase.io/kentonv) on keybase.
  • I have a public key whose fingerprint is 8802 23DF 25AA 25A9 433A F0FB 4067 8458 440D DCF1

To claim this, I am signing this object:

@kentonv
kentonv / kwargs.c++
Created November 19, 2013 22:35
Keyword args in C++?
// Keyword args. In C++.
//
// Compile with:
// g++ -std=c++11 kwargs.c++
#include <utility>
#include <assert.h>
#include <string.h>
#include <vector>
#include <initializer_list>
@kentonv
kentonv / rpc.capnp
Last active December 19, 2015 02:08
Cap'n Proto RPC protocol straw man
# Recall that Cap'n Proto RPC allows messages to contain references to remote objects that
# implement interfaces. These references are called "capabilities", because they both designate
# the remote object to use and confer permission to use it.
#
# Cap'n Proto RPC takes place over a connection -- any bi-directional stream. The protocol does
# not distinguish between client and server as both ends can receive capabilities from the other
# and subsequently make calls to those capabilities.
#
# Capabilities are, at least initially, tied to connections. If the connection dies, all
# capabilities received through it are lost. The ability to persist capabilities across
kenton@megaman:~/workspace/capnproto/doc:master$ echo -e '<div><span>@Foo</span>\n\n</div>' | maruku
___________________________________________________________________________
| Maruku tells you:
+---------------------------------------------------------------------------
| Malformed HTML starting at "<div><span>@Foo</span>"
| ---------------------------------------------------------------------------
| <div><span>@Foo</span>EOF
| |---------------------------------------------------------------------------
| +--- Byte 0