Subject: ultrix_getsysinfo & setsysinfo
To: None <glass@sun-lamp.cs.berkeley.edu, port-pmax@sun-lamp.cs.berkeley.edu>
From: Arne H Juul <arnej@dsl.unit.no>
List: port-pmax
Date: 08/01/1994 14:40:15
Here's a (stub) implementation of ultrix_getsysinfo and
ultrix_setsysinfo. I don't think we need to implement
more than this for now, and at least we don't want to
emulate all the ultrix BSD/SYSV/POSIX modes.
(I've actually used setsysinfo on ultrix, and 'you don't
want to know about this brain-damage' as gcc says about
trigraphs).

  -arnej

diff -rc ./syscalls.master sys/compat/ultrix/syscalls.master
*** ./syscalls.master	Wed Jun 29 12:28:11 1994
--- sys/compat/ultrix/syscalls.master	Mon Aug  1 06:05:28 1994
***************
*** 293,297 ****
  253	UNIMPL	0 audgen
  254	UNIMPL	0 startcpu
  255	UNIMPL	0 stopcpu
! 256	UNIMPL	0 ultrix_getsysinfo
! 257	UNIMPL	0 ultrix_setsysinfo
--- 293,297 ----
  253	UNIMPL	0 audgen
  254	UNIMPL	0 startcpu
  255	UNIMPL	0 stopcpu
! 256	STD	5 ultrix_getsysinfo
! 257	STD	5 ultrix_setsysinfo
diff -rc ./ultrix_misc.c sys/compat/ultrix/ultrix_misc.c
*** ./ultrix_misc.c	Wed Jun 29 12:28:12 1994
--- sys/compat/ultrix/ultrix_misc.c	Mon Aug  1 14:08:54 1994
***************
*** 90,95 ****
--- 90,142 ----
  
  #include <vm/vm.h>
  
+ #define GSI_PROG_ENV 1
+ 
+ struct ultrix_getsysinfo_args {
+ 	unsigned	op;
+ 	char		*buffer;
+ 	unsigned	nbytes;
+ 	int		*start;
+ 	char		*arg;
+ };
+ ultrix_getsysinfo(p, uap, retval)
+ 	struct proc *p;
+ 	struct ultrix_getsysinfo_args *uap;
+ 	int *retval;
+ {
+ 	static short progenv = 0;
+ 
+ 	switch (uap->op) {
+ 		/* operations implemented: */
+ 	case GSI_PROG_ENV:
+ 		if (uap->nbytes < sizeof(short))
+ 			return EINVAL;
+ 		*retval = 1;
+ 		return(copyout(&progenv, uap->buffer, sizeof(short)));
+ 	default:
+ 		printf("warning: ultrix_getsysinfo %d req unknown\n", uap->op);
+ 		*retval = 0; /* info unavail */
+ 		return 0;
+ 	}
+ }
+ 
+ struct ultrix_setsysinfo_args {
+ 	unsigned	op;
+ 	char		*buffer;
+ 	unsigned	nbytes;
+ 	unsigned	arg;
+ 	unsigned	flag;
+ };
+ ultrix_setsysinfo(p, uap, retval)
+ 	struct proc *p;
+ 	struct ultrix_setsysinfo_args *uap;
+ 	int *retval;
+ {
+ 	printf("warning: ultrix_setsysinfo req %d\n", uap->op);
+ 	*retval = 0;
+ 	return 0;
+ }
+ 
  struct ultrix_waitpid_args {
  	int	pid;
  	int	*status;
diff -rc ./ultrix_syscall.h sys/compat/ultrix/ultrix_syscall.h
*** ./ultrix_syscall.h	Fri Jul  1 12:20:10 1994
--- sys/compat/ultrix/ultrix_syscall.h	Mon Aug  1 06:07:20 1994
***************
*** 152,154 ****
--- 152,156 ----
  #define	ULTRIX_SYS_sun_sigpending	187
  #define	ULTRIX_SYS_setsid	188
  #define	ULTRIX_SYS_ultrix_waitpid	189
+ #define	ULTRIX_SYS_ultrix_getsysinfo	256
+ #define	ULTRIX_SYS_ultrix_setsysinfo	257
diff -rc ./ultrix_syscalls.c sys/compat/ultrix/ultrix_syscalls.c
*** ./ultrix_syscalls.c	Fri Jul  1 12:20:10 1994
--- sys/compat/ultrix/ultrix_syscalls.c	Mon Aug  1 06:07:20 1994
***************
*** 279,284 ****
  	"#253",			/* 253 = audgen */
  	"#254",			/* 254 = startcpu */
  	"#255",			/* 255 = stopcpu */
! 	"#256",			/* 256 = ultrix_getsysinfo */
! 	"#257",			/* 257 = ultrix_setsysinfo */
  };
--- 279,284 ----
  	"#253",			/* 253 = audgen */
  	"#254",			/* 254 = startcpu */
  	"#255",			/* 255 = stopcpu */
! 	"ultrix_getsysinfo",			/* 256 = ultrix_getsysinfo */
! 	"ultrix_setsysinfo",			/* 257 = ultrix_setsysinfo */
  };
diff -rc ./ultrix_sysent.c sys/compat/ultrix/ultrix_sysent.c
*** ./ultrix_sysent.c	Fri Jul  1 12:20:11 1994
--- sys/compat/ultrix/ultrix_sysent.c	Mon Aug  1 06:07:21 1994
***************
*** 147,152 ****
--- 147,154 ----
  int	sun_sigpending();
  int	setsid();
  int	ultrix_waitpid();
+ int	ultrix_getsysinfo();
+ int	ultrix_setsysinfo();
  
  #ifdef XXX_UNUSED
  #define compat(n, name) n, __CONCAT(o,name)
***************
*** 455,462 ****
  	{ 0, nosys },			/* 253 = audgen */
  	{ 0, nosys },			/* 254 = startcpu */
  	{ 0, nosys },			/* 255 = stopcpu */
! 	{ 0, nosys },			/* 256 = ultrix_getsysinfo */
! 	{ 0, nosys },			/* 257 = ultrix_setsysinfo */
  };
  
  int	nultrix_sysent = sizeof(ultrix_sysent) / sizeof(ultrix_sysent[0]);
--- 457,464 ----
  	{ 0, nosys },			/* 253 = audgen */
  	{ 0, nosys },			/* 254 = startcpu */
  	{ 0, nosys },			/* 255 = stopcpu */
! 	{ 5, ultrix_getsysinfo },			/* 256 = ultrix_getsysinfo */
! 	{ 5, ultrix_setsysinfo },			/* 257 = ultrix_setsysinfo */
  };
  
  int	nultrix_sysent = sizeof(ultrix_sysent) / sizeof(ultrix_sysent[0]);

------------------------------------------------------------------------------