Commit Graph

6840 Commits

Author SHA1 Message Date
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
c363a9cb62 bzero -> memset 2009-03-18 16:00:08 +00:00
cegger
df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
cegger
b8817e4aed ansify function definitions 2009-03-15 17:14:40 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
ad
0fa70e9b6f 'boot -z' bogons 2009-03-14 11:08:28 +00:00
yamt
6fb9967219 do_sys_unlink: remove an unused credential. 2009-03-13 11:05:26 +00:00
mrg
9ba87b8cc3 completely rework the way that orphaned sockets that are being fdpassed
via SCM_RIGHTS messages are dealt with:

1. unp_gc: make this a kthread.

2. unp_detach: go not call unp_gc directly. instead, wake up unp_gc kthread.

3. unp_scan: do not close files here. instead, put them on a global list
   for unp_gc to close, along with a per-file "deferred close count". if
   file is already enqueued for close, just increment deferred close count.
   this eliminates the recursive calls.

3. unp_gc: scan files on global deferred close list. close each file N
   times, as specified by deferred close count in file. continue processing
   list until it becomes empty (closing may cause additional files to be
   queued for close).

4. unp_gc: add additional bit to mark files we are scanning. set during
   initial scan of global file list that currently clears FMARK/FDEFER.
   during later scans, never examine / garbage collect descriptors that
   we have not marked during the earlier scan. do not proceed with this
   initial scan until all deferred closes have been processed. be careful
   with locking to ensure no races are introduced between deferred close
   and file scan.

5. unp_gc: use dummy file_t to mark position in list when scanning. allow
   us to drop filelist_lock. in turn allows us to eliminate kmem_alloc()
   and safely close files, etc.

6. prohibit transfer of descriptors within SCM_RIGHTS messages if
   (num_files_in_transit > maxfiles / unp_rights_ratio)

7. fd_allocfile: ensure recycled filse don't get scanned.


this is 97% work done by andrew doran, with a couple of minor bug fixes
and a lot of testing by yours truly.
2009-03-11 06:05:29 +00:00
mrg
ce98775552 like KERN_FILE2: *do* update "needed" when there is no count. we want
userland to know what sort of size to provide..

while here, slightly normalise the previous to init_sysctl.c.
2009-03-11 05:55:22 +00:00
mrg
47fb2b7401 always calculate "needed" for KERN_FILE2 calls. this allows a caller
to get an estimate of the needed space, like the intention is.
2009-03-11 01:30:27 +00:00
mlelstv
046c06b035 Make curlwp accesses conditional on wether the data structures
have been initialized. Fixes PR kern/38599.
2009-03-10 10:48:09 +00:00
uebayasi
7c002f258b KNF. ANSI'fy. 2009-03-09 16:19:22 +00:00
ad
69f9e17075 Don't bother with file_t::f_iflags any more, as it's not used.
Noted by mrg@.
2009-03-08 12:52:08 +00:00
christos
4dbda5da97 don't enforce maxproc resource limits for root. 2009-03-07 19:23:02 +00:00
joerg
f5b0fec0e0 Remove SHMMAXPGS from all kernel configs. Dynamically compute the
initial limit as 1/4 of the physical memory. Ensure the limit is at
least 1024 pages, the old default on most platforms.
2009-03-06 20:31:46 +00:00
uebayasi
c8f1efab53 xc_lowpri: don't truncate `where' from uint64_t to u_int. 2009-03-05 13:18:51 +00:00
yamt
c75123c99b main: disable kerenel preemption during early on boot. namely, between
configure() and configure2().  some kernel threads are not expected
to be run before "cold = 0".  fixes cache_thread() busy-loop.
2009-03-05 06:37:03 +00:00
skrll
5ccc095a3e Fix the posix_fadvise return value... finally.
Tested martin on sparc64/m68k and me on hppa.
2009-03-04 18:11:24 +00:00
rmind
4f1720c349 lwp_create: fix the locking bugs on affinity ingerition path (mea culpa).
pset_assign: traverse the list of LWPs safely.
sched_setaffinity: free cpuset (unused path) outside the lock.

