Commit Graph

2832 Commits

Author SHA1 Message Date
christos ce8e03cd9f Avoid file use underflow; thanks to YAMAMOTO Takashi for noticing. 2002-04-24 16:09:24 +00:00
christos 7ad1c0f407 Don't forget to set mature and unuse the file. 2002-04-23 17:20:58 +00:00
christos 1261c89715 From OpenBSD, via FreeBSD: If a set{u,g}id binary is invoked with fd < 3
closed, open those fds to /dev/null.

XXX: This needs to be fixed in a better way. The kernel should not need to
know about /dev/null or special case 0, 1, 2.
2002-04-23 15:11:25 +00:00
simonb b0b78e1e37 Fix a white-space nit. 2002-04-20 06:04:35 +00:00
gmcgarry acb682fad2 When searching for devices also skip those deleted by userconf.
Problem reported by uwe.
2002-04-15 05:30:12 +00:00
christos 7d930e8572 Use SESSHOLD and SESSRELE consistently.
Add SESSHOLD and SESSRELE to the t_session, so that we don't have dangling
references [inspired by OpenBSD].
2002-04-12 17:02:33 +00:00
matt 2bf9358fc0 Don't use the tqh_ field names, instead use the correspond TAILQ_* macro. 2002-04-06 08:04:17 +00:00
thorpej 605e664094 vfs_mountroot(): provide more info when we panic. 2002-04-04 01:44:30 +00:00
fvdl c2bf6c9615 Split off the backend of the shmat system call, and find removed segments
if requested. This enables the linux compat code to be bug compatible
(under Linux, shmat() to a removed segment works).
2002-04-03 11:53:01 +00:00
fvdl 8cc2d64d7a Include opt_malloc_debug.h so that debug_malloc will actually be used
when enabled, thankyouverymuch.
2002-04-03 09:45:22 +00:00
simonb 8bcefa5e82 Fix a typo that stopped this compiling in the !LKM case.
Remove the buf2 variable from sysctl_sysvipc(), which was only ever
 assigned to but not used.
2002-04-03 08:06:17 +00:00
rafal 8fcad97302 Fix up linux a.out compat entry after move of emul-related sysctl handler
to struct emul.
2002-04-02 23:56:17 +00:00
jdolecek 3ffbb4470d make emul_sysctl() work with emulations loaded via LKM, properly bound check
name[0]
2002-04-02 20:21:51 +00:00
jdolecek ebd670f0bc move emulation-specific sysctl hook from struct execsw to struct emul,
where it belongs
2002-04-02 20:19:59 +00:00
jdolecek 2e327b16be expose emul_search() 2002-04-02 20:18:06 +00:00
itohy ab5fe01c20 Print ttyinfo *before* (not after) sending SIGINFO to processes.
This generates more useful information of a process who catches SIGINFO,
rather than always printing "runnable" (the process is marked runnable
because of the signal).
Inspired by the behavior of BSD/OS.
2002-03-25 04:26:43 +00:00
jdolecek 943f2b4f8a make COMPAT_11 or COMPAT_12 imply EXEC_ELF_NOTELESSS
use #if for the execsw entries, to allow 'options EXEC_ELF_NOTELESS=0'
  to override this

This addresses kern/13520 and kern/14409 by Matthew Green.
2002-03-23 09:50:54 +00:00
jdolecek 083f26646d rename EXEC_ELF_CATCHALL to EXEC_ELF_NOTELESS 2002-03-23 09:40:55 +00:00
jdolecek 225f07a8d4 Make sure file descriptor is properly FILE_UNUSE()d in error case
of writev(2).
Problem found by Alistair G. Crooks.
2002-03-22 18:58:59 +00:00
christos 195539260e emulation specific sysctls. 2002-03-20 00:27:25 +00:00
oki 075769476a Use /emul/pecoff as prefix to run PE/COFF binaries. 2002-03-18 07:11:06 +00:00
christos 18c7399ada oops, forgot to commit the caller of exithook... 2002-03-17 23:41:30 +00:00
christos 22839acdb9 use the exithook mechanism to clean up semaphores. 2002-03-17 22:21:58 +00:00
christos f7d98e2451 - merge all the hook insertion and deletion code so that we don't create
a fourth copy.
- add exithook to be executed when a process exits.
2002-03-17 22:19:20 +00:00
atatat 31144d9976 Convert ioctl code to use EPASSTHROUGH instead of -1 or ENOTTY for
indicating an unhandled "command".  ERESTART is -1, which can lead to
confusion.  ERESTART has been moved to -3 and EPASSTHROUGH has been
placed at -4.  No ioctl code should now return -1 anywhere.  The
ioctl() system call is now properly restartable.
2002-03-17 19:40:26 +00:00
thorpej 53df727d27 Add a new ptrace request, PT_IO, as proposed by Artur Grabowski
on the <bsd-api-discuss@wasabisystems.com> mailing list.  PT_IO
is a more general inferior I/D space I/O mechanism.  FreeBSD and
OpenBSD have also added PT_IO.

