Xinu7/man/man2/mark.doc




MARK(2)             Xinu Programmer's Manual              MARK(2)



NAME
     mark, unmarked - set and check initialization marks effi-
     ciently

SYNOPSIS
     #include <mark.h>

     int mark(mk)
     MARKER mk;

     int unmarked(mk)
     MARKER mk;

DESCRIPTION
     _M_a_r_k sets _m_k 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.

     _U_n_m_a_r_k_e_d checks the contents and location of _m_k to see if it
     has been previously marked with the _m_a_r_k procedure.  It
     returns OK if and only if _m_k has not been marked, 0 other-
     wise.  The key is that they work correctly after a reboot,
     no matter what was left in the marked locations when the
     system stopped.

     Both _m_a_r_k and _u_n_m_a_r_k_e_d 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 _m_k 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 sys-
     tem retain marks for locations on the stack after procedure
     exit, do not mark automatic variables.












Version 6b               Printed 1/12/87                        1