



		    discard_.pl1                    08/14/86  1450.1rew 08/14/86  1422.0      119844



/****^  ***********************************************************
        *                                                         *
        * Copyright, (C) Honeywell Information Systems Inc., 1982 *
        *                                                         *
        * Copyright (c) 1972 by Massachusetts Institute of        *
        * Technology and Honeywell Information Systems, Inc.      *
        *                                                         *
        *********************************************************** */

/* format: style4,delnl,insnl,ifthenstmt,indnoniterend */

/* Modified 05/15/84 by Jim Lippard to free attach data on detach */


/****^  HISTORY COMMENTS:
  1) change(86-06-20,Kissel), approve(86-07-23,MCR7455), audit(86-07-31,Ex),
     install(86-08-14,MR12.0-1126):
     Modified to handle all opening modes and IOX operations.  Also added the
     correct cleanup protocol around calls to hcs_$(set reset)_ips_mask.
                                                   END HISTORY COMMENTS */


discard_:
     proc ();

RETURN:
	return;

/* Parameters. */

dcl  actlen fixed bin (21) parameter;
dcl  args (*) char (*) varying parameter;
dcl  buflen fixed (21) parameter;
dcl  bufptr ptr parameter;
dcl  Code fixed bin (35) parameter;
dcl  extend_bit bit (1) aligned parameter;
dcl  infptr ptr parameter;
dcl  Iocb_ptr ptr parameter;
dcl  key char (256) varying parameter;
dcl  len fixed (21) parameter;
dcl  loud_sw bit (1) aligned parameter;
dcl  mode fixed bin parameter;
dcl  newmode char (*) parameter;
dcl  oldmode char (*) parameter;
dcl  order char (*) parameter;
dcl  position_type fixed bin parameter;
dcl  position_n fixed bin (21) parameter;

/* Automatic. */

dcl  blkptr ptr;
dcl  iocb_ptr ptr;
dcl  mask bit (36) aligned;

/* Based. */

dcl  based_area area based;

dcl  1 IOCB aligned like iocb based (iocb_ptr);

dcl  1 blk aligned based (blkptr),
       2 attach char (8) varying,
       2 open char (31) varying;

/* Procedures. */

dcl  com_err_ entry () options (variable);
dcl  continue_to_signal_ entry (fixed bin (35));
dcl  get_system_free_area_ entry () returns (ptr);
dcl  hcs_$set_ips_mask entry (bit (36) aligned, bit (36) aligned);
dcl  hcs_$reset_ips_mask entry (bit (36) aligned, bit (36) aligned);

/* Constants. */

dcl  error_table_$bad_mode fixed (35) ext;
dcl  error_table_$end_of_info fixed bin (35) ext static;
dcl  error_table_$no_record fixed (35) ext;
dcl  error_table_$not_detached fixed (35) ext;
dcl  error_table_$wrong_no_of_args fixed (35) ext;
dcl  error_table_$no_operation fixed (35) ext;

/* Built-in. */

dcl  (addr, hbound, lbound, null, substr) builtin;

/* Conditions. */

dcl  any_other condition;
dcl  cleanup condition;

/* End of declarations. */

/* Beginning of entry point ..... discard_discard_attach(Iocb_ptr,args,loud_sw) ..... */

discard_attach:
     entry (Iocb_ptr, args, loud_sw, Code);

	mask = ""b;
	iocb_ptr = Iocb_ptr;
	on cleanup call Cleanup_Handler ();
	on any_other call Any_Other_Handler ();
	call hcs_$set_ips_mask (""b, mask);

	if IOCB.attach_descrip_ptr ^= null () then do;
	     call Cleanup_Handler ();
	     if loud_sw then call com_err_ (error_table_$not_detached, "discard_");
	     Code = error_table_$not_detached;
	     end;
	else do;
	     allocate blk in (get_system_free_area_ () -> based_area) set (blkptr);
	     blk.attach = "discard_";
	     blk.open = "";
	     IOCB.attach_descrip_ptr = addr (blk.attach);
	     IOCB.attach_data_ptr = blkptr;
	     IOCB.detach_iocb = discard_detach;
	     IOCB.open = discard_open;
	     IOCB.modes = iox_$err_not_open;
	     IOCB.control = iox_$err_not_open;
	     call iox_$propagate (iocb_ptr);
	     call hcs_$reset_ips_mask (mask, mask);
	     Code = 0;
	     end;
	call GOTO_RETURN ();

