1997-11-17 04:00:32 +00:00
|
|
|
|
/*
|
1995-06-25 17:32:43 +00:00
|
|
|
|
* Copyright (c) 1994-1995 S<EFBFBD>ren Schmidt
|
|
|
|
|
* 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
|
|
|
|
|
* notice, this list of conditions and the following disclaimer
|
|
|
|
|
* in this position and unchanged.
|
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
|
* 3. The name of the author may not be used to endorse or promote products
|
|
|
|
|
* derived from this software withough specific prior written permission
|
|
|
|
|
*
|
|
|
|
|
* 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.
|
|
|
|
|
*
|
1999-08-28 01:08:13 +00:00
|
|
|
|
* $FreeBSD$
|
1995-06-25 17:32:43 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <sys/param.h>
|
|
|
|
|
#include <sys/systm.h>
|
1995-11-22 07:43:53 +00:00
|
|
|
|
#include <sys/sysproto.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#include <sys/proc.h>
|
1999-04-29 04:37:57 +00:00
|
|
|
|
#include <sys/cdio.h>
|
1997-03-23 03:37:54 +00:00
|
|
|
|
#include <sys/fcntl.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#include <sys/file.h>
|
|
|
|
|
#include <sys/filedesc.h>
|
1997-03-24 11:37:53 +00:00
|
|
|
|
#include <sys/filio.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#include <sys/tty.h>
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <net/if.h>
|
1997-06-02 06:31:49 +00:00
|
|
|
|
#include <net/if_dl.h>
|
|
|
|
|
#include <net/if_types.h>
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
#include <sys/sockio.h>
|
1999-09-04 14:15:26 +00:00
|
|
|
|
#include <sys/soundcard.h>
|
1995-11-22 07:43:53 +00:00
|
|
|
|
|
1997-12-15 06:09:11 +00:00
|
|
|
|
#include <machine/console.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
1995-11-22 07:43:53 +00:00
|
|
|
|
#include <i386/linux/linux.h>
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
#include <i386/linux/linux_proto.h>
|
1999-08-13 14:44:13 +00:00
|
|
|
|
#include <i386/linux/linux_util.h>
|
1999-08-28 08:43:03 +00:00
|
|
|
|
#include <i386/linux/linux_mib.h>
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
1998-08-31 06:55:02 +00:00
|
|
|
|
#define ISSIGVALID(sig) ((sig) > 0 && (sig) < NSIG)
|
|
|
|
|
|
1996-03-03 19:07:50 +00:00
|
|
|
|
struct linux_termio {
|
|
|
|
|
unsigned short c_iflag;
|
|
|
|
|
unsigned short c_oflag;
|
|
|
|
|
unsigned short c_cflag;
|
|
|
|
|
unsigned short c_lflag;
|
|
|
|
|
unsigned char c_line;
|
|
|
|
|
unsigned char c_cc[LINUX_NCC];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
struct linux_termios {
|
1999-08-14 10:05:50 +00:00
|
|
|
|
unsigned int c_iflag;
|
|
|
|
|
unsigned int c_oflag;
|
|
|
|
|
unsigned int c_cflag;
|
|
|
|
|
unsigned int c_lflag;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
unsigned char c_line;
|
|
|
|
|
unsigned char c_cc[LINUX_NCCS];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct linux_winsize {
|
|
|
|
|
unsigned short ws_row, ws_col;
|
|
|
|
|
unsigned short ws_xpixel, ws_ypixel;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static struct speedtab sptab[] = {
|
1999-08-14 10:05:50 +00:00
|
|
|
|
{ B0, LINUX_B0 }, { B50, LINUX_B50 },
|
|
|
|
|
{ B75, LINUX_B75 }, { B110, LINUX_B110 },
|
|
|
|
|
{ B134, LINUX_B134 }, { B150, LINUX_B150 },
|
|
|
|
|
{ B200, LINUX_B200 }, { B300, LINUX_B300 },
|
|
|
|
|
{ B600, LINUX_B600 }, { B1200, LINUX_B1200 },
|
|
|
|
|
{ B1800, LINUX_B1800 }, { B2400, LINUX_B2400 },
|
|
|
|
|
{ B4800, LINUX_B4800 }, { B9600, LINUX_B9600 },
|
|
|
|
|
{ B19200, LINUX_B19200 }, { B38400, LINUX_B38400 },
|
|
|
|
|
{ B57600, LINUX_B57600 }, { B115200, LINUX_B115200 },
|
|
|
|
|
{-1, -1 }
|
1995-06-25 17:32:43 +00:00
|
|
|
|
};
|
|
|
|
|
|
1996-03-10 22:30:53 +00:00
|
|
|
|
struct linux_serial_struct {
|
|
|
|
|
int type;
|
|
|
|
|
int line;
|
|
|
|
|
int port;
|
|
|
|
|
int irq;
|
|
|
|
|
int flags;
|
|
|
|
|
int xmit_fifo_size;
|
|
|
|
|
int custom_divisor;
|
|
|
|
|
int baud_base;
|
|
|
|
|
unsigned short close_delay;
|
|
|
|
|
char reserved_char[2];
|
|
|
|
|
int hub6;
|
|
|
|
|
unsigned short closing_wait;
|
|
|
|
|
unsigned short closing_wait2;
|
|
|
|
|
int reserved[4];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
static int
|
|
|
|
|
linux_to_bsd_speed(int code, struct speedtab *table)
|
|
|
|
|
{
|
|
|
|
|
for ( ; table->sp_code != -1; table++)
|
|
|
|
|
if (table->sp_code == code)
|
|
|
|
|
return (table->sp_speed);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int
|
|
|
|
|
bsd_to_linux_speed(int speed, struct speedtab *table)
|
|
|
|
|
{
|
|
|
|
|
for ( ; table->sp_speed != -1; table++)
|
|
|
|
|
if (table->sp_speed == speed)
|
|
|
|
|
return (table->sp_code);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bsd_to_linux_termios(struct termios *bsd_termios,
|
|
|
|
|
struct linux_termios *linux_termios)
|
|
|
|
|
{
|
1996-06-12 05:11:41 +00:00
|
|
|
|
int i;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
printf("LINUX: BSD termios structure (input):\n");
|
|
|
|
|
printf("i=%08x o=%08x c=%08x l=%08x ispeed=%d ospeed=%d\n",
|
|
|
|
|
bsd_termios->c_iflag, bsd_termios->c_oflag,
|
|
|
|
|
bsd_termios->c_cflag, bsd_termios->c_lflag,
|
|
|
|
|
bsd_termios->c_ispeed, bsd_termios->c_ospeed);
|
|
|
|
|
printf("c_cc ");
|
|
|
|
|
for (i=0; i<NCCS; i++)
|
|
|
|
|
printf("%02x ", bsd_termios->c_cc[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
#endif
|
|
|
|
|
linux_termios->c_iflag = 0;
|
|
|
|
|
if (bsd_termios->c_iflag & IGNBRK)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IGNBRK;
|
|
|
|
|
if (bsd_termios->c_iflag & BRKINT)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_BRKINT;
|
|
|
|
|
if (bsd_termios->c_iflag & IGNPAR)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IGNPAR;
|
|
|
|
|
if (bsd_termios->c_iflag & PARMRK)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_PARMRK;
|
|
|
|
|
if (bsd_termios->c_iflag & INPCK)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_INPCK;
|
|
|
|
|
if (bsd_termios->c_iflag & ISTRIP)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_ISTRIP;
|
|
|
|
|
if (bsd_termios->c_iflag & INLCR)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_INLCR;
|
|
|
|
|
if (bsd_termios->c_iflag & IGNCR)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IGNCR;
|
|
|
|
|
if (bsd_termios->c_iflag & ICRNL)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_ICRNL;
|
|
|
|
|
if (bsd_termios->c_iflag & IXON)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IXON;
|
1999-08-14 10:05:50 +00:00
|
|
|
|
if (bsd_termios->c_iflag & IXANY)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IXANY;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
if (bsd_termios->c_iflag & IXOFF)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IXOFF;
|
|
|
|
|
if (bsd_termios->c_iflag & IMAXBEL)
|
|
|
|
|
linux_termios->c_iflag |= LINUX_IMAXBEL;
|
|
|
|
|
|
|
|
|
|
linux_termios->c_oflag = 0;
|
|
|
|
|
if (bsd_termios->c_oflag & OPOST)
|
|
|
|
|
linux_termios->c_oflag |= LINUX_OPOST;
|
|
|
|
|
if (bsd_termios->c_oflag & ONLCR)
|
|
|
|
|
linux_termios->c_oflag |= LINUX_ONLCR;
|
|
|
|
|
if (bsd_termios->c_oflag & OXTABS)
|
|
|
|
|
linux_termios->c_oflag |= LINUX_XTABS;
|
|
|
|
|
|
|
|
|
|
linux_termios->c_cflag =
|
|
|
|
|
bsd_to_linux_speed(bsd_termios->c_ispeed, sptab);
|
|
|
|
|
linux_termios->c_cflag |= (bsd_termios->c_cflag & CSIZE) >> 4;
|
|
|
|
|
if (bsd_termios->c_cflag & CSTOPB)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_CSTOPB;
|
|
|
|
|
if (bsd_termios->c_cflag & CREAD)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_CREAD;
|
|
|
|
|
if (bsd_termios->c_cflag & PARENB)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_PARENB;
|
|
|
|
|
if (bsd_termios->c_cflag & PARODD)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_PARODD;
|
|
|
|
|
if (bsd_termios->c_cflag & HUPCL)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_HUPCL;
|
|
|
|
|
if (bsd_termios->c_cflag & CLOCAL)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_CLOCAL;
|
|
|
|
|
if (bsd_termios->c_cflag & CRTSCTS)
|
|
|
|
|
linux_termios->c_cflag |= LINUX_CRTSCTS;
|
|
|
|
|
|
|
|
|
|
linux_termios->c_lflag = 0;
|
|
|
|
|
if (bsd_termios->c_lflag & ISIG)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ISIG;
|
|
|
|
|
if (bsd_termios->c_lflag & ICANON)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ICANON;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHO)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHO;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHOE)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHOE;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHOK)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHOK;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHONL)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHONL;
|
|
|
|
|
if (bsd_termios->c_lflag & NOFLSH)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_NOFLSH;
|
|
|
|
|
if (bsd_termios->c_lflag & TOSTOP)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_TOSTOP;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHOCTL)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHOCTL;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHOPRT)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHOPRT;
|
|
|
|
|
if (bsd_termios->c_lflag & ECHOKE)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_ECHOKE;
|
|
|
|
|
if (bsd_termios->c_lflag & FLUSHO)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_FLUSHO;
|
|
|
|
|
if (bsd_termios->c_lflag & PENDIN)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_PENDIN;
|
|
|
|
|
if (bsd_termios->c_lflag & IEXTEN)
|
|
|
|
|
linux_termios->c_lflag |= LINUX_IEXTEN;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<LINUX_NCCS; i++)
|
1996-03-03 19:07:50 +00:00
|
|
|
|
linux_termios->c_cc[i] = LINUX_POSIX_VDISABLE;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
linux_termios->c_cc[LINUX_VINTR] = bsd_termios->c_cc[VINTR];
|
|
|
|
|
linux_termios->c_cc[LINUX_VQUIT] = bsd_termios->c_cc[VQUIT];
|
|
|
|
|
linux_termios->c_cc[LINUX_VERASE] = bsd_termios->c_cc[VERASE];
|
|
|
|
|
linux_termios->c_cc[LINUX_VKILL] = bsd_termios->c_cc[VKILL];
|
|
|
|
|
linux_termios->c_cc[LINUX_VEOF] = bsd_termios->c_cc[VEOF];
|
|
|
|
|
linux_termios->c_cc[LINUX_VEOL] = bsd_termios->c_cc[VEOL];
|
|
|
|
|
linux_termios->c_cc[LINUX_VMIN] = bsd_termios->c_cc[VMIN];
|
|
|
|
|
linux_termios->c_cc[LINUX_VTIME] = bsd_termios->c_cc[VTIME];
|
|
|
|
|
linux_termios->c_cc[LINUX_VEOL2] = bsd_termios->c_cc[VEOL2];
|
|
|
|
|
linux_termios->c_cc[LINUX_VSUSP] = bsd_termios->c_cc[VSUSP];
|
|
|
|
|
linux_termios->c_cc[LINUX_VSTART] = bsd_termios->c_cc[VSTART];
|
|
|
|
|
linux_termios->c_cc[LINUX_VSTOP] = bsd_termios->c_cc[VSTOP];
|
|
|
|
|
linux_termios->c_cc[LINUX_VREPRINT] = bsd_termios->c_cc[VREPRINT];
|
|
|
|
|
linux_termios->c_cc[LINUX_VDISCARD] = bsd_termios->c_cc[VDISCARD];
|
|
|
|
|
linux_termios->c_cc[LINUX_VWERASE] = bsd_termios->c_cc[VWERASE];
|
|
|
|
|
linux_termios->c_cc[LINUX_VLNEXT] = bsd_termios->c_cc[VLNEXT];
|
|
|
|
|
|
1996-03-03 19:07:50 +00:00
|
|
|
|
for (i=0; i<LINUX_NCCS; i++) {
|
|
|
|
|
if (linux_termios->c_cc[i] == _POSIX_VDISABLE)
|
|
|
|
|
linux_termios->c_cc[i] = LINUX_POSIX_VDISABLE;
|
|
|
|
|
}
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
linux_termios->c_line = 0;
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
printf("LINUX: LINUX termios structure (output):\n");
|
1999-08-17 10:27:55 +00:00
|
|
|
|
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
|
1998-07-29 16:43:00 +00:00
|
|
|
|
linux_termios->c_iflag, linux_termios->c_oflag, linux_termios->c_cflag,
|
1999-08-17 10:27:55 +00:00
|
|
|
|
linux_termios->c_lflag, (int)linux_termios->c_line);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
printf("c_cc ");
|
|
|
|
|
for (i=0; i<LINUX_NCCS; i++)
|
|
|
|
|
printf("%02x ", linux_termios->c_cc[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1996-03-03 19:07:50 +00:00
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
static void
|
|
|
|
|
linux_to_bsd_termios(struct linux_termios *linux_termios,
|
|
|
|
|
struct termios *bsd_termios)
|
|
|
|
|
{
|
1996-06-12 05:11:41 +00:00
|
|
|
|
int i;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
printf("LINUX: LINUX termios structure (input):\n");
|
1999-08-17 10:27:55 +00:00
|
|
|
|
printf("i=%08x o=%08x c=%08x l=%08x line=%d\n",
|
1998-07-29 16:43:00 +00:00
|
|
|
|
linux_termios->c_iflag, linux_termios->c_oflag, linux_termios->c_cflag,
|
1999-08-17 10:27:55 +00:00
|
|
|
|
linux_termios->c_lflag, (int)linux_termios->c_line);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
printf("c_cc ");
|
|
|
|
|
for (i=0; i<LINUX_NCCS; i++)
|
|
|
|
|
printf("%02x ", linux_termios->c_cc[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
#endif
|
|
|
|
|
bsd_termios->c_iflag = 0;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_IGNBRK)
|
|
|
|
|
bsd_termios->c_iflag |= IGNBRK;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_BRKINT)
|
|
|
|
|
bsd_termios->c_iflag |= BRKINT;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_IGNPAR)
|
|
|
|
|
bsd_termios->c_iflag |= IGNPAR;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_PARMRK)
|
|
|
|
|
bsd_termios->c_iflag |= PARMRK;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_INPCK)
|
|
|
|
|
bsd_termios->c_iflag |= INPCK;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_ISTRIP)
|
|
|
|
|
bsd_termios->c_iflag |= ISTRIP;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_INLCR)
|
|
|
|
|
bsd_termios->c_iflag |= INLCR;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_IGNCR)
|
|
|
|
|
bsd_termios->c_iflag |= IGNCR;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_ICRNL)
|
|
|
|
|
bsd_termios->c_iflag |= ICRNL;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_IXON)
|
|
|
|
|
bsd_termios->c_iflag |= IXON;
|
1999-08-14 10:05:50 +00:00
|
|
|
|
if (linux_termios->c_iflag & LINUX_IXANY)
|
|
|
|
|
bsd_termios->c_iflag |= IXANY;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
if (linux_termios->c_iflag & LINUX_IXOFF)
|
|
|
|
|
bsd_termios->c_iflag |= IXOFF;
|
|
|
|
|
if (linux_termios->c_iflag & LINUX_IMAXBEL)
|
|
|
|
|
bsd_termios->c_iflag |= IMAXBEL;
|
|
|
|
|
|
|
|
|
|
bsd_termios->c_oflag = 0;
|
|
|
|
|
if (linux_termios->c_oflag & LINUX_OPOST)
|
|
|
|
|
bsd_termios->c_oflag |= OPOST;
|
|
|
|
|
if (linux_termios->c_oflag & LINUX_ONLCR)
|
|
|
|
|
bsd_termios->c_oflag |= ONLCR;
|
|
|
|
|
if (linux_termios->c_oflag & LINUX_XTABS)
|
|
|
|
|
bsd_termios->c_oflag |= OXTABS;
|
|
|
|
|
|
|
|
|
|
bsd_termios->c_cflag = (linux_termios->c_cflag & LINUX_CSIZE) << 4;
|
|
|
|
|
if (linux_termios->c_cflag & LINUX_CSTOPB)
|
|
|
|
|
bsd_termios->c_cflag |= CSTOPB;
|
1999-08-14 10:05:50 +00:00
|
|
|
|
if (linux_termios->c_cflag & LINUX_CREAD)
|
|
|
|
|
bsd_termios->c_cflag |= CREAD;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
if (linux_termios->c_cflag & LINUX_PARENB)
|
|
|
|
|
bsd_termios->c_cflag |= PARENB;
|
|
|
|
|
if (linux_termios->c_cflag & LINUX_PARODD)
|
|
|
|
|
bsd_termios->c_cflag |= PARODD;
|
|
|
|
|
if (linux_termios->c_cflag & LINUX_HUPCL)
|
|
|
|
|
bsd_termios->c_cflag |= HUPCL;
|
|
|
|
|
if (linux_termios->c_cflag & LINUX_CLOCAL)
|
|
|
|
|
bsd_termios->c_cflag |= CLOCAL;
|
|
|
|
|
if (linux_termios->c_cflag & LINUX_CRTSCTS)
|
|
|
|
|
bsd_termios->c_cflag |= CRTSCTS;
|
|
|
|
|
|
|
|
|
|
bsd_termios->c_lflag = 0;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ISIG)
|
|
|
|
|
bsd_termios->c_lflag |= ISIG;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ICANON)
|
|
|
|
|
bsd_termios->c_lflag |= ICANON;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHO)
|
|
|
|
|
bsd_termios->c_lflag |= ECHO;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHOE)
|
|
|
|
|
bsd_termios->c_lflag |= ECHOE;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHOK)
|
|
|
|
|
bsd_termios->c_lflag |= ECHOK;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHONL)
|
|
|
|
|
bsd_termios->c_lflag |= ECHONL;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_NOFLSH)
|
|
|
|
|
bsd_termios->c_lflag |= NOFLSH;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_TOSTOP)
|
|
|
|
|
bsd_termios->c_lflag |= TOSTOP;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHOCTL)
|
|
|
|
|
bsd_termios->c_lflag |= ECHOCTL;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHOPRT)
|
|
|
|
|
bsd_termios->c_lflag |= ECHOPRT;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_ECHOKE)
|
|
|
|
|
bsd_termios->c_lflag |= ECHOKE;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_FLUSHO)
|
|
|
|
|
bsd_termios->c_lflag |= FLUSHO;
|
|
|
|
|
if (linux_termios->c_lflag & LINUX_PENDIN)
|
|
|
|
|
bsd_termios->c_lflag |= PENDIN;
|
1999-08-14 10:05:50 +00:00
|
|
|
|
if (linux_termios->c_lflag & LINUX_IEXTEN)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
bsd_termios->c_lflag |= IEXTEN;
|
|
|
|
|
|
|
|
|
|
for (i=0; i<NCCS; i++)
|
|
|
|
|
bsd_termios->c_cc[i] = _POSIX_VDISABLE;
|
|
|
|
|
bsd_termios->c_cc[VINTR] = linux_termios->c_cc[LINUX_VINTR];
|
|
|
|
|
bsd_termios->c_cc[VQUIT] = linux_termios->c_cc[LINUX_VQUIT];
|
|
|
|
|
bsd_termios->c_cc[VERASE] = linux_termios->c_cc[LINUX_VERASE];
|
|
|
|
|
bsd_termios->c_cc[VKILL] = linux_termios->c_cc[LINUX_VKILL];
|
|
|
|
|
bsd_termios->c_cc[VEOF] = linux_termios->c_cc[LINUX_VEOF];
|
|
|
|
|
bsd_termios->c_cc[VEOL] = linux_termios->c_cc[LINUX_VEOL];
|
|
|
|
|
bsd_termios->c_cc[VMIN] = linux_termios->c_cc[LINUX_VMIN];
|
|
|
|
|
bsd_termios->c_cc[VTIME] = linux_termios->c_cc[LINUX_VTIME];
|
|
|
|
|
bsd_termios->c_cc[VEOL2] = linux_termios->c_cc[LINUX_VEOL2];
|
|
|
|
|
bsd_termios->c_cc[VSUSP] = linux_termios->c_cc[LINUX_VSUSP];
|
|
|
|
|
bsd_termios->c_cc[VSTART] = linux_termios->c_cc[LINUX_VSTART];
|
|
|
|
|
bsd_termios->c_cc[VSTOP] = linux_termios->c_cc[LINUX_VSTOP];
|
|
|
|
|
bsd_termios->c_cc[VREPRINT] = linux_termios->c_cc[LINUX_VREPRINT];
|
|
|
|
|
bsd_termios->c_cc[VDISCARD] = linux_termios->c_cc[LINUX_VDISCARD];
|
|
|
|
|
bsd_termios->c_cc[VWERASE] = linux_termios->c_cc[LINUX_VWERASE];
|
|
|
|
|
bsd_termios->c_cc[VLNEXT] = linux_termios->c_cc[LINUX_VLNEXT];
|
|
|
|
|
|
1996-03-03 19:07:50 +00:00
|
|
|
|
for (i=0; i<NCCS; i++) {
|
|
|
|
|
if (bsd_termios->c_cc[i] == LINUX_POSIX_VDISABLE)
|
|
|
|
|
bsd_termios->c_cc[i] = _POSIX_VDISABLE;
|
|
|
|
|
}
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
bsd_termios->c_ispeed = bsd_termios->c_ospeed =
|
|
|
|
|
linux_to_bsd_speed(linux_termios->c_cflag & LINUX_CBAUD, sptab);
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
|
printf("LINUX: BSD termios structure (output):\n");
|
|
|
|
|
printf("i=%08x o=%08x c=%08x l=%08x ispeed=%d ospeed=%d\n",
|
|
|
|
|
bsd_termios->c_iflag, bsd_termios->c_oflag,
|
|
|
|
|
bsd_termios->c_cflag, bsd_termios->c_lflag,
|
|
|
|
|
bsd_termios->c_ispeed, bsd_termios->c_ospeed);
|
|
|
|
|
printf("c_cc ");
|
|
|
|
|
for (i=0; i<NCCS; i++)
|
|
|
|
|
printf("%02x ", bsd_termios->c_cc[i]);
|
|
|
|
|
printf("\n");
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
|
1996-03-03 19:07:50 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bsd_to_linux_termio(struct termios *bsd_termios,
|
|
|
|
|
struct linux_termio *linux_termio)
|
|
|
|
|
{
|
|
|
|
|
struct linux_termios tmios;
|
|
|
|
|
|
|
|
|
|
bsd_to_linux_termios(bsd_termios, &tmios);
|
|
|
|
|
linux_termio->c_iflag = tmios.c_iflag;
|
|
|
|
|
linux_termio->c_oflag = tmios.c_oflag;
|
|
|
|
|
linux_termio->c_cflag = tmios.c_cflag;
|
|
|
|
|
linux_termio->c_lflag = tmios.c_lflag;
|
|
|
|
|
linux_termio->c_line = tmios.c_line;
|
|
|
|
|
memcpy(linux_termio->c_cc, tmios.c_cc, LINUX_NCC);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
linux_to_bsd_termio(struct linux_termio *linux_termio,
|
|
|
|
|
struct termios *bsd_termios)
|
|
|
|
|
{
|
|
|
|
|
struct linux_termios tmios;
|
|
|
|
|
int i;
|
|
|
|
|
|
|
|
|
|
tmios.c_iflag = linux_termio->c_iflag;
|
|
|
|
|
tmios.c_oflag = linux_termio->c_oflag;
|
|
|
|
|
tmios.c_cflag = linux_termio->c_cflag;
|
|
|
|
|
tmios.c_lflag = linux_termio->c_lflag;
|
|
|
|
|
|
1999-08-14 10:05:50 +00:00
|
|
|
|
for (i=LINUX_NCC; i<LINUX_NCCS; i++)
|
1996-03-03 19:07:50 +00:00
|
|
|
|
tmios.c_cc[i] = LINUX_POSIX_VDISABLE;
|
|
|
|
|
memcpy(tmios.c_cc, linux_termio->c_cc, LINUX_NCC);
|
|
|
|
|
|
|
|
|
|
linux_to_bsd_termios(&tmios, bsd_termios);
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-29 04:37:57 +00:00
|
|
|
|
struct linux_cdrom_msf
|
|
|
|
|
{
|
|
|
|
|
u_char cdmsf_min0;
|
|
|
|
|
u_char cdmsf_sec0;
|
|
|
|
|
u_char cdmsf_frame0;
|
|
|
|
|
u_char cdmsf_min1;
|
|
|
|
|
u_char cdmsf_sec1;
|
|
|
|
|
u_char cdmsf_frame1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct linux_cdrom_tochdr
|
|
|
|
|
{
|
|
|
|
|
u_char cdth_trk0;
|
|
|
|
|
u_char cdth_trk1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
union linux_cdrom_addr
|
|
|
|
|
{
|
|
|
|
|
struct {
|
|
|
|
|
u_char minute;
|
|
|
|
|
u_char second;
|
|
|
|
|
u_char frame;
|
|
|
|
|
} msf;
|
|
|
|
|
int lba;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct linux_cdrom_tocentry
|
|
|
|
|
{
|
|
|
|
|
u_char cdte_track;
|
|
|
|
|
u_char cdte_adr:4;
|
|
|
|
|
u_char cdte_ctrl:4;
|
|
|
|
|
u_char cdte_format;
|
|
|
|
|
union linux_cdrom_addr cdte_addr;
|
|
|
|
|
u_char cdte_datamode;
|
|
|
|
|
};
|
|
|
|
|
|
1999-08-13 14:44:13 +00:00
|
|
|
|
struct linux_cdrom_subchnl
|
|
|
|
|
{
|
|
|
|
|
u_char cdsc_format;
|
|
|
|
|
u_char cdsc_audiostatus;
|
|
|
|
|
u_char cdsc_adr:4;
|
|
|
|
|
u_char cdsc_ctrl:4;
|
|
|
|
|
u_char cdsc_trk;
|
|
|
|
|
u_char cdsc_ind;
|
|
|
|
|
union linux_cdrom_addr cdsc_absaddr;
|
|
|
|
|
union linux_cdrom_addr cdsc_reladdr;
|
|
|
|
|
};
|
|
|
|
|
|
1999-05-09 16:04:14 +00:00
|
|
|
|
#if 0
|
1999-04-29 04:37:57 +00:00
|
|
|
|
static void
|
|
|
|
|
linux_to_bsd_msf_lba(u_char address_format,
|
|
|
|
|
union linux_cdrom_addr *lp, union msf_lba *bp)
|
|
|
|
|
{
|
|
|
|
|
if (address_format == CD_LBA_FORMAT)
|
|
|
|
|
bp->lba = lp->lba;
|
|
|
|
|
else {
|
|
|
|
|
bp->msf.minute = lp->msf.minute;
|
|
|
|
|
bp->msf.second = lp->msf.second;
|
|
|
|
|
bp->msf.frame = lp->msf.frame;
|
|
|
|
|
}
|
|
|
|
|
}
|
1999-05-09 16:04:14 +00:00
|
|
|
|
#endif
|
1999-04-29 04:37:57 +00:00
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
|
bsd_to_linux_msf_lba(u_char address_format,
|
|
|
|
|
union msf_lba *bp, union linux_cdrom_addr *lp)
|
|
|
|
|
{
|
|
|
|
|
if (address_format == CD_LBA_FORMAT)
|
|
|
|
|
lp->lba = bp->lba;
|
|
|
|
|
else {
|
|
|
|
|
lp->msf.minute = bp->msf.minute;
|
|
|
|
|
lp->msf.second = bp->msf.second;
|
|
|
|
|
lp->msf.frame = bp->msf.frame;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-08-13 14:44:13 +00:00
|
|
|
|
static void
|
|
|
|
|
set_linux_cdrom_addr(union linux_cdrom_addr *addr, int format, int lba)
|
|
|
|
|
{
|
|
|
|
|
if (format == LINUX_CDROM_MSF) {
|
|
|
|
|
addr->msf.frame = lba % 75;
|
|
|
|
|
lba /= 75;
|
|
|
|
|
lba += 2;
|
|
|
|
|
addr->msf.second = lba % 60;
|
|
|
|
|
addr->msf.minute = lba / 60;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
addr->lba = lba;
|
|
|
|
|
}
|
|
|
|
|
|
1999-10-06 19:51:37 +00:00
|
|
|
|
static unsigned dirbits[4] = { IOC_VOID, IOC_IN, IOC_OUT, IOC_INOUT };
|
1999-04-29 04:37:57 +00:00
|
|
|
|
|
|
|
|
|
#define SETDIR(c) (((c) & ~IOC_DIRMASK) | dirbits[args->cmd >> 30])
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
int
|
1997-11-06 19:29:57 +00:00
|
|
|
|
linux_ioctl(struct proc *p, struct linux_ioctl_args *args)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
{
|
|
|
|
|
struct termios bsd_termios;
|
|
|
|
|
struct linux_termios linux_termios;
|
1996-03-03 19:07:50 +00:00
|
|
|
|
struct linux_termio linux_termio;
|
1995-06-25 17:32:43 +00:00
|
|
|
|
struct filedesc *fdp = p->p_fd;
|
|
|
|
|
struct file *fp;
|
|
|
|
|
int bsd_line, linux_line;
|
|
|
|
|
int error;
|
|
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
1998-07-29 16:43:00 +00:00
|
|
|
|
printf("Linux-emul(%ld): ioctl(%d, %04lx, *)\n",
|
|
|
|
|
(long)p->p_pid, args->fd, args->cmd);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
#endif
|
|
|
|
|
if ((unsigned)args->fd >= fdp->fd_nfiles
|
|
|
|
|
|| (fp = fdp->fd_ofiles[args->fd]) == 0)
|
|
|
|
|
return EBADF;
|
|
|
|
|
|
|
|
|
|
if (!fp || (fp->f_flag & (FREAD | FWRITE)) == 0) {
|
|
|
|
|
return EBADF;
|
|
|
|
|
}
|
|
|
|
|
|
1995-12-30 00:42:25 +00:00
|
|
|
|
switch (args->cmd & 0xffff) {
|
1996-03-03 19:07:50 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TCGETA:
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bsd_termios, p)) != 0)
|
1996-03-03 19:07:50 +00:00
|
|
|
|
return error;
|
|
|
|
|
bsd_to_linux_termio(&bsd_termios, &linux_termio);
|
|
|
|
|
return copyout((caddr_t)&linux_termio, (caddr_t)args->arg,
|
|
|
|
|
sizeof(linux_termio));
|
|
|
|
|
|
|
|
|
|
case LINUX_TCSETA:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termio, sizeof(linux_termio));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termio(&linux_termio, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETA, (caddr_t)&bsd_termios, p);
|
1996-03-03 19:07:50 +00:00
|
|
|
|
|
1996-03-04 11:15:19 +00:00
|
|
|
|
case LINUX_TCSETAW:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termio, sizeof(linux_termio));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termio(&linux_termio, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETAW, (caddr_t)&bsd_termios, p);
|
1996-03-04 11:15:19 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TCSETAF:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termio, sizeof(linux_termio));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termio(&linux_termio, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETAF, (caddr_t)&bsd_termios, p);
|
1996-03-04 11:15:19 +00:00
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
case LINUX_TCGETS:
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
if ((error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bsd_termios, p)) != 0)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
return error;
|
|
|
|
|
bsd_to_linux_termios(&bsd_termios, &linux_termios);
|
|
|
|
|
return copyout((caddr_t)&linux_termios, (caddr_t)args->arg,
|
|
|
|
|
sizeof(linux_termios));
|
|
|
|
|
|
|
|
|
|
case LINUX_TCSETS:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termios,
|
|
|
|
|
sizeof(linux_termios));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termios(&linux_termios, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETA, (caddr_t)&bsd_termios, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TCSETSW:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termios,
|
|
|
|
|
sizeof(linux_termios));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termios(&linux_termios, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETAW, (caddr_t)&bsd_termios, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TCSETSF:
|
1999-08-14 10:30:38 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, &linux_termios,
|
|
|
|
|
sizeof(linux_termios));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
linux_to_bsd_termios(&linux_termios, &bsd_termios);
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETAF, (caddr_t)&bsd_termios, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCGPGRP:
|
|
|
|
|
args->cmd = TIOCGPGRP;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCSPGRP:
|
|
|
|
|
args->cmd = TIOCSPGRP;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCGWINSZ:
|
|
|
|
|
args->cmd = TIOCGWINSZ;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCSWINSZ:
|
|
|
|
|
args->cmd = TIOCSWINSZ;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
1999-07-06 11:41:48 +00:00
|
|
|
|
case LINUX_TIOCMGET:
|
|
|
|
|
args->cmd = TIOCMGET;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_TIOCMBIS:
|
|
|
|
|
args->cmd = TIOCMBIS;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_TIOCMBIC:
|
|
|
|
|
args->cmd = TIOCMBIC;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_TIOCMSET:
|
|
|
|
|
args->cmd = TIOCMSET;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
case LINUX_FIONREAD:
|
|
|
|
|
args->cmd = FIONREAD;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_FIONBIO:
|
|
|
|
|
args->cmd = FIONBIO;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_FIOASYNC:
|
|
|
|
|
args->cmd = FIOASYNC;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_FIONCLEX:
|
|
|
|
|
args->cmd = FIONCLEX;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_FIOCLEX:
|
|
|
|
|
args->cmd = FIOCLEX;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCEXCL:
|
|
|
|
|
args->cmd = TIOCEXCL;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCNXCL:
|
|
|
|
|
args->cmd = TIOCNXCL;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCCONS:
|
|
|
|
|
args->cmd = TIOCCONS;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_TIOCNOTTY:
|
|
|
|
|
args->cmd = TIOCNOTTY;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
case LINUX_SIOCGIFCONF:
|
|
|
|
|
args->cmd = OSIOCGIFCONF;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGIFFLAGS:
|
|
|
|
|
args->cmd = SIOCGIFFLAGS;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGIFADDR:
|
|
|
|
|
args->cmd = OSIOCGIFADDR;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGIFDSTADDR:
|
|
|
|
|
args->cmd = OSIOCGIFDSTADDR;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGIFBRDADDR:
|
|
|
|
|
args->cmd = OSIOCGIFBRDADDR;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGIFNETMASK:
|
|
|
|
|
args->cmd = OSIOCGIFNETMASK;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1997-06-02 06:31:49 +00:00
|
|
|
|
/* get hardware address */
|
|
|
|
|
case LINUX_SIOCGIFHWADDR:
|
|
|
|
|
{
|
|
|
|
|
int ifn;
|
|
|
|
|
struct ifnet *ifp;
|
|
|
|
|
struct ifaddr *ifa;
|
|
|
|
|
struct sockaddr_dl *sdl;
|
|
|
|
|
struct linux_ifreq *ifr = (struct linux_ifreq *)args->arg;
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Note that we don't actually respect the name in the ifreq structure, as
|
|
|
|
|
* Linux interface names are all different
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
for (ifn = 0; ifn < if_index; ifn++) {
|
|
|
|
|
|
|
|
|
|
ifp = ifnet_addrs[ifn]->ifa_ifp; /* pointer to interface */
|
|
|
|
|
if (ifp->if_type == IFT_ETHER) { /* looks good */
|
|
|
|
|
/* walk the address list */
|
1997-06-02 10:43:41 +00:00
|
|
|
|
for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = TAILQ_NEXT(ifa, ifa_link)) {
|
1997-06-02 06:31:49 +00:00
|
|
|
|
if ((sdl = (struct sockaddr_dl *)ifa->ifa_addr) && /* we have an address structure */
|
|
|
|
|
(sdl->sdl_family == AF_LINK) && /* it's a link address */
|
|
|
|
|
(sdl->sdl_type == IFT_ETHER)) { /* for an ethernet link */
|
|
|
|
|
|
|
|
|
|
return(copyout(LLADDR(sdl), (caddr_t)&ifr->ifr_hwaddr.sa_data, LINUX_IFHWADDRLEN));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return(ENOENT); /* ??? */
|
|
|
|
|
}
|
|
|
|
|
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
case LINUX_SIOCADDMULTI:
|
|
|
|
|
args->cmd = SIOCADDMULTI;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SIOCDELMULTI:
|
|
|
|
|
args->cmd = SIOCDELMULTI;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
Mega-commit for Linux emulator update.. This has been stress tested under
netscape-2.0 for Linux running all the Java stuff. The scrollbars are now
working, at least on my machine. (whew! :-)
I'm uncomfortable with the size of this commit, but it's too
inter-dependant to easily seperate out.
The main changes:
COMPAT_LINUX is *GONE*. Most of the code has been moved out of the i386
machine dependent section into the linux emulator itself. The int 0x80
syscall code was almost identical to the lcall 7,0 code and a minor tweak
allows them to both be used with the same C code. All kernels can now
just modload the lkm and it'll DTRT without having to rebuild the kernel
first. Like IBCS2, you can statically compile it in with "options LINUX".
A pile of new syscalls implemented, including getdents(), llseek(),
readv(), writev(), msync(), personality(). The Linux-ELF libraries want
to use some of these.
linux_select() now obeys Linux semantics, ie: returns the time remaining
of the timeout value rather than leaving it the original value.
Quite a few bugs removed, including incorrect arguments being used in
syscalls.. eg: mixups between passing the sigset as an int, vs passing
it as a pointer and doing a copyin(), missing return values, unhandled
cases, SIOC* ioctls, etc.
The build for the code has changed. i386/conf/files now knows how
to build linux_genassym and generate linux_assym.h on the fly.
Supporting changes elsewhere in the kernel:
The user-mode signal trampoline has moved from the U area to immediately
below the top of the stack (below PS_STRINGS). This allows the different
binary emulations to have their own signal trampoline code (which gets rid
of the hardwired syscall 103 (sigreturn on BSD, syslog on Linux)) and so
that the emulator can provide the exact "struct sigcontext *" argument to
the program's signal handlers.
The sigstack's "ss_flags" now uses SS_DISABLE and SS_ONSTACK flags, which
have the same values as the re-used SA_DISABLE and SA_ONSTACK which are
intended for sigaction only. This enables the support of a SA_RESETHAND
flag to sigaction to implement the gross SYSV and Linux SA_ONESHOT signal
semantics where the signal handler is reset when it's triggered.
makesyscalls.sh no longer appends the struct sysentvec on the end of the
generated init_sysent.c code. It's a lot saner to have it in a seperate
file rather than trying to update the structure inside the awk script. :-)
At exec time, the dozen bytes or so of signal trampoline code are copied
to the top of the user's stack, rather than obtaining the trampoline code
the old way by getting a clone of the parent's user area. This allows
Linux and native binaries to freely exec each other without getting
trampolines mixed up.
1996-03-02 19:38:20 +00:00
|
|
|
|
|
1998-09-30 01:42:53 +00:00
|
|
|
|
case LINUX_FIOSETOWN:
|
|
|
|
|
args->cmd = FIOSETOWN;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SIOCSPGRP:
|
|
|
|
|
args->cmd = SIOCSPGRP;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_FIOGETOWN:
|
|
|
|
|
args->cmd = FIOGETOWN;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SIOCGPGRP:
|
|
|
|
|
args->cmd = SIOCGPGRP;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SIOCATMARK:
|
|
|
|
|
args->cmd = SIOCATMARK;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
case LINUX_TIOCSETD:
|
|
|
|
|
switch (args->arg) {
|
|
|
|
|
case LINUX_N_TTY:
|
|
|
|
|
bsd_line = TTYDISC;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETD, (caddr_t)&bsd_line, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
case LINUX_N_SLIP:
|
|
|
|
|
bsd_line = SLIPDISC;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETD, (caddr_t)&bsd_line, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
case LINUX_N_PPP:
|
|
|
|
|
bsd_line = PPPDISC;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, TIOCSETD, (caddr_t)&bsd_line, p);
|
1995-06-25 17:32:43 +00:00
|
|
|
|
default:
|
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LINUX_TIOCGETD:
|
|
|
|
|
bsd_line = TTYDISC;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
error = fo_ioctl(fp, TIOCGETD, (caddr_t)&bsd_line, p);
|
1999-05-06 18:44:42 +00:00
|
|
|
|
if (error)
|
1995-06-25 17:32:43 +00:00
|
|
|
|
return error;
|
|
|
|
|
switch (bsd_line) {
|
|
|
|
|
case TTYDISC:
|
|
|
|
|
linux_line = LINUX_N_TTY;
|
|
|
|
|
break;
|
|
|
|
|
case SLIPDISC:
|
|
|
|
|
linux_line = LINUX_N_SLIP;
|
|
|
|
|
break;
|
|
|
|
|
case PPPDISC:
|
|
|
|
|
linux_line = LINUX_N_PPP;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|
|
|
|
|
return copyout(&linux_line, (caddr_t)args->arg,
|
|
|
|
|
sizeof(int));
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
1998-11-12 00:42:08 +00:00
|
|
|
|
case LINUX_SNDCTL_SEQ_RESET:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_RESET;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_SYNC:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_SYNC;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SYNTH_INFO:
|
|
|
|
|
args->cmd = SNDCTL_SYNTH_INFO;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_CTRLRATE:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_CTRLRATE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_GETOUTCOUNT:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_GETOUTCOUNT;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_GETINCOUNT:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_GETINCOUNT;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_PERCMODE:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_PERCMODE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_FM_LOAD_INSTR:
|
|
|
|
|
args->cmd = SNDCTL_FM_LOAD_INSTR;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_TESTMIDI:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_TESTMIDI;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_RESETSAMPLES:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_RESETSAMPLES;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_NRSYNTHS:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_NRSYNTHS;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_NRMIDIS:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_NRMIDIS;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_MIDI_INFO:
|
|
|
|
|
args->cmd = SNDCTL_MIDI_INFO;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SEQ_TRESHOLD:
|
|
|
|
|
args->cmd = SNDCTL_SEQ_TRESHOLD;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_SYNTH_MEMAVL:
|
|
|
|
|
args->cmd = SNDCTL_SYNTH_MEMAVL;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1997-11-17 04:00:32 +00:00
|
|
|
|
case LINUX_SNDCTL_DSP_GETOPTR :
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETOPTR;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETIPTR :
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETIPTR;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SETTRIGGER:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SETTRIGGER;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETCAPS:
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETCAPS;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1995-12-29 22:12:14 +00:00
|
|
|
|
case LINUX_SNDCTL_DSP_RESET:
|
|
|
|
|
args->cmd = SNDCTL_DSP_RESET;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SYNC:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SYNC;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SPEED:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SPEED;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_STEREO:
|
|
|
|
|
args->cmd = SNDCTL_DSP_STEREO;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETBLKSIZE:
|
|
|
|
|
/* LINUX_SNDCTL_DSP_SETBLKSIZE */
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETBLKSIZE;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SETFMT:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SETFMT;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_PCM_WRITE_CHANNELS:
|
|
|
|
|
args->cmd = SOUND_PCM_WRITE_CHANNELS;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_PCM_WRITE_FILTER:
|
|
|
|
|
args->cmd = SOUND_PCM_WRITE_FILTER;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_POST:
|
|
|
|
|
args->cmd = SNDCTL_DSP_POST;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SUBDIVIDE:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SUBDIVIDE;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_SETFRAGMENT:
|
|
|
|
|
args->cmd = SNDCTL_DSP_SETFRAGMENT;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETFMTS:
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETFMTS;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETOSPACE:
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETOSPACE;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_GETISPACE:
|
|
|
|
|
args->cmd = SNDCTL_DSP_GETISPACE;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1995-12-29 22:12:14 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SNDCTL_DSP_NONBLOCK:
|
|
|
|
|
args->cmd = SNDCTL_DSP_NONBLOCK;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-03-10 22:30:53 +00:00
|
|
|
|
|
1996-11-05 02:04:37 +00:00
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_VOLUME:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_VOLUME);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_BASS:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_BASS);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_TREBLE:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_TREBLE);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_SYNTH:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_SYNTH);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_PCM:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_PCM);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_SPEAKER:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_SPEAKER);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_LINE:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_MIC:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_MIC);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_CD:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_CD);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_IMIX:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_IMIX);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_ALTPCM:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_ALTPCM);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_RECLEV:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_RECLEV);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_IGAIN:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_IGAIN);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_OGAIN:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_OGAIN);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_LINE1:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE1);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_LINE2:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE2);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_WRITE_LINE3:
|
1999-04-29 04:37:57 +00:00
|
|
|
|
args->cmd = SETDIR(SOUND_MIXER_WRITE_LINE3);
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_SOUND_MIXER_READ_DEVMASK:
|
|
|
|
|
args->cmd = SOUND_MIXER_READ_DEVMASK;
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-11-05 02:04:37 +00:00
|
|
|
|
|
1999-08-14 13:26:44 +00:00
|
|
|
|
case LINUX_TIOCGSERIAL: {
|
|
|
|
|
struct linux_serial_struct lss;
|
|
|
|
|
|
|
|
|
|
lss.type = LINUX_PORT_16550A;
|
|
|
|
|
lss.flags = 0;
|
|
|
|
|
lss.close_delay = 0;
|
|
|
|
|
return copyout((caddr_t)&lss, (caddr_t)args->arg, sizeof(lss));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LINUX_TIOCSSERIAL: {
|
|
|
|
|
struct linux_serial_struct lss;
|
1996-03-10 22:30:53 +00:00
|
|
|
|
|
1999-08-14 13:26:44 +00:00
|
|
|
|
error = copyin((caddr_t)args->arg, (caddr_t)&lss, sizeof(lss));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
/*
|
|
|
|
|
* XXX - It really helps to have an implementation that does nothing.
|
|
|
|
|
* NOT!
|
|
|
|
|
*/
|
1996-03-10 22:30:53 +00:00
|
|
|
|
return 0;
|
1999-08-14 13:26:44 +00:00
|
|
|
|
}
|
1996-03-10 22:30:53 +00:00
|
|
|
|
|
1999-07-17 08:24:57 +00:00
|
|
|
|
case LINUX_TCXONC:
|
|
|
|
|
switch (args->arg) {
|
|
|
|
|
case LINUX_TCOOFF:
|
|
|
|
|
args->cmd = TIOCSTOP;
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_TCOON:
|
|
|
|
|
args->cmd = TIOCSTART;
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_TCIOFF:
|
|
|
|
|
case LINUX_TCION: {
|
|
|
|
|
u_char c;
|
|
|
|
|
struct write_args wr;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
error = fo_ioctl(fp, TIOCGETA, (caddr_t)&bsd_termios, p);
|
1999-07-17 08:24:57 +00:00
|
|
|
|
if (error != 0)
|
|
|
|
|
return error;
|
|
|
|
|
c = bsd_termios.c_cc[args->arg == LINUX_TCIOFF ? VSTOP : VSTART];
|
|
|
|
|
if (c != _POSIX_VDISABLE) {
|
|
|
|
|
wr.fd = args->fd;
|
|
|
|
|
wr.buf = &c;
|
|
|
|
|
wr.nbyte = sizeof(c);
|
|
|
|
|
return write(p, &wr);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
return (0);
|
|
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|
|
|
|
|
args->arg = 0;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1996-03-10 22:30:53 +00:00
|
|
|
|
case LINUX_TCFLSH:
|
|
|
|
|
args->cmd = TIOCFLUSH;
|
|
|
|
|
switch (args->arg) {
|
|
|
|
|
case LINUX_TCIFLUSH:
|
|
|
|
|
args->arg = FREAD;
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_TCOFLUSH:
|
|
|
|
|
args->arg = FWRITE;
|
|
|
|
|
break;
|
|
|
|
|
case LINUX_TCIOFLUSH:
|
|
|
|
|
args->arg = FREAD | FWRITE;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|
1997-11-06 19:29:57 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1996-03-10 22:30:53 +00:00
|
|
|
|
|
1997-12-15 06:09:11 +00:00
|
|
|
|
case LINUX_VT_OPENQRY:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_OPENQRY;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_VT_GETMODE:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_GETMODE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1998-08-31 06:55:02 +00:00
|
|
|
|
case LINUX_VT_SETMODE:
|
|
|
|
|
{
|
|
|
|
|
struct vt_mode *mode;
|
1997-12-15 06:09:11 +00:00
|
|
|
|
args->cmd = VT_SETMODE;
|
1998-08-31 06:55:02 +00:00
|
|
|
|
mode = (struct vt_mode *)args->arg;
|
|
|
|
|
if (!ISSIGVALID(mode->frsig) && ISSIGVALID(mode->acqsig))
|
|
|
|
|
mode->frsig = mode->acqsig;
|
1998-08-31 10:51:19 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
}
|
1997-12-15 06:09:11 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_VT_GETSTATE:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_GETACTIVE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1999-07-08 16:15:19 +00:00
|
|
|
|
case LINUX_VT_RELDISP:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_RELDISP;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
1997-12-15 06:09:11 +00:00
|
|
|
|
case LINUX_VT_ACTIVATE:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_ACTIVATE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_VT_WAITACTIVE:
|
|
|
|
|
|
|
|
|
|
args->cmd = VT_WAITACTIVE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_KDGKBMODE:
|
|
|
|
|
|
|
|
|
|
args->cmd = KDGKBMODE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_KDSKBMODE:
|
|
|
|
|
{
|
|
|
|
|
int kbdmode;
|
|
|
|
|
switch (args->arg) {
|
|
|
|
|
case LINUX_KBD_RAW:
|
|
|
|
|
kbdmode = K_RAW;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, KDSKBMODE, (caddr_t)&kbdmode, p);
|
1997-12-15 06:09:11 +00:00
|
|
|
|
case LINUX_KBD_XLATE:
|
|
|
|
|
kbdmode = K_XLATE;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, KDSKBMODE , (caddr_t)&kbdmode, p);
|
1997-12-15 06:09:11 +00:00
|
|
|
|
case LINUX_KBD_MEDIUMRAW:
|
|
|
|
|
kbdmode = K_RAW;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
return fo_ioctl(fp, KDSKBMODE , (caddr_t)&kbdmode, p);
|
1997-12-15 06:09:11 +00:00
|
|
|
|
default:
|
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|
|
|
|
|
}
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KDGETMODE:
|
|
|
|
|
args->cmd = KDGETMODE;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KDSETMODE:
|
|
|
|
|
args->cmd = KDSETMODE;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KDSETLED:
|
|
|
|
|
args->cmd = KDSETLED;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KDGETLED:
|
|
|
|
|
args->cmd = KDGETLED;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KIOCSOUND:
|
|
|
|
|
args->cmd = KIOCSOUND;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
|
|
|
|
case LINUX_KDMKTONE:
|
|
|
|
|
args->cmd = KDMKTONE;
|
1998-08-31 10:53:33 +00:00
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
1999-04-29 04:37:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMPAUSE:
|
|
|
|
|
args->cmd = CDIOCPAUSE;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMRESUME:
|
|
|
|
|
args->cmd = CDIOCRESUME;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMPLAYMSF:
|
|
|
|
|
args->cmd = CDIOCPLAYMSF;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMPLAYTRKIND:
|
|
|
|
|
args->cmd = CDIOCPLAYTRACKS;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMSTART:
|
|
|
|
|
args->cmd = CDIOCSTART;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMSTOP:
|
|
|
|
|
args->cmd = CDIOCSTOP;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMEJECT:
|
|
|
|
|
args->cmd = CDIOCEJECT;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMRESET:
|
|
|
|
|
args->cmd = CDIOCRESET;
|
|
|
|
|
return ioctl(p, (struct ioctl_args *)args);
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMREADTOCHDR: {
|
|
|
|
|
struct ioc_toc_header th;
|
|
|
|
|
struct linux_cdrom_tochdr lth;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
error = fo_ioctl(fp, CDIOREADTOCHEADER, (caddr_t)&th, p);
|
1999-04-29 04:37:57 +00:00
|
|
|
|
if (!error) {
|
|
|
|
|
lth.cdth_trk0 = th.starting_track;
|
|
|
|
|
lth.cdth_trk1 = th.ending_track;
|
|
|
|
|
copyout((caddr_t)<h, (caddr_t)args->arg, sizeof(lth));
|
|
|
|
|
}
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case LINUX_CDROMREADTOCENTRY: {
|
|
|
|
|
struct linux_cdrom_tocentry lte, *ltep =
|
|
|
|
|
(struct linux_cdrom_tocentry *)args->arg;
|
|
|
|
|
struct ioc_read_toc_single_entry irtse;
|
|
|
|
|
irtse.address_format = ltep->cdte_format;
|
|
|
|
|
irtse.track = ltep->cdte_track;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
error = fo_ioctl(fp, CDIOREADTOCENTRY, (caddr_t)&irtse, p);
|
1999-04-29 04:37:57 +00:00
|
|
|
|
if (!error) {
|
|
|
|
|
lte = *ltep;
|
|
|
|
|
lte.cdte_ctrl = irtse.entry.control;
|
|
|
|
|
lte.cdte_adr = irtse.entry.addr_type;
|
|
|
|
|
bsd_to_linux_msf_lba(irtse.address_format,
|
|
|
|
|
&irtse.entry.addr, <e.cdte_addr);
|
|
|
|
|
copyout((caddr_t)<e, (caddr_t)args->arg, sizeof(lte));
|
|
|
|
|
}
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
1999-08-13 14:44:13 +00:00
|
|
|
|
case LINUX_CDROMSUBCHNL: {
|
|
|
|
|
caddr_t sg;
|
|
|
|
|
struct linux_cdrom_subchnl sc;
|
|
|
|
|
struct ioc_read_subchannel bsdsc;
|
|
|
|
|
struct cd_sub_channel_info *bsdinfo;
|
|
|
|
|
|
|
|
|
|
sg = stackgap_init();
|
|
|
|
|
bsdinfo = (struct cd_sub_channel_info*)stackgap_alloc(&sg,
|
|
|
|
|
sizeof(struct cd_sub_channel_info));
|
|
|
|
|
|
|
|
|
|
bsdsc.address_format = CD_LBA_FORMAT;
|
|
|
|
|
bsdsc.data_format = CD_CURRENT_POSITION;
|
|
|
|
|
bsdsc.data_len = sizeof(struct cd_sub_channel_info);
|
|
|
|
|
bsdsc.data = bsdinfo;
|
This is what was "fdfix2.patch," a fix for fd sharing. It's pretty
far-reaching in fd-land, so you'll want to consult the code for
changes. The biggest change is that now, you don't use
fp->f_ops->fo_foo(fp, bar)
but instead
fo_foo(fp, bar),
which increments and decrements the fp refcount upon entry and exit.
Two new calls, fhold() and fdrop(), are provided. Each does what it
seems like it should, and if fdrop() brings the refcount to zero, the
fd is freed as well.
Thanks to peter ("to hell with it, it looks ok to me.") for his review.
Thanks to msmith for keeping me from putting locks everywhere :)
Reviewed by: peter
1999-09-19 17:00:25 +00:00
|
|
|
|
error = fo_ioctl(fp, CDIOCREADSUBCHANNEL, (caddr_t)&bsdsc, p);
|
1999-08-13 14:44:13 +00:00
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
|
|
|
|
|
error = copyin((caddr_t)args->arg, (caddr_t)&sc,
|
|
|
|
|
sizeof(struct linux_cdrom_subchnl));
|
|
|
|
|
if (error)
|
|
|
|
|
return error;
|
|
|
|
|
|
|
|
|
|
sc.cdsc_audiostatus = bsdinfo->header.audio_status;
|
|
|
|
|
sc.cdsc_adr = bsdinfo->what.position.addr_type;
|
|
|
|
|
sc.cdsc_ctrl = bsdinfo->what.position.control;
|
|
|
|
|
sc.cdsc_trk = bsdinfo->what.position.track_number;
|
|
|
|
|
sc.cdsc_ind = bsdinfo->what.position.index_number;
|
|
|
|
|
set_linux_cdrom_addr(&sc.cdsc_absaddr, sc.cdsc_format,
|
|
|
|
|
bsdinfo->what.position.absaddr.lba);
|
|
|
|
|
set_linux_cdrom_addr(&sc.cdsc_reladdr, sc.cdsc_format,
|
|
|
|
|
bsdinfo->what.position.reladdr.lba);
|
|
|
|
|
error = copyout((caddr_t)&sc, (caddr_t)args->arg,
|
|
|
|
|
sizeof(struct linux_cdrom_subchnl));
|
|
|
|
|
return error;
|
|
|
|
|
}
|
|
|
|
|
|
1999-08-28 08:43:03 +00:00
|
|
|
|
case LINUX_OSS_GETVERSION: {
|
|
|
|
|
int version;
|
|
|
|
|
|
|
|
|
|
version = linux_get_oss_version(p);
|
|
|
|
|
return copyout((caddr_t)&version, (caddr_t)args->arg, sizeof(int));
|
|
|
|
|
}
|
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
}
|
1998-08-31 06:55:02 +00:00
|
|
|
|
|
1995-06-25 17:32:43 +00:00
|
|
|
|
uprintf("LINUX: 'ioctl' fd=%d, typ=0x%x(%c), num=0x%x not implemented\n",
|
1998-07-29 16:43:00 +00:00
|
|
|
|
args->fd, (u_int)((args->cmd & 0xffff00) >> 8),
|
|
|
|
|
(int)((args->cmd & 0xffff00) >> 8), (u_int)(args->cmd & 0xff));
|
1995-06-25 17:32:43 +00:00
|
|
|
|
return EINVAL;
|
|
|
|
|
}
|