Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux/common/linux_termios.c
RevisionDateAuthorComments
 1.39  23-Nov-2021  pho Make LINUX_FIOCLEX and LINUX_FIONCLEX work

These ioctls were declared in linux_termios.h but were not actually
handled.
 1.38  23-Aug-2019  maxv Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.
 1.37  27-Dec-2013  njoly branches: 1.37.4; 1.37.16; 1.37.22; 1.37.30; 1.37.34;
Add easy parts (TCOOFF/TCOON) of the TCXONC linux termios ioctl.
 1.36  04-Jul-2008  matthias branches: 1.36.30; 1.36.40; 1.36.46;
make LINUX_TCSBRK work. The code is mostly copied from
sys/compat/ibcs2/ibcs2_ioctl.c.
 1.35  28-Apr-2008  martin branches: 1.35.2; 1.35.4;
Remove clause 3 and 4 from TNF licenses
 1.34  21-Mar-2008  ad branches: 1.34.2; 1.34.4;
Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
 1.33  20-Dec-2007  dsl branches: 1.33.6;
Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.32  19-Oct-2007  njoly branches: 1.32.4; 1.32.8;
Add compat_linux and exec_linux_elf lkm support for amd64:
- Add needed COMPAT_OSSAUDIO to GENERIC.
- Add missing includes needed by linux_syscallargs.h.
- Add lkm building.
 1.31  13-May-2007  dsl branches: 1.31.6; 1.31.8; 1.31.12;
This is deja vu - I fixed this earlier....
No need to use stackgap for ioctl to get PTM name, directly call file's
ioctl function with kernel buffer.
 1.30  14-Mar-2007  manu Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.29  04-Mar-2007  christos branches: 1.29.2; 1.29.4;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.28  09-Feb-2007  ad branches: 1.28.2;
Merge newlock2 to head.
 1.27  25-Nov-2006  elad branches: 1.27.2;
Part of PR/33280: Christian Ehrhardt: The call to FILE_USE should be
immediatly before the FREAD | FWRITE test not after it or FILE_UNUSE will
be called after the jump to out without a corresponding FILE_USE.
 1.26  22-Sep-2006  christos Pretend to implement TIOCSPTLCK. Although failing is harmless, there is no
point in doing so.
 1.25  15-Feb-2006  manu branches: 1.25.14; 1.25.16;
- Move the BSD to Linux and Linux to BSD termio/termios conversion functions
to a header where they can be shared between COMPAT_LINUX and COMPAT_LINUX32
- Add termios ioctl emulation to COMPAT_LINUX32
- Add the getcwd system call to COMPAT_LINUX32/amd64

That makes Linux's bash working with COMPAT_LINUX32.
 1.24  11-Dec-2005  christos branches: 1.24.2; 1.24.4; 1.24.6;
merge ktrace-lwp.
 1.23  24-Oct-2005  christos PR/31905: Wolfgang Stukenbrock: Termios ioctls TIOCMBIC and TIOCMBIS missing
in linux emulation code
 1.22  26-Feb-2005  perry branches: 1.22.2; 1.22.4; 1.22.6;
nuke trailing whitespace
 1.21  13-Nov-2004  christos branches: 1.21.4; 1.21.6;
Add LINUX_TIOCGPTN for ptyfs pty emulation.
 1.20  29-Jun-2003  fvdl branches: 1.20.2;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.19  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.18  21-Mar-2003  dsl Change 'data' argument to fo_ioctl and fo_fcntl from 'caddr_t' to 'void *'.
Avoids a lot of casting and removes the need for some line breaks.
Removed a load of (caddr_t) casts from calls to copyin/copyout as well.
(approved by christos - he has a plan to remove caddr_t...)
 1.17  27-Feb-2003  yamt make compat_linux struct file interlock friendly.
 1.16  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.15  19-Dec-2001  augustss Add some missing ioctl()s. From Tommy Bohlin in PR kern/14414.
 1.14  13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.13  14-Jun-2001  thorpej branches: 1.13.2;
Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads. What we do is stick descriptors in the table, but
mark them as "larval". This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again. When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
 1.12  22-May-2001  manu When c_ospeed in termio is null, NetBSD hangup the terminal. Since Linux
does not do this, we fake null c_ospeed values by -1 in the kernel, so
that NetBSD does not hangup.
 1.11  21-Feb-2001  jdolecek branches: 1.11.2;
make some more constant arrays 'const'
 1.10  05-Feb-2001  itojun make it compile on alpha. cast pointer to u_long, not int
 1.9  03-Feb-2001  ross Emulate LINUX_TCFLSH with our TIOCFLUSH. Do some CSE.
 1.8  10-Dec-2000  fvdl Add some ioctls for harddisk, floppy disk and console handling.
Implement a few extra cdrom ioctl calls.
Make sure to correctly use FILE_USE and FILE_UNUSE.
 1.7  30-Mar-2000  augustss branches: 1.7.4;
Kill register declarations.
 1.6  04-Oct-1998  fvdl branches: 1.6.12;
