Commit Graph

259 Commits

Author SHA1 Message Date
Marcel Moolenaar
759eb4613e Return Linux kernel version 2.2.12 by default. This is in line
with linux_base-6.1.
2000-01-10 13:09:08 +00:00
Bruce Evans
31399cd05e Removed bogus include of opt_global.h. opt_global.h is automatically
included in all C files if it makes sense (i.e., for compiling kernels
but not for compiling modules), so including it explicitly just
complicates module makefiles.
2000-01-09 12:29:45 +00:00
Marcel Moolenaar
dca60efcc9 Convert the filesystem type returned in struct statfs by syscalls
linux_statfs and linux_fstatfs. Linux binaries testing this expect
the filesystem's magic number and not our vnode's tag.

PR: 15425
Tested by: Vladimir N. Silyaev <vsilyaev@mindspring.com>
2000-01-08 21:09:41 +00:00
Mark Newton
196d6399bb Need to #include vm_zone.h to pick up inline definition of zfree() so that
NDFREE() macro from namei.h will be happy.
2000-01-03 20:34:39 +00:00
Eivind Eklund
762e6b856c Introduce NDFREE (and remove VOP_ABORTOP) 1999-12-15 23:02:35 +00:00
Mark Newton
268b6cb68e Replace the svr4_sys_getdents64() routine with a port of linux_getdents() --
differences between the VFS interface between FreeBSD and NetBSD make
it easier to pick up the Linux one than to continue development with the
NetBSD port.

This patch fixes a bug which caused duplicate filenames to be seen by
callers to svr4_sys_getdents64(), leading to malformed directory listings
from Solaris client programs.

Obtained from:	The Linuxulator, with a pointer from marcel
1999-12-12 11:25:33 +00:00
Mark Newton
84fbe5a0ba Avoid excessive redundancy in svr4_sys_getmsg() and svr4_sys_putmsg():
Only look up the provided descriptor in fd_ofiles[] once.

Submitted by:	Ville-Pertti Keinone <will@iki.fi>
1999-12-12 10:28:30 +00:00
Mark Newton
ce12799bad fd_revoke() shouldn't panic if the descriptor provided is not a file or
socket.  Return EINVAL instead.

Submitted by:	Ville-Pertti Keinone <will@iki.fi>
1999-12-12 10:27:04 +00:00
Marcel Moolenaar
af3a75ec0d Remove unused includes.
Found by: phk-scan
1999-12-10 12:36:20 +00:00
Mark Newton
68d6a0593b Remove unnecessary includes
Prodded by:	phk
1999-12-08 12:01:59 +00:00
Mark Newton
6d6fd92936 SVR4 emulator source files now take their compilation options from
opt_global.h and opt_svr4.h, instead of from the command line.  This
brings them in-line with most of the rest of the kernel.

svr4_ioctl.c has also failed to compile with debugging for a while
now;  fixed by adding systm.h and socketvar.

Some svr4 source files are automatically generated from syscalls.master;
these have been committed as consequential changes, otherwise everyone
will have to "make svr4_sysent.c".

Changes:

sys/svr4/svr4.h			include opt_global.h and opt_svr4.h
sys/svr4/svr4_ioctl.c		include svr4.h, sys/systm.h and sys/socketvar.h
sys/svr4/svr4_ipc.c		include svr4.h
sys/svr4/svr4_resource.c 	include svr4.h
sys/svr4/svr4_socket.c		include svr4.h
sys/svr4/svr4_ttold.c		include svr4.h
sys/svr4/syscalls.master	include svr4.h
sys/svr4/svr4_syscallnames.c	dependent on syscalls.master
sys/svr4/svr4_sysent.c		dependent on syscalls.master
sys/svr4/svr4_syscall.h		dependent on syscalls.master
sys/svr4/svr4_proto.h		dependent on syscalls.master
sys/modules/svr4/Makefile	create opt_global.h and opt_svr4.h
1999-12-08 10:51:17 +00:00
Archie Cobbs
7ec7564af4 Fix LINT breakage. 1999-12-05 18:49:09 +00:00
Marcel Moolenaar
43bef51567 Implement pluggable ioctl handlers.
Other modules can register and unregister ioctl handlers to extend the
ioctls known by the Linuxulator. A recent application is the vmware
port. The Linuxulator itself uses the new interface to register its
handlers as well. Handlers for the following types of ioctls have been
defined:
	cdrom
	console (=keyboard and VT handling)
	socket
	sound
	termio

All ioctl related defines and declarations have been moved to a new
file (linux_ioctl.h), except for the pluggable ioctl handler interface
definition.