/* End of entry point ..... discard_$discard_attach(Iocb_ptr,args,loud_sw) ..... */





/* Handler for the 'detach_iocb' I/O operation. */

discard_detach:
     entry (Iocb_ptr, Code);
	mask = ""b;
	iocb_ptr = Iocb_ptr;
	on cleanup call Cleanup_Handler ();
	on any_other call Any_Other_Handler ();
	call hcs_$set_ips_mask (""b, mask);
	blkptr = IOCB.attach_data_ptr;
	IOCB.attach_descrip_ptr, IOCB.attach_data_ptr = null ();
	IOCB.detach_iocb = iox_$err_not_attached;
	IOCB.open = iox_$err_not_attached;
	call iox_$propagate (iocb_ptr);
	call hcs_$reset_ips_mask (mask, mask);
	Code = 0;
	free blkptr -> blk;
	call GOTO_RETURN ();

/* End of 'detach_iocb' handler. */





/* Handler for the 'open' I/O operation. */

discard_open:
     entry (Iocb_ptr, mode, extend_bit, Code);
	mask = ""b;
	on cleanup call Cleanup_Handler ();
	on any_other call Any_Other_Handler ();
	call hcs_$set_ips_mask (""b, mask);
	iocb_ptr = Iocb_ptr -> iocb.actual_iocb_ptr;
	blkptr = IOCB.attach_data_ptr;

	if mode > lbound (iox_modes, 1) & mode < hbound (iox_modes, 1)
	then blk.open = iox_modes (mode);
	else do;
	     call Cleanup_Handler ();
	     Code = error_table_$bad_mode;
	     call GOTO_RETURN ();
	     end;

	if mode = Stream_input then do;
	     IOCB.get_line = discard_get_chars;		/* We always return 0 anyway. */
	     IOCB.get_chars = discard_get_chars;
	     IOCB.position = discard_position;
	     end;

	else if mode = Stream_output then IOCB.put_chars = discard_put_chars;

	else if mode = Stream_input_output then do;
	     IOCB.get_line = discard_get_chars;		/* We always return 0 anyway. */
	     IOCB.get_chars = discard_get_chars;
	     IOCB.put_chars = discard_put_chars;
	     IOCB.position = discard_position;
	     end;

	else if mode = Sequential_input then do;
	     IOCB.read_record = discard_read;
	     IOCB.read_length = discard_read_length;
	     IOCB.position = discard_position;
	     end;

	else if mode = Sequential_output then do;
	     IOCB.write_record = discard_write;
	     IOCB.position = discard_position;
	     end;

	else if mode = Sequential_input_output then do;
	     IOCB.read_record = discard_read;
	     IOCB.read_length = discard_read_length;
	     IOCB.write_record = discard_write;
	     IOCB.position = discard_position;
	     end;

	else if mode = Sequential_update then do;
	     IOCB.read_record = discard_read;
	     IOCB.read_length = discard_read_length;
	     IOCB.write_record = discard_write;
	     IOCB.rewrite_record = discard_write;	/* It's all the same to us. */
	     IOCB.delete_record = discard_delete;
	     IOCB.position = discard_position;
	     end;

	else if mode = Keyed_sequential_input then do;
	     IOCB.read_record = discard_read;
	     IOCB.read_length = discard_read_length;
	     IOCB.position = discard_position;
	     IOCB.seek_key = discard_seek_key;
	     IOCB.read_key = discard_seek_key;		/* They have the same calling sequence. */
	     end;

	else if mode = Keyed_sequential_output then do;
	     IOCB.write_record = discard_write;
	     IOCB.seek_key = discard_seek_key;
	     end;

	else if mode = Keyed_sequential_update then do;
	     IOCB.read_record = discard_read;
	     IOCB.delete_record = discard_delete;
	     IOCB.read_length = discard_read_length;
	     IOCB.position = discard_position;
	     IOCB.seek_key = discard_seek_key;
	     IOCB.read_key = discard_seek_key;		/* They have the same calling sequence. */
	     IOCB.write_record = discard_write;
	     IOCB.rewrite_record = discard_write;	/* It's all the same to us. */
	     end;

	else if mode = Direct_input then do;
	     IOCB.read_record = discard_read;
	     IOCB.read_length = discard_read_length;
	     IOCB.seek_key = discard_seek_key;
	     end;

	else if mode = Direct_output then do;
	     IOCB.write_record = discard_write;
	     IOCB.seek_key = discard_seek_key;
	     end;

	else if mode = Direct_update then do;
	     IOCB.read_record = discard_read;
	     IOCB.rewrite_record = discard_write;	/* It's all the same to us. */
	     IOCB.delete_record = discard_delete;
	     IOCB.read_length = discard_read_length;
	     IOCB.seek_key = discard_seek_key;
	     IOCB.write_record = discard_write;
	     end;

	else ;					/* We already checked the mode above. */

	if extend_bit then blk.open = blk.open || " -extend";

	IOCB.open_descrip_ptr = addr (blk.open);
	IOCB.detach_iocb = iox_$err_not_closed;
	IOCB.open = iox_$err_not_closed;
	IOCB.close = discard_close;
	IOCB.modes = discard_modes;
	IOCB.control = discard_control;

	call iox_$propagate (iocb_ptr);
	call hcs_$reset_ips_mask (mask, mask);

	Code = 0;
	call GOTO_RETURN ();

