Stamp

Number0x27
Signature(handle, marker) -> stamped_handle or -err
Grouphandles
Since1.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

RegisterNameDescription
r0handlePort handle to stamp. Must be unmarked (marker == MARKER_NONE)
r1markerThe 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

CodeCondition
ERR_BADARGmarker is `MARKER_NONE` (0)
ERR_BADHANDLEhandle names no live entry
ERR_BADTYPEhandle is not a port
ERR_DEADThe port has died
ERR_DUPLICATEhandle is already marked; a marked handle cannot itself be re-stamped
ERR_NOMEMCaller's handle table is full

See also