Commit Graph

531 Commits

Author SHA1 Message Date
christos b5e0c9eb5b add LK_CANRECURSE in the locking of /dev/<pid>/fd/<n> and remove the curproc
kludge. Thanks to fvdl.
2003-01-03 13:54:22 +00:00
christos dbe6c38bc2 Implement /proc/<pid>/fd/<n>. This is work in progress. Questionable things:
- Is it ok to convert DTYPE_PIPE to VFIFO and DTYPE_SOCKET to VSOCK?
    - XXX: Avoid locking issue in ls -Rl /proc by avoiding curproc
    - Does I/O to pipes work?
    - XXX: Are there security implications?
2003-01-03 13:21:17 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
christos f5ff34bbc6 si_ -> sel_ 2002-11-26 18:51:18 +00:00
yamt bbbe3e07d7 genfs_compat_gop_write: set uio_iovcnt correctly. 2002-11-15 14:01:57 +00:00
thorpej ec2b09dc84 Fix a signed/unsigned comparison warning. 2002-11-07 08:21:36 +00:00
thorpej b7d2ca250a Fix signed/unsigned comparison warnings. 2002-11-07 08:13:10 +00:00
jdolecek c82ab2eb79 now that mem_no is emitted by config(8), there is no reason to keep
copy of more or less identical iskmemdev() for every arch; move the function
to spec_vnop.c, and g/c machine-dependant copies
2002-10-26 13:50:17 +00:00
yamt ac3a01e67e use B_ASYNC for children of nested buffers in genfs_getpages.
ok'ed by Chuck Silvers.
2002-10-25 05:44:41 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
fvdl eb485a7e27 Use B_ASYNC in the !PGO_SYNCIO case. Gets back most, if not all, NFS
read throughput performance lost since the introduction of UBC. Spotted
by YAMAMOTO Takashi, many thanks to him.
2002-10-21 15:21:35 +00:00
jdolecek affeea595d put back the while loop in kernfs_getattr() removed in rev 1.82; it's
necessary to get the whole file length e.g. for msgbuf

this fixes the '/kern/msgbuf & less' problem reported on port-i386
by Dave Tyson
2002-10-12 14:04:45 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
christos 6868d0a7d6 MNT_GETARGS support 2002-09-21 18:08:27 +00:00
jtk 2bbcff81d5 restore ancestral RCS ID from 4.4BSD-Lite2 2002-09-10 02:52:40 +00:00
gehenna 77a6b82b27 Merge the gehenna-devsw branch into the trunk.
This merge changes the device switch tables from static array to
dynamically generated by config(8).

- All device switches is defined as a constant structure in device drivers.

- The new grammer ``device-major'' is introduced to ``files''.

	device-major <prefix> char <num> [block <num>] [<rules>]

- All device major numbers must be listed up in port dependent majors.<arch>
  by using this grammer.

- Added the new naming convention.
  The name of the device switch must be <prefix>_[bc]devsw for auto-generation
  of device switch tables.

- The backward compatibility of loading block/character device
  switch by LKM framework is broken. This is necessary to convert
  from block/character device major to device name in runtime and vice versa.

- The restriction to assign device major by LKM is completely removed.
  We don't need to reserve LKM entries for dynamic loading of device switch.

- In compile time, device major numbers list is packed into the kernel and
  the LKM framework will refer it to assign device major number dynamically.
2002-09-06 13:18:43 +00:00
thorpej 3767580d1a Fix a signed/unsigned comparison warning from GCC 3.3. 2002-08-26 01:26:29 +00:00
simonb c475865f39 Just use the "time" variable in the *_getattr functions instead of a call
to (the potentially expensive) microtime().
2002-08-03 04:52:44 +00:00
soren 178d83d503 Die, qaddr_t, die! - mnt_data in struct mount is already effectively
a void *, so stop pretending otherwise.
2002-07-30 07:40:07 +00:00
chs e697956ce6 we can't use the vnode's v_usecount to track how many times the vnode
has been VOP_OPEN()'d.  if the fifo is being accessed via a layered fs,
v_usecount is always one (representing the hold by the layered vnode)
regardless of how many times the vnode has been opened.  instead, keep a
separate counter for opens.  fixes PR 17195 and probably 17724.
2002-07-27 16:43:36 +00:00
jdolecek 02eb342b57 Make sure that the pointer to old parent process for ptraced children
gets reset properly when the old parent exits before the child. A flag
is set in old parent process when the child is reparented in ptrace(2).
If it's set when process is exiting, all running processes have their
'old parent process' pointer checked and reset if appropriate. Also
change to use 'struct proc *' pointer directly, rather than pid_t.
This fixes security/14444 by David Sainty.

Reviewed by Christos Zoulas.
2002-07-25 20:04:02 +00:00
jdolecek 9c55530336 Properly detect error in kernfs_xread().
Fixes kern/10278 by IWAMOTO Toshihiro, though implemented different way.

