Commit Graph

687 Commits

Author SHA1 Message Date
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
christos 3908d39e06 step 3. Assign lwp properly if null, so that we can PHOLD without segfaulting. 2003-01-21 00:01:14 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +00:00
matt 5d09a84558 Add multiple inclusion protection. 2003-01-06 21:02:18 +00:00
wiz 1035faff1d writable, not writeable. 2003-01-06 20:30:28 +00:00
martin d30bd703a5 Cast off_t expression to long long to match format even on 64 bit
plattforms.

Shouldn't we introduce a PRIoff_t macro to create such format strings?
2003-01-04 15:42:35 +00:00
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
christos 5ff60a19d9 Don't hide the real return code with EPERM. 2002-01-12 18:51:56 +00:00
christos 5266303896 When checking for permissions, include the P_INEXEC test and return
EAGAIN if the process is exec'ing.
2002-01-12 18:51:31 +00:00
christos 67c310f08c Apply the same P_INEXEC test to avoid the execve/trace problem using
the procfs ptrace calls.
2002-01-11 22:02:56 +00:00
chs 2776bd066f add the entry for layer_getpages() to the VOP tables of the
layered file systems that need it.
2002-01-04 07:19:33 +00:00
chs 03ea276e84 in genfs_gop_write(), actually set the B_ASYNC flag on buffers that we're
not going to wait for.  this doesn't matter for real devices since we call
VOP_STRATEGY() directly, but NFS uses this flag to decide whether or not
to hand the buffer off to an nfsiod thread.
2001-12-31 06:44:58 +00:00
chs 64b0c2adbb in genfs_putpages(), we must wait for any pending write i/os to complete
if the putpages request is synchronous.
2001-12-31 06:40:08 +00:00
chs 40bf5f0e12 add some compatibility routines to allow mmap() to work non-UBCified
filesystems (in the same non-coherent fashion that they worked before).
2001-12-18 07:49:36 +00:00
chs 8e9cdbbd63 replace "vnode" and "vtext" with "file" and "exec" in uvmexp field names. 2001-12-09 03:07:43 +00:00
chs 0931f31deb add a VOP_PUTPAGES method for all the filesystems that don't have pages.
do all the work for destroying syncfs vnodes in vfs_deallocate_syncvnode()
to make some new assertions work out.
2001-12-06 04:30:49 +00:00
chs 1361ca58eb be consistent, clear VONWORKLST when we take a syncer vnode off the
syncer list.
2001-12-06 04:29:55 +00:00
chs 4d14671458 add VOP_GETPAGES and VOP_PUTPAGES methods for layered filesystems.
drop the interlock on the upper layer, acquire the interlock on the
lower layer.
2001-12-06 04:29:23 +00:00
chs 5a690c92a1 add a VOP_PUTPAGES method for all the filesystems that don't have pages,
just unlock the interlock.
2001-12-06 04:27:40 +00:00
thorpej 03efee5585 * Allow machine-dependent code to specify hooks for ptrace(2)
(__HAVE_PTRACE_MACHDEP) and procfs (__HAVE_PROCFS_MACHDEP).
  These changes will allow platforms like x86 (XMM) and PowerPC
  (AltiVec) to export extended register sets in a sane manner.

* Use __HAVE_PTRACE_MACHDEP to export x86 XMM registers (standard
  FP + SSE/SSE2) using PT_{GET,SET}XMMREGS (in the machdep
  ptrace request space).
* Use __HAVE_PROCFS_MACHDEP to export x86 XMM registers via
  /proc/N/xmmregs in procfs.