/* End of 'open' handler. */





/* Handler for the 'close' I/O operation. */

discard_close:
     entry (Iocb_ptr, Code);
	mask = ""b;
	on cleanup call Cleanup_Handler ();
	on any_other call Any_Other_Handler ();
	call hcs_$set_ips_mask (""b, mask);
	iocb_ptr = Iocb_ptr -> iocb.actual_iocb_ptr;
	blkptr = IOCB.attach_data_ptr;
	IOCB.open_descrip_ptr = null ();
	IOCB.detach_iocb = discard_detach;
	IOCB.open = discard_open;
	IOCB.close = iox_$err_not_open;
	IOCB.get_line = iox_$err_not_open;
	IOCB.get_chars = iox_$err_not_open;
	IOCB.put_chars = iox_$err_not_open;
	IOCB.modes = iox_$err_not_open;
	IOCB.position = iox_$err_not_open;
	IOCB.control = iox_$err_not_open;
	IOCB.read_record = iox_$err_not_open;
	IOCB.write_record = iox_$err_not_open;
	IOCB.rewrite_record = iox_$err_not_open;
	IOCB.delete_record = iox_$err_not_open;
	IOCB.seek_key = iox_$err_not_open;
	IOCB.read_key = iox_$err_not_open;
	IOCB.read_length = iox_$err_not_open;
	call iox_$propagate (iocb_ptr);
	call hcs_$reset_ips_mask (mask, mask);
	Code = 0;
	call GOTO_RETURN ();

/* End of 'close' handler. */





/* Handler for the 'get_line' and  'get_chars' I/O operations. */

discard_get_chars:
     entry (Iocb_ptr, bufptr, buflen, actlen, Code);
	actlen = 0;
	Code = error_table_$end_of_info;
	call GOTO_RETURN ();

/* End of 'get_line' and  'get_chars' handlers. */





/* Handler for the 'put_chars' I/O operation. */

discard_put_chars:
     entry (Iocb_ptr, bufptr, buflen, Code);
	Code = 0;
	call GOTO_RETURN ();

