Home | History | Annotate | Download | only in common
History log of /src/sys/compat/linux32/common/linux32_unistd.c
RevisionDateAuthorComments
 1.44  27-Nov-2021  ryo Add pselect6(2) system call to COMPAT_LINUX32
 1.43  25-Nov-2021  ryo add support COMPAT_LINUX32 for aarch64
 1.42  09-Nov-2019  jdolecek add dummy implementation of linux fallocate() which just returns EOPNOTSUPP;
this is needed so that glibc falls back to emulation and apps behaving
properly, since EOPNOTSUPP is a documented and expected return code, but
ENOSYS is not

right now there are no filesystems in NetBSD tree supporting the fallocate
VOP, so no point trying to map this to a native call

supposed to help with problem reported in
https://mail-index.netbsd.org/tech-kern/2019/11/03/msg025641.html
 1.41  20-Sep-2019  kamil Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.
 1.40  26-Dec-2017  kamil branches: 1.40.4;
Refactor pipe1() and correct a bug in sys_pipe2() (SYS_pipe2)

sys_pipe2() returns two integers (values), the 2nd one is a copy of the 2nd
file descriptor that lands in fildes[2]. This is a side effect of reusing
the code for sys_pipe() (SYS_pipe) and not cleaning it up.

The first returned value is (on success) 0.

Introduced a small refactoring in pipe1() that it does not operate over
retval[], but on an array int[2]. A user sets retval[] for pipe() when
desired and needed.

This refactoring touches compat code: netbsd32, linux, linux32.

Before the changes on NetBSD/amd64:

$ ktruss -i ./a.out
[...]
15131 1 a.out pipe2(0x7f7fff2e62b8, 0) = 0, 4
[...]

After the changes:

$ ktruss -i ./a.out
[...]
782 1 a.out pipe2(0x7f7fff97e850, 0) = 0
[...]

There should not be a visible change for current users.

Sponsored by <The NetBSD Foundation>
 1.39  01-Jun-2014  njoly Cleanup pipe(2) flags, now that native handle them.
 1.38  18-May-2014  njoly Simplify dup3 emulation to call dodup() directly instead of
sys_dup2()+fd_set_exclose(). While here, add some error conditions.
 1.37  04-May-2014  njoly Fix pread/pwrite syscalls which need a 64bit offset argument.
 1.36  18-Nov-2013  chs branches: 1.36.2;
implement the *at() syscalls.
bring the unimplemented syscall list up to date.
 1.35  10-Apr-2011  christos branches: 1.35.4; 1.35.14; 1.35.18;
implement pipe2 and dup3
 1.34  11-Nov-2009  rmind branches: 1.34.4; 1.34.6;
- selcommon/pollcommon: drop redundant l argument.
- Use cached curlwp->l_fd, instead of p->p_fd.
- Inline selscan/pollscan.
 1.33  02-Jun-2009  njoly Make nice(2) return EPERM on error, not EACCES (from sys_setpriority).
 1.32  29-Mar-2009  christos Move the internal poll/select related API's to use timespec instead
of timeval (rides the uvm bump).
 1.31  15-Mar-2009  cegger ansify function definitions
 1.30  16-Jan-2009  njoly branches: 1.30.2;
Update some syscalls that now needs compat50 timeval structure.
 1.29  29-Dec-2008  njoly s/syscallcarg/syscallarg/ in comments.
 1.28  06-Dec-2008  njoly Cleanup; kill netbsd32_caddr_t use.
 1.27  06-Dec-2008  njoly Small setres{uid,gid} cleanup; there is no need to use a specific
handling for -1 uid values.
 1.26  05-Dec-2008  njoly Add getres{uid,gid} syscalls.
 1.25  19-Nov-2008  ad Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.24  03-Oct-2008  njoly branches: 1.24.2;
Compat linux/linux32 nice(2) fix. The syscall argument is an increment
to be added to the current nice value, not an absolute value to be
set.
 1.23  22-Sep-2008  njoly Kill a few linux32 syscalls identical to netbsd32 ones.
No functional changes expected.
 1.22  15-Apr-2008  njoly branches: 1.22.4; 1.22.6; 1.22.10;
Make linux32_sys_nice call sys_setpriority directly instead of
netbsd32_setpriority.
 1.21  17-Feb-2008  njoly branches: 1.21.6;
pread/pwrite fixes: use SCARG_P32 to access pointers, and update
syscalls definitions.
 1.20  02-Feb-2008  dsl Impletemt pread() and pwrite().
 1.19  15-Jan-2008  njoly compat linux (and linux32) uid16 functions cleanup and fixes.