2001-12-05 00:58:05 +00:00
christos 420771d7cc PR/14781: Matthew Fredette: Clamp the number of read-ahead pages to 16 because
other code has this limit. Also while I am here, convert the magic 16 into
a #define constant and use it in the appropriate places. This is a temporary
fix, since all this read-ahead business is XXXUBC anyway.
2001-11-30 15:18:39 +00:00
lukem 2565646230 don't need <sys/types.h> when including <sys/param.h> 2001-11-15 09:47:59 +00:00
lukem e4b00f433c add RCSIDs 2001-11-10 13:33:40 +00:00
enami 7b7e3f6b7e Wrap long line and remove name of argument from function prototype. 2001-11-07 04:56:09 +00:00
enami 8e5afc2cbe Make the size of null node hash table to desiredvnodes instead of 16. 2001-11-07 04:55:26 +00:00
enami 888e968e4d Call hashdone where appropriate. 2001-11-07 04:21:26 +00:00
enami 579ece8405 Cosmetic changes. 2001-11-07 04:15:41 +00:00
enami 9af6d646c2 Fix typo in comment. 2001-11-07 04:04:10 +00:00
simonb cf63a6b052 Remove some variables that are set but never used. 2001-11-06 07:20:37 +00:00
simonb 86c9e7e6d2 In procfs_domem() the addr variable is only needed if PMAP_NEED_PROCWR is
defined.
2001-11-06 07:20:08 +00:00
enami 6e46b6ec2c s/genfs_do_putpages/genfs_gop_write/ in uvmhist. 2001-10-03 14:13:08 +00:00
chs f0b6149f57 change spec_{read,write}() to specify the device blkno in units of DEV_BSIZE
rather than the device's sector size.  this allows /dev/rcd0a and /dev/cd0a
to return the same data.  fixes PRs 3261 and 14026.
2001-09-23 04:39:25 +00:00
sommerfeld 181c4513dc Add fifo_putpages() placebo so that the vnode's uobj is unlocked. 2001-09-22 22:35:18 +00:00
chs d0b76cab5e use shared locks instead of exclusive for VOP_READ() and VOP_READDIR(). 2001-09-21 08:02:55 +00:00
chs 4111c37251 when zeroing pages past EOF, don't zero the page containing EOF if it
already contains valid data.  should fix PRs 13361 and 13436.
2001-09-21 07:52:25 +00:00
chs 5f5ac77eff add a forward decl for struct vm_page. 2001-09-15 22:38:40 +00:00
chs 099a6b5258 interfaces and structures used by new genfs_{get,put}pages(). 2001-09-15 21:33:05 +00:00
chs 64c6d1d2dc a whole bunch of changes to improve performance and robustness under load:
- remove special treatment of pager_map mappings in pmaps.  this is
   required now, since I've removed the globals that expose the address range.
   pager_map now uses pmap_kenter_pa() instead of pmap_enter(), so there's
   no longer any need to special-case it.
 - eliminate struct uvm_vnode by moving its fields into struct vnode.
 - rewrite the pageout path.  the pager is now responsible for handling the
   high-level requests instead of only getting control after a bunch of work
   has already been done on its behalf.  this will allow us to UBCify LFS,
   which needs tighter control over its pages than other filesystems do.
   writing a page to disk no longer requires making it read-only, which
   allows us to write wired pages without causing all kinds of havoc.
 - use a new PG_PAGEOUT flag to indicate that a page should be freed
   on behalf of the pagedaemon when it's unlocked.  this flag is very similar
   to PG_RELEASED, but unlike PG_RELEASED, PG_PAGEOUT can be cleared if the
   pageout fails due to eg. an indirect-block buffer being locked.
   this allows us to remove the "version" field from struct vm_page,
   and together with shrinking "loan_count" from 32 bits to 16,
   struct vm_page is now 4 bytes smaller.
 - no longer use PG_RELEASED for swap-backed pages.  if the page is busy
   because it's being paged out, we can't release the swap slot to be
   reallocated until that write is complete, but unlike with vnodes we
   don't keep a count of in-progress writes so there's no good way to
   know when the write is done.  instead, when we need to free a busy
   swap-backed page, just sleep until we can get it busy ourselves.
 - implement a fast-path for extending writes which allows us to avoid
   zeroing new pages.  this substantially reduces cpu usage.
 - encapsulate the data used by the genfs code in a struct genfs_node,
   which must be the first element of the filesystem-specific vnode data
   for filesystems which use genfs_{get,put}pages().
 - eliminate many of the UVM pagerops, since they aren't needed anymore
   now that the pager "put" operation is a higher-level operation.
 - enhance the genfs code to allow NFS to use the genfs_{get,put}pages
   instead of a modified copy.
 - clean up struct vnode by removing all the fields that used to be used by
   the vfs_cluster.c code (which we don't use anymore with UBC).
 - remove kmem_object and mb_object since they were useless.
   instead of allocating pages to these objects, we now just allocate
   pages with no object.  such pages are mapped in the kernel until they
   are freed, so we can use the mapping to find the page to free it.
   this allows us to remove splvm() protection in several places.

The sum of all these changes improves write throughput on my
decstation 5000/200 to within 1% of the rate of NetBSD 1.5
and reduces the elapsed time for "make release" of a NetBSD 1.5
source tree on my 128MB pc to 10% less than a 1.5 kernel took.
2001-09-15 20:36:31 +00:00
chs adf5d360a7 add a new VFS op, vfs_reinit, which is called when desiredvnodes is
adjusted via sysctl.  file systems that have hash tables which are
sized based on the value of this variable now resize those hash tables
using the new value.  the max number of FFS softdeps is also recalculated.

convert various file systems to use the <sys/queue.h> macros for
their hash tables.
2001-09-15 16:12:54 +00:00
assar 41f102fe0e install miscfs/syncfs/syncfs.h 2001-09-09 17:42:46 +00:00
chs 94d6f3ee95 map files are zero-length. 2001-08-31 04:56:26 +00:00
chs c60e896954 undo the part of the last revision that made user block device access
use the UBC interfaces.  too many problems with that yet.
2001-08-18 05:34:46 +00:00
chs f051fe3125 add definitions for UBCification of block devices. 2001-08-17 05:52:07 +00:00
chs 103d879bd7 initialize the UVM vnode size for block devices.
UBCify user access to block devices.
2001-08-17 05:51:53 +00:00
chs 5a4fdb6ddb make genfs get/put work for block devices as well:
- the "fs bshift" for block devices is always DEV_BSHIFT.
 - retrieve the device vnode from VOP_BMAP() and use that to set b_dev
   in page i/o buffers.
2001-08-17 05:51:29 +00:00
tv 57c096de20 KNF on previous. 2001-08-16 15:37:06 +00:00
jdolecek 332bb4894a bound check mount args more thoroughly 2001-08-03 06:00:13 +00:00
assar a9eb6b2c79 (*fs_mount): do not get the parent vnode back from namei to just release it 2001-08-02 22:40:58 +00:00
assar bec71dc090 change vop_symlink and vop_mknod to return vpp (the created node)
refed, so that the caller can actually use it.  update callers and
file systems that implement these vnode operations
2001-07-24 15:39:30 +00:00
chs 7ebc99879b don't set PG_RDONLY on the lower layer's pages,
the lower layer needs to have control over that flag.
that didn't solve the whole problem that it was trying to solve anyway.
(the issue is that if we have create mappings to the lower layer,
we need to get rid of those when we copy the file to the upper layer.)
we'll have to figure out some other way to handle this.
2001-07-04 21:38:00 +00:00
jdolecek c57b6d9ba4 Add DTYPE_PIPE (to be used by new pipe implementation) and handle
it accordingly.
2001-06-16 08:28:39 +00:00
thorpej 80cc38a1af Fix a partial construction problem that can cause race conditions
between creation of a file descriptor and close(2) when using kernel
assisted threads.  What we do is stick descriptors in the table, but
mark them as "larval".  This causes essentially everything to treat
it as a non-existent descriptor, except for fdalloc(), which sees a
filled slot so that it won't (incorrectly) allocate it again.  When
a descriptor is fully constructed, the code that has constructed it
marks it as "mature" (which actually clears the "larval" flag), and
things continue to work as normal.

While here, gather all the code that gets a descriptor from the table
into a fd_getfile() function, and call it, rather than having the
same (sometimes incorrect) code copied all over the place.
2001-06-14 20:32:41 +00:00
chs 766dfc9b6f be sure to allocate dirty zeroed pages to cover blocks we allocate
to resolve a write fault.  fixes PR 13201.
also, be sure to allocate blocks for write faults to holes even if
the page is already in memory.  fixes PR 13189.
2001-06-14 08:22:14 +00:00
wiz 09b77243bc Some more corrections by Michael K. Sanders. 2001-06-09 11:02:08 +00:00
wiz e265f98875 Typos and grammer fixes in comments (misc/13133 by Michael K. Sanders) 2001-06-07 13:44:46 +00:00
wiz fa87a2091d Typos in comments (misc/13133 by Michael K. Sanders) 2001-06-07 13:32:46 +00:00
chs c8642d34a1 let kernfs_mmap() use the default error method. 2001-06-03 02:23:31 +00:00
chs 27e388d697 let portalfs_mmap() use the default error method. 2001-06-03 02:22:40 +00:00
chs 6e2828061f procfs_bmap() should never be called, make it a "bad op".
let procfs_mmap() use the default error method.
2001-06-03 02:21:35 +00:00
chs 821ec03ed9 replace vm_map{,_entry}_t with struct vm_map{,_entry} *. 2001-06-02 18:09:08 +00:00
mrg 67afbd6270 use _KERNEL_OPT 2001-05-30 11:57:16 +00:00
chs 45701591c6 add a genfs_mmap() and change all of the disk-based filesystems
to implement VOP_MMAP() with the genfs version, in preparation for
actually using this VOP.
2001-05-28 02:50:51 +00:00
chs 11a9651c8f replace vm_page_t with struct vm_page *. 2001-05-26 21:27:10 +00:00
enami bb08989ba7 Since union_getpages may be called with PGO_LOCKED,
- We need to skip PGO_DONTCARE page also.
- ``npages'' returned by VOP_GETPAGES for lower vp doesn't count
  those pages in this case.  So, just loop ``npages'' times is
  insufficient.  Loop while there is real pages instead.
2001-04-26 05:25:14 +00:00
thorpej 13e5178e3d Don't hold vp->v_interlock when calling vcount(); vcount() calls
vgone(), which may sleep.
2001-04-17 18:49:26 +00:00
kleink 79283614b3 In procfs_readdir(), give /proc/# directories DT_DIR (rather than DT_REG). 2001-04-14 13:25:46 +00:00
jdolecek b6d1d4db02 Change the first arg to fileops fo_stat routine to struct file *, adjust
callers and appropriate routines to cope. This makes fo_stat more
consistent with rest of fileops routines and also makes the fo_stat
match FreeBSD as an added bonus.
Discussed with Luke Mewburn on tech-kern@.
2001-04-09 10:22:00 +00:00
jdolecek 3fc6fc58e6 Call file descriptor stat function via (*fp->f_ops->fo_stat) instead
of a switch statement and explicit call.
Sprinkle some FILE_USE()/FILE_UNUSE() as appropriate.
2001-04-09 09:39:09 +00:00
jdolecek bb8ceadfcc Adapt to struct fileops, soo_stat() changes.
Pointed out by Bernd Ernesti in private mail.
2001-04-07 17:37:09 +00:00
pk 3c425b682f Cast `field-width' arguments to type `int'. 2001-04-02 07:16:05 +00:00
fvdl 49b162566a Bump va_blocksize for the map files some more, so that programs with
quite a few mappings have a chance of being handled correctly if
st_blksize is looked at.
2001-03-30 20:25:11 +00:00
fvdl 2e64bebd3b For -o linux mounts, add some code to emulate /proc/#/maps.
Needs NAMECACHE_ENTER_REVERSE to include filenames.
2001-03-29 22:41:52 +00:00
chs dd82ad8e2c eliminate the VM_PAGER_* error codes in favor of the traditional E* codes.
the mapping is:

VM_PAGER_OK		        0
VM_PAGER_BAD		        <unused>
VM_PAGER_FAIL		        <unused>
VM_PAGER_PEND		        0 (see below)
VM_PAGER_ERROR		        EIO
VM_PAGER_AGAIN		        EAGAIN
VM_PAGER_UNLOCK		        EBUSY
VM_PAGER_REFAULT	        ERESTART

for async i/o requests, it used to be possible for the request to
be convert to sync, and the pager would return VM_PAGER_OK or VM_PAGER_PEND
to indicate whether the caller should perform post-i/o cleanup.
this is no longer allowed; pagers must now return 0 to indicate that
the async i/o was successfully started, and the caller never needs to
worry about doing the post-i/o cleanup.
2001-03-10 22:46:45 +00:00
jmc 1d6219e000 XXX: Temporary work around to fdesc truncating files when it shouldn't. Treat
setattr calls on underlying vnodes the same as sockets and just return 0.

This whole thing needs to be gutted and replaced with either fall throughs
to specfs (the attr forwarding is just bizarre and leads to weird crap like
the above truncation problems), or better yet a real cloning device node.
2001-03-06 01:23:42 +00:00
chs 667e1805e6 in genfs_getpages(), don't try to optimize zeroing past EOF.
fixes PR 12297.
2001-02-28 02:59:19 +00:00
lukem 4f9c98118a convert to ansi knf 2001-02-27 19:52:21 +00:00
chs f87a22a66b distinguish between a file's in-memory EOF (which marks the offset at
which we disallow creation of page cache pages) and its on-disk EOF
(which marks the offset at which there is not (yet) data on disk that
we need to read when creating pages).  for requests with PGO_PASTEOF,
the in-memory EOF maybe be much larger than the on-disk EOF.
2001-02-27 02:57:02 +00:00
jdolecek 522f569810 make some more constant arrays 'const' 2001-02-21 21:39:52 +00:00
chs 1a5818b05e fix a couple more bugs:
- in genfs_getpages(), unbusy any pages that we don't free in the error path.
 - in genfs_putpages(), if we get a bmap error, record that in the master buf.
