Commit Graph

348 Commits

Author SHA1 Message Date
Jonathan Lemon
2459336973 Allow debugging output to be controlled on a per-syscall granularity.
Also clean up debugging output in a slightly more uniform fashion.

The default behavior remains the same (all debugging output is turned on)
2001-02-16 16:40:43 +00:00
Jonathan Lemon
a25f3493bc Re-gen auto generated files. 2001-02-16 14:47:24 +00:00
Jonathan Lemon
3417b54986 Remove dummy stub functions. 2001-02-16 14:46:16 +00:00
Jonathan Lemon
705deb78a3 Add mount syscall to linux emulation. Also improve emulation of reboot. 2001-02-16 14:42:11 +00:00
John Baldwin
611d940790 Proc locking. 2001-01-24 00:27:28 +00:00
John Baldwin
fdfdfb786a - Proc locking.
- Use NULL instead of 0.
2001-01-24 00:23:30 +00:00
Dag-Erling Smørgrav
158eb2773f The Linuxulator needs sysvipc to work. 2001-01-14 18:16:01 +00:00
Dag-Erling Smørgrav
c094d916c4 Remove after repo-copy to sys/compat/linprocfs. 2000-12-12 22:01:59 +00:00
Dag-Erling Smørgrav
b51a26edb2 Add proc/<pid>/cmdline. 2000-12-09 16:20:48 +00:00
Dag-Erling Smørgrav
8b5a844af9 Add a dependency on procfs. 2000-12-09 16:20:35 +00:00
Dag-Erling Smørgrav
f786d43aac A bunch of fixes that have been rotting in my tree for a month or two
waiting for procfs to get fixed:

  - Use fill_eproc() to obtain correct VM stats. Attempt to compute VmLib.

  - Fill some more fields in proc/<pid>/stat, and add four (unimplemented)
    fields after studying a recent Linux kernel.

  - Compute CPU frequency only once instead of twice.

  - Fix some comments that were OBE.

  - Fix indentation except where it makes the code less readable.
2000-12-09 13:25:54 +00:00
John Baldwin
0de7d1da20 Protect access to p_stat with sched_lock. 2000-12-01 06:34:19 +00:00
Marcel Moolenaar
d034d459da Don't use p->p_sigstk.ss_flags to keep state of whether the
process is on the alternate stack or not. For compatibility
with sigstack(2) state is being updated if such is needed.

We now determine whether the process is on the alternate
stack by looking at its stack pointer. This allows a process
to siglongjmp from a signal handler on the alternate stack
to the place of the sigsetjmp on the normal stack. When
maintaining state, this would have invalidated the state
information and causing a subsequent signal to be delivered
on the normal stack instead of the alternate stack.