From lha@stacken.kth.se, kern/15945.
2002-03-17 17:02:45 +00:00
simonb 1f467013b2 White space nits. 2002-03-17 11:15:49 +00:00
simonb 21d2b8b53d We don't need to include <uvm/uvm_extern.h> before <sys/sysctl.h> anymore. 2002-03-17 11:10:43 +00:00
chs 4d4825010d fix bread() to return errors from reading past the end of the device.
back in rev. 1.51, bread() and breadn() were changed to assume that
if B_DONE is set on a buffer returned by bio_doread(), that the buffer
must have already been in the cache, and thus the overall bread() should
return success.  but if the requested buffer is not in the cache and
is past the end of the device, bounds_check_with_label() will set B_ERROR
on the buffer and the caller will call biodone(), which will cause bread()
to think the buffer was already in the cache and thus return success.
to fix this, undo rev. 1.51 and instead have biowait() treat both B_DONE
and B_DELWRI as indicators that it doesn't need to sleep waiting for an
i/o to complete.
2002-03-16 23:49:59 +00:00
mjacob ad97873103 size_t is a long on alpha. I forget whether there's actually a 'best'
kernel printf format arg to print size_t in NetBSD, but coercing the
arg to long probably works well enough.
2002-03-16 22:44:41 +00:00
eeh 8bf657ddf1 Don't forget to allocate space for the property name's trailing NUL. 2002-03-15 20:33:50 +00:00
jdolecek fcc4c4d402 Merge the update to FreeBSD rev 1.95.
Changes:
* MP locking changes (mostly FreeBSD specific)
  XXXSMP the MP locking macros are noops on NetBSD for now
* kevent fix (FreeBSD rev. 1.87): when the last reader/writer
  disconnects, ensure that anybody who is waiting for the kevent
  on the other end of the pipe gets EV_EOF
* kill __P
2002-03-13 21:50:24 +00:00
simonb f81b8604f8 Move 'struct pool_cache_group' definition into <sys/pool.h> 2002-03-13 10:57:18 +00:00
simonb 4067afd322 Remove two instances of an "error" variable that is only ever assigned to
but not used.
2002-03-13 08:12:58 +00:00
thorpej d100f2ae43 Put back pool_prime(); the i386 mp pmap uses it. 2002-03-09 18:06:54 +00:00
bjh21 dca4ae94d6 When checking that a potentially-unsigned enum is >= 0, assign it to an int
first.  This is necessary to avoid warnings with -fshort-enums.  Casting
to an int really should be enough, but turns out not to be.

This change will be documented in doc/HACKS.
2002-03-09 13:22:52 +00:00
thorpej 59a96297ef Fix a couple of typos in simple_{,un}lock()'s. 2002-03-09 05:14:33 +00:00
thorpej c4a2ca6a3e Remove pool_prime(). Nothing uses it, and how it should be used it not
really well-defined in the absense of PR_STATIC.
2002-03-09 01:56:27 +00:00
thorpej e21319b482 Make mbpool and mclpool use the new drain hook facaility. Adjust
m_reclaim() to match the drain hook signature.  This allows us to
delete m_retry() and m_retryhdr(), as the pool allocator will now
perform the reclaimation step for us.

From art@openbsd.org.
2002-03-09 01:46:32 +00:00
thorpej 4be86fcc13 If, when a page becomes idle, the backend allocator is waiting for
resources, release the page immediately, rather than letting it sit
around cached.

From art@openbsd.org.
2002-03-09 01:37:19 +00:00
thorpej d54150e78a Remove PR_MALLOCOK and PR_STATIC. The former wasn't actually used,
and the latter, while there was some code tested the bit, was woefully
incomplete and also unused by anything.  Besides, PR_STATIC functionality
could be better handled by backend allocators anyhow.

From art@openbsd.org
2002-03-09 01:33:33 +00:00
thorpej ce635a702a Add a missing simple_unlock. 2002-03-08 21:43:54 +00:00
thorpej 8cdc6121b7 Add an optional "drain" client callback, which can be set by the new
pool_set_drain_hook().  This hook is called in three cases:
* When a pool has hit the hard limit, just before either erroring
  out or sleeping.
* When a backend allocator fails to allocate memory.
* Just before trying to reclaim pages in pool_reclaim().

This hook requests the client to try and free some items back to
the pool.

From art@openbsd.org.
2002-03-08 21:41:59 +00:00
thorpej 7c94c68f10 Remove PR_FREEHEADER; nothing uses it anymore.
From art@openbsd.org.
2002-03-08 20:51:25 +00:00
thorpej a180cee23b Pool deals fairly well with physical memory shortage, but it doesn't
deal with shortages of the VM maps where the backing pages are mapped
(usually kmem_map).  Try to deal with this:

* Group all information about the backend allocator for a pool in a
  separate structure.  The pool references this structure, rather than
  the individual fields.
* Change the pool_init() API accordingly, and adjust all callers.
* Link all pools using the same backend allocator on a list.
* The backend allocator is responsible for waiting for physical memory
  to become available, but will still fail if it cannot callocate KVA
  space for the pages.  If this happens, carefully drain all pools using
  the same backend allocator, so that some KVA space can be freed.
* Change pool_reclaim() to indicate if it actually succeeded in freeing
  some pages, and use that information to make draining easier and more
  efficient.
* Get rid of PR_URGENT.  There was only one use of it, and it could be
  dealt with by the caller.

From art@openbsd.org.
2002-03-08 20:48:27 +00:00
nathanw 3f0d660168 Make the debugging printfs compile:
- printf format checking doesn't like %x for pointers; use %p like we should.
 - LP64 fixes.
2002-03-05 23:28:58 +00:00
simonb bc7301d415 nlinesw is already declared in <sys/conf.h>. 2002-03-04 02:32:58 +00:00
simonb 8ecad242b9 Use <sys/disk.h> for the prototype of disk_init() rather than declaring
our own locally.
2002-03-04 02:30:27 +00:00
simonb 9a942a34e0 Don't use local extern declarations for the mountroot variable or
declare local prototypes for nfs_mountroot() or md_root_setconf().
2002-03-04 02:25:21 +00:00
mrg d3b3f3e560 move the COMPAT_SUNOS TIOCGPGRP handling in the compat sunos code proper.
this is the final fix needed for it to run properly as an LKM.  no more
COMPAT_SUNOS hacks around the tree!
2002-03-02 12:30:43 +00:00