Subject: kern/9769: unimplemented syscalls in FreeBSD emulation
To: None <gnats-bugs@gnats.netbsd.org>
From: IWAMOTO Toshihiro <iwamoto@sat.t.u-tokyo.ac.jp>
List: netbsd-bugs
Date: 04/04/2000 04:03:46
>Number:         9769
>Category:       kern
>Synopsis:       unimplemented syscalls in FreeBSD emulation
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Apr 04 03:38:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     
>Release:        2 weeks ago -current
>Organization:
	Univ. of Tokyo
>Environment:
	
System: NetBSD een.sat.t.u-tokyo.ac.jp 1.4W NetBSD 1.4W (EEN) #7: Fri Mar 24 22:31:56 JST 2000 iwamoto@een.sat.t.u-tokyo.ac.jp:/usr/src/syssrc/sys/arch/i386/compile/EEN i386


>Description:
	There are several syscalls added in FreeBSD-4.0.
	New syscalls include sigprocmask() and sigaction(),
	which are in wide use.
>How-To-Repeat:
	Try to run several FreeBSD-4 binaries.
>Fix:
	The attached diff partially solves the problem.
	This patch doesn't handle SA_SIGINFO yet
	(ghostscript seems to require SA_SIGINFO).
Index: files.freebsd
===================================================================
RCS file: /public/dpt/NetBSD/NetBSD-CVS/syssrc/sys/compat/freebsd/files.freebsd,v
retrieving revision 1.3
diff -u -r1.3 files.freebsd
--- files.freebsd       1998/01/22 16:31:33     1.3
+++ files.freebsd       2000/03/22 09:57:29
@@ -12,5 +12,6 @@
 file   compat/freebsd/freebsd_ipc.c            compat_freebsd
 file   compat/freebsd/freebsd_misc.c           compat_freebsd
 file   compat/freebsd/freebsd_ptrace.c         compat_freebsd
+file   compat/freebsd/freebsd_sigaction.c      compat_freebsd
 file   compat/freebsd/freebsd_sysent.c         compat_freebsd
 file   compat/freebsd/freebsd_syscalls.c       compat_freebsd
Index: syscalls.master
===================================================================
RCS file: /public/dpt/NetBSD/NetBSD-CVS/syssrc/sys/compat/freebsd/syscalls.master,v
retrieving revision 1.25
diff -u -r1.25 syscalls.master
--- syscalls.master     1999/08/25 04:48:21     1.25
+++ syscalls.master     2000/03/24 13:31:32
@@ -582,3 +582,31 @@
 335    UNIMPL          utrace
 336    UNIMPL          sendfile
 337    UNIMPL          kldsym
+338    UNIMPL
+339    UNIMPL
+340    NOARGS          { int sys___sigprocmask14(int how, \
+                           const sigset_t *set, \
+                           sigset_t* oset); }
+341    UNIMPL          sigsuspend
+342    STD             { int freebsd_sys_sigaction4(int sig, \
+                               const struct freebsd_sigaction *act, \
+                               struct freebsd_sigaction *oact); }
+343    UNIMPL          sigpending
+344    UNIMPL          sigreturn
+345    UNIMPL          sigtimedwait
+346    UNIMPL          sigwaitinfo
+347    UNIMPL          __acl_get_file
+348    UNIMPL          __acl_set_file
+349    UNIMPL          __acl_get_fd
+350    UNIMPL          __acl_set_fd
+351    UNIMPL          __acl_delete_file
+352    UNIMPL          __acl_delete_fd
+353    UNIMPL          __acl_aclcheck_file
+354    UNIMPL          __acl_aclcheck_fd
+355    UNIMPL          extattrctl
+356    UNIMPL          extattr_set_file
+357    UNIMPL          extattr_get_file
+358    UNIMPL          extattr_delete_file
+359    UNIMPL          aio_waitcomplete
+360    UNIMPL          getresuid
+361    UNIMPL          getresgid
--- /dev/null   Tue Apr  4 03:21:13 2000
+++ freebsd_sigaction.c Fri Mar 24 15:50:57 2000
@@ -0,0 +1,46 @@
+#include "opt_compat_freebsd.h"
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/proc.h>
+#include <sys/mount.h>
+#include <sys/errno.h>
+
+#include <sys/signal.h>
+#include <sys/signalvar.h>
+#include <sys/syscallargs.h>
+#include <compat/freebsd/freebsd_syscallargs.h>
+
+struct freebsd_sigaction {
+       union {
+               void    (*sa_handler)(int);
+               void    (*sa_sigaction)(int, void * /*siginfo_t* */, void *);
+       } __sigaction_u;
+       sigset_t        sa_mask;
+       int             sa_flags;
+};
+
+int
+freebsd_sys_sigaction4(p, v, retval)
+       struct proc *p;
+       void *v;
+       register_t *retval;
+{
+       struct freebsd_sys_sigaction4_args /* {
+               syscallarg(int) sig;
+               syscallarg(const struct freebsd_sigaction *) act;
+               syscallarg(struct freebsd_sigaction *) oact;
+       } */ *uap = v;
+       int error;
+       struct freebsd_sigaction act;
+
+       if (SCARG(uap, act)) {
+               error = copyin(SCARG(uap, act), &act, sizeof(act));
+               if (error)
+                       return (error);
+
+               if (act.sa_flags & SA_SIGINFO)
+                       return(ENOSYS); /* XXX */
+       }
+
+       return sys___sigaction14(p, v, retval);
+}

>Release-Note:
>Audit-Trail:
>Unformatted: