MARK(2)
NAME
mark, unmarked − set and check initialization marks efficiently
SYNOPSIS
#include <mark.h>
int mark(mk)
MARKER mk;
int unmarked(mk)
MARKER mk;
DESCRIPTION
Mark sets mk to "initialized", and records its location in the system. It returns 0 if the location is already marked, OK if the marking was successful, and SYSERR if there are too many marked locations.
Unmarked checks the contents and location of mk to see if it has been previously marked with the mark procedure. It returns OK if and only if mk has not been marked, 0 otherwise. The key is that they work correctly after a reboot, no matter what was left in the marked locations when the system stopped.
Both mark and unmarked operate efficiently (in a few instructions) to correctly determine whether a location has been marked. They are most useful for creating self-initializing procedures when the system will be restarted. Both the value in mk as well as its location are used to tell if it has been marked.
Memory marking can be eliminated from Xinu by removing the definition of the symbol MEMMARK from the Configuration file. Self-initializing library routines may require manual initialization if MEMMARK is disabled (e.g., see BUFFER(3)).
BUGS
Mark does not verify that the location given lies in the static data area before marking it; to avoid having the system retain marks for locations on the stack after procedure exit, do not mark automatic variables.
December 01, 1986 — Xinu Programmer’s Manual