/* End of 'put_chars' handler. */





/* Handler for the 'modes' I/O operation. */

discard_modes:
     entry (Iocb_ptr, newmode, oldmode, Code);
	oldmode = "";
	Code = 0;
	call GOTO_RETURN ();

/* End of 'modes' handler. */





/* Handler for the 'position' I/O operation. */

discard_position:
     entry (Iocb_ptr, position_type, position_n, Code);
	Code = 0;
	call GOTO_RETURN ();

/* End of 'position' handler. */





/* Handler for the 'control' I/O operation. */

discard_control:
     entry (Iocb_ptr, order, infptr, Code);
	if order = "io_call"
	then Code = error_table_$no_operation;
	else Code = 0;
	call GOTO_RETURN ();

/* End of 'control' handler. */





/* Handler for the 'read_record' I/O operation. */

discard_read:
     entry (Iocb_ptr, bufptr, buflen, actlen, Code);
	actlen = 0;
	Code = error_table_$end_of_info;
	call GOTO_RETURN ();

/* End of 'read_record' handler. */





/* Handler for the 'write_record' and 'rewrite_record I/O operations. */

discard_write:
     entry (Iocb_ptr, bufptr, buflen, Code);
	Code = 0;
	call GOTO_RETURN ();

/* End of 'write_record' and 'rewrite_record' handlers. */





/* Handler for the 'delete_record' I/O operation. */

discard_delete:
     entry (Iocb_ptr, Code);
	Code = error_table_$no_record;
	call GOTO_RETURN ();

/* End of 'delete_record' handler. */





/* Handler for the 'seek_key' and 'read_key' I/O operations. */

discard_seek_key:
     entry (Iocb_ptr, key, len, Code);
	len = 0;
	Code = error_table_$no_record;
	call GOTO_RETURN ();

/* End of 'seek_key' and 'read_key' handlers. */





/* Handler for the 'read_length' I/O operation. */

discard_read_length:
     entry (Iocb_ptr, actlen, Code);
	actlen = 0;
	Code = error_table_$no_record;
	call GOTO_RETURN ();

/* End of 'read_length' handler. */

/* format: ^indcomtxt */

/*****************************************************************************/
/*							       */
/*   PROCEDURE:  Any_Other_Handler				       */
/*							       */
/*   This procedure restores the IPS mask if necessary and continues to      */
/*   signal whatever the problem was.				       */
/*							       */
/*****************************************************************************/

Any_Other_Handler:
     proc ();

	if substr (mask, 36, 1) then call hcs_$reset_ips_mask (mask, mask);

	call continue_to_signal_ ((0));		/* Ignore the code. */

	return;

     end Any_Other_Handler;

/*****************************************************************************/
/*							       */
/*   PROCEDURE:  Cleanup_Handler				       */
/*							       */
/*   This procedure restores the IPS mask if necessary.		       */
/*							       */
/*****************************************************************************/

Cleanup_Handler:
     proc ();

	if substr (mask, 36, 1) then call hcs_$reset_ips_mask (mask, mask);

	return;

     end Cleanup_Handler;

/*****************************************************************************/
/*							       */
/*   PROCEDURE:  GOTO_RETURN					       */
/*							       */
/*   This procedure only exists to aid debugging, and centralize the return. */
/*							       */
/*****************************************************************************/

GOTO_RETURN:
     proc ();

	goto RETURN;				/* A non-local goto to the main return. */

     end GOTO_RETURN;

/* format: revert */
%page;
%include iocb;
%include iox_dcls;
%include iox_modes;

     end discard_;




		    signal_io_.pl1                  11/29/84  1138.2rew 11/28/84  1034.0      129285



/* ***********************************************************
   *                                                         *
   * Copyright, (C) Honeywell Information Systems Inc., 1984 *
   *                                                         *
   *********************************************************** */
/* io module for admin commands that traps input */

/* format: style2 */
signal_io_:
     procedure;
	return;


