Commit Graph

849 Commits

Author SHA1 Message Date
dogcow 905b715a4b use PRIu64, not llu, to unbork on 64-bit platforms. 2007-05-24 05:33:08 +00:00
agc 4dbe5ed7e7 Extend the Linux emulation of /proc to include
/proc/stat
	/proc/loadavg and
	/proc/<pid>/statm.

These are only present when -o linux is specified as a mount option
to procfs.

Factor out some common code so that it can be used by a number of
functions.

XXX The values returned in the statm emulation need to be verified.
2007-05-24 00:37:40 +00:00
hannken 64b7e5637e Fstrans_start() always returns zero, so change its type to void. 2007-05-17 07:26:21 +00:00
yamt 4d3b7e04c8 use a cached value of v_size. no functional changes. 2007-05-13 13:11:53 +00:00
perseant 0569cad0fd Split the VOP interface part of genfs_putpages() from the code. The new
function that does the work, genfs_do_putpages(), now takes as an argument
a pointer to the page that would be waited on, if PGO_BUSYWAIT were not set.
This allows a consumer, e.g. lfs_putpages(), to perform an action outside
the scope of UVM before sleeping on the page in question.
2007-04-24 22:46:03 +00:00
enami 780e071921 Don't expand RCS id of ancestor file. The id itself is actually copied
from null_vnops.c since the log message of rev. 1.1 implies the copy.
2007-04-16 08:10:58 +00:00
chs aba740b225 define a pager flag PGO_RECLAIM, similar to FSYNC_RECLAIM, and use it
to skip unnecessary flushing when layered file system vnodes are recycled.
this also prevents a deadlock with the dodgy LFS putpages routine.
fixes the non-LFS part of PR 36150.
2007-04-16 05:14:54 +00:00
hannken fc6776f366 Remove now obsolete vn_start_write() and vn_finished_write() and
corresponding flags.

Revert softdep_trackbufs() to its state before vn_start_write() was added.

Remove from struct mount now unneeded flags IMNT_SUSPEND* and
members mnt_writeopcountupper, mnt_writeopcountlower and mnt_leaf.

Welcome to 4.99.17
2007-04-08 11:20:42 +00:00
hannken e956461048 Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-07 15:06:53 +00:00
rmind 0a747ea89c Unfortunately, missed procfs_proc_unlock() in previous.
Pointed out by pooka@
2007-04-04 10:50:42 +00:00
rmind 199691e947 procfs_readlink: Handle a possible fail of fd_getfile(), also, we
do not need to check for error again.
CID: 4436
2007-04-04 01:27:32 +00:00
christos a7761fd2c5 Instead of reading and writing little by little, allocate memory and
write the whole map in one shot so that we don't have to deal with the
map changing under us. Fixes the linux emulated jdk-1.6 where it was
losing the last map entry and could not find the stack on startup.
2007-04-01 03:18:57 +00:00
christos 6a4825167b return a page less than the actual top of stack so that linux-java works. 2007-04-01 03:16:44 +00:00
ad 0b43c20288 Remove useless cast. 2007-03-11 22:07:32 +00:00
ad c147748d84 - Make the proclist_lock a mutex. The write:read ratio is unfavourable,
and mutexes are cheaper use than RW locks.
- LOCK_ASSERT -> KASSERT in some places.
- Hold proclist_lock/kernel_lock longer in a couple of places.
2007-03-09 14:11:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
salo 20af5e4fd5 Don't prepend rootvnode to the path in non-NULL case for exe links.
It breaks procfs in chroot.

from <christos>, tested by me.
2007-03-03 01:18:32 +00:00
ad b89010bfa3 Destroy the hash locks on final unmount. 2007-02-27 16:11:51 +00:00
thorpej 7cc07e11dc TRUE -> true, FALSE -> false 2007-02-22 06:16:03 +00:00
thorpej 712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
ad 4abc9f506a Add genfs_node_destroy(). Fixes a lock "leak" seen when running LOCKDEBUG
kernels.
2007-02-20 16:19:42 +00:00
pooka 76aba343c2 When checking for file validity under pid/, do proper proc->lwp
lookup (fsvo proper) instead of fiddling directly with the lwp
list.
2007-02-19 00:08:18 +00:00
ad 42a7dff463 procfs_map():
- Drop the target's vm_map lock before calling uiomove(). We could
  deadlock if inspecting /proc/curproc/map.
- If the vm_map might have changed, restart the operation, but give
  up after 250 retries if the map keeps changing.  XXX This is not
  ideal.
