2005-01-06 23:22:04 +00:00
|
|
|
/*-
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
* Copyright (c) 1994, 1995 Scott Bartram
|
|
|
|
* Copyright (c) 1994 Arne H Juul
|
1994-10-14 08:53:16 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. The name of the author may not be used to endorse or promote products
|
|
|
|
* derived from this software without specific prior written permission
|
1994-10-14 08:53:16 +00:00
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-06-02 06:48:51 +00:00
|
|
|
#include <sys/cdefs.h>
|
|
|
|
__FBSDID("$FreeBSD$");
|
|
|
|
|
1994-10-14 08:53:16 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
#include <sys/sysproto.h>
|
2002-02-27 15:23:01 +00:00
|
|
|
#include <sys/jail.h>
|
1996-06-12 01:10:26 +00:00
|
|
|
#include <sys/kernel.h>
|
2008-07-05 13:10:10 +00:00
|
|
|
#include <sys/lock.h>
|
|
|
|
#include <sys/mutex.h>
|
1996-06-12 01:10:26 +00:00
|
|
|
#include <sys/sysctl.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
#include <i386/ibcs2/ibcs2_socksys.h>
|
|
|
|
#include <i386/ibcs2/ibcs2_util.h>
|
1994-10-14 08:53:16 +00:00
|
|
|
|
1996-06-12 01:10:26 +00:00
|
|
|
/* Local structures */
|
|
|
|
struct getipdomainname_args {
|
|
|
|
char *ipdomainname;
|
|
|
|
int len;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct setipdomainname_args {
|
|
|
|
char *ipdomainname;
|
|
|
|
int len;
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Local prototypes */
|
2002-03-20 05:48:58 +00:00
|
|
|
static int ibcs2_getipdomainname(struct thread *,
|
|
|
|
struct getipdomainname_args *);
|
|
|
|
static int ibcs2_setipdomainname(struct thread *,
|
|
|
|
struct setipdomainname_args *);
|
1996-06-12 01:10:26 +00:00
|
|
|
|
1994-10-14 08:53:16 +00:00
|
|
|
/*
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
* iBCS2 socksys calls.
|
1994-10-14 08:53:16 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
int
|
2001-09-12 08:38:13 +00:00
|
|
|
ibcs2_socksys(td, uap)
|
|
|
|
register struct thread *td;
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
register struct ibcs2_socksys_args *uap;
|
1994-10-14 08:53:16 +00:00
|
|
|
{
|
|
|
|
int error;
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
int realargs[7]; /* 1 for command, 6 for recvfrom */
|
|
|
|
void *passargs;
|
1994-10-14 08:53:16 +00:00
|
|
|
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
/*
|
|
|
|
* SOCKET should only be legal on /dev/socksys.
|
|
|
|
* GETIPDOMAINNAME should only be legal on /dev/socksys ?
|
|
|
|
* The others are (and should be) only legal on sockets.
|
1994-10-14 08:53:16 +00:00
|
|
|
*/
|
|
|
|
|
1999-01-28 01:59:53 +00:00
|
|
|
if ((error = copyin(uap->argsp, (caddr_t)realargs, sizeof(realargs))) != 0)
|
1994-10-14 08:53:16 +00:00
|
|
|
return error;
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
DPRINTF(("ibcs2_socksys: %08x %08x %08x %08x %08x %08x %08x\n",
|
|
|
|
realargs[0], realargs[1], realargs[2], realargs[3],
|
|
|
|
realargs[4], realargs[5], realargs[6]));
|
|
|
|
|
|
|
|
passargs = (void *)(realargs + 1);
|
|
|
|
switch (realargs[0]) {
|
|
|
|
case SOCKSYS_ACCEPT:
|
2001-09-12 08:38:13 +00:00
|
|
|
return accept(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_BIND:
|
2001-09-12 08:38:13 +00:00
|
|
|
return bind(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_CONNECT:
|
2001-09-12 08:38:13 +00:00
|
|
|
return connect(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETPEERNAME:
|
2001-09-12 08:38:13 +00:00
|
|
|
return getpeername(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETSOCKNAME:
|
2001-09-12 08:38:13 +00:00
|
|
|
return getsockname(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETSOCKOPT:
|
2001-09-12 08:38:13 +00:00
|
|
|
return getsockopt(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_LISTEN:
|
2001-09-12 08:38:13 +00:00
|
|
|
return listen(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_RECV:
|
|
|
|
realargs[5] = realargs[6] = 0;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case SOCKSYS_RECVFROM:
|
2001-09-12 08:38:13 +00:00
|
|
|
return recvfrom(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SEND:
|
|
|
|
realargs[5] = realargs[6] = 0;
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
case SOCKSYS_SENDTO:
|
2001-09-12 08:38:13 +00:00
|
|
|
return sendto(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETSOCKOPT:
|
2001-09-12 08:38:13 +00:00
|
|
|
return setsockopt(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SHUTDOWN:
|
2001-09-12 08:38:13 +00:00
|
|
|
return shutdown(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SOCKET:
|
2001-09-12 08:38:13 +00:00
|
|
|
return socket(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SELECT:
|
2001-09-12 08:38:13 +00:00
|
|
|
return select(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETIPDOMAIN:
|
2001-09-12 08:38:13 +00:00
|
|
|
return ibcs2_getipdomainname(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETIPDOMAIN:
|
2001-09-12 08:38:13 +00:00
|
|
|
return ibcs2_setipdomainname(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_ADJTIME:
|
2001-09-12 08:38:13 +00:00
|
|
|
return adjtime(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETREUID:
|
2001-09-12 08:38:13 +00:00
|
|
|
return setreuid(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETREGID:
|
2001-09-12 08:38:13 +00:00
|
|
|
return setregid(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETTIME:
|
2001-09-12 08:38:13 +00:00
|
|
|
return gettimeofday(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETTIME:
|
2001-09-12 08:38:13 +00:00
|
|
|
return settimeofday(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_GETITIMER:
|
2001-09-12 08:38:13 +00:00
|
|
|
return getitimer(td, passargs);
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
case SOCKSYS_SETITIMER:
|
2001-09-12 08:38:13 +00:00
|
|
|
return setitimer(td, passargs);
|
1994-10-14 08:53:16 +00:00
|
|
|
|
|
|
|
default:
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
printf("socksys unknown %08x %08x %08x %08x %08x %08x %08x\n",
|
|
|
|
realargs[0], realargs[1], realargs[2], realargs[3],
|
|
|
|
realargs[4], realargs[5], realargs[6]);
|
|
|
|
return EINVAL;
|
1994-10-14 08:53:16 +00:00
|
|
|
}
|
Remove old files no longer needed.
Add new files created for emulator.
Modify NetBSD import to work with FreeBSD and add new features and
code. The complete emulator is essentially a combination of work/code
implemented by Sean Eric Fagan, Soren Schmidt, Scott Bartram, and myself,
Steven Wallace.
Features of this new emulator system include:
o "clean" code, including strict prototyping.
o Auto-generation of ibcs2 system calls, xenix system calls, isc system
calls. Generation includes system tables, structure definitions,
and prototyping of function calls.
o ibcs2 emulator does not rely on any COMPAT_43 system calls.
o embedded socksys support
o ibcs2 msgsys, semsys, shmsys calls supported if supported in kernel
o alternate /emul/ibcs2 namespace searched first for files in ibcs2
system. Usefull to keep sysv libraries, binaries in /emul/ibcs2.
o many other finer details and functions fixed or implemented.
1995-10-10 07:59:30 +00:00
|
|
|
/* NOTREACHED */
|
1994-10-14 08:53:16 +00:00
|
|
|
}
|
1996-06-12 01:10:26 +00:00
|
|
|
|
|
|
|
/* ARGSUSED */
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
ibcs2_getipdomainname(td, uap)
|
|
|
|
struct thread *td;
|
1996-06-12 01:10:26 +00:00
|
|
|
struct getipdomainname_args *uap;
|
|
|
|
{
|
|
|
|
char hname[MAXHOSTNAMELEN], *dptr;
|
|
|
|
int len;
|
|
|
|
|
|
|
|
/* Get the domain name */
|
2002-02-27 16:55:30 +00:00
|
|
|
getcredhostname(td->td_ucred, hname, sizeof(hname));
|
2002-02-27 15:23:01 +00:00
|
|
|
|
1996-06-12 01:10:26 +00:00
|
|
|
dptr = index(hname, '.');
|
|
|
|
if ( dptr )
|
|
|
|
dptr++;
|
|
|
|
else
|
|
|
|
/* Make it effectively an empty string */
|
|
|
|
dptr = hname + strlen(hname);
|
|
|
|
|
|
|
|
len = strlen(dptr) + 1;
|
|
|
|
if ((u_int)uap->len > len + 1)
|
|
|
|
uap->len = len + 1;
|
|
|
|
return (copyout((caddr_t)dptr, (caddr_t)uap->ipdomainname, uap->len));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ARGSUSED */
|
|
|
|
static int
|
2001-09-12 08:38:13 +00:00
|
|
|
ibcs2_setipdomainname(td, uap)
|
|
|
|
struct thread *td;
|
1996-06-12 01:10:26 +00:00
|
|
|
struct setipdomainname_args *uap;
|
|
|
|
{
|
|
|
|
char hname[MAXHOSTNAMELEN], *ptr;
|
|
|
|
int error, sctl[2], hlen;
|
|
|
|
|
|
|
|
/* W/out a hostname a domain-name is nonsense */
|
2008-07-05 13:10:10 +00:00
|
|
|
mtx_lock(&hostname_mtx);
|
|
|
|
if ( strlen(hostname) == 0 ) {
|
|
|
|
mtx_unlock(&hostname_mtx);
|
1996-06-12 01:10:26 +00:00
|
|
|
return EINVAL;
|
2008-07-05 13:10:10 +00:00
|
|
|
}
|
1996-06-12 01:10:26 +00:00
|
|
|
|
|
|
|
/* Get the host's unqualified name (strip off the domain) */
|
1998-12-04 22:54:57 +00:00
|
|
|
snprintf(hname, sizeof(hname), "%s", hostname);
|
2008-07-05 13:10:10 +00:00
|
|
|
mtx_unlock(&hostname_mtx);
|
1996-06-12 01:10:26 +00:00
|
|
|
ptr = index(hname, '.');
|
|
|
|
if ( ptr != NULL ) {
|
|
|
|
ptr++;
|
|
|
|
*ptr = '\0';
|
2003-10-12 04:25:26 +00:00
|
|
|
} else {
|
|
|
|
if (strlcat(hname, ".", sizeof(hname)) >= sizeof(hname))
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
1996-06-12 01:10:26 +00:00
|
|
|
|
|
|
|
/* Set ptr to the end of the string so we can append to it */
|
|
|
|
hlen = strlen(hname);
|
|
|
|
ptr = hname + hlen;
|
|
|
|
if ((u_int)uap->len > (sizeof (hname) - hlen - 1))
|
|
|
|
return EINVAL;
|
|
|
|
|
|
|
|
/* Append the ipdomain to the end */
|
2003-10-12 04:25:26 +00:00
|
|
|
error = copyinstr((caddr_t)uap->ipdomainname, ptr, uap->len, NULL);
|
1996-06-12 01:10:26 +00:00
|
|
|
if (error)
|
|
|
|
return (error);
|
|
|
|
|
|
|
|
/* 'sethostname' with the new information */
|
|
|
|
sctl[0] = CTL_KERN;
|
|
|
|
sctl[1] = KERN_HOSTNAME;
|
|
|
|
hlen = strlen(hname) + 1;
|
2004-10-12 07:58:13 +00:00
|
|
|
return (kernel_sysctl(td, sctl, 2, 0, 0, hname, hlen, 0, 0));
|
1996-06-12 01:10:26 +00:00
|
|
|
}
|