/* Written 1984-10-12 BIM, from tty_ */

/* Parameters */

	dcl     arg_iocbp		 ptr;		/* ptr to iocb (input) */
	dcl     arg_buffer_ptr	 pointer;
	dcl     arg_buffer_length	 fixed bin (21);
	dcl     arg_n_read		 fixed bin (21);
	dcl     arg_pos_type	 fixed bin;
	dcl     arg_pos_amt		 fixed bin (35);
	dcl     arg_order_name	 char (*);
	dcl     arg_order_info_ptr	 pointer;
	dcl     arg_old_modes	 char (*);
	dcl     arg_new_modes	 char (*);
	dcl     arg_key		 char (256) varying;

	dcl     code		 fixed bin (35);	/* Multics standard error code (output) */
	dcl     com_err_switch	 bit (1);		/* ON if should call com_err_ for errors (input) */
	dcl     extend_bit		 bit (1);		/* Obsolete open argument */
	dcl     mode		 fixed bin;
	dcl     option_array	 (*) char (*) var;

/* Automatic */

	dcl     actual_iocbp	 ptr;		/* copy of iocb.actual_ioc_ptr */
	dcl     device		 char (32);
	dcl     i			 fixed bin;
	dcl     iocbp		 ptr;		/* copy of arg_iocb_ptr */
	dcl     mask		 bit (36) aligned;	/* ips mask */
	dcl     system_free_area_ptr	 pointer;

/* builtins */

	dcl     (addr, hbound, length, null, string)
				 builtin;

/* Internal Static */

	dcl     ME		 char (32) int static options (constant) init ("signal_io_");
						/* used by com_err_ and setting attach descrip */

/* Based */

	dcl     system_free_area	 area based (system_free_area_ptr);

/* External Static */

	dcl     (
	        error_table_$action_not_performed,
	        error_table_$too_many_args,
	        error_table_$inconsistent,
	        error_table_$badopt,
	        error_table_$bad_mode,
	        error_table_$noarg,
	        error_table_$not_detached,
	        error_table_$wrong_no_of_args
	        )			 fixed bin (35) ext;

	dcl     (any_other, cleanup)	 condition;

/* Procedures */

	dcl     com_err_		 entry options (variable);
	dcl     get_system_free_area_	 entry () returns (pointer);
	dcl     hcs_$reset_ips_mask	 entry (bit (36) aligned, bit (36) aligned);
	dcl     hcs_$set_ips_mask	 entry (bit (36) aligned, bit (36) aligned);
	declare signal_		 entry () options (variable);

	declare 1 sgii		 aligned like signal_io_info;

	declare attach_data_ptr	 pointer;
	declare 1 attach_data	 aligned based (attach_data_ptr),
		2 attach_description char (200) varying,
		2 open_description	 char (200) varying;

%page;


signal_io_attach:
     entry (arg_iocbp, option_array, com_err_switch, code);

	code = 0;
	mask = ""b;
	iocbp = arg_iocbp;

	attach_data_ptr = null ();
	on cleanup call clean_up_attach;

	if hbound (option_array, 1) ^= 0
	then call error (error_table_$noarg, "Usage: signal_io_");

	if iocbp -> iocb.attach_descrip_ptr ^= null ()
	then call error (error_table_$not_detached, "");

	system_free_area_ptr = get_system_free_area_ ();
	allocate attach_data in (system_free_area);

	attach_data.attach_description = "signal_io_";
	attach_data.open_description = "";

	on any_other call handler;			/* should be on */

	call hcs_$set_ips_mask (""b, mask);
	iocbp -> iocb.attach_descrip_ptr = addr (attach_data.attach_description);
	iocbp -> iocb.attach_data_ptr = attach_data_ptr;
	iocbp -> iocb.detach_iocb = signal_io_detach;
	iocbp -> iocb.open = signal_io_open;
	iocbp -> iocb.control = signal_io_control;
	call iox_$propagate (iocbp);
	revert any_other;
	call hcs_$reset_ips_mask (mask, mask);