PR: 22286
2000-11-30 05:23:49 +00:00
Dag-Erling Smørgrav
fbbd9aebdd Add bogomips to cpuinfo (set it equal to the CPU frequency, which is bogus
but not more so than Linux' definition).
This should get the IBM JDK 1.3 working again.

Prompted by:	sobomax
2000-11-27 11:10:03 +00:00
Jonathan Lemon
14db7f978b Correct a misnamed argument hidden behind a #ifdef DEBUG
Found by:  LINT
2000-11-25 07:04:43 +00:00
Marcel Moolenaar
cc6ca9b35c o Change the argument of linux_sigreturn to be a pointer to a
struct sigframe. We need more than only the signal context.

o  Properly convert the signal mask when setting up the signal
   frame in linux_sendsig and properly convert it back in
   linux_sigreturn.

Do some cleanups and improve style while here.
2000-11-23 08:55:30 +00:00
Marcel Moolenaar
e26cc4467b Change the argument of linux_sigreturn to be a pointer to a
struct sigframe.
2000-11-23 08:53:19 +00:00
Marcel Moolenaar
466b14d758 Don't unregister the ioctl handlers before we verified we
can unload. Doing so leaves the linuxulator in a crippled
state (no ioctl support) when Linux binaries are run at
unload time.

While here, consistently spell ELF in capitals and perform
some minor style improvements.

ELF spelling submitted by: asmodai
2000-11-23 03:21:58 +00:00
Andrew Gallatin
088638dae4 remove redundant declaration of bsd_to_linux_sigset()
reviewed by: marcel
2000-11-16 02:08:40 +00:00
Andrew Gallatin
b595ab370b fix glaring bugs in rt signals -- copyout the right signal mask in
linux_rt_sendsig() and restore the same signal mask linux does
in rt_sigreturn().  This gets us saving/restoring all 64-bits of the
linux sigset_t in rt signals.

Reviewed by: marcel
2000-11-16 02:07:05 +00:00
Andrew Gallatin
2c4ab9ddfa Make linux_sendsig and linux_sigreturn use all 64 bits of a
linux_sigset_t by updating the linux_sigframe struct so as to include
linux's "extramask" field.  This field contains the upper 32-bits of
the sigset.  extramask sits behind a linux_fpstate struct, which I've
defined primarily for padding purposes.

While we're here, define LINUX_NSIG in terms of LINUX_NBPW (32) and
LINUX_NSIG_WORDS (2).

This fixes problems where threaded apps would accumulate a large
number of zombies.  This was happening because the exit signal resides
in the upper 32-bits of the sigset and was never getting unmasked by
the manager thread after the first child exited.

PR: 		misc/18530  (may be related, originator not yet contacted)
Reviewed by:	marcel
2000-11-13 20:44:05 +00:00
Marcel Moolenaar
ebea866055 Revert auto-generation. The Alpha port is broken.
Syncing with it is wrong.
2000-11-10 21:30:19 +00:00
Marcel Moolenaar
806d7daafe Make MINSIGSTKSZ machine dependent, and have the sigaltstack
syscall compare against a variable sv_minsigstksz in struct
sysentvec as to properly take the size of the machine- and
ABI dependent struct sigframe into account.

The SVR4 and iBCS2 modules continue to have a minsigstksz of
8192 to preserve behavior. The real values (if different) are
not known at this time. Other ABI modules use the real
values.

The native MINSIGSTKSZ is now defined as follows:

Arch		MINSIGSTKSZ
----		-----------
alpha		    4096
i386		    2048
ia64		   12288

Reviewed by: mjacob
Suggested by: bde
2000-11-09 08:25:48 +00:00
Marcel Moolenaar
2da829a0c8 Sync with Alpha:
Do not use sysent.c, proto.h and syscall.h in source tree;
use auto-generated versions.
2000-11-09 07:27:55 +00:00
Dag-Erling Smørgrav
fd9f324055 Check that p->p_pptr is not NULL - kernel processes have no parents! 2000-11-06 03:23:56 +00:00
David E. O'Brien
83d2913008 Make the target a little bit more generic. 2000-11-01 08:47:34 +00:00
Andrew Gallatin
84aa58ab03 fix the sigaltstack hack by lowering the stack size to the original value
if the request was for less than MINSIGSTKSZ (in which case we "round up").
discussed with: marcel
2000-10-31 03:10:41 +00:00
Poul-Henning Kamp
da936bf80a Remove unneeded <stddef.h> #includes. 2000-10-29 16:57:42 +00:00
Dag-Erling Smørgrav
f8c05e5019 Bring cpuinfo closer to what it looks like in Linux 2.2.
Submitted by:	R Bradford Jones <brad@kazrak.com>
2000-10-25 22:38:23 +00:00
Dag-Erling Smørgrav
886a6f6fca Add /proc/<pid>/status and /proc/<pid>/stat (the latter being mostly
zeroes for the time being).

Prompted by:	Nathan Boeger <nathan@khmere.com>
2000-10-25 22:12:59 +00:00
Andrew Gallatin
242fae60f0 Some linux apps, such as IBM's JDK 1.3, will attempt to mmap thread
stacks near the top of their address space.  If their TOS is greater
than vm_maxsaddr, vm_map_growstack() will confuse the thread stack
with the process stack and deliver a SEGV if they attempt to grow the
thread stack past their current stacksize rlimit.  To avoid this,
adjust vm_maxsaddr upwards to reflect the current stacksize rlimit
rather than the maximum possible stacksize.  It would be better to
adjust the mmap'ed region, but some apps (again, IBM's JDK 1.3) do not
check mmap's return value..

This commit (in conjunction with setting MINSIGSTKSZ to 2048 &
rebuilding your kernel and modules) will get IBM's JDK 1.3 working
with FreeBSD at least well enough to run many of the example applets.

Reviewed by: marcel
Tested by:   sto@stat.duke.edu, many others on freebsd-java@
2000-10-17 00:25:43 +00:00
Andrew Gallatin
21b0b22ce3 regen after addition of linux_rt_sigreturn 2000-10-17 00:03:02 +00:00
Andrew Gallatin
7936339495 A start at an implemention of linux_rt_sendsig & linux_rt_sigreturn
and associated user-level signal trampoline glue.

Without this patch, an SA_SIGINFO style handler can be installed by a linux
app, but if the handler accesses its sip argument, it will get a garbage
pointer and likely segfault.

We currently supply a valid pointer, but its contents are mainly
garbage.  Filling this in properly is future work.

This is the second of 3 commits that will get IBM's JDK 1.3 working with
FreeBSD ...
2000-10-17 00:00:20 +00:00
Andrew Gallatin
931a725809 This is the first of 3 commits that will get IBM's JDK 1.3 working
with FreeBSD (not including the MINSIGSTKSZ issue, which belongs to
Marcel).  Due to time constraints, I'm going to space them out over a
few days.