2007-02-18 20:03:44 +00:00
pooka 7b63f0de5d Don't check for validity of p in lookup for root nodes, since it
will always be NULL.  Rather, just call pt_valid with NULL directly
and let it decide if we're a linux mount or not.
2007-02-18 01:55:26 +00:00
pavel 934634a18c Change the process/lwp flags seen by userland via sysctl back to the
P_*/L_* naming convention, and rename the in-kernel flags to avoid
conflict. (P_ -> PK_, L_ -> LW_ ). Add back the (now unused) LSDEAD
constant.

Restores source compatibility with pre-newlock2 tools like ps or top.

Reviewed by Andrew Doran.
2007-02-17 22:31:36 +00:00
pooka 85cb1a4957 In lookup, when checking for procfs process node validity, target the
process we're trying to get information about through procfs, not
the caller of lookup.

fixes 'ls -l /proc/*/file' panic, which would occur when trying to
lookup "file" for a kernel thread, which doesn't have p->p_textvp.
2007-02-16 21:37:56 +00:00
ad 9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
ad f8fe10ea6a Need to acquire procp->p_mutex for procfs_dir(). 2007-02-15 15:35:45 +00:00
ad c18c0d2eaa Eliminate a couple of reference count and mutex leaks. 2007-02-11 17:16:08 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
hannken 4d607243ba Change fstrans enum types to upper case.
No functional change.

From Antti Kantee <pooka@netbsd.org>
2007-01-29 15:42:50 +00:00
hannken 1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
elad b2eb9a5389 Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 19:07:03 +00:00
elad 5d2c44c76f PR/32877: Geoff C. Wing: mount_procfs(8) doesn't null-terminate cmdline
output

Patch applied, thanks!
2006-12-28 09:17:52 +00:00
elad 8e5a82bb94 Revert bogus NULL check introduced in revision 1.96 that generated false
Coverity "bugs".
2006-12-28 09:12:38 +00:00
alc 8f1ebe33c9 revert previous, after inspection `kfs->kfs_kt' could really not be NULL here.
reported/requested by elad@
2006-12-28 05:51:56 +00:00
alc 94d1925ccb fix comment (forgotten in rev 1.19):
- pfsnode -> kernfs_node
 - procfs -> kernfs
2006-12-28 05:49:05 +00:00
yamt ccfd2c0df0 remove nqnfs. 2006-12-27 12:10:09 +00:00
alc 8ffa4fbf16 CID-3855: check if 'kfs->kfs_kt != NULL' before dereferencing it 2006-12-26 00:01:48 +00:00
elad f02f51a039 PR/35226: Johann Franz: Problems with permissions in
/usr/pkg/emul/linux/proc .

Okay mlelstv@
2006-12-25 12:13:54 +00:00
christos b5fb56163d fix permissions on /proc/<pid> node. From elad. 2006-12-24 17:37:35 +00:00
elad a687717695 Add two comments. No functional change. 2006-12-24 16:45:23 +00:00
elad f1a69ab3ea Some changes to get rid of another KAUTH_GENERIC_ISSUSER usage:
- Make procfs_control() in procfs_ctl.c static,
  - Add an argument to the above, 'pfs', for the pfsnode,
  - Add another request type to KAUTH_PROCESS_CANPROCFS named
    KAUTH_REQ_PROCESS_CANPROCFS_CTL (and update documentation),
  - Use the above combination in a call to kauth_authorize_process().
2006-12-19 09:58:34 +00:00
yamt fc88d88996 put ->K loaned pages on the page queue, so that page loaning doesn't
disturb pagedaemon/pdpolicy.
2006-12-15 13:51:30 +00:00
pooka 4013808f45 Teach deadfs about vm object locking for getpages. This avoids
errors resulting from situations where we take a page fault for a
vnode which has been converted a deadfs vnode.

wrstuden ok
2006-12-10 23:57:33 +00:00
chs c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
christos 33b30b1ee3 From Nicolas Joly: restore previous behavior in procfs_validfile_linux, since
readdir passes a NULL lwp.
2006-12-04 18:27:52 +00:00
elad 8a806df7dc Move kauth(9) call to where it belongs. Noticed by Nicolas Joly, thanks! 2006-12-03 13:24:10 +00:00
pooka 5f132bf76c * update comments before putpages(): the vm object is always returned
unlocked instead of locked.  chuq agrees
* use slock set to &uobj->vmobjlock also for the last simple lock
  operation to be consistent with the rest of the function
2006-11-30 06:11:03 +00:00
elad 8bb202af97 Move ktrace, ptrace, systrace, and procfs to use kauth(9).
First, remove process_checkioperm() calls from MD code. Similar checks
using kauth(9) routines (on the process scope, using appropriate action)
are done in the callers.

Add secmodel back-end to handle each subsystem.
2006-11-28 17:27:09 +00:00