RETURN:
	return;


/*  Error calls com_err_ if the loud switch is set and goes to the attach return */

error:
     proc (err_code, message);

	dcl     err_code		 fixed bin (35);	/* Multics standard error code */
	dcl     message		 char (*);	/* Additional error information */

	if com_err_switch
	then call com_err_ (err_code, ME, "^a  ^a", iocbp -> iocb.name, message);
	code = err_code;

	call clean_up_attach;
	goto RETURN;

     end error;
%page;

signal_io_detach:
     entry (arg_iocbp, code);

	call set_up;				/* set no lock, but get actual_iocb_ptr */

	on any_other call handler;			/* should be on */
	call hcs_$set_ips_mask (""b, mask);
	actual_iocbp -> iocb.attach_descrip_ptr = null ();
	actual_iocbp -> iocb.attach_data_ptr = null ();
	actual_iocbp -> iocb.detach_iocb = iox_$err_not_attached;
	actual_iocbp -> iocb.open = iox_$err_not_attached;
	actual_iocbp -> iocb.control = iox_$err_not_attached;
	call iox_$propagate (actual_iocbp);
	call hcs_$reset_ips_mask (mask, mask);
	revert any_other;				/* avoid unneccessary fatal errors */
	free attach_data;
	return;
%page;
/*  This entry sets the open description and the legal operation entries in the iocb.  The operations permitted:

   all the time:	close, control, modes
   input:		get_chars, get_line, position
   output:	put_chars
*/

signal_io_open:
     entry (arg_iocbp, mode, extend_bit, code);

	call set_up;

	attach_data.open_description = iox_modes (mode);

	on any_other call handler;
	call hcs_$set_ips_mask (""b, mask);

	actual_iocbp -> iocb.open_descrip_ptr = addr (attach_data.open_description);
	actual_iocbp -> iocb.detach_iocb = iox_$err_not_closed;
	actual_iocbp -> iocb.open = iox_$err_not_closed;
	actual_iocbp -> iocb.close = signal_io_close;
	actual_iocbp -> iocb.modes = signal_io_modes;

	if mode = Stream_input_output | mode = Stream_input | mode = Stream_output
	then do;

		if mode ^= Stream_output
		then do;
			actual_iocbp -> iocb.get_line = signal_io_get_line;
			actual_iocbp -> iocb.get_chars = signal_io_get_chars;
			actual_iocbp -> iocb.position = signal_io_position;
		     end;

		if mode ^= Stream_input
		then actual_iocbp -> iocb.put_chars = signal_io_put_chars;
	     end;

	if mode = Sequential_input_output | mode = Sequential_input | mode = Sequential_output
	then do;

		if mode = Sequential_input | mode = Sequential_input_output | mode = Sequential_update
		then do;
			actual_iocbp -> iocb.read_record = signal_io_read_record;
			actual_iocbp -> iocb.read_length = signal_io_read_length;
			actual_iocbp -> iocb.position = signal_io_position;
		     end;

		if mode = Sequential_output | mode = Sequential_input_output | mode = Sequential_update
		then actual_iocbp -> iocb.write_record = signal_io_write_record;
		if mode = Sequential_update
		then do;
			actual_iocbp -> iocb.rewrite_record = signal_io_rewrite_record;
			actual_iocbp -> iocb.delete_record = signal_io_delete_record;

		     end;

	     end;
	if mode = Keyed_sequential_input | mode = Keyed_sequential_output
	then do;

		actual_iocbp -> iocb.seek_key = signal_io_seek_key;

		if mode = Keyed_sequential_input | mode = Keyed_sequential_update
		then do;
			actual_iocbp -> iocb.read_record = signal_io_read_record;
			actual_iocbp -> iocb.read_length = signal_io_read_length;
			actual_iocbp -> iocb.position = signal_io_position;
			actual_iocbp -> iocb.read_key = signal_io_read_key;
		     end;

		if mode = Keyed_sequential_output | mode = Keyed_sequential_update
		then actual_iocbp -> iocb.write_record = signal_io_write_record;
		if mode = Keyed_sequential_update
		then do;
			actual_iocbp -> iocb.rewrite_record = signal_io_rewrite_record;
			actual_iocbp -> iocb.delete_record = signal_io_delete_record;

		     end;
	     end;
	if mode = Direct_input | mode = Direct_output
	then do;
		actual_iocbp -> iocb.seek_key = signal_io_seek_key;
		if mode = Direct_input | mode = Direct_update
		then do;
			actual_iocbp -> iocb.read_record = signal_io_read_record;
			actual_iocbp -> iocb.read_length = signal_io_read_length;
		     end;

		if mode = Direct_output | mode = Direct_update
		then actual_iocbp -> iocb.write_record = signal_io_write_record;
		if mode = Direct_update
		then do;
			actual_iocbp -> iocb.rewrite_record = signal_io_rewrite_record;
			actual_iocbp -> iocb.delete_record = signal_io_delete_record;

		     end;
	     end;
	call iox_$propagate (actual_iocbp);
	call hcs_$reset_ips_mask (mask, mask);
	revert any_other;

	code = 0;
	return;