While there, cleanup linux.h some more.

linux.h and linux_ioctl.[ch] have been made to conform to style(9) as
much as possible.

Inspired and reviewed by: Vladimir N. Silyaev
1999-12-04 11:10:22 +00:00
Marcel Moolenaar
ec99e32256 Implement linux_sigaltstack. 1999-11-30 15:02:28 +00:00
Alfred Perlstein
fac9a03b4e add linuxulator wrapper for SNDCTL_DSP_GETODELAY 1999-11-29 23:03:34 +00:00
Marcel Moolenaar
408da11907 Implement linux_ustat.
Reviewed by: bde
1999-11-27 16:55:14 +00:00
Marcel Moolenaar
25e5bdab9e Implement fdatasync in terms of fsync. The regeneration of proto.h,
syscall.h and sysent.h was probably forgotten after the last change
syscalls.master.
1999-11-26 10:20:10 +00:00
Poul-Henning Kamp
9b962c56a4 General clean-up of socket.h and associated sources to synchronise up
with NetBSD and the Single Unix Specification v2.

This updates some structures with other, almost equivalent types and
effort is under way to get the whole more consistent.

Also removes a double definition of INET6 and some other clean-ups.

Reviewed by: green, bde, phk
Some part obtained from: NetBSD, SUSv2 specification
1999-11-24 20:49:04 +00:00
Poul-Henning Kamp
da654d9070 s/p_cred->pc_ucred/p_ucred/g 1999-11-21 12:38:21 +00:00
Poul-Henning Kamp
3e30338edd simplify check for device. 1999-11-08 09:59:17 +00:00
Peter Wemm
53c2c4e22b Use fo_stat() rather than Yet Another duplication of kern_descrip.c's stat
code.
1999-11-08 03:33:21 +00:00
Poul-Henning Kamp
923502ff91 useracc() the prequel:
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.
1999-10-29 18:09:36 +00:00
Marcel Moolenaar
5a02dbe45a Fix the duplicate filenames that are the result of using getdents.
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.
1999-10-21 09:14:49 +00:00
Mark Newton
ea5216bcc7 Remove unnecessary includes.
phk's script walked through .c and .h files, but some of the ones on
the list are actually derived from sys/svr4/syscalls.master.  Make
the necessary changes here and the others will implicitly follow...

Submitted by:	phk
1999-10-17 14:50:13 +00:00
Mark Newton
aa13b40be1 Remove unnecessary includes.
Submitted by:	phk
1999-10-17 14:44:48 +00:00
Luoqi Chen
645682fd40 Add a per-signal flag to mark handlers registered with osigaction, so we
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
1999-10-11 20:33:17 +00:00
John Hay
5cdfd8f709 Swap IOC_OUT and IOC_IN for the SETDIR macro. The linux ioctl read and
write bits are swapped.

Reviewed by:	luoqi, marcel
1999-10-06 19:51:37 +00:00
Nick Hibma
3e2c6ca3b9 Removal of sys/device.h
- Move intrhook stuff into kernel.h
- Remove all occurrences of #device <device.h>
- Add kernel.h were necessary (nowhere)
- delete device.h

This file contained the structures for cfdata (old style config) and is no
longer used. It was included by most drivers.

It confuses the remote debugger as the definition of 'struct device' in
device.h is found before the one in bus_private.h.
1999-10-05 21:19:41 +00:00
Peter Wemm
a1edd2ae7d Oops. That'll teach me to commit without testing. I either replaced
one trigraph with another, or completely missed the point.  Kill it for
real this time.
1999-10-01 14:26:28 +00:00
Peter Wemm
34f8c21730 Zap a trigraph (???) 1999-10-01 14:23:36 +00:00
Marcel Moolenaar
956d3333ca sigset_t change (part 4 of 5)
-----------------------------

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.
1999-09-29 15:12:18 +00:00
Poul-Henning Kamp
ae8e1d08d7 This patch clears the way for removing a number of tty related
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
1999-09-25 16:21:39 +00:00
Marcel Moolenaar
1beb0dc732 Linux doesn't complain if you remove a msg queue that doesn't exist
(given the proper permissions).
1999-09-23 09:57:45 +00:00
Luoqi Chen
2323686abc Implement linux_ioperm() syscall. Fix linux_iopl() to use the level argument.
SVGAlib should now work.

Reviewed by:	marcel
1999-09-22 22:01:51 +00:00
Brian Feldman
13ccadd4b0 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
Marcel Moolenaar
13d9e61a67 Fix getcwd. It must return the length of the path including the terminating 0.
While I'm here, fix style and debug printf.