This fixes two problems with linux_sigaltstack()

o ss == 0 is perfectly valid use, so do not fail in this case.

o Fix flag handling:
 - Our SS_DISABLE is 4, linux's is 2, so we need conversion routines.
	These conversion routines will be needed by linux_rt_sendsig()
	and linux_rt_sigreturn (forthcoming), so they are not static.
 - Linux's flag 0 historically meant SS_ONSTACK according to a comment
	in their linux/kernel/signal.c file.

Among other things, this fixes a warning from Sun's JDK 1.3:
"Java HotSpot(TM) Client VM warning: cannot uninstall alt signal stack"

Reviewed by: marcel
Tested by:   sto@stat.duke.edu, many others on freebsd-java@
2000-10-13 01:57:43 +00:00
Dag-Erling Smørgrav
e57416dc56 Mark directories as directories, not as regular files. 2000-10-10 12:32:44 +00:00
Dag-Erling Smørgrav
cd595ef506 Fix cut'n'paste bogon.
Submitted by:	Jim Pirzyk <Jim.Pirzyk@disney.com>
2000-09-18 17:46:01 +00:00
Dag-Erling Smørgrav
fecfecfbd0 Remove unused variables. 2000-09-09 14:35:35 +00:00
Dag-Erling Smørgrav
ddc0b9925d Add stat, uptime and version.
Note that version currently returns the first line of the version string
from vers.c, which is not quite what a Linux system would return.
2000-09-09 11:44:58 +00:00
Dag-Erling Smørgrav
81dc16f619 Pierre Beyssac originally derived linprocfs from procfs, and I've made (and
will keep making) significant modifications, so I'm adding both our copyrights
to the top of these files.
2000-09-07 16:44:26 +00:00
Marcel Moolenaar
dee4ec33cf When sigaltstack is called with a stack size that's not smaller
than LINUX_MINSIGSTKSZ but smaller than MINSIGSTKSZ, cheat and
pass MINSIGSTKSZ to the kernel. This is a workaround.

Submitted through: nate
2000-09-06 06:08:54 +00:00
Dag-Erling Smørgrav
9acf7ab9bc Remove obsolete comment (see rev 1.84 of procfs_vnops.c) 2000-09-04 18:19:04 +00:00
Robert Watson
c0ea0959b8 o Synchronize linprocfs authorization with procfs authorization improvements
(better hiding of hidden processes, more access checks, use vaccess(), et
  al)

Approved by:	des
Obtained from:	TrustedBSD Project
2000-09-01 18:40:52 +00:00
Robert Watson
9cd5f4c13b o Update linprocfs to include similar changes as those in procfs, fixing
the build (oops!): replace calls to p_trespass() and PRISON_CHECK()
  with p_can(..., {P_CAN_SEE, P_CAN_DEBUG}, NULL)
o Remove volatile usage from procfs_readdir() to remove warnings
o Apply bp's CREATE fix to linprocfs, causing EROFS to be returned on
  CREATE calls to procfs_lookup()
o Some further synchronization still needs to occur: only existing
  access checks were replaced, to fix the build--the new ones were not
  added.  I'll do this later today, this is a "fix the build quickly"
  commit.  This means that, in the interim, some information leakage
  can still occur via linprocfs when using jail or kern.ps_showallprocs

Submitted by:	knu
Approved by:	des
Obtained from:	TrustedBSD Project
2000-08-30 13:23:19 +00:00
Marcel Moolenaar
bc34729c47 Fix typo in license. 2000-08-25 07:32:24 +00:00
Marcel Moolenaar
3ed7f6a56f Finish the Linuxulator MD/MI split.
In summary:
o  This file has been moved to sys/compat/linux,
o  Any MD syscalls in this file are moved to
   linux_machdep.c in sys/i386/linux,
o  Include directives, makefiles and config files
   have been updated.
2000-08-22 07:08:33 +00:00
Marcel Moolenaar
322bfdc330 Update include directives for Linuxulator headers after the
MD/MI split.
2000-08-22 05:57:55 +00:00
Marcel Moolenaar
146aad745b Collect the MD syscalls from /sys/compat/linux here. Since this
is a new file, fix most of the style bugs at the same time.
2000-08-22 02:24:02 +00:00
Bruce Evans
c6e4d7c5ba Fixed null pointer panic for accessing "meminfo" when there is no swap. 2000-08-12 21:08:42 +00:00
Peter Wemm
3a285cc807 Regen. (Fix SYS_exit) 2000-07-29 10:07:38 +00:00
Peter Wemm
4e0f152bbe Sigh. Fix SYS_exit problems. I misunderstood the significance of these
trailing options.
2000-07-29 10:05:25 +00:00