%page;
/*  This procedure closes the io switch and returns a zero code. 
*/

signal_io_close:
     entry (arg_iocbp, code);

	call set_up;


	on any_other call handler;			/* should be on */
	call hcs_$set_ips_mask (""b, mask);

	actual_iocbp -> iocb.open_descrip_ptr = null;
	actual_iocbp -> iocb.detach_iocb = signal_io_detach;
	actual_iocbp -> iocb.open = signal_io_open;
	actual_iocbp -> iocb.modes = iox_$err_not_open;

	call iox_$propagate (actual_iocbp);

	call hcs_$reset_ips_mask (mask, mask);
	return;
%page;

signal_io_get_chars:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, arg_n_read, code);
	call set_up_io (SGI_OP_GET_CHARS);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

signal_io_get_line:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, arg_n_read, code);
	call set_up_io (SGI_OP_GET_LINE);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

signal_io_put_chars:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, code);
	call set_up_io (SGI_OP_PUT_CHARS);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_modes:
     entry (arg_iocbp, arg_new_modes, arg_old_modes, code);
	call set_up_io (SGI_OP_MODES);
	sgii.new_modes.pointer = addr (arg_new_modes);
	sgii.new_modes.length = length (arg_new_modes);
	sgii.old_modes.pointer = addr (arg_old_modes);
	sgii.old_modes.length = length (arg_old_modes);
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_position:
     entry (arg_iocbp, arg_pos_type, arg_pos_amt, code);
	call set_up_io (SGI_OP_POSITION);
	sgii.position_type = arg_pos_type;
	sgii.position_amount = arg_pos_amt;
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_control:
     entry (arg_iocbp, arg_order_name, arg_order_info_ptr, code);
	call set_up_io (SGI_OP_CONTROL);
	sgii.control_order_info_ptr = arg_order_info_ptr;
	sgii.data_ptr = addr (arg_order_name);
	sgii.data_length = length (arg_order_name);
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_write_record:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, code);
	call set_up_io (SGI_OP_WRITE_RECORD);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_read_record:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, arg_n_read, code);
	call set_up_io (SGI_OP_READ_RECORD);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

signal_io_rewrite_record:
     entry (arg_iocbp, arg_buffer_ptr, arg_buffer_length, code);
	call set_up_io (SGI_OP_REWRITE_RECORD);
	sgii.data_ptr = arg_buffer_ptr;
	sgii.data_length = arg_buffer_length;
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_delete_record:
     entry (arg_iocbp, code);
	call set_up_io (SGI_OP_DELETE_RECORD);
	call signal ();
	code = sgii.returned_error_code;
	return;