Reviewed (with feedback) by <ad>.
2009-03-03 21:55:06 +00:00
ad
822f68cc07 If DEBUG is enabled, drop kpreempt_pri to zero. It means that every
wakeup will cause a kernel preemption, simulating massive concurrency.

Proposed on tech-kern@.
2009-03-02 21:17:29 +00:00
rmind
4bd0e7cebc fd_copy: fix off-by-one bug in a race condition path and assert.
Should fix PR/40625.  OK by <ad>.
2009-03-02 19:28:08 +00:00
kenh
dc5d469510 If sys/param.h is not included, the kernel compile fails on some platforms
with SOFTINT_COUNT undefined (I noticed it on some evbarm kernels)
2009-02-26 05:50:54 +00:00
ad
b2dec392e0 Fix some comments. 2009-02-23 20:33:30 +00:00
ad
59fcf21389 PR kern/26878 FFSv2 + softdep = livelock (no free ram)
PR kern/16942 panic with softdep and quotas
PR kern/19565 panic: softdep_write_inodeblock: indirect pointer #1 mismatch
PR kern/26274 softdep panic: allocdirect_merge: ...
PR kern/26374 Long delay before non-root users can write to softdep partitions
PR kern/28621 1.6.x "vp != NULL" panic in ffs_softdep.c:4653 while unmounting a softdep (+quota) filesystem
PR kern/29513 FFS+Softdep panic with unfsck-able file-corruption
PR kern/31544 The ffs softdep code appears to fail to write dirty bits to disk
PR kern/31981 stopping scsi disk can cause panic (softdep)
PR kern/32116 kernel panic in softdep (assertion failure)
PR kern/32532 softdep_trackbufs deadlock
PR kern/37191 softdep: locking against myself
PR kern/40474 Kernel panic after remounting raid root with softdep

Retire softdep, pass 2. As discussed and later formally announced on the
mailing lists.
2009-02-22 20:28:05 +00:00
ad
430f67aa17 PR kern/39564 wapbl performance issues with disk cache flushing
PR kern/40361 WAPBL locking panic in -current
PR kern/40361 WAPBL locking panic in -current
PR kern/40470 WAPBL corrupts ext2fs
PR kern/40562 busy loop in ffs_sync when unmounting a file system
PR kern/40525 panic: ffs_valloc: dup alloc

- A fix for an issue that can lead to "ffs_valloc: dup" due to dirty cg
  buffers being invalidated. Problem discovered and patch by dholland@.

- If the syncer fails to lazily sync a vnode due to lock contention,
  retry 1 second later instead of 30 seconds later.

- Flush inode atime updates every ~10 seconds (this makes most sense with
  logging). Presently they didn't hit the disk for read-only files or
  devices until the file system was unmounted. It would be better to trickle
  the updates out but that would require more extensive changes.

- Fix issues with file system corruption, busy looping and other nasty
  problems when logging and non-logging file systems are intermixed,
  with one being the root file system.

- For logging, do not flush metadata on an inode-at-a-time basis if the sync
  has been requested by ioflush. Previously, we could try hundreds of log
  sync operations a second due to inode update activity, causing the syncer
  to fall behind and metadata updates to be serialized across the entire
  file system. Instead, burst out metadata and log flushes at a minimum
  interval of every 10 seconds on an active file system (happens more often
  if the log becomes full). Note this does not change the operation of
  fsync() etc.

- With the flush issue fixed, re-enable concurrent metadata updates in
  vfs_wapbl.c.
