#ifndef _RCI_H_ccf9f822_
#define _RCI_H_ccf9f822_

#include <sys/proc.h>
#include <rciext/crashinfo.h>

#define MAX_RCI_PROCS	4	/* XXX no way around this right now ... */
	
typedef struct _rciinfo {
	  struct _rciinfo *next;
	  struct _rciinfo *prev;
	  struct proc *proc;
	  CRASHINFO lastcrash;
	  int hbticks;
	  int (*hbfxn)();
	  int hbarg;
	  int flags;
#define RCI_OPEN 0x00000001
#define RCI_BUSY 0x00000002
#define RCI_SIGS 0x00000004
	  int crashsig;
	  int pid;
	  int (*ifxn)();
	  int iarg;
	  struct rcitimeout {
	    struct rcitimeout *link;
	    struct _rciinfo *info;
	    int clockno;
	    int when;
	    int (*handler)();
	    int argument;
	    struct rcitimeout *explink;
	    int (*exphandler)();
	    int expargument;
	    } timeout;
	  } RCIINFO;

/* macros for linking things into a double linked list with 
   a head pointer (h) */

#define LINK_H(h,x)			\
	if (h)				\
	 { (h)->prev = (x);		\
	   (x)->next = (h);		\
	 }				\
	else				\
	 { (x)->next = NULL;		\
	 }				\
	(x)->prev = NULL;		\
	(h) = (x);

#define UNLINK_H(h,x)			\
	if ((x)->prev)			\
	 { (x)->prev->next = (x)->next;	\
	 }				\
	else				\
	 { (h) = (x)->next;		\
	 }				\
	if ((x)->next)			\
	 { (x)->next->prev = (x)->prev;	\
	 }

#define CTXLOCKED		0x80000000
#define SRCIPRC			0x40000000

#endif
