Stamp
| Number | 0x27 |
|---|---|
| Signature | (handle, marker) -> stamped_handle or -err |
| Group | handles |
| Since | 1.1 |
Badge a port. Stamp mints a new handle in the caller’s own table that points at the same
underlying port as handle, but carries marker which is an opaque, caller-chosen value the kernel
attaches to that handle entry and no other. handle itself is left untouched: Stamp is
non-consuming, so the same unmarked handle can be stamped again with a different marker to
mint additional badges for the same port.
The marker travels with whichever badged handle a sender used to MsgSend or MsgCall. On the
receiving end, Waitany reports it back in WaitanyResult.marker, so one port and one
Waitany loop can tell multiple logical clients apart without a handle (or a thread) per
client. See waitany and
Markers & nametable.
Pitfalls
Only an unmarked handle (marker == MARKER_NONE) can be stamped; stamping an
already-marked handle returns ERR_DUPLICATE rather than re-badging it or minting a second
badge on top of the first. To hand out several badges for one port, Stamp the same
unmarked source handle multiple times, not the badges it produced.
Stamp only accepts port handles so notifications, shared memory, devices, replies, and
tasks all fail with ERR_BADTYPE.
Arguments
| Register | Name | Description |
|---|---|---|
r0 | handle | Port handle to stamp. Must be unmarked (marker == MARKER_NONE) |
r1 | marker | The badge to stamp with. Must be nonzero; 0 (`MARKER_NONE`) is the reserved unmarked sentinel |
Returns
The new, marked handle in the caller's own table.
Errors
| Code | Condition |
|---|---|
ERR_BADARG | marker is `MARKER_NONE` (0) |
ERR_BADHANDLE | handle names no live entry |
ERR_BADTYPE | handle is not a port |
ERR_DEAD | The port has died |
ERR_DUPLICATE | handle is already marked; a marked handle cannot itself be re-stamped |
ERR_NOMEM | Caller's handle table is full |