- Move uid16 functions to their own file linux_uid16.c, included by
needed archs (arm, i386 and m68k).
- Add new MI types linux_{u,g}id16_t.
- Add macros to handle linux_uid16_t and uid_t conversions.
- Add linux_sys_getres{uid,gid}16 syscalls, to fix an overflow with
bad sizes given to copyout when linux_sys_getres{uid,gid} are used.
- Update arm syscall table to use more uid16 functions.
 1.18  21-Dec-2007  njoly - Fix setfsuid to return uid on success.
- Replace getfsuid, which never existed on Linux, by correct setfsgid
syscall.

ok by christos and dsl.
 1.17  20-Dec-2007  dsl 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.16  15-Dec-2007  njoly s/netbsd32_void */netbsd32_caddr_t/
 1.15  08-Dec-2007  dsl branches: 1.15.4;
ANSIfy most of the function definitions in sys/compat (but not ndis).
All by the magic of sed ...
 1.14  16-Nov-2007  njoly branches: 1.14.2;
Update, for linux_sys_readlink() removal.
 1.13  07-Nov-2007  njoly Remove remaining 64-bit compat linux syscalls linux_sys_xxx() (except
for ones without arguments), and replace them by their 32-bit
equivalent linux32_sys_xxxx().
 1.12  31-Oct-2007  njoly branches: 1.12.2;
compat linux32 syscalls cleanup.

With stackgap and CHECK_ALT_xxx removal, some linux32 and netbsd32
syscalls are now identical.
To avoid code duplication, remove the linux32 definition and use the
netbsd32 one (no functional change).
 1.11  27-Oct-2007  njoly Add missing chown's syscalls family members.
This makes chown(1)/chgrp(1) works under compat linux32.

Problem reported and fix tested by Arto Huusko. Thanks.
 1.10  16-Jun-2007  dsl branches: 1.10.6; 1.10.8; 1.10.12;
Remove a spare 'timeval' structure - makes this version of this function
match some of the other copies lurking in the world of compat.
 1.9  22-Apr-2007  dsl Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
- which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
search for absolute pathnames in the emulation root, if that fails it will
retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
the real root is returned instead (matching the behaviour of emul_lookup,
but being a cheap comparison here) so that programs that scan "../.."
looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
 1.8  02-Apr-2007  njoly Fix select() behaviour with NULL timeout, to blocks indefinitely
instead of returning immediately.
Reported by Edgar Fu� on port-amd64@.
 1.7  18-Mar-2007  dsl Change all the NETBSD32PTR64(SCARG(uap, xxx))) to SCARG_P32(uap, xxx).
 1.6  04-Mar-2007  christos branches: 1.6.2; 1.6.4; 1.6.6;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.5  09-Feb-2007  ad branches: 1.5.2;
Merge newlock2 to head.
 1.4  13-Sep-2006  manu branches: 1.4.4;
Jumbo COMPAT_LINUX/COMPAT_LINUX32 bugfix, with the help of Nicolas Joly
- Fix shmat return value on amd64: it uses no black magic with retval[0]
- Fix integer overflows in sysinfo
- Implement sysinfo, mmap2, sched_getparam, sched_getscheduler, mremap,
and madvise in COMPAT_LINUX32
- Fix improper types used in setgroups16/getgroups16
- Implement mmap2 for COMPAT_LINUX32
- Ifdef debug messages by DEBUG_LINUX
 1.3  06-Sep-2006  manu branches: 1.3.2; 1.3.4;
Fix linux32_sys_setres{uid|gid}: -1 does not means the same thing on i386
and amd64...
 1.2  13-Jun-2006  skd branches: 1.2.4;
include kauth.h
workaround a gcc4 warning.
 1.1  09-Feb-2006  manu branches: 1.1.2; 1.1.4; 1.1.10; 1.1.12;
Add initial (but unfinished) COMPAT_LINUX32 for amd64. This is good enough so
that the i386 license manager part of amd64 version of Fluent works.