Fix derived from patch by: Darryl Okahata <darrylo@sr.hp.com>
1999-09-17 08:35:08 +00:00
Peter Wemm
5a90d999a9 <machine/soundcard.h> -> <sys/soundcard.h>, since it's an exported API
that's arch neutral and OSS API and Linux API compatable.
1999-09-04 14:15:26 +00:00
Marcel Moolenaar
6771d80337 I missed the namechange of field desc in struct i386_ldt_args into descs while
reviewing luoqi's changes...

Pointed out by: luoqi
1999-09-03 06:18:39 +00:00
Marcel Moolenaar
ff78e85043 Implementation of the modify_ldt syscall. Use the sysarch() interface to do
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
1999-09-02 21:50:42 +00:00
Mark Newton
c2de70091b Add MAINTAINER line 1999-09-01 00:32:18 +00:00
Marcel Moolenaar
e459b442df Fix a braino: Linux minor device numbers are 8 bits wide and not 10. 1999-08-29 11:47:01 +00:00
Marcel Moolenaar
d4c45842d7 Fix a missing '-1' in the size argument of copyout in getgroups. Spotted while
reviewing the MFC in -stable.
1999-08-29 08:52:38 +00:00
Marcel Moolenaar
86f95e6b6d Implement the OSS_GETVERSION ioctl. The version returned can be changed through
the sysctl variable `compat.linux.oss_version'.

PR: 12917
Originator: Dean Lombardo <dlombardo@excite.com>
1999-08-28 08:43:03 +00:00
Peter Wemm
280652828b $Id$ -> $FreeBSD$ 1999-08-28 02:16:32 +00:00
Peter Wemm
c3aac50f28 $Id$ -> $FreeBSD$ 1999-08-28 01:08:13 +00:00
Marcel Moolenaar
c6dfea0ebd Add sysctl variables for the Linuxulator. These reside under `compat.linux' as
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
1999-08-27 19:47:41 +00:00
Poul-Henning Kamp
dbafb3660f Simplify the handling of VCHR and VBLK vnodes using the new dev_t:
Make the alias list a SLIST.

        Drop the "fast recycling" optimization of vnodes (including
        the returning of a prexisting but stale vnode from checkalias).
        It doesn't buy us anything now that we don't hardlimit
        vnodes anymore.

        Rename checkalias2() and checkalias() to addalias() and
        addaliasu() - which takes dev_t and udev_t arg respectively.

        Make the revoke syscalls use vcount() instead of VALIASED.

        Remove VALIASED flag, we don't need it now and it is faster
        to traverse the much shorter lists than to maintain the
        flag.

        vfs_mountedon() can check the dev_t directly, all the vnodes
        point to the same one.

Print the devicename in specfs/vprint().

Remove a couple of stale LFS vnode flags.

Remove unimplemented/unused LK_DRAINED;
1999-08-26 14:53:31 +00:00
Marcel Moolenaar
4e0eaf6924 Fix linux_newlstat in that it doesn't return the attributes of its containing
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
1999-08-25 15:23:54 +00:00
Marcel Moolenaar
c85f67175f Fix {g|s}etgroups semantics. We use cr_groups[0] to hold egid. This means that
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
1999-08-25 14:11:01 +00:00
Marcel Moolenaar
2fdc82e093 Change all UNIMPL syscalls to STD and add them to linux_dummy. Now we always
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.
1999-08-25 11:19:03 +00:00
Marcel Moolenaar
4c60745daf Fix a bug in debug-printfs of struct linux_termios fields, where I forgot to
change the format specifier after changing the definition of the structure.

Submitted by: billf
Commented on by: bde
1999-08-17 10:27:55 +00:00
Marcel Moolenaar
ce2b2a92fc Fix bug in the debug-printf of the vfork syscall, where the format specifier
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
1999-08-17 10:09:06 +00:00
Marcel Moolenaar
42035021f5 Implement linux_vfork() syscall by calling vfork(). Analogous to the
linux_fork() implementation.
1999-08-16 11:49:30 +00:00
Marcel Moolenaar
a171f5adb6 Provide wrappers for sched_{s|g}etscheduler. We need to convert the policy
argument.