2001-02-18 15:03:42 +00:00
fvdl f12c24a45c Oops, removal unintenionally commited debug code. 2001-02-12 19:12:10 +00:00
fvdl dd32618956 Format arg nit. 2001-02-12 17:41:49 +00:00
chs 8c14e1d2db fix several bugs:
- in the cases where we skip over the i/o loop, increment npages by ridx
   so that when the cleanup code starts processing the pgs array at index 0
   it'll actually process all of the pages.
 - process the PG_RELEASED flag when unbusying pages.
 - add some missing MP locking.
 - use MIN() and MAX() instead of min() and max() since the latter are
   functions which take arguments of type "int" but we call them with
   values of type "off_t", so the values could be truncated.
 - in the PGO_PASTEOF case, use the larger of the current file size and the
   end of the requested range of pages as the file size for this request.
   this fixes some problems with sparsing writes to large offsets.
2001-02-05 12:26:08 +00:00
mrg 6bcf1102df clean up some KERNFS_DIAGNOSTIC calls. 2001-02-04 10:20:00 +00:00
jdolecek 98449698d2 Back previous out, it was right the way it was. Seems like I should
attend some basic arithmetic lessons to avoid such mistakes :-/
2001-01-27 12:28:35 +00:00
jdolecek 8c0e5dec1a fix 'physmem' - the actual value we want is ctob(physmem) 2001-01-27 11:42:41 +00:00
jdolecek 555bbcc02a g/c pmnt_mp in struct procfs_args 2001-01-25 12:44:56 +00:00
fvdl f4ddf5e1b6 Cast lbn to off_t in a few places, to avoid daddr_t overflow and all sorts
of havoc. From Bill Sommerfeld.
2001-01-22 16:39:54 +00:00
jdolecek d9466585b7 make filesystem vnodeop, specop, fifoop and vnodeopv_* arrays const 2001-01-22 12:17:35 +00:00
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +00:00
tv 231789093f No-op revision to force update of this file to a non-"-kk" version. 2001-01-18 16:39:43 +00:00
fvdl 4e000b75b2 Add a few linux-style files, only enabled when -o linux is specified
for the mount. Currently these are /proc/cpuinfo and /proc/meminfo.
The former only does something on i386 right now.
2001-01-17 00:09:07 +00:00
david d0ec21672f Increase psbuf size as in FreeBSD patch. We don't have jail(8), so the
recent bugtraq exploit doesn't apply, but it could be exploitable in
other ways.
2000-12-30 23:14:52 +00:00
chs 68b98ea45f several bugs:
- in genfs_getpages() don't start read-ahead if we get an error on the
   sync read, and always start read-ahead after the range of the sync read
   if we do any at all.
 - off-by-one error in genfs_size().