While here, clean up some int vs. size_t confusion, make
kernfs_x{read|write}() static and g/c some #if 0 stuff.
2002-07-19 18:35:44 +00:00
wiz 4b20971f01 Spell acquire with a 'c'. 2002-07-10 23:16:32 +00:00
lukem b8e7104984 be consistent about how va_[acm]time is set to the current time
(inspired by how procfs does it)
2002-07-05 03:24:06 +00:00
lukem 20657af5c3 set vap->va_ctime to vap->va_atime (the current time),
rather than vap->va_ctime (which is a no-op).
2002-07-05 02:02:00 +00:00
enami 9e1deeab34 Add missing pageq lock while uvm_pagefree() is called (either directly
or indirectly).  Reviewed by chuq.
2002-05-29 11:04:39 +00:00
enami 1578726840 Just give up to do readahead rather than waiting busy pages.
While I'm here, added few patchable variable so that one can
easily measure readahead behaviour.
2002-05-18 02:54:57 +00:00
perseant 3fa1c8abe9 Protect v_synclist with splbio(); note that LIST_REMOVE is not an idempotent
operation if more than one LIST_REMOVE happens on interrupt, so both the test
for VONWORKLIST and the LIST_REMOVE(vp, v_synclist) need to be in splbio().
2002-05-14 19:37:18 +00:00
matt ea5cd1699b Extern speclisth 2002-05-12 20:42:03 +00:00
enami 293906a53a Redo rev. 1.57 a bit different way; don't use `tpg' since it may be freed.
Subtract the number of pages behind us when calculating new offset instead.
2002-05-10 07:51:37 +00:00
enami 911c9febb2 Don't modify the local variable `n' in genfs_putpages(). It should contain
the number of elements in the page array at the beginning of every iteration.
2002-05-10 02:51:44 +00:00
thorpej f1f51aa2b8 Move code shared by procfs and the kernel proper out of procfs and
into the kernel proper (renaming functions from procfs_* to process_*).
2002-05-09 15:44:44 +00:00
enami e3cc9c0682 When traversing by list, if the page next to us is a page in the cluster,
advance the pointer.
2002-05-09 07:22:09 +00:00
enami fabaf9a730 - In genfs_putpages(), no need to restrict the cluster within the given
region.
- In uvm_aio_aiodone(), remove assertions no longer true.
2002-05-09 07:14:37 +00:00
enami 8876669f4c Since npages may includes number of pages behind us, we can't use it to
update current offset.  Instead, use the last page in the run of pages
to calculate new offset.
2002-05-06 00:42:22 +00:00
enami e6513c283e Stylistic change; introduce new local variable and use it instead of
sprinkling different expression to test if we're pagedaemon.
2002-05-06 00:18:15 +00:00
enami 6335b88f05 We don't need to re-activate page in genfs_putpages() when GOP_WRITE returns
ENOMEM (temporary memory shortage) since it is already handled in
uvm_aio_aiodone() for both async/sync case.  Discussed with chuq.
2002-04-26 03:57:31 +00:00
thorpej 37dc008ca3 Cleanup how file system configuration information is declared, grouping
related information together, with the file system code itself.

This is just low-hanging fruit -- more to come.
2002-04-16 23:14:05 +00:00
enami 6cfcfb947c genfs_{compat_}getpages(): For PGO_LOCKED request, it is safe to return
read only page if it was due to read fault.  This avoid many unnecessary
read fault introduced by recent nfs_bio.c change.  Reviewed by chuq.
2002-04-16 06:05:05 +00:00
enami 08625200a0 KNF and other misc. cosmetic changes. 2002-04-16 06:00:46 +00:00
jdolecek 83bb6f6dd7 Changes to make it less likely to need to be revisited later again:
* fdesc_attr(): don't panic for 'unknown' descriptor types, rather use
  (*fp->f_ops->fo_stat)() hook, as for DTYPE_SOCKET and DTYPE_PIPE
  XXX perhaps use different vnode type than VBAD for these?
* fdesc_setattr(): just return 0 regardless of type, rather than paniccing
  for 'unknown' descriptor types
2002-04-02 17:46:06 +00:00
jmc 70ba374a66 Treat pipes like sockets and don't do setattr on them 2002-04-02 10:34:54 +00:00
chs 72c455ce83 in genfs_compat_getpages(), clear any part of a page that
VOP_READ() doesn't fill in (eg. because it's past EOF).
2002-03-22 03:51:51 +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
chs a51be40dcb don't yield the cpu in genfs_putpages() if we're the pagedaemon.
pointed out by enami.  fixes PR 15784.
2002-03-02 06:58:01 +00:00
enami 9a623b9870 Don't use MALLOC for variable sized allocation. 2002-02-20 06:16:22 +00:00
chs 96f907f394 fix two problems:
- when yielding the cpu while using the vnode's page list, use a marker page
   to keep our place in the list (like the other cases where we drop the lock).
 - wait until no one else has the page busy before deciding if the page needs
   to be cleaned.  a page will be dirty while it's being initialized but will
   be marked clean before PG_BUSY is cleared.
both found by enami.
2002-02-19 15:49:39 +00:00
enami fe24174a3b Don't bother to subtract 0. 2002-02-13 05:20:41 +00:00
enami 52a2a21502 Don't leave junk in pgs[] array since it will be passed to uvn_findpages()
again.
2002-02-12 01:08:12 +00:00
chs 0365a63944 in genfs_putpages():
- yield the cpu if we've taken too long.
 - when traversing by offset, skip over any pages that we clustered.
2002-01-26 02:44:27 +00:00