PR: 12006
Originator: Jean-Claude MICHOT <jcmichot@teaser.fr>
1999-08-15 17:28:40 +00:00
Marcel Moolenaar
dc6f939870 Fix bug in the fcntl syscall where 'arg' was not set properly.
PR: 12147
Submitted by: Allan Saddi <asaddi@philosophysw.com>
1999-08-15 14:22:30 +00:00
Marcel Moolenaar
20c661befb Include opt_compat.h so that COMPAT_43 is defined. This gives us the proper
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
1999-08-15 13:28:35 +00:00
Marcel Moolenaar
81d960fa6d Implementation of the linux_getcwd syscall. 1999-08-14 18:20:44 +00:00
Marcel Moolenaar
06ebbe77ed Implementation of linux_rt_sigaction and linux_rt_sigprocmask syscalls. Both
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.
1999-08-14 17:28:46 +00:00
Marcel Moolenaar
3bde119b1e Fix LINUX_TIOC{S|G}SERIAL implementation. Both do not copy data in or out
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...
1999-08-14 13:26:44 +00:00
Mark Newton
5462f43fb0 Avoid possible panic by checking for EFAULT from copyinstr() during
pathname translation.

Submitted by:	green
1999-08-14 10:52:33 +00:00
Marcel Moolenaar
86cfb28d8d Fix the LINUX_TCSET{A|AW|AF} and LINUX_TCSET{S|SW|SF} ioctls. These all suffer
from the same bug in that the argument is not first copied from user space
before it is used. This is part 2 (of 2) of the termios fixes.
1999-08-14 10:30:38 +00:00
Marcel Moolenaar
432d528c8d Fix a couple of termio/termios conversion bugs/typos/dupos/brainos and other
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.
1999-08-14 10:05:50 +00:00
Marcel Moolenaar
7636612d50 Implementation of the CDROMSUBCHNL ioctl. 1999-08-13 14:44:13 +00:00
Marcel Moolenaar
0839a7e83d In doing lock type conversion (struct flock), make sure that carbage in results
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>
1999-08-13 09:27:54 +00:00
Marcel Moolenaar
00d3c51669 Use a wrapper for the link syscall that does name translations.
PR: 12749
Submitted by: Boris Nikolaus <boris@cs.tu-berlin.de>
1999-08-12 19:53:33 +00:00
Marcel Moolenaar
175db64b3e Do not map {s|g}etrlimit onto FreeBSD syscalls. The arguments don't match.
The linux syscalls translate the arguments first before invoking the
FreeBSD native syscalls.

PR: kern/9591
Originator: John Plevyak <jplevyak@inktomi.com>
1999-08-11 13:34:31 +00:00
Marcel Moolenaar
6a6ea79ac8 Fix page fault in linux_uselib syscall.
PR: 12910
Submitted by: Peter Holm <peter@holm.cc>
1999-08-08 11:26:46 +00:00
Brian Feldman
942fd180df We don't end up checking for a return value of EFAULT from the copyinstr()
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.
1999-08-07 05:33:35 +00:00
Mark Newton
275d27d822 Previous commit also removed some 'const' qualifiers on args for
svr4_sys_sendto() which probably shouldn't have been 'const'.
1999-07-30 13:44:43 +00:00
Mark Newton
c8f2ce34ac Previous commit also finished cleaning up some dev_t -> udev_t transformations
related to the commit for rev 1.3 of svr4_stat.c.
svr4_sysvec.c also received a copyright message (which is why it grew by
28 lines).
1999-07-30 13:42:56 +00:00
Mark Newton
f46f4cccb8 Fix svr4_sys_poll(); SysV STREAMS produce return values from poll() which
BSD sockets don't.  Guess at a correct emulation for those values (it seems
to work for telnet, ftp and friends)
1999-07-30 13:12:26 +00:00
Mark Newton
587297dc40 Add $Id$ tags 1999-07-30 12:45:21 +00:00
Mark Newton
6ef6864f94 Fix panic caused when *stat64() family of syscalls try to fill-in
their svr4_stat64 structures with old dev_t values instead of udev_t's.
Panic was caused when major() and minor() were called with args which
weren't pointers.  The panic was probably introduced in rev 1.51 of
kern_conf.c
1999-07-30 12:43:30 +00:00
Poul-Henning Kamp
684adedee4 Use the vn_todev() function, rather than VOP_GETATTR 1999-07-18 14:31:01 +00:00
Marcel Moolenaar
3cef63a1f6 Implementation of TCXONC.
Reviewed by: bde
1999-07-17 08:24:57 +00:00
Marcel Moolenaar
68875907c6 Implement VT_RELDISP ioctl
Submitted by: Kazutaka Yokota <yokota@FreeBSD.org>
1999-07-08 16:15:19 +00:00
Marcel Moolenaar
4cf8b502c3 Trivial implementation of TIOCM{S|G}ET and TIOCMBI{S|C} ioctls. No need
to convert the arguments.
1999-07-06 11:41:48 +00:00
Martin Cracauer
8f437f4439 Rename struct members sa_siginfo. POSIX reserves identifiers starting
with sa_ when <signal.h> is included. They would conflict with the
upcoming SA_SIGINFO implementation.

