LIBCASPER(3)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

🌸 NAME 🌸

okay bestie, welcome to the libcasper manual page β€” specifically the CREATE_SERVICE moment. This macro is a casper service declaration macro, and yes, it’s the main character here. πŸ’…

  • CREATE_SERVICE β€” casper service declaration macro ✨

🫢 LIBRARY 🫢

it’s giving: library β€œlibcasper”. no notes. πŸŽ€


✨ SYNOPSIS ✨

copy these exactly, bestie β€” character for character, no improv:

#include <sys/nv.h>
#include <libcasper.h>
#include <libcasper_service.h>

typedef int service_limit_func_t(const nvlist_t *, const nvlist_t *);

typedef int service_command_func_t(const char *, const nvlist_t *, nvlist_t *,
    nvlist_t *);

CREATE_SERVICE(name, limit_func, command_func, flags);

πŸ’– DESCRIPTION πŸ’–

The CREATE_SERVICE macro is used to create a new casper service. The name is a string containing the service name, which will be used in the cap_service_open(3) function to identify it. iconic behavior, honestly. πŸ‘‘

The limit_func is a function of type service_limit_func_t where the first argument of the function contains an nvlist(9) with old service limits and the second argument contains the new limits. If the service was not limited then the old limits will be set to NULL. 🚨 Important: this function must not allow the extension of service limits. hard no, bestie.

The command_func is a function of type service_command_func_t where the first argument is the name of the command that should be executed. The first nvlist(9) contains the current limits and the second contains an nvlist(9) with the current request. The last argument contains a return value nvlist(9) which contains the response from casper. the way that whole pipeline works is lowkey elegant. πŸ¦‹

The flags argument defines the limits of the service. The supported flags are:

🚩 supported flags 🚩

  • CASPER_SERVICE_STDIO β€” the casper service has access to the stdio descriptors from the process it was spawned from. πŸ–₯️
  • CASPER_SERVICE_FD β€” the casper service has access to all of the descriptors, besides the stdio descriptors, from the process it was spawned from. πŸ“
  • CASPER_SERVICE_NO_UNIQ_LIMITS β€” the whole casper communication is using an nvlist(9) with the NV_FLAG_NO_UNIQUE flag. πŸ”₯

πŸ‘€ SEE ALSO πŸ‘€


πŸ•°οΈ HISTORY πŸ•°οΈ

The libcasper library first appeared in FreeBSD 10.3. a whole era. ⭐


πŸ’œ AUTHORS πŸ’œ

The libcasper library was implemented by Pawel Jakub Dawidek <pawel@dawidek.net> under sponsorship from the FreeBSD Foundation. The libcasper new architecture was implemented by Mariusz Zaborski <oshogbo@FreeBSD.org>. absolute icons, fr fr. 🫢


Debian β€’ November 15, 2021 β€’ LIBCASPER(3) β€” that’s the footer, bestie: Debian, dated November 15, 2021, manual page LIBCASPER(3). mwah πŸ’‹πŸŒˆ

πŸ“¦ where this page comes from