Assign my copyright to TNF. Merge with others were appropriate.
Regen syscall files after script change.
 1.5  03-Oct-1998  christos Attempt to fix the mess.
 1.4  01-Oct-1998  erh Moved from compat/linux/linux_termios.c to common.
 1.3  05-Apr-1996  christos Prototyping changes.
 1.2  03-Apr-1996  mycroft Add explicit return types.
 1.1  08-Mar-1996  mycroft Separate ioctl emulation by group. Add (minimal) audio emulation.
 1.6.12.4  12-Mar-2001  bouyer Sync with HEAD.
 1.6.12.3  11-Feb-2001  bouyer Sync with HEAD.
 1.6.12.2  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.6.12.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.7.4.1  30-Mar-2001  he Pull up revision 1.8 (requested by fvdl):
Add some required Linux emulation bits to support the Linux
version of VMware.
 1.11.2.6  24-Jun-2002  nathanw Curproc->curlwp renaming.

Change uses of "curproc->l_proc" back to "curproc", which is more like the
original use. Bare uses of "curproc" are now "curlwp".

"curproc" is now #defined in proc.h as ((curlwp) ? (curlwp)->l_proc) : NULL)
so that it is always safe to reference curproc (*de*referencing curproc
is another story, but that's always been true).
 1.11.2.5  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.11.2.4  08-Jan-2002  nathanw Catch up to -current.
 1.11.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.11.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.11.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.13.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.20.2.7  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.20.2.6  04-Mar-2005  skrll Sync with HEAD.

Hi Perry!
 1.20.2.5  21-Nov-2004  skrll This was somehow missed in the sync to HEAD.
 1.20.2.4  14-Nov-2004  skrll Sync with HEAD.
 1.20.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.20.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.20.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.21.6.1  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.21.4.1  29-Apr-2005  kent sync with -current
 1.22.6.1  26-Oct-2005  yamt sync with head
 1.22.4.7  24-Mar-2008  yamt sync with head.
 1.22.4.6  21-Jan-2008  yamt sync with head
 1.22.4.5  27-Oct-2007  yamt sync with head.
 1.22.4.4  03-Sep-2007  yamt sync with head.
 1.22.4.3  26-Feb-2007  yamt sync with head.
 1.22.4.2  30-Dec-2006  yamt sync with head.
 1.22.4.1  21-Jun-2006  yamt sync with head.
 1.22.2.1  11-Jan-2007  bouyer Pull up following revision(s) (requested by tron in ticket #1627):
sys/compat/linux/common/linux_termios.c: revision 1.23
PR/31905: Wolfgang Stukenbrock: Termios ioctls TIOCMBIC and TIOCMBIS missing
in linux emulation code
 1.24.6.1  22-Apr-2006  simonb Sync with head.
 1.24.4.1  09-Sep-2006  rpaulo sync with head
 1.24.2.1  18-Feb-2006  yamt sync with head.
 1.25.16.2  10-Dec-2006  yamt sync with head.
 1.25.16.1  22-Oct-2006  yamt sync with head
 1.25.14.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.25.14.2  12-Jan-2007  ad Sync with head.
 1.25.14.1  18-Nov-2006  ad Sync with head.
 1.27.2.1  13-May-2007  pavel Pull up following revision(s) (requested by manu in ticket #637):
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.21
sys/compat/linux/arch/amd64/linux_machdep.h: revision 1.7
sys/compat/linux/common/linux_termios.c: revision 1.30
Add ptmx fakedevice hack for amd64
Fix a bug in ioctl handling
 1.28.2.3  17-May-2007  yamt sync with head.
 1.28.2.2  24-Mar-2007  yamt sync with head.
 1.28.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.29.4.1  11-Jul-2007  mjf Sync with head.
 1.29.2.2  27-May-2007  ad Sync with head.
 1.29.2.1  10-Apr-2007  ad Sync with head.
 1.31.12.1  25-Oct-2007  bouyer Sync with HEAD.
 1.31.8.2  09-Jan-2008  matt sync with HEAD
 1.31.8.1  06-Nov-2007  matt sync with HEAD
 1.31.6.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.32.8.1  02-Jan-2008  bouyer Sync with HEAD
 1.32.4.1  26-Dec-2007  ad Sync with head.
 1.33.6.3  28-Sep-2008  mjf Sync with HEAD.
 1.33.6.2  02-Jun-2008  mjf Sync with HEAD.
 1.33.6.1  03-Apr-2008  mjf Sync with HEAD.
 1.34.4.2  04-May-2009  yamt sync with head.
 1.34.4.1  16-May-2008  yamt sync with head.
 1.34.2.1  18-May-2008  yamt sync with head.
 1.35.4.1  18-Jul-2008  simonb Sync with head.
 1.35.2.3  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.35.2.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.35.2.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.36.46.1  18-May-2014  rmind sync with head
 1.36.40.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.36.30.1  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.37.34.1  13-Sep-2019  martin Pull up following revision(s) (requested by maxv in ticket #194):

sys/compat/linux/common/linux_socket.c: revision 1.146
sys/compat/linux/common/linux_socket.c: revision 1.147
sys/compat/linux/common/linux_socket.c: revision 1.148
sys/compat/linux/common/linux_socket.c: revision 1.149
sys/compat/linux/arch/amd64/linux_machdep.c: revision 1.59
sys/compat/linux32/common/linux32_sysinfo.c: revision 1.8
sys/kern/sysv_shm.c: revision 1.138
sys/compat/linux/common/linux_file64.c: revision 1.61
sys/compat/linux/common/linux_file64.c: revision 1.62
sys/compat/netbsd32/netbsd32_compat_43.c: revision 1.58
sys/compat/linux32/common/linux32_dirent.c: revision 1.20
sys/compat/linux32/common/linux32_utsname.c: revision 1.10
sys/compat/linux/common/linux_termios.h: revision 1.22
sys/compat/linux32/common/linux32_termios.c: revision 1.15
sys/compat/linux32/common/linux32_misc.c: revision 1.27
sys/compat/linux32/common/linux32_ioctl.c: revision 1.14
sys/compat/linux/common/linux_statfs.h: revision 1.7
sys/compat/linux/common/linux_ipc.c: revision 1.57
sys/compat/linux/common/linux_fcntl.h: revision 1.18
sys/compat/linux/common/linux_socket.h: revision 1.24
sys/sys/shm.h: revision 1.54
sys/compat/ossaudio/ossaudio.c: revision 1.75
sys/compat/linux32/common/linux32_signal.c: revision 1.20
sys/miscfs/procfs/procfs_linux.c: revision 1.75
sys/compat/linux/common/linux_signal.c: revision 1.81
sys/compat/linux/common/linux_termios.c: revision 1.38
sys/compat/linux/common/linux_misc.c: revision 1.241
sys/compat/linux/common/linux_misc.c: revision 1.242
sys/compat/linux/common/linux_misc.c: revision 1.243
sys/compat/linux/common/linux_misc.c: revision 1.244

Fix info leaks.

Fix stupid bugs in linux_sys_shmctl(): the index could be out of bound
(page fault) and there was no proper locking.
Maybe we should just remove LINUX_SHM_STAT, like compat_linux32.

Remove printf.

When dealing with an unknown value, set -1, to prevent (harmless)
uninitialized accesses later.

Add a default case, don't call sys_ioctl() with an uninitialized 'com'
argument.

Fix error handling, returns an errno, not -1.

Put the printf under DEBUG_LINUX.


Hum, don't forget the 'pid' argument, otherwise we're not gonna go very
far.

Don't read data from userland directly. This simply does not work on any
recent x86 CPU (thanks to SMAP) and all architectures that forbid direct
access to userland from the kernel. But I guess no one noticed because no
one ever uses compat_linux, right?

Hum, don't pass an mbuf to realloc(). Inspired from copyin32_msg_control().

Fix memory leak.

I don't see the point in having this useless printf, but add a '\n' to it,
so that it at least displays useless stuff correctly.

Hum, remove incorrect assignment. Userland could have passed a smaller
namelen, and the uninitialized bytes from sb_data were being used later in
the network stack.
 1.37.30.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.37.22.1  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1487:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.37.16.1  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.
 1.37.4.1  21-Jan-2020  martin Pull up the following, requested by christos in ticket #1720:

sys/compat/common/kern_sig_43.c 1.36
sys/compat/linux/arch/amd64/linux_machdep.c 1.59
sys/compat/linux/common/linux_fcntl.h 1.18
sys/compat/linux/common/linux_file64.c 1.62
sys/compat/linux/common/linux_ipc.c 1.57
sys/compat/linux/common/linux_misc.c 1.243
sys/compat/linux/common/linux_signal.c 1.81
sys/compat/linux/common/linux_socket.c 1.149 (patch)
sys/compat/linux/common/linux_socket.h 1.24
sys/compat/linux/common/linux_statfs.h 1.7
sys/compat/linux/common/linux_termios.c 1.38
sys/compat/linux/common/linux_termios.h 1.22
sys/compat/linux32/common/linux32_dirent.c 1.20
sys/compat/linux32/common/linux32_ioctl.c 1.14
sys/compat/linux32/common/linux32_misc.c 1.27
sys/compat/linux32/common/linux32_signal.c 1.20
sys/compat/linux32/common/linux32_sysinfo.c 1.8
sys/compat/linux32/common/linux32_termios.c 1.15
sys/compat/linux32/common/linux32_utsname.c 1.10
sys/compat/netbsd32/netbsd32_compat_20.c 1.39
sys/compat/netbsd32/netbsd32_compat_43.c 1.59
sys/compat/netbsd32/netbsd32_compat_50.c 1.44
sys/compat/ossaudio/ossaudio.c 1.75
sys/kern/sysv_shm.c 1.138
sys/miscfs/procfs/procfs_linux.c 1.75 (patch)
sys/sys/shm.h 1.54 (patch)

Fix various info leaks, out of bound access, usage of uninitialized
values and direct access to userland variables from kernel space
and memory leaks in system calls implemented for the compatibility
subsystems.

RSS XML Feed