Reviewed by:	BDE
1999-07-06 06:55:29 +00:00
Marcel Moolenaar
19e520961c Let newuname return "Linux" as the OS name and not "FreeBSD". Also, return a
more sensible (for Linux applications) release number. Hardcoding a release
number has its drawbacks, but it will do for now.
1999-07-05 19:18:03 +00:00
Brian Feldman
6989d53551 sys/buf.h needs to have included sys/systm.h for spl prototypes. 1999-07-03 04:56:57 +00:00
Poul-Henning Kamp
bfbb9ce670 Divorce "dev_t" from the "major|minor" bitmap, which is now called
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).
1999-05-11 19:55:07 +00:00
Peter Wemm
0749bbe267 Ack! I deleted "struct", not "const".. Oh boy...
Submitted by:	jkh
1999-05-10 12:38:41 +00:00
Peter Wemm
e37622b251 Fix a couple of warnings and some bitrot in comments. 1999-05-09 16:04:14 +00:00
Poul-Henning Kamp
90fb336860 Yet another place which knew too much. Still not sure how much
good this does in the end.
1999-05-09 10:25:30 +00:00
Poul-Henning Kamp
4be2eb8c49 I got tired of seeing all the cdevsw[major(foo)] all over the place.
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.
1999-05-08 06:40:31 +00:00
Peter Wemm
d5558c001a Fix up a few easy 'assignment used as truth value' and 'suggest parens
around && within ||' type warnings.  I'm pretty sure I have not masked
any problems here, I've committed real problem fixes seperately.
1999-05-06 18:44:42 +00:00
Luoqi Chen
9debe21353 - Handle mixer read ioctls correctly. They have the same group, number and
argument size as their write counterparts and were handled as write ioctls.
- Emulate some cdrom ioctls.
1999-04-29 04:37:57 +00:00
Luoqi Chen
5206bca10a Enable vmspace sharing on SMP. Major changes are,
- %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>
1999-04-28 01:04:33 +00:00
Poul-Henning Kamp
1c308b817a Change suser_xxx() to suser() where it applies. 1999-04-27 12:21:16 +00:00
Poul-Henning Kamp
f711d546d2 Suser() simplification:
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.
1999-04-27 11:18:52 +00:00
Peter Wemm
db42d90829 unifdef -DVM_STACK - it's been on for a while for x86 and was checked
and appeared to be working for the Alpha some time ago.
1999-04-19 14:14:14 +00:00
Peter Wemm
e91896117b Well folks, this is it - The second stage of the removal for build support
for LKM's..
1999-04-17 08:36:07 +00:00
Peter Wemm
6637b74945 Image activators use EXEC_SET(), not TEXT_SET(). (The first is a macro
wrapper for DECLARE_MODULE(), the second is a linker set declaration)
1999-04-17 07:55:15 +00:00
Julian Elischer
4ac9ae7083 Fix thread/process tracking and differentiation for Linux threads emulation.
Submitted by:	Richard Seaman, Jr." <dick@tar.com>

Also clean some compiler warnings in surrounding code.
1999-03-02 00:28:09 +00:00
Mark Newton
0f1110bb5f svr4 emulator will refuse to unload itself if it is currently in use. 1999-02-04 12:43:17 +00:00
Mark Newton
4a735ee8b0 Acquiesce to proc.h for declarations of M_ZOMBIE, M_SUBPROC (and reorder
includes so proc.h knows the right type for 'em).

Suggested by: bde
1999-02-01 13:26:13 +00:00
Mark Newton
871f5df0ef Oops - Ripped out a bit of debugging code which will stop certain bits
of networking from working for people without DEC Tulip ethernet cards.
1999-01-30 09:42:55 +00:00
Mark Newton
f22dd58acc Emulator KLD for SysVR4 executables grabbed from NetBSD.
See http://www.freebsd.org/~newton/freebsd-svr4 for limitations,
capabilities, history and TO-DO list.
1999-01-30 06:29:48 +00:00
Julian Elischer
88c5ea4574 Enable Linux threads support by default.
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>
1999-01-26 02:38:12 +00:00
Mike Smith
096d55fc13 Fix linux sendmsg() emulation
Submitted by:	Brian Feldman <green@unixhelp.org>
1999-01-11 05:28:44 +00:00