/* 
 * $RCSfile: process.h,v $
 *
 * x-kernel v3.3
 *
 * Original Copyright (c) 1993,1991,1990,1996  Arizona Board of Regents
 * Modifications Copyright (c) 1993 Massachusetts Board of Regents
 *
 * $Log: process.h,v $
 * Revision 1.2  1996/01/30 20:51:19  slm
 * Updated copyright and version.
 *
 * Revision 1.1  1995/07/29  02:40:49  slm
 * Initial revision
 *
 * Revision 1.3.1.1.1.1  1994/11/12  19:10:46  hkaram
 * New branch
 *
 * Revision 1.3.1.1  1994/03/14  21:50:50  umass
 * New prototypes added
 *
 * Revision 1.3  1993/12/16  02:09:12  menze
 * Multiple CreateProcess* prototypes replaced by one CreateProcess1
 * prototype.
 *
 * Revision 1.2  1993/11/13  00:45:39  menze
 * Original version from UMass
 */


#ifndef process_h
#define process_h

#include "xtype.h"

/* the "normal" priority for process creation */
/* Currently UNUSED by process code, but left in */
/* for compatibility */

#define STD_PRIO                0

#ifndef NULL
#define NULL 0
#endif

#define MAX_NUMARGS 6

typedef struct _Process {
  struct _Process *	prev;
  struct _Process *	next;
  int			pid;
  int			ppid;
  int			thread_id;
  int			group_id;
  int			(* func)();
  int			num_args;
  int			args[MAX_NUMARGS];
} Process;

typedef struct _Semaphore {
  void *	irix_semaphore;
} Semaphore;

typedef struct _Queue {
  void *	mutex;
  int		count;
  struct _Process *	head;
  struct _Process *	tail;
} Queue;

extern void 		* xkernel_arena;

#ifdef __STDC__

extern void semInit( Semaphore *, unsigned );
extern void semFree( Semaphore * );
extern void semWait( Semaphore * );
extern void semSignal( Semaphore * );

void xk_master_lock();	
void xk_master_unlock();

void	process_init( void );
typedef	void (*CreateProcFunc) ( void * );
void	CreateProcess1( CreateProcFunc, int, void * );
void	Yield( void );
void	process_kill_all_others( void );
void	process_unblock_children( void );

Process * process_self();
void 	queue_init( Queue * );
void 	queue_insert_first( Queue *, Process * );
void 	queue_insert_last( Queue *, Process * );
Process * queue_remove_first( Queue * );

#endif /* __STDC__ */

extern Process *Active;

#endif