2000-12-27 04:47:43 +00:00
enami 0088605039 Don't cache a device vnode in a layer node cache once the layer node
is inactivated.  Otherwise, the device won't closed.
2000-12-21 03:51:02 +00:00
chs a8a757cd0a implement VOP_GETPAGES(). 2000-12-11 02:50:17 +00:00
chs f5878a3362 only zero the part of the page after EOF if we're actually
initializing the page.
2000-12-09 22:38:23 +00:00
chs e9037d16c5 allow building without SOFTDEP by adding the pageiodone hook to bio_ops. 2000-11-27 18:26:38 +00:00
chs aeda8d3b77 Initial integration of the Unified Buffer Cache project. 2000-11-27 08:39:39 +00:00
chs b0ec16cc38 remove dead code and other misc cleanup. 2000-11-24 18:58:37 +00:00
chs 3a947bfaf7 avoid removing syncer vnodes from the worklist twice. 2000-11-19 05:53:21 +00:00
ad 642267bcc7 Update for hashinit() change. 2000-11-08 14:28:12 +00:00
chs 071195415e fix an LP64BE bogon. 2000-11-08 05:29:32 +00:00
jmc 7a615b0018 Remove usecount check in spec_open. It fails to catch VALIAS situations
and vfs_mountedon will handle them all correctly.
2000-10-27 06:28:27 +00:00
jdolecek 74cffdc95f fix typo (dely --> delay) 2000-10-06 19:08:00 +00:00
eeh 1ecf6779be Add support for variable end of user stacks needed to support COMPAT_NETBSD32:
`struct vmspace' has a new field `vm_minsaddr' which is the user TOS.

	PS_STRINGS is deprecated in favor of curproc->p_pstr which is derived
	from `vm_minsaddr'.

	Bump the kernel version number.
2000-09-28 19:05:06 +00:00
thorpej 94a08f31b3 PHOLD/PRELE around uvm_io() to user address space is unnecessary. There
is nothing in the U-area that we need.
2000-09-26 23:28:01 +00:00
fvdl db4108490a Adapt for VOP_FSYNC parameter change. 2000-09-19 22:01:59 +00:00
thorpej a86d1f4891 Add a lock around the scheduler, and use it as necessary, including
in the non-MULTIPROCESSOR case (LOCKDEBUG requires it).  Scheduler
lock is held upon entry to mi_switch() and cpu_switch(), and
cpu_switch() releases the lock before returning.

Largely from Bill Sommerfeld, with some minor bug fixes and
machine-dependent code hacking from me.
2000-08-20 21:50:06 +00:00
tv 10d08cc9f2 Only show the "exe" entry to Linux processes, suggested by christos.
Since there are actually three struct emul's for linux, use the e_name
field to determine eligibility with strcmp().
2000-08-09 23:30:49 +00:00
tv ae4dea1dc4 Some versions of Linux libc look for /proc/.../exe instead of /proc/../file.
Add an entry for "exe" that is the same as "file", provided only if
COMPAT_LINUX is set.
2000-08-09 21:08:11 +00:00
thorpej 7cc27a88c0 Convert namei pathname buffer allocation to use the pool allocator. 2000-08-03 20:41:05 +00:00
thorpej b94e29816f MALLOC()/FREE() are not to be used for variable sized allocations. 2000-08-03 03:39:52 +00:00
jdolecek b0fb24279c change the lf_advlock() arguments from
int     lf_advlock __P((struct lockf **,
           off_t, caddr_t, int, struct flock *, int));
to

int     lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).
2000-07-22 15:26:11 +00:00
thorpej b221909e32 Sprinkle some const. 2000-07-14 07:21:50 +00:00
mycroft caf07dfa04 When unmounting, make sure to free the syncer vnode so that it can be reused. 2000-07-09 00:59:03 +00:00
mrg 20515f2854 <vm/vm.h> -> <uvm/uvm_extern.h> 2000-06-28 02:44:06 +00:00
mrg e185413725 remove redudant <vm/pmap.h> includes. <vm/pmap.h> -> <uvm/uvm_pmap.h> 2000-06-27 04:18:48 +00:00
mrg 2f159a1bac remove/move more mach vm header files:
<vm/pglist.h> -> <uvm/uvm_pglist.h>
	<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
	<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
	<vm/vm_object.h> -> nothing
	<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
2000-06-26 14:20:25 +00:00
mrg c543a66253 remove some redundant <vm/vm_xxx.h> includes 2000-06-25 13:26:19 +00:00
assar 6c734cd283 make vfs_getnewfsid only take one argument and fetch the name of the
filesystem from the supplied mount argument.  also make makefstype
take a const parameter.  update all the callers.
2000-06-10 18:27:01 +00:00
thorpej a804b492ac Use CMSG_*() properly. 2000-06-05 17:21:38 +00:00
simonb ab92666f6b Fix a possible kernel memory leak - if the cmdline of a process was
requested after it had started to exit but before it became a zombie
a page of kernel memory wouldn't be free'd.
2000-06-01 13:43:08 +00:00
mycroft 7385963fc9 Stylistic change. 2000-05-29 18:59:51 +00:00
thorpej 21fc65e1a8 sleep() -> tsleep() 2000-05-27 04:52:27 +00:00
simonb 0c59b3c325 Apply patch from Robert Elz in PR kern/10113. This fixes two problems
with procfs's cmdline - from the PR:

	The cmdline implementation in procfs is bogus.  It's possible that
	part of the fix is a workaround of a UVM problem - that is, when
	(internally) accessing the top of the process VM (the end of the
	args) a request for I/0 of a PAGE_SIZE'd block starting at less
	than a PAGE_SIZE from the end of the mem space returns EINVAL
	rather than the data that is available.  Whether this is a bug
	in UVM or not depends upon how it is defined to work, and I was
	unable to determine that.   (Simon Burge found that problem, and
	provided the basis of the workaround/fix).

	Then, the cmdline function is unable to read more than one
	page of args, and a good thing too, as the way it is written
	attempting to get more than that would reference into lala land.

	And, on an attempt to read a lot of data when the above is
	fixed, most of the data won't be returned, only the final block
	of any read.

Tested on alpha, pmax, i386 and sparc.
2000-05-16 13:45:25 +00:00
perseant f0728fdce1 Change the sementics of the last parameter from a boolean ("waitfor") to
a set of flags ("flags").  Two flags are defined, UPDATE_WAIT and
UPDATE_DIROP.

Under the old semantics, VOP_UPDATE would block if waitfor were set,
under the assumption that directory operations should be done
synchronously.  At least LFS and FFS+softdep do not make this
assumption; FFS+softdep got around the problem by enclosing all relevant
calls to VOP_UPDATE in a "if(!DOINGSOFTDEP(vp))", while LFS simply
ignored waitfor, one of the reasons why NFS-serving an LFS filesystem
did not work properly.

Under the new semantics, the UPDATE_DIROP flag is a hint to the
fs-specific update routine that the call comes from a dirop routine, and
should be wait for, or not, accordingly.

Closes PR#8996.
2000-05-13 23:43:06 +00:00
augustss bd842961d4 Register, begone! 2000-03-30 12:22:12 +00:00
simonb 45171aaef9 Delete redundant decls of vn_syncer_add_to_worklist(), syncdelay,
filedelay, dirdelay and metadelay - they're in <sys/vnode.h>.
2000-03-30 02:21:49 +00:00
simonb 92701d715c Delete duplicate declaration of atopid(). 2000-03-30 02:20:14 +00:00
simonb 08312317e7 Delete redundant decl of layer_node_create(), it's in layer_extern.h. 2000-03-30 02:19:16 +00:00
simonb 0177c68ba1 Delete redundant decl of fdesc_root, it's in fdesc.h. 2000-03-30 02:16:22 +00:00
jdolecek 88b591be30 Adapt to last VFS changes - add appropriate vfs_done routine. 2000-03-16 19:00:26 +00:00
jdolecek 89015c4648 Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.
2000-03-16 18:08:17 +00:00
soren 95054da1a1 Fix doubled 'the's in comments. 2000-03-13 23:52:25 +00:00
fvdl bb4e324508 Fix pasto: some lines of the procfs hash code were copied from the
UFS code, and I forgot to rename the "ihash" variable, causing
weird effects, because 3/4th of the UFS hash table would become
unreachable after procfs was loaded as an LKM.
2000-02-25 22:33:43 +00:00
fvdl 15bb1bd145 At mount/unmount time, add an exec hook to revoke all vnodes iff the
process is about to exec a sugid binary.

To speed up things, use hashing for vnode allocation, like other filesystems
do. This avoids walking the whole procfs node list in the revoke case too.
2000-01-25 21:52:04 +00:00
wrstuden fab192f2d2 Add overlay, a layered file system which overlays itself on
the underlying fs, rather than exporting it to another part of the
directory name space.
2000-01-20 19:06:13 +00:00
sommerfeld 530432986b Actually nullop is a better idea here 1999-12-12 00:56:29 +00:00
sommerfeld c7ed8ada64 one more tweak: placebo for VOP_LEASE 1999-12-08 20:05:19 +00:00
sommerfeld a51f685d41 Add appropriate VOP_FCNTL handlers to deadfs and specfs ops vectors. 1999-12-08 19:16:51 +00:00
sommerfeld f0cc7a5815 Change to comment (only) indicating what the specfs ops vector is used for. 1999-12-08 18:57:07 +00:00
fvdl d901f6eae0 Be more careful to block bio interrupts for some data structures. There
were at least a few missed cases where vp->v_{clean,dirty}blkhd were
unprotected since the softdep/trickle sync merge.
1999-11-23 23:52:40 +00:00
fvdl 0b1963121a Add Kirk McKusick's soft updates code to the trunk. Not enabled by
default, as the copyright on the main file (ffs_softdep.c) is such
that is has been put into gnusrc. options SOFTDEP will pull this
in. This code also contains the trickle syncer.

Bump version number to 1.4O
1999-11-15 18:49:07 +00:00
wrstuden 092a6ee985 Since we don't put layered device nodes in the spechash hash chains,
initialize vp->v_hashchain to NULL.
1999-10-25 23:34:31 +00:00
fvdl d369311766 Remove some mentioned members in the vop {un}lock args struct that we
do not actually have.
1999-10-23 19:34:50 +00:00
wrstuden e682a080e9 In spec_close(), if we're not doing a non-blocking close and VXLOCK is
not set, unlock the vnode before calling the device's close routine and
relock it after it returns. tty close routines will sleep waiting for
buffers to drain, which won't happen often times as the other side needs
to grab the vnode lock first.

Make all unmount routines lock the device vnode before calling VOP_CLOSE().
1999-10-16 23:53:26 +00:00
thorpej 8772062270 Make /proc/self a symlink to /proc/curproc. I've observed Linux programs
that expect /proc/self/cmdline to exist.
1999-09-02 23:33:45 +00:00
sommerfeld 197579af47 Change variable used for directory offset from "int" to "off_t".
Overkill, but avoids a host of truncation problems.
1999-08-25 14:42:35 +00:00
sommerfeld 2e649e46d3 Fix PR8270:
Problem turned out to be due to improper handling of reads beyond EOF:
they should just return without error with the uio unchanged, and the
caller will recognize this as a zero-byte return (EOF).

The previous fix to protect directory reads against bogus uio_offset
values returned EINVAL, which broke mount -o union, which only
union'ed in the lower directory if the upper directory cleanly
returned EOF.

While we're here, protect kernfs as well.
1999-08-24 23:29:08 +00:00
wrstuden e4a256cf0c Fin uninitialized variable use noted by Simon Burge. 1999-08-16 21:24:53 +00:00
christos 582a6def8b protect against large uio_offset 1999-08-14 02:20:19 +00:00