#

include(`dict.h')
include(`KERcalls.h')

/*
 *       SCCS File Type - Emulator Source File
 *
 *       What identification string
 */
static char *_S_K15	"@(#)EM_K15.c	3.2";
	/****************************************************************/
	/*
	 *      K_open
	 */


/*
 *      K_open (
 *          1   oSeid,    : seid           : long (* object SEID    *)
 *          2   om,       : open_mode      : char (* how to open    *)
 *          3   stCap,    : openDescriptor : int  (* subtype cap    *)
 *          4  &od        : openDescriptor : int  (* return od      *)
 *             )
 */

K_open( PoSeid, Pom, PstCap, PodP )
	seid                   PoSeid;
	open_mode              Pom;
	openDescriptor         PstCap;
	openDescriptor         *PodP;
{
	K_err_num       ex;

	struct  {       /* Kopen_param  */
			seid            o_seid; /* const */
			KopenModes      om;     /* const */
			openDescriptor  stCap;  /* const */
			/* vars */
			openDescriptor  vod;
		}pb;

	pb.o_seid   = PoSeid;

	/*  Emulator open_modes == char. Kernel LopenModes == 4 booleans == */
	/* long. Must map between them. In Kernel Non 0 == True.            */

	pb.om.KomRead    = Pom & om_read;
	pb.om.KomWrite   = Pom & om_write;
	pb.om.KomEread   = Pom & om_exclusive_read;
	pb.om.KomEwrite  = Pom & om_exclusive_write;

	pb.stCap    = PstCap;

	ex = EMT15(&pb);

	*PodP      = pb.vod;

	return( ex );
}
