"rw" argument, rather than hijacking B_{READ|WRITE}.
Fix two bugs (physio & cam) resulting by the confusion caused by this.
Submitted by: Tor.Egge@fast.no
Reviewed by: alc, ken (partly)
Merge the contents (less some trivial bordering the silly comments)
of <vm/vm_prot.h> and <vm/vm_inherit.h> into <vm/vm.h>. This puts
the #defines for the vm_inherit_t and vm_prot_t types next to their
typedefs.
This paves the road for the commit to follow shortly: change
useracc() to use VM_PROT_{READ|WRITE} rather than B_{READ|WRITE}
as argument.
glibc2 defines struct dirent differently than the Linux kernel does.
The getdents function therefore needs to read a heuristically defined
number of kernel dirents to satisfy the request. In case where too
many kernel dirents have been read, the function lseeks on the
directory so that a next call will start with the right dirent. The
offset used in lseeking is the offset-field in the last dirent passed
to the application. This can only mean that the offset-field holds
the offset of the next dirent and not the offset of the dirent itself.
can provide the correct context to each signal handler.
Fix broken sigsuspend(): don't use p_oldsigmask as a flag, use SAS_OLDMASK
as we did before the linuxthreads support merge (submitted by bde).
Move ps_sigstk from to p_sigacts to the main proc structure since signal
stack should not be shared among threads.
Move SAS_OLDMASK and SAS_ALTSTACK flags from sigacts::ps_flags to proc::p_flag.
Move PS_NOCLDSTOP and PS_NOCLDWAIT flags from proc::p_flag to procsig::ps_flag.
Reviewed by: marcel, jdp, bde
-----------------------------
The compatibility code and/or emulators have been updated:
iBCS2 now mostly uses the older syscalls. SVR4 now properly
handles all signals. This has been achieved by using the
new sigset_t throughout the emulator. The Linuxulator has
been severely updated. Internally the new Linux sigset_t is
made the default. These are then mapped to and from the
new FreeBSD sigset_t.
Also, rt_sigsuspend has been implemented in the Linuxulator.
Implementing this syscall basicly caused all this sigset_t
changing in the first place and the syscall has been used
throughout the change as a means for testing. It basicly is
too much work to undo the implementation so that it can
later be added again.
A special note on the use of sv_sigtbl and sv_sigsize in
struct sysentvec:
Every signal larger than sv_sigsize is not translated and is
passed on to the signal handler unmodified. Signals in the
range 1 upto and including sv_sigsize are translated.
The rationale is that only the system defined signals need to
be translated.
The emulators also have been updated so that the translation
tables are only indexed for valid (system defined) signals.
This change also fixes the translation bug already in the
SVR4 emulator.
fields in struct cdevsw:
d_stop moved to struct tty.
d_reset already unused.
d_devtotty linkage now provided by dev_t->si_tty.
These fields will be removed from struct cdevsw together with
d_params and d_maxio Real Soon Now.
The changes in this patch consist of:
initialize dev->si_tty in *_open()
initialize tty->t_stop
remove devtotty functions
rename ttpoll to ttypoll
a few adjustments to these changes in the generic code
a bump of __FreeBSD_version
add a couple of FreeBSD tags
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
the actual work. When USER_LDT is not defined for a kernel, sysarch returns
EOPNOTSUPP. Display a message in that case and return ENOSYS to userland.
Reviewed by: luoqi
discussed on current.
The following variables are defined (for now):
osname (defaults to "Linux")
Allow users to change the name of the OS as returned by uname(2),
specially added for all those Linux Netscape users and statistics
maniacs :-) We now have what we all wanted!
osrelease (defaults to "2.2.5")
Allow users to change the version of the OS as returned by uname(2).
Since -current supports glibc2.1 now, change the default to 2.2.5
(was 2.0.36).
oss_version (defaults to 198144 [0x030600])
This one will be used by the OSS_GETVERSION ioctl (PR 12917) which I
can commit now that we have the MIB. The default version number is the
lowest version possible with the current 'encoding'.
A note about imprisoned processes (see jail(2)):
These variables are copy-on-write (as suggested by phk). This means that
imprisoned processes will use the system wide value unless it is written/set
by the process. From that moment on, a copy local to the prison will be
used.
A note about the implementation:
I choose to add a single pointer to struct prison, because I didn't like the
idea of changing struct prison every time I come up with a new variable. As
a side effect, the extra storage is only needed when a variable is set from
within the prison. This also minimizes kernel bloat when the Linuxulator is
not used; both compiled in or as a module.
Reviewed by: bde (first version only) and phk
directory. Also, update arguments of NDINIT for both newstat and newlstat.
While I'm at it, fix style bugs in all {s|ls|fs}tat syscalls.
Reported by: bde
egid will be twice in the set and that setting cr_groups[0] will change egid.
This is simply solved by ignoring cr_groups[0]. That is; linux_getgroups does
not return cr_groups[0] and linux_setgroups does not touch it.
Noticed by: bde
Brought to my attention by: sheldonh
know if and when an unimplemented or obsoleted syscall is being used. Make the
message more end-user friendly.
And as long as we're here, rename some unimplemeted syscalls (linux_phys ->
linux_umount2, linux_vm86 -> linux_vm86old, linux_new_vm86 -> linux_vm86).
Change prototype for linux_newuname from `struct linux_newuname_t *' into
`struct linux_new_utsname *'. This change is reflected in linux.h and
linux_misc.c.
know if and when an unimplemented or obsoleted syscall is being used. Make the
message more end-user friendly.
And as long as we're here, rename some unimplemeted syscalls (linux_phys ->
linux_umount2, linux_vm86 -> linux_vm86old, linux_new_vm86 -> linux_vm86).
Change prototype for linux_newuname from `struct linux_newuname_t *' into
`struct linux_new_utsname *'. This change is reflected in linux.h and
linux_misc.c.
Lastly, make line-continuation and indentation more uniform.
didn't match the argument (p->p_pid).
While I'm at it, also fix the dupo in the format string and fix the annoying
inconsistency in all the debug-printfs wrt p_pid arguments. Change all of them
to use the %ld format specifier and cast the p_pid arguments to long.
Submitted by: billf
The first reason for this rewrite is KNF conformance.
The second reason is to avoid redundancy. Each function printed the same
string, with only the syscall name being different. The actual printing is now
performed by a single function, which gets the syscall name as an argument.
The third reason is that of convenience. It's now very easy to add a new
dummy implementation. Just add ``DUMMY(foo);'' to the file. It's also a lot
easier now to see if a syscall has a dummy implementation or not.
The dummies are ordered on syscall number. Please maintain this when adding
new dummies (there're 32 candidates at the time of writing :-)
Reviewed by: bde
prototypes of o{s|g}etrlimit (from sys/sysproto.h). Update linux_{s|g}etrlimit
so that the arguments to o{s|g}etrlimit are corresponding the prototypes.
Pointed out by: bde
functions use the new sigset_t and sigaction_t which allows support for more
than 32 signals. Only the lower 32 signals are supported for now.
linux_rt_sigaction, linux_sigaction and linux_signal use linux_do_sigaction
to do the actual work. That way unnecessary redundancy is avoided. The same
has been done for linux_rt_sigprocmask and linux_sigprocmask. They call
linux_do_sigprocmask to do the actual work.
of kernel space. Remove the ioctl supporting functions, and move the actual
code to the switch-statement. Now everybody can clearly see that the
implementation is really poor.
Also fix a typo in LINUX_TIOCGETD. The underlying function was given command
TIOCSETD instead op TIOCGETD...
changes. This is part 1 of the complete termios ioctl fixes.
o change type of c_{i|o|c|l}flag in struct termios from unsigned long to
unsigned int. The type now matches the Linux definitions.
o replaced constants by the corresponding defines in sptab[] for clarity.
Since there's no define for 135 baud, its mapping has been dropped.
function bsd_to_linux_termios:
o Fix typo IXON -> IXANY.
o Remove bogus assignment to c_cc[LINUX_VSWTC].
function linux_to_bsd_termios:
o Fix dupo LINUX_IXON -> LINUX_IXANY.
o Add LINUX_CREAD mapping.
o Fix typo IEXTEN -> LINUX_IEXTEN.
function linux_to_bsd_termio:
o Small optimization: Don't preset the complete c_cc array when we next
assign to the first LINUX_NCC entries.
in deterministic behaviour. In this case known garbage out.
The fix is different than suggested in the PR.
PR: 12749
Originator: Boris Nikolaus <boris@cs.tu-berlin.de>
The linux syscalls translate the arguments first before invoking the
FreeBSD native syscalls.
PR: kern/9591
Originator: John Plevyak <jplevyak@inktomi.com>
in the pathname translation procedure. This proves fatal, and can be
easily fixed. This or a similar change needs to be committed to svr4_util.h
and ibcs2_util.h. I will update ibcs2_util.h, if noone else thinks of a
better way to do this, in the same manner. I will leave svr4 to the
respective maintainer.
This closes the problem of the only crash I've been able to produce as
a user recently, except for (currently not-in-the-source tree) fd
table sharing fixes. Thanks goes to pho for his stress-testers.
udev_t in the kernel but still called dev_t in userland.
Provide functions to manipulate both types:
major() umajor()
minor() uminor()
makedev() umakedev()
dev2udev() udev2dev()
For now they're functions, they will become in-line functions
after one of the next two steps in this process.
Return major/minor/makedev to macro-hood for userland.
Register a name in cdevsw[] for the "filedescriptor" driver.
In the kernel the udev_t appears in places where we have the
major/minor number combination, (ie: a potential device: we
may not have the driver nor the device), like in inodes, vattr,
cdevsw registration and so on, whereas the dev_t appears where
we carry around a reference to a actual device.
In the future the cdevsw and the aliased-from vnode will be hung
directly from the dev_t, along with up to two softc pointers for
the device driver and a few houskeeping bits. This will essentially
replace the current "alias" check code (same buck, bigger bang).
A little stunt has been provided to try to catch places where the
wrong type is being used (dev_t vs udev_t), if you see something
not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if
it makes a difference. If it does, please try to track it down
(many hands make light work) or at least try to reproduce it
as simply as possible, and describe how to do that.
Without DEVT_FASCIST I belive this patch is a no-op.
Stylistic/posixoid comments about the userland view of the <sys/*.h>
files welcome now, from userland they now contain the end result.
Next planned step: make all dev_t's refer to the same devsw[] which
means convert BLK's to CHR's at the perimeter of the vnodes and
other places where they enter the game (bootdev, mknod, sysctl).
Made a new (inline) function devsw(dev_t dev) and substituted it.
Changed to the BDEV variant to this format as well: bdevsw(dev_t dev)
DEVFS will eventually benefit from this change too.
- %fs register is added to trapframe and saved/restored upon kernel entry/exit.
- Per-cpu pages are no longer mapped at the same virtual address.
- Each cpu now has a separate gdt selector table. A new segment selector
is added to point to per-cpu pages, per-cpu global variables are now
accessed through this new selector (%fs). The selectors in gdt table are
rearranged for cache line optimization.
- fask_vfork is now on as default for both UP and SMP.
- Some aio code cleanup.
Reviewed by: Alan Cox <alc@cs.rice.edu>
John Dyson <dyson@iquest.net>
Julian Elischer <julian@whistel.com>
Bruce Evans <bde@zeta.org.au>
David Greenman <dg@root.com>
1:
s/suser/suser_xxx/
2:
Add new function: suser(struct proc *), prototyped in <sys/proc.h>.
3:
s/suser_xxx(\([a-zA-Z0-9_]*\)->p_ucred, \&\1->p_acflag)/suser(\1)/
The remaining suser_xxx() calls will be scrutinized and dealt with
later.
There may be some unneeded #include <sys/cred.h>, but they are left
as an exercise for Bruce.
More changes to the suser() API will come along with the "jail" code.
This takes the conditionals out of the code that has been tested by
various people for a while.
ps and friends (libkvm) will need a recompile as some proc structure
changes are made.
Submitted by: "Richard Seaman, Jr." <dick@tar.com>
downward growing stacks more general.
Add (but don't activate) code to use the new stack facility
when running threads, (specifically the linux threads support).
This allows people to use both linux compiled linuxthreads, and also the
native FreeBSD linux-threads port.
The code is conditional on VM_STACK. Not using this will
produce the old heavily tested system.
Submitted by: Richard Seaman <dick@tar.com>
"I've been having a problem running the patches [committed to current]
installed with the COMPAT_LINUX_THREADS option along
with the VM_STACK patches I did. I'm not sure what
the problem is, since it seemed to work before.
In any event, the attached patch fixes the problem for
me. While I've had no report of problems from anyone
else, possibly it would be wise to commit the patch
until the problem is found.
Also, there was some left-over junk in the linux_misc.c
file from some earlier work I did. The attached patch
cleans that up too."
Submitted by: "Richard Seaman, Jr." <dick@tar.com>
performed all sorts of sanity checks. The FreeBSD linux emulator returns
EINVAL in such a case.
Allowing signal 0 to be passed to kill will result in compatible behaviour.
PR: 9082
Submitted by: Marcel Moolenaar <marcel@scc.nl>
Submitted by: "Richard Seaman, Jr." <lists@tar.com>
Obtained from: linux :-)
Code to allow Linux Threads to run under FreeBSD.
By default not enabled
This code is dependent on the conditional
COMPAT_LINUX_THREADS (suggested by Garret)
This is not yet a 'real' option but will be within some number of hours.
adjusted related casts to match (only in the kernel in this commit).
The pointer was only wanted in one place in kern_exec.c. Applications
should use the kern.ps_strings sysctl instead of PS_STRINGS, so they
shouldn't notice this change.
programs using glibc expect edx to be preserved accross syscalls.
As a result, linux programs running in emulation mode can
have whatever value may be represented by edx clobbered.
PR: 9038
Submitted-By: Richard Seaman, Jr. <dick@tar.com>
for possible buffer overflow problems. Replaced most sprintf()'s
with snprintf(); for others cases, added terminating NUL bytes where
appropriate, replaced constants like "16" with sizeof(), etc.
These changes include several bug fixes, but most changes are for
maintainability's sake. Any instance where it wasn't "immediately
obvious" that a buffer overflow could not occur was made safer.
Reviewed by: Bruce Evans <bde@zeta.org.au>
Reviewed by: Matthew Dillon <dillon@apollo.backplane.com>
Reviewed by: Mike Spengler <mks@networkcs.com>
This is the bulk of the support for doing kld modules. Two linker_sets
were replaced by SYSINIT()'s. VFS's and exec handlers are self registered.
kld is now a superset of lkm. I have converted most of them, they will
follow as a seperate commit as samples.
This all still works as a static a.out kernel using LKM's.
Change the ELF registration/unregistration scheme to be less error prone.
Adding a new brand requires a single addition to linux_brandlist instead of
modifying linux_load(), linux_unload(), and linux_elf_init().
Approved by: jkh
Reviewed by: msmith
Linux and FreeBSD signal numbers. Also, check signal numbers passed
in from application programs for validity. Without these checks,
it is trivial to panic the system from a Linux program.
object format of the executable being dumped. This is the first
step toward producing ELF core dumps in the proper format. I will
commit the code to generate the ELF core dumps Real Soon Now. In
the meantime, ELF executables won't dump core at all. That is
probably no less useful than dumping a.out-style core dumps as they
have done until now.
Submitted by: Alex <garbanzo@hooked.net> (with very minor changes by me)
XFree86 server, users need to create the following links in their
/compat/linux/dev directory (assuming kernel configured with 4 VTs).
lrwxrwxrwx 1 root wheel 7 Aug 30 22:59 tty0 -> console
lrwxrwxrwx 1 root wheel 5 Aug 30 22:45 tty1 -> ttyv0
lrwxrwxrwx 1 root wheel 5 Aug 30 22:45 tty2 -> ttyv1
lrwxrwxrwx 1 root wheel 5 Aug 30 22:45 tty3 -> ttyv2
lrwxrwxrwx 1 root wheel 5 Aug 30 22:45 tty4 -> ttyv3
VT switching is still not yet supported. Attempting to switch VT
currently will cause Xserver bus error.
Submitted by: Chain Lee <chain@110.net>
It can be integral or a struct in POSIX, so it is difficult to print,
but it is actually declared as unsigned long. Assume that it is
unsigned integral.
Fixed nearby bugs (in linux_alarm()):
- the itimer for the alarm was relative to the epoch instead of relative
to the boot time. This was harmless because the itimer's interval is 0.
- the seconds arg was not checked for validity before converting it to a
possibly different value.
- printf format errors.
Improvements:
Don't use splclock(). splsoftclock() suffices. Don't complicate things
by micro-optimizing interrupt latency.
Minor improvements:
Various micro-optimizations to exploit the specialness of the alarm itimer
and the value 0.
FreeBSD/alpha. The most significant item is to change the command
argument to ioctl functions from int to u_long. This change brings us
inline with various other BSD versions. Driver writers may like to
use (__FreeBSD_version == 300003) to detect this change.
The prototype FreeBSD/alpha machdep will follow in a couple of days
time.
layer does not like the null shmid_ds buffer pointer. The emulation layer
returned an error without ever calling FreeBSD's shmctl, so the segments
were not being deleted when the reference count went to zero."
Submitted by: Kevin Street <street@iname.com>
Linux emulation. This make Allegro Common Lisp 4.3 work under
FreeBSD!
Submitted by: Fred Gilham <gilham@csl.sri.com>
Commented on by: bde, dg, msmith, tg
Hoping he got everything right: eivind
"time" wasn't a atomic variable, so splfoo() protection were needed
around any access to it, unless you just wanted the seconds part.
Most uses of time.tv_sec now uses the new variable time_second instead.
gettime() changed to getmicrotime(0.
Remove a couple of unneeded splfoo() protections, the new getmicrotime()
is atomic, (until Bruce sets a breakpoint in it).
A couple of places needed random data, so use read_random() instead
of mucking about with time which isn't random.
Add a new nfs_curusec() function.
Mark a couple of bogosities involving the now disappeard time variable.
Update ffs_update() to avoid the weird "== &time" checks, by fixing the
one remaining call that passwd &time as args.
Change profiling in ncr.c to use ticks instead of time. Resolution is
the same.
Add new function "tvtohz()" to avoid the bogus "splfoo(), add time, call
hzto() which subtracts time" sequences.
Reviewed by: bde
_KPOSIX_PRIORITY_SCHEDULING options to work. Changes:
Change all "posix4" to "p1003_1b". Misnamed files are left
as "posix4" until I'm told if I can simply delete them and add
new ones;
Add _POSIX_PRIORITY_SCHEDULING system calls for FreeBSD and Linux;
Add man pages for _POSIX_PRIORITY_SCHEDULING system calls;
Add options to LINT;
Minor fixes to P1003_1B code during testing.
Gee, I wish there was a better way to run makesyscalls.sh so that
a make world finds missing things like this. Running it manually
sucks.
Pointed out by: Peter Dufault
----
I've worked to enhance the connect() patches.
I've just tested this with the Linux JDK appletviewer on an applet
that does a lot of connects, and it works as well as during my
previous tests.
The connect() patch is now a merge between my older patch and the
OpenBSD stuff. It ensures that any async error is returned by
connect() instead of getsockopt(SOL_SOCKET, SO_ERROR) as reasonnable
systems do.
There are also minor patches to implement IPPROTO_TCP for
get/setsocktopt(). These are also tested (with Linux Apache).
----
I would appreciate any feedback regarding these changes, as they'd
be very useful in 2.2.6.
Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
was not being set copied to the bsd arguments..
frequently, resulting in files of over 100MB of NULs
PR: 386/5044
Reviewed by: jmb
Submitted by: (Richard Winkel) rich@math.missouri.edu
Pointed out by: Eivind Eklund <eivind@FreeBSD.ORG>
NOPROTO LINUX { int getpgrp(void); }
66 NOPROTO LINUX { int setsid(void); }
67 STD LINUX { int linux_sigaction(int sig, \
struct linux_sigaction *nsa, \
struct linux_sigaction *osa); }
68 STD LINUX { int linux_siggetmask(void); }
69 STD LINUX { int linux_sigsetmask(linux_sigset_t mask); }
70 NOPROTO LINUX { int setreuid(int ruid, int euid); }
71 NOPROTO LINUX { int setregid(int rgid, int egid); }
72 STD LINUX { int linux_sigsuspend(int restart, \
linux_sigset_t oldmask, linux_sigset_t mask); }
73 STD LINUX { int linux_sigpending(linux_sigset_t *mask); }
74 NOPROTO LINUX { int osethostname(char *hostname, \
u_int len);}
75 NOPROTO LINUX { int osetrlimit(u_int which, \
struct ogetrlimit *rlp); }
76 NOPROTO LINUX { int ogetrlimit(u_int which, \
struct ogetrlimit *rlp); }
77 NOPROTO LINUX { int getrusage(int who, struct rusage *rusage); }
78 NOPROTO LINUX { int gettimeofday(struct timeval *tp, \
struct timezone *tzp); }
79 NOPROTO LINUX { int settimeofday(struct timeval *tp, \
struct timezone *tzp); }
80 NOPROTO LINUX { int getgroups(u_int gidsetsize, gid_t *gidset); }
81 NOPROTO LINUX { int setgroups(u_int gidsetsize, gid_t *gidset); }
82 STD LINUX { int linux_select(struct linux_select_argv *ptr); }
83 STD LINUX { int linux_symlink(char *path, char *to); }
84 NOPROTO LINUX { int ostat(char *path, struct ostat *up); }
85 STD LINUX { int linux_readlink(char *name, char *buf, \
int count); }
86 STD LINUX { int linux_uselib(char *library); }
87 NOPROTO LINUX { int swapon(char *name); }
88 NOPROTO LINUX { int reboot(int opt); }
89 STD LINUX { int linux_readdir(int fd, struct linux_dirent *dent, \
unsigned int count); }
90 STD LINUX { int linux_mmap(struct linux_mmap_argv *ptr); }
91 NOPROTO LINUX { int munmap(caddr_t addr, int len); }
92 STD LINUX { int linux_truncate(char *path, long length); }
93 NOPROTO LINUX { int oftruncate(int fd, long length); }
94 NOPROTO LINUX { int fchmod(int fd, int mode); }
95 NOPROTO LINUX { int fchown(int fd, int uid, int gid); }
96 NOPROTO LINUX { int getpriority(int which, int who); }
97 NOPROTO LINUX { int setpriority(int which, int who, int prio); }
98 NOPROTO LINUX { int profil(caddr_t samples, u_int size, \
u_int offset, u_int scale); }
99 STD LINUX { int linux_statfs(char *path, \
struct linux_statfs_buf *buf); }
100 STD LINUX { int linux_fstatfs(int fd, \
struct linux_statfs_buf *buf); }
101 STD LINUX { int linux_ioperm(unsigned int lo, \
unsigned int hi, int val); }
102 STD LINUX { int linux_socketcall(int what, void *args); }
103 STD LINUX { int linux_ksyslog(int what); }
104 STD LINUX { int linux_setitimer(u_int which, \
struct itimerval *itv, struct itimerval *oitv); }
105 STD LINUX { int linux_getitimer(u_int which, \
struct itimerval *itv); }
106 STD LINUX { int linux_newstat(char *path, \
struct linux_newstat *buf); }
107 STD LINUX { int linux_newlstat(char *path, \
struct linux_newstat *buf); }
108 STD LINUX { int linux_newfstat(int fd, struct linux_newstat *buf); }
109 STD LINUX { int linux_uname(struct linux_old_utsname *up); }
110 STD LINUX { int linux_iopl(int level); }
111 STD LINUX { int linux_vhangup(void); }
112 STD LINUX { int linux_idle(void); }
113 STD LINUX { int linux_vm86(void); }
114 STD LINUX { int linux_wait4(int pid, int *status, \
int options, struct rusage *rusage); }
115 STD LINUX { int linux_swapoff(void); }
116 STD LINUX { int linux_sysinfo(void); }
117 STD LINUX { int linux_ipc(int what, int arg1, int arg2, int arg3, \
caddr_t ptr); }
118 NOPROTO LINUX { int fsync(int fd); }
119 STD LINUX { int linux_sigreturn(struct linux_sigcontext *scp); }
access
These patches enables us to play quake2 .
Support linux keyboard ioctl for setting RAW, MEDIUMRAW and XLATE.
Support linux virtual terminal operations:
OPENQRY, GETMODE, SETMODE, GETSTATE, ACTIVATE, and WAITACTIVE.
Submitted by: Amancio Hasty <hasty@rah.star-gate.com>
- emulate Linux IP_HDRINCL behaviour in sendto(): byte order fixed
Note that we do an extra getsockopt() on every sendto()
to check if the option is set because we don't keep state
in the emulator code. Is there a better way to implement
this?
- correct a bug (value of "name" not passed) with
getsockopt()
Submitted by: pb@fasterix.freenix.org (Pierre Beyssac)
LINUX_SNDCTL_DSP_GETOPTR
LINUX_SNDCTL_DSP_GETIPTR
LINUX_SNDCTL_DSP_SETTRIGGER
LINUX_SNDCTL_DSP_GETCAPS
With this rev level the linux realaudio player 5 and xquake should work.
it in struct proc instead.
This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.
I have not removed the /*ARGSUSED*/, they will require some looking at.
libkvm, ps and other userland struct proc frobbing programs will need
recompiled.
license managers to obtain the host's ethernet address as
a key.
Note that this implementation takes the first hardware address for
the first ethernet interface found, and disregards the interface name
that may be passed in, as linux ethernet devices are all "ethX".
fork. (On my machine, fork is about 240usecs, vfork is 78usecs.)
Implement rfork(!RFPROC !RFMEM), which allows a thread to divorce its memory
from the other threads of a group.
Implement rfork(!RFPROC RFCFDG), which closes all file descriptors, eliminating
possible existing shares with other threads/processes.
Implement rfork(!RFPROC RFFDG), which divorces the file descriptors for a
thread from the rest of the group.
Fix the case where a thread does an exec. It is almost nonsense for a thread
to modify the other threads address space by an exec, so we
now automatically divorce the address space before modifying it.
the directory format (ext2fs, cd9660). For these filesystems, it must use
cookies to find the correct offset to use for subsequent reads. Without it,
linux /bin/ls tends to loop re-reading the same block over and over again.
2.2 candidate.
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.
The system boots and can mount UFS filesystems.
Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
Mount_std mounts will not work until the getfsent
library routine is changed.
Reviewed by: various people
Submitted by: Jeffery Hsu <hsu@freebsd.org>
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.
Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.
Broke locking on named pipes in the same way as locking on non-vnodes
(wrong errno). This will be fixed later.
The fix involves negative logic. Named pipes are now distinguished from
other types of files with vnodes, and there is additional code to handle
vnodes and named pipes in the same way only where that makes sense (not
for lseek, locking or TIOCSCTTY).
list of IP setsockopts the Linux emulator recognizes.
Explicitly disallow IP_HDRINCL since Linux's handling of
raw output is different than BSD's.
Closes PR#kern/2111.
Submitted by: y-nakaga@ccs.mt.nec.co.jp (Yoshihisa NAKAGAWA)
the one place that depended on it. wakeup() is now prototyped in
<sys/systm.h> so that it is normally visible.
Added nested include of <sys/queue.h> in <vm/vm_object.h>. The queue
macros are a more fundamental prerequisite for <vm/vm_object.h> than
the wakeup prototype and previously happened to be included by
namespace pollution from <sys/proc.h> or elsewhere.
so that the compiler can see that it is OK to use const strings in
NDINIT(). Some emulators want to use paths of the form "/compat/foo".
Removed the casts that hid the non-problem. Didn't fix the missing
consts in syscalls.master that hid the non-problem.
buffer in certain error conditions. Sync up the code to that in NetBSD
where applicable.
Reviewed by: Gary Jennejohn <garyj@munich.netsurf.de>
Submitted by: Michael Smith <msmith@atrad.adelaide.edu.au>
Obtained from: NetBSD sources
vm_offset_t is currently unsigned long but should probably be plain
unsigned for i386's to match the choice of minimal types to represent
for fixed-width types in Lite2. Anyway, it shouldn't be assumed
to be unsigned long.
I only fixed the type mismatches that were detected when I changed
vm_offset_t to unsigned. Only pointer type mismatches were detected.
To complete this, some extra state has to be kept somewhere so that the
B38400 flag in Linux can be correctly translated to/from either 38400,
57600 or 115200.
Submitted by: Robert Sanders <rsanders@mindspring.com>
this code was not quite right (linux has a readdir and getdents syscall,
with the same args. readdir only returns one entry and uses a mutant
dirent structure. This code was also returning the mutant form for
getdents as well. My fault for missing this before.)
Compile and link a new kernel, that will give native ELF support, and
provide the hooks for other ELF interpreters as well.
To make native ELF binaries use John Polstras elf-kit-1.0.1..
For the time being also use his ld-elf.so.1 and put it in
/usr/libexec.
The Linux emulator has been enhanced to also run ELF binaries, it
is however in its very first incarnation.
Just get some Linux ELF libs (Slackware-3.0) and put them in the
prober place (/compat/linux/...).
I've ben able to run all the Slackware-3.0 binaries I've tried
so far.
(No it won't run quake yet :)
Also, LINUX_POSIX_VDISABLE is \0, FreeBSD's is 0xff. Convert between them.
This enables some more programs to run, including the Livingston Portmaster
utilities (PMtools).
Submitted by: Robert Sanders <rsanders@mindspring.com>
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.
- Optimise the linux a.out loading and uselib system calls so they
take advantage of some of John's recent interface improvements.
Basically, this means they make far less map changes than before.
- Attempt to plug some potentially nasty kernel_map memory leaks..
- Improve support for QMAGIC libs (I only use QMAGIC (ie: a.out libraries from
the slackware 3.0 dist) but this depends on other changes to enhance
the /compat/linux support)
- uselib goes out through a single exit as part of the resource tracking
that I did when closing the resource leaks on errors. This could be
cleaner than what I did, but making a 30-deep nested if/else was not my
idea of fun, neither did I want to repeat the same code 30 times over for
each failure possibility. I guess this function needs to be split into
smaller functions to solve this.
I've been running the Linux Netscape-2.0 (with Java) to test this, and apart
from the long-standing problem with the missing scrollbars, it appears to
still work as before with ZMAGIC libs (and the leaks).. However, I've
been using it with mods for the signal trampoline code for native linux stack
frames on signals and exterminated the blasted sigreturn printf() problem,
so I can't be certain that there is not a dependency on something else.
fstat() syscall, rather than panic("linux newfstat").
(Note: I've extracted this from a larger set of diffs, I'm confident I've
not missed any dependencies but can't modload it to test it on my system)
successfully run linux netscape 2.0b3 with a QMAGIC ld.so and libc/libm
that I found on some linux machine that I _think_ is running slackware 3.0.
There are still problems.. ld.so claims the libraries are the wrong
format, but it still runs anyway.. :-/ The QMAGIC ld.so also screams
about needing ld.so.cache, and running a linux ldconfig is quite
educational. You soon learn to run "chroot /compat/linux /bin/ldconfig"
where ldconfig is living in /compat/linux/bin. :-]
(Lets just say that it puts loads of symlinks in /usr/lib otherwise :-)
Changed vnodep -> vp for consistency with the rest of the kernel, and
changed iparams -> imgp for brevity.
kern_exec.c:
Explicitly initialized some additional parts of the image_params struct
to avoid bzeroing it. Rewrote the set-id code to reduce the number of
logical tests. The rewrite exposed a mostly benign bug in the algorithm:
traced set-id images would get ktracing disabled even if the set-id didn't
happen for other reasons.
Obtained from: other people on the net ?
1. stepping over syscalls (gdb ni) sends you to DDB, and returned
to the wrong address afterwards, with or without DDB. patch in
i386/i386/trap.c below.
2. the linux emulator (modload'ed) still causes panics with DIAGNOSTIC,
re-applied a patch posted to one of the lists...
Submitted by: terry (terry lambert)
This is a composite of 3 patch sets submitted by terry.
they are:
New low-level init code that supports loadbal modules better
some cleanups in the namei code to help terry in 16-bit character support
some changes to the mount-root code to make it a little more
modular..
NOTE: mounting root off cdrom or NFS MIGHT be broken as I haven't been able
to test those cases..
certainly mounting root of disk still works just fine..
mfs should work but is untested. (tomorrows task)
The low level init stuff includes a total rewrite of init_main.c
to make it possible for new modules to have an init phase by simply
adding an entry to a TEXT_SET (or is it DATA_SET) list. thus a new module can
be added to the kernel without editing any other files other than the
'files' file.
calls with a byte size of 1. This special case was not
correctly emulated. Now programs such as a simple 'ls' to a commercial
Macintosh emulator called 'executor' will work correctly.