Commit Graph

68 Commits

Author SHA1 Message Date
yamt ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
atatat fca6393ad4 Add "cwd" and "root" symlinks to each process's directory. The cwd
link points to the process's current working directory, and the root
link points to the process's root directory.  What else would you
expect?

For directories that are out of reach (caller is in a chroot, target
process is in a different chroot, etc), the links point to "/"
instead.
2005-10-01 03:17:37 +00:00
xtraeme af97f2e875 Remove __P() 2005-08-30 20:08:01 +00:00
christos c107ef9edc - sprinkle const
- avoid shadowed variables.
2005-05-29 21:55:33 +00:00
perry 477853c351 nuke trailing whitespace 2005-02-26 22:58:54 +00:00
jdolecek 845beacce3 add 'mounts' file for -o linux, which lists all currently mounted
filesystems; Linux glibc statvfs() uses this to get some of mount flags,
and this file is also useful as /emul/linux/etc/mtab (via symlink)
2004-09-20 17:53:08 +00:00
skrll 685703c354 Do previous slightly differently - just pass a struct lwp * and derive the
struct proc *.

OK'd by Jaromir.
2004-08-27 07:02:45 +00:00
jdolecek b1126ead62 fix process used for /proc/<pid>/stat contents - it should be process
<pid>, not the current process looking at the information
2004-08-21 15:59:32 +00:00
christos 999e9cef64 Simplify the code by:
1. Checking for a negative uio_offset at the beginning. This really does
   not affect us in most cases because we check that later too.
2. Checking for attempts to write to init sooner and in all cases.
2004-05-14 16:35:24 +00:00
darcy 566d30be44 Changes as discussed with itojun on tech-kern. I have modified the enums
to have KFS or PFS differentiators.  Further I have wrapped the enum in
procfs in "#ifdef _KERNEL" as it is done in kernfs.

To see the discussion go to http://mail-index.NetBSD.org/tech-kern/2003/09/
and look for "Mismatched enums in include files" in the list.
2003-09-27 13:29:02 +00:00
agc aad01611e7 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22364, verified by myself.
2003-08-07 16:26:28 +00:00
fvdl d5aece61d6 Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
2003-06-29 22:28:00 +00:00
thorpej a06b275edc Undo part of the ktrace/lwp changes. In particular:
* Remove the "lwp *" argument that was added to vget().  Turns out
  that nothing actually used it!
* Remove the "lwp *" arguments that were added to VFS_ROOT(), VFS_VGET(),
  and VFS_FHTOVP(); all they did was pass it to vget() (which, as noted
  above, didn't use it).
* Remove all of the "lwp *" arguments to internal functions that were added
  just to appease the above.
2003-06-29 18:43:21 +00:00
darrenr 960df3c8d1 Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records.  The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
2003-06-28 14:20:43 +00:00
christos 210944c7de Add /proc/<pid>/stat for linux compat. j2sdk1.4.2 depends on it. 2003-05-28 18:03:15 +00:00
christos 4e4a4c7bc9 Make the mode of /proc/<pid>/fd dr-x------ 2003-04-18 23:19:24 +00:00
christos 11cc5eb2c6 Make symlinks for directories that point to the actual directory.
Make symlinks to [kqueue] and [misc] for kqueue and misc fds.
2003-04-18 21:55:35 +00:00
jdolecek f331bb3205 do not show nodes corresponding to directory descriptors for process
in fd/ subdirectory, nor allow lookup/open for the nodes
this fixes PR kern/21187 for good, and also avoids interesting directory
locking issues
2003-04-17 20:50:46 +00:00
jdolecek ed9a5a7448 use fd_getfile() in procfs_getfp(), and FILE_USE()/FILE_UNUSE() the
returned file descriptor pointer appropriately
2003-04-17 19:04:25 +00:00
enami 464f962310 Release the hash lock on failure. 2003-03-15 00:22:47 +00:00
tron 98e6fa0c08 Teach procfs_allocvp() about Puptime to avoid panics if "/proc/uptime"
is opened.
2003-03-04 18:55:02 +00:00
jrf a2d850baf8 This addresses PR kerm/19989. Thanks to hamajima@nagoya.ydc.co.jp for submitting this patch which enables /proc/uptime for linux emul. Patch reviewed by atatat@netbsd.org and tron@netbsd.org, approved by tron@netbsd.org. 2003-02-25 21:00:31 +00:00
jdolecek b327a5601a don't bother special-casing DTYPE_KQUEUE/DTYPE_MISC nor panic for unknown
descriptors; just return with EOPNOTSUPP for any unsupported descriptor type
2003-02-03 22:29:07 +00:00
jdolecek b1fc5ffac3 procfs_allocvp():
* do not set *vpp unless successful, otherwise we'd trigger
    DIAGNOSTIC panic in lookup(9) on error return
  * on error, make sure to free malloc'ed memory and ungetnewvnode() the
    previously acquired vnode

this fixes panic on 'tail -f <file> &; ls -l /proc/$!/fd' reported by
Andrew Brown

fix reviewed by Christos Zoulas
2003-02-03 22:27:42 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +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
thorpej ec2b09dc84 Fix a signed/unsigned comparison warning. 2002-11-07 08:21:36 +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
lukem e4b00f433c add RCSIDs 2001-11-10 13:33:40 +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
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
jdolecek 34c8ae80da constify 2001-01-18 20:28:15 +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
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
ad 642267bcc7 Update for hashinit() change. 2000-11-08 14:28:12 +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
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
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
wrstuden 9fc36d6807 Bump osrelease to 1.4E. Add layerfs files, remove null_subr.c.
Update coda to new struct lock in struct vnode.

make fdescfs, kernfs, portalfs, and procfs actually lock their vnodes.
It's not that hard.

Make unionfs set v_vnlock = NULL so any overlayed fs will call its
VOP_LOCK.
1999-07-08 01:26:21 +00:00
christos 8aa2fc5ab8 PR/7143: Jaromir Docelek: Add procfs/cmdline from Linux emulation 1999-03-12 18:45:40 +00:00
msaitoh ea669760d6 Add /proc/#/map. From FreeBSD. 1999-01-25 02:20:08 +00:00
perry 4522c799a1 bzero->memset, bcopy->memcpy, bcmp->memcmp 1998-08-09 20:51:08 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
mycroft d24c4d31e1 Make the curproc link executable. 1997-10-30 09:14:07 +00:00
explorer 945beb8d63 Move procfs_checkioperm() from procvs_subr.c to procfs_mem.c, since _subr is
not included in a kernel without procfs, and it seems wrong to pull
all of procfs_subr.c in for just that one function.  Perhaps this
should go into a new file instead?
1997-08-13 04:01:22 +00:00
thorpej f9777e4a1c Fix the procfs hole described on current-users, similar to a fix for
FreeBSD by Sean Eric Fagan, but a bit different.  This makes the checks
in the same places as sef's FreeBSD patch, but does not hardcode the
"kmem" group into the kernel, and also does a check identical to the
(3) and (4) checks in the NetBSD ptrace(2):

	(1) it's not owned by you, or is set-id on exec (unless
	    you're root), or

	(2) it's init, which controls the security level of the
	    entire system, and the system was not compiled with
	    permanently insecure mode turned on.
1997-08-12 22:47:18 +00:00
mycroft 2ee8bc2b79 Don't allow writes to init's memory or registers while in secure mode. 1997-06-25 11:32:15 +00:00