While I'm here, add SysV IPC to COMPAT_LINUX/amd64
 1.1.12.1  19-Jun-2006  chap Sync with head.
 1.1.10.2  22-Apr-2006  simonb Sync with head.
 1.1.10.1  09-Feb-2006  simonb file linux32_unistd.c was added on branch simonb-timecounters on 2006-04-22 11:38:14 +0000
 1.1.4.2  14-Sep-2006  yamt sync with head.
 1.1.4.1  26-Jun-2006  yamt sync with head.
 1.1.2.2  18-Feb-2006  yamt sync with head.
 1.1.2.1  09-Feb-2006  yamt file linux32_unistd.c was added on branch yamt-uio_vmspace on 2006-02-18 15:39:02 +0000
 1.2.4.11  27-Feb-2008  yamt sync with head.
 1.2.4.10  04-Feb-2008  yamt sync with head.
 1.2.4.9  21-Jan-2008  yamt sync with head
 1.2.4.8  07-Dec-2007  yamt sync with head
 1.2.4.7  15-Nov-2007  yamt sync with head.
 1.2.4.6  27-Oct-2007  yamt sync with head.
 1.2.4.5  03-Sep-2007  yamt sync with head.
 1.2.4.4  26-Feb-2007  yamt sync with head.
 1.2.4.3  30-Dec-2006  yamt sync with head.
 1.2.4.2  21-Jun-2006  yamt sync with head.
 1.2.4.1  13-Jun-2006  yamt file linux32_unistd.c was added on branch yamt-lazymbuf on 2006-06-21 14:59:27 +0000
 1.3.4.2  09-Sep-2006  rpaulo sync with head
 1.3.4.1  06-Sep-2006  rpaulo file linux32_unistd.c was added on branch rpaulo-netinet-merge-pcb on 2006-09-09 02:46:04 +0000
 1.3.2.2  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.3.2.1  18-Nov-2006  ad Sync with head.
 1.4.4.1  12-Apr-2007  bouyer Pull up following revision(s) (requested by njoly in ticket #564):
sys/compat/linux32/common/linux32_unistd.c: revision 1.8
Fix select() behaviour with NULL timeout, to blocks indefinitely
instead of returning immediately.
Reported by Edgar Fu� on port-amd64@.
 1.5.2.4  07-May-2007  yamt sync with head.
 1.5.2.3  15-Apr-2007  yamt sync with head.
 1.5.2.2  24-Mar-2007  yamt sync with head.
 1.5.2.1  12-Mar-2007  rmind Sync with HEAD.
 1.6.6.1  29-Mar-2007  reinoud Pullup to -current
 1.6.4.1  11-Jul-2007  mjf Sync with head.
 1.6.2.3  15-Jul-2007  ad Sync with head.
 1.6.2.2  27-May-2007  ad Sync with head.
 1.6.2.1  10-Apr-2007  ad Sync with head.
 1.10.12.2  18-Nov-2007  bouyer Sync with HEAD
 1.10.12.1  13-Nov-2007  bouyer Sync with HEAD
 1.10.8.4  23-Mar-2008  matt sync with HEAD
 1.10.8.3  09-Jan-2008  matt sync with HEAD
 1.10.8.2  08-Nov-2007  matt sync with -HEAD
 1.10.8.1  06-Nov-2007  matt sync with HEAD
 1.10.6.5  09-Dec-2007  jmcneill Sync with HEAD.
 1.10.6.4  21-Nov-2007  joerg Sync with HEAD.
 1.10.6.3  11-Nov-2007  joerg Sync with HEAD.
 1.10.6.2  31-Oct-2007  joerg Sync with HEAD.
 1.10.6.1  28-Oct-2007  joerg Sync with HEAD.
 1.12.2.3  18-Feb-2008  mjf Sync with HEAD.
 1.12.2.2  27-Dec-2007  mjf Sync with HEAD.
 1.12.2.1  19-Nov-2007  mjf Sync with HEAD.
 1.14.2.1  26-Dec-2007  ad Sync with head.
 1.15.4.2  19-Jan-2008  bouyer Sync with HEAD
 1.15.4.1  02-Jan-2008  bouyer Sync with HEAD
 1.21.6.4  17-Jan-2009  mjf Sync with HEAD.
 1.21.6.3  05-Oct-2008  mjf Sync with HEAD.
 1.21.6.2  28-Sep-2008  mjf Sync with HEAD.
 1.21.6.1  02-Jun-2008  mjf Sync with HEAD.
 1.22.10.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.22.10.1  19-Oct-2008  haad Sync with HEAD.
 1.22.6.3  10-Oct-2008  skrll Sync with HEAD.
 1.22.6.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.22.6.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.22.4.3  11-Mar-2010  yamt sync with head
 1.22.4.2  20-Jun-2009  yamt sync with head
 1.22.4.1  04-May-2009  yamt sync with head.
 1.24.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.24.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.30.2.2  23-Jul-2009  jym Sync with HEAD.
 1.30.2.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.34.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.34.4.1  21-Apr-2011  rmind sync with head
 1.35.18.1  18-May-2014  rmind sync with head
 1.35.14.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.35.4.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.36.2.1  10-Aug-2014  tls Rebase.
 1.40.4.1  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411

RSS XML Feed