signal_io_seek_key:
     entry (arg_iocbp, arg_key, arg_n_read, code);
	call set_up_io (SGI_OP_SEEK_KEY);
	sgii.key = arg_key;
	call signal ();
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

signal_io_read_key:
     entry (arg_iocbp, arg_key, arg_n_read, code);
	call set_up_io (SGI_OP_READ_KEY);
	call signal ();
	arg_key = sgii.key;
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

signal_io_read_length:
     entry (arg_iocbp, arg_n_read, code);
	call set_up_io (SGI_OP_READ_LENGTH);
	call signal ();
	arg_n_read = sgii.returned_data_length;
	code = sgii.returned_error_code;
	return;

%page;
set_up_io:
     procedure (op);

	declare op		 char (32);

	sgii.version = 0;
	sgii.header.length = currentsize (sgii);
	sgii.action_flags = "0"b;			/* can restart */
	sgii.info_string = op;			/* we could do better */
	sgii.status_code = 0;
	sgii.operation = op;
	sgii.iocb_ptr = arg_iocbp;			/* in the case of syn_, give the original */
	sgii.iocb_name = arg_iocbp -> iocb.name;	/* since the handler can always fetch iocb.actual */
	sgii.control_order_info_ptr, sgii.data_ptr = null ();
	sgii.data_length, sgii.returned_data_length = 0;
	sgii.returned_error_code = error_table_$action_not_performed;
	sgii.old_modes.pointer, sgii.new_modes.pointer = null ();
	sgii.old_modes.length, sgii.new_modes.length = 0;
	sgii.key = "";
	return;
     end set_up_io;

signal:
     procedure;

	call signal_ ("signal_io_", null (), addr (sgii));
	return;
     end signal;

/*  Internal procedure to handle faults while IPS interrupts are masked.  For a fault while masked, the process
   is terminated (with the reason "unable to do critical I/O") because the I/O control blocks are in an
   inconsistent state.
*/
terminate_the_process:
     entry (code);
	call terminate_this_process (code);

handler:
     procedure options (non_quick);			/* visible in ifd */

	dcl     error_table_$unable_to_do_io
				 fixed (35) ext;
	if mask ^= ""b
	then call terminate_this_process (error_table_$unable_to_do_io);
     end handler;


terminate_this_process:
     procedure (cd);

	dcl     cd		 fixed bin (35);
	dcl     terminate_process_	 ext entry (char (*), ptr);
	dcl     1 ti		 aligned automatic,
		2 version		 fixed,
		2 code		 fixed (35);


	ti.version = 0;
	ti.code = cd;
	call terminate_process_ ("fatal_error", addr (ti));

     end terminate_this_process;

set_up:
     procedure;

	code = 0;
	mask = ""b;
	actual_iocbp = arg_iocbp -> iocb.actual_iocb_ptr;
	attach_data_ptr = actual_iocbp -> iocb.attach_data_ptr;
	return;

     end set_up;

clean_up_attach:
     procedure;

	if attach_data_ptr = null ()
	then return;
	free attach_data;
     end clean_up_attach;
%page;
%include iox_entries;
%include iox_modes;
%include iocb;
%include condition_info_header;
%include signal_io_info;

     end signal_io_;







		    bull_copyright_notice.txt       08/30/05  1008.4r   08/30/05  1007.3    00020025

                                          -----------------------------------------------------------


Historical Background

This edition of the Multics software materials and documentation is provided and donated
to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
as a contribution to computer science knowledge.  
This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
and Bull HN Information Systems Inc. to the development of this operating system. 
Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
of Professor Fernando Jose Corbato.Users consider that Multics provided the best software architecture for 
managing computer hardware properly and for executing programs. Many subsequent operating systems
incorporated Multics principles.
Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .

                                          -----------------------------------------------------------

Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
and that both the copyright notice and historical background and this permission notice appear in supporting
documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
to distribution of the programs without specific prior written permission.
    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
    Copyright 2006 by Bull HN Information Systems Inc.
    Copyright 2006 by Bull SAS
    All Rights Reserved

