Commit Graph

229 Commits

Author SHA1 Message Date
atatat 19af35fd0d Tango on sysctl_createv() and flags. The flags have all been renamed,
and sysctl_createv() now uses more arguments.
2004-03-24 15:34:46 +00:00
jdolecek cb3ab0a872 unlock the descriptor table simple lock after fd_getfile() call in
procfs_readdir()
fixes procfs locking problems reported on current-users@, problem place
found by enami tsugutomo
2004-02-15 22:18:17 +00:00
drochner a33b8b088c a little bit more namespace sanity 2003-12-10 14:19:02 +00:00
atatat 13f8d2ce5f Dynamic sysctl.
Gone are the old kern_sysctl(), cpu_sysctl(), hw_sysctl(),
vfs_sysctl(), etc, routines, along with sysctl_int() et al.  Now all
nodes are registered with the tree, and nodes can be added (or
removed) easily, and I/O to and from the tree is handled generically.

Since the nodes are registered with the tree, the mapping from name to
number (and back again) can now be discovered, instead of having to be
hard coded.  Adding new nodes to the tree is likewise much simpler --
the new infrastructure handles almost all the work for simple types,
and just about anything else can be done with a small helper function.

All existing nodes are where they were before (numerically speaking),
so all existing consumers of sysctl information should notice no
difference.

PS - I'm sorry, but there's a distinct lack of documentation at the
moment.  I'm working on sysctl(3/8/9) right now, and I promise to
watch out for buses.
2003-12-04 19:38:21 +00:00
christos 4c1141b840 t_pgrp can be null. 2003-10-30 14:51:01 +00:00
simonb b6abb6ab1d Remove some assigned-to but otherwise unused variables. 2003-10-30 01:58:17 +00:00
yamt 589e82f2ba terminate snprintb 'new' format strings correctly.
(fixes overrun in mount_*)
2003-10-03 16:34:31 +00:00
mycroft 88dd794c62 Put pfsnode in the #ifdef _KERNEL too, so this actually compiles. 2003-09-27 15:32:50 +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
itojun dca8daa76d remove meaningless line (variable overwritten 2 lines below) 2003-09-07 00:25:04 +00:00
he 25d9b10ee9 Add casts of LINUX_USRSTACK and USRSTACK to handle the cases
where these are not constants.
2003-08-21 23:00:07 +00:00
christos c626c860b1 LINUX_USRSTACK is only defined on i386. Thanks Izumi! 2003-08-09 16:28:49 +00:00
christos a24080409e Only choose the linux usrstack if the netbsd usrstack was higher. 2003-08-09 14:17:28 +00:00
christos 9897a5425c Change the way we compute the top of the stack. This makes java-1.4.2 work. 2003-08-09 13:44:39 +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
hannken 5c19a0665c Change "%qu" to "PRIu64" to make it compile on sparc64. 2003-05-29 08:13:41 +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
nakayama bbdab69970 Add breaks which were forgotten in rev. 1.2 change.
Inspired from a report by HIRATSUKA Kouichirou in tech-pkg-ja mailing list.
2003-05-08 13:46:50 +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 b7b5aac957 change PROCFS_FILENO() to use 5 bits for 'type', since there are more than
16 types nowadays (i.e. Pfd is 17)
2003-04-18 10:00:19 +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 884bdfdbaf procfs_readdir(): in Pfd case, only show descriptors of types we want
how to represent (vnodes, fifo, pipes); also use fd_getfile() et al

this avoids annoying EOPNOTSUPP error messages from ls -F and such
2003-04-17 20:33:17 +00:00
jdolecek be4c900d41 procfs_lookup(): use fd_getfile() et al in Pfd case 2003-04-17 20:19:18 +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
jdolecek b5bca36101 g/c, it's outdated and the info wouldn't belong here anyway 2003-04-17 18:14:57 +00:00
jdolecek 64b598bf33 make some local arrays/variables static + const 2003-04-17 18:08:28 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
jdolecek 98f212db7d use former genfs_eopnotsupp_rele() as genfs_eopnotsupp(), so that vnodes
are vput()/vrele()d as necessary - some filesystems did use the wrong
one for some ops, and it's just safer to not take the chance

based on suggestion by Bill Studenmund
2003-04-10 21:53:32 +00:00
dsl b2aefec351 Remove pointless check against PID_MAX. Let pfind() do the validation.
(The new pid allocation code may decide to allocate pids above PID_MAX.)
2003-04-05 23:32:52 +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
hannken 11d5f11e82 Change "%llu" to "PRIu64" to make it compile on sparc64. 2003-02-27 12:20:28 +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
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
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
christos 6868d0a7d6 MNT_GETARGS support 2002-09-21 18:08:27 +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
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
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