;
;  Name: SETUIC.MAR
;
;  Type: Integer*4 Function (MACRO)
;
;  Author: M. R. London
;
;  Date: May 31, 1983
;
;  Purpose: To set the UIC of the current process (which turns out
;	to be the process running this program.)
;
;  Usage:
;	status = SETUIC(group number, user number)
;
;	status		- $CMKRNL status return. 0 if arguments wrong.
;	group number	- longword containing UIC group number
;	user number	- longword containing UIC user number
;
;  NOTES:
;	Must link with SS:SYS.STB
;

	.Title SETUIC	Set uic
	.IDENT /830531/
;
;  Libraries:
;
	.LIBRARY	/SYS$LIBRARY:LIB.MLB/
;
;  Global variables:
;
	$PCBDEF
;
;  Executable:
;
	.PSECT	SETUIC_CODE,EXE,NOWRT	; Executable code

	.ENTRY SETUIC,^M<R2,R3>
	CLRL	R0				; 0 is error code
	MOVZBL	(AP),R2				; Get number of arguments
	CMPL	R2,#2				; Are there 2 arguments
	BNEQ	5$				; If not, return
	MOVL	@4(AP),R3			; Group number into R3
	ROTL	#16,R3,R3			; Move to upper half of R3
	ADDL2	@8(AP),R3			; User number to top half of R3
	$CMKRNL_S ROUTIN=10$			; Must run in kernel mode
5$:	RET
10$:	.WORD	^M<>				; Entry mask
	MOVL	SCH$GL_CURPCB,R2		; Address of current process
	MOVL	R3,PCB$L_UIC(R2)		; Set UIC to specified
	MOVZWL	#SS$_NORMAL,R0			; Normal ending
	RET
	.END