2009-02-22 20:10:25 +00:00
pooka
b50bd8632e Instead of linking rump system call entry points directly to the
backend, perform all calls through a syscall table.  This makes it
possible to make system calls to non-local rump kernels.
(requires a bit support code.  it's written but quite messy currently)
2009-02-20 17:56:36 +00:00
yamt
777ded00ac cache_lookup_entry: add an assertion. 2009-02-18 13:36:11 +00:00
yamt
c69852d701 vmem_rehash_all: remove a debug printf slipped in with the previous changes. 2009-02-18 13:33:46 +00:00
yamt
f68e4571e5 - fix vmem unittest. rename VMEM_DEBUG so that it won't be abused again.
- reimplement vmem sanity checks with less code duplication.
- reimplement ddb vmem-related commands in a more consistent ways.
  remove automatic whatis.
2009-02-18 13:31:59 +00:00
yamt
947efbeab9 cache_purge1: consistently unlock ncp a little earlier. 2009-02-18 13:24:18 +00:00
yamt
4c5a0bb384 redo rev.1.19 correctly. 2009-02-18 13:22:10 +00:00
yamt
a13bb3bef4 whitespace 2009-02-18 13:12:00 +00:00
yamt
feff5384df use %zu for size_t 2009-02-18 13:04:59 +00:00
rmind
3de401ae19 Make sched_getrq() inline (gcc does not optimize it), avoids call. 2009-02-17 22:00:14 +00:00
ad
81525af92d Fix min/max confusion that causes a problem with DEBUG on some
architectures. Independently spotted by yamt@. /brick ad
2009-02-17 21:54:30 +00:00
enami
fb8633d4a9 Simplify the code; we already have a hint to decide which string to copy.
(And at least gcc generates better code.)
2009-02-15 03:52:49 +00:00
enami
60ebbc4e81 The knote objects attached by peer will still be linked in our list
if we are closed before the peer.  So, remove them.  It didn't matter
when pipe objects are directly returned to pool, but nowadays they
are cached.
2009-02-15 00:07:54 +00:00
christos
24587463c9 remove 2038 comment 2009-02-14 20:45:29 +00:00
christos
bd1260c5ff from enami: Only apply rootdir changes if the chroot dir != / 2009-02-14 17:06:35 +00:00
christos
78a45c73e9 PR/40634: Christoph Badura: "chroot / /sbin/mount" shows only / as mounted 2009-02-14 16:55:25 +00:00
pooka
3e656734b8 cosmetic: don't print empty line at end of init_sysent.c 2009-02-14 16:21:23 +00:00
apb
0cc72e51ac Use "defopt MODULAR" in sys/conf/files, and #include "opt_modular.h"
in all kernel sources that use the MODULAR option.
Proposed in tech-kern on 18 Jan 2009.
2009-02-13 22:41:00 +00:00
christos
160a37667a Unbreak ssp kernels. The issue here that when the ssp_init() call was deferred,
it caused the return from the enclosing function to break, as well as the
ssp return on i386. To fix both issues, split configure in two pieces
the one before calling ssp_init and the one after, and move the ssp_init()
call back in main. Put ssp_init() in its own file, and compile this new file
with -fno-stack-protector. Tested on amd64.
XXX: If we want to have ssp kernels working on 5.0, this change needs to
be pulled up.
2009-02-12 18:24:18 +00:00
enami
d5b0f6df4c s/NOFOLLOW/FOLLOW/ in NDINIT so that it matches actual behavior
which is controlled by NO_FOLLOW bit passed in 2nd arg of vn_open().
2009-02-11 00:32:45 +00:00
enami
7efd6dbe73 Make module (auto)loading under chroot envrionment actually work:
- NOCHROOT flag must be assigned to different bit from TRYEMULROOT
  since the code expected to be executed is in the else clase of
  if (flags & TRYEMULROOT).
- Necessary variables aren't set.
2009-02-11 00:19:11 +00:00
rmind
db4ca04011 dosetrlimit: remove the checks which are no longer needed since rlim_t
is unsigned again.  Hi <christos>!
2009-02-09 11:13:20 +00:00
pooka
8e52b87ec3 Don't try to fd_putfile() descriptors we didn't manage to fd_getfile().
Fixes local DoS panic described in kern/40570.
2009-02-08 16:38:12 +00:00
enami
e3b99073fb Previous code ususally works since compiler won't put gap between
those struct members but there is no reason to rely on that.
While here, I rewrite the loop using an usual idiom.  It shaves
both source and object code.
2009-02-06 23:56:26 +00:00
enami
e1be06d405 Instead of missing NULL check in pipe_create, let the pipe_ctor to wait
on buffer allocation.  The other allocation is simply an optimization,
so leave it as is.
2009-02-06 23:04:57 +00:00