Subject: port-m68k/3056: compat/sunos/sunos_misc.c fails to compile
To: None <bernd@arresum.inka.de, gnats-bugs@gnats.netbsd.org>
From: Bernd Ernesti <bernd@arresum.inka.de>
List: netbsd-bugs
Date: 12/23/1996 15:59:40
>Number:         3056
>Category:       port-m68k
>Synopsis:       compat/sunos/sunos_misc.c fails to compile
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 23 07:05:00 1996
>Last-Modified:
>Originator:     Bernd Ernesti
>Organization:
	
>Release:        NetBSD-current 23-12-96 1300GMT
>Environment:
	
System: NetBSD arresum 1.2B NetBSD 1.2B (VEEGO) #205: Wed Nov 27 00:08:09 MET 1996 bernd@arresum:/home/source/src/sys/arch/amiga/compile/VEEGO amiga


>Description:

a kernel with COMPAT_SUNOS fails to build after the recent syscall changes:
../../../../compat/sunos/sunos_misc.c: In function `sunos_sys_stime':
../../../../compat/sunos/sunos_misc.c:125: warning: passing arg 2 of `copyout' discards `const' from pointer target type
*** Error code 1

>How-To-Repeat:

add COMPAT_SUNOS to your kernel config and make a new kernel.

>Fix:

I looked after the other changes to sys/compat and made this diff:

*** sunos_misc.c-orig	Sun Oct 13 10:33:54 1996
--- sunos_misc.c	Mon Dec 23 15:38:29 1996
***************
*** 113,131 ****
  	caddr_t sg = stackgap_init(p->p_emul);
  	struct timeval tv;
  	int error;
  
  	error = copyin(SCARG(uap, tp), &tv.tv_sec, sizeof(tv.tv_sec));
  	if (error)
  		return error;
  	tv.tv_usec = 0;
  
! 	SCARG(&ap, tv) = stackgap_alloc(&sg, sizeof(struct timeval));
  	SCARG(&ap, tzp) = NULL;
  
! 	error = copyout(&tv, SCARG(&ap, tv), sizeof(struct timeval));
  	if (error)
  		return error;
  
  	return sys_settimeofday(p, &ap, retval);
  }
  
--- 113,133 ----
  	caddr_t sg = stackgap_init(p->p_emul);
  	struct timeval tv;
  	int error;
+ 	void *tpp;
  
  	error = copyin(SCARG(uap, tp), &tv.tv_sec, sizeof(tv.tv_sec));
  	if (error)
  		return error;
  	tv.tv_usec = 0;
  
! 	tpp = stackgap_alloc(&sg, sizeof(struct timeval));
  	SCARG(&ap, tzp) = NULL;
  
! 	error = copyout(&tv, tpp, sizeof(struct timeval));
  	if (error)
  		return error;
  
+ 	SCARG(&ap, tv) = tpp;
  	return sys_settimeofday(p, &ap, retval);
  }
  
>Audit-Trail:
>Unformatted: