RAS(9)                 NetBSD Kernel Developer's Manual                 RAS(9)

     ras_lookup, ras_fork, ras_purgeall -- restartable atomic sequences

     #include <sys/types.h>
     #include <sys/proc.h>
     #include <sys/ras.h>

     void *
     ras_lookup(struct proc *p, void *addr);

     ras_fork(struct proc *p1, struct proc *p2);

     ras_purgeall(struct proc *p);

     Restartable atomic sequences are user code sequences which are guaranteed
     to execute without preemption.  This property is assured by checking the
     set of restartable atomic sequences registered for a process during
     cpu_switchto(9).  If a process is found to have been preempted during a
     restartable sequence, then its execution is rolled-back to the start of
     the sequence by resetting its program counter saved in its process con-
     trol block (PCB).

     The RAS functionality is provided by a combination of the machine-inde-
     pendent routines discussed in this page and a machine-dependent component
     in cpu_switchto(9).  A port which supports restartable atomic sequences
     will define __HAVE_RAS in <machine/types.h> for machine-independent code
     to conditionally provide RAS support.

     A complicated side-effect of restartable atomic sequences is their inter-
     action with the machine-dependent ptrace(2) support.  Specifically, sin-
     gle-step traps and/or the emulation of single-stepping must carefully
     consider the effect on restartable atomic sequences.  A general solution
     is to ignore these traps or disable them within restartable atomic

     The functions which operate on restartable atomic sequences are:

     ras_lookup(p, addr)
              This function searches the registered restartable atomic
              sequences for process p which contain the user address addr.  If
              the address addr is found within a RAS, then the restart address
              of the RAS is returned, otherwise -1 is returned.

     ras_fork(p1, p2)
              This function is used to copy all registered restartable atomic
              sequences for process p1 to process p2.  It is primarily called
              from fork1(9) when the sequences are inherited from the parent
              by the child.

              This function is used to remove all registered restartable
              atomic sequences for process p.  It is primarily used to remove
              all registered restartable atomic sequences for a process during
              exec(3) and by rasctl(2).

     The RAS framework itself is implemented within the file
     sys/kern/kern_ras.c.  Data structures and function prototypes for the
     framework are located in <sys/ras.h>.  Machine-dependent portions are
     implemented within cpu_switchto(9) in the machine-dependent file

     rasctl(2), cpu_switchto(9), fork1(9)

     Gregory McGarry, "An Implementation of User-level Restartable Atomic
     Sequences on the NetBSD Operating System", Proceedings of the FREENIX
     Track: 2003 USENIX Annual Technical Conference, USENIX Association,
     311-322, June 9-14, 2003.

     The RAS functionality first appeared in NetBSD 2.0.

NetBSD 6.0.1                    April 17, 2010                    NetBSD 6.0.1

You can also request any man page by name and (optionally) by section:


Use the DEFAULT collection to view manual pages for third-party software.

©1994 Man-cgi 1.15, Panagiotis Christias <christia@softlab.ntua.gr>
©1996-2014 Modified for NetBSD by Kimmo Suominen