Commit Graph

240 Commits

Author SHA1 Message Date
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
hannken 8c21bc6224 Add ffs internal snapshots. Written by Marshall Kirk McKusick for FreeBSD.
- Not enabled by default. Needs kernel option FFS_SNAPSHOT.
- Change parameters of ffs_blkfree.
- Let the copy-on-write functions return an error so spec_strategy
    may fail if the copy-on-write fails.
- Change genfs_*lock*() to use vp->v_vnlock instead of &vp->v_lock.
- Add flag B_METAONLY to VOP_BALLOC to return indirect block buffer.
- Add a function ffs_checkfreefile needed for snapshot creation.
- Add special handling of snapshot files:
    Snapshots may not be opened for writing and the attributes are read-only.
    Use the mtime as the time this snapshot was taken.
    Deny mtime updates for snapshot files.
- Add function transferlockers to transfer any waiting processes from
  one lock to another.
- Add vfsop VFS_SNAPSHOT to take a snapshot and make it accessible through
  a vnode.
- Add snapshot support to ls, fsck_ffs and dump.

Welcome to 2.0F.

Approved by: Jason R. Thorpe <thorpej@netbsd.org>
2004-05-25 14:54:55 +00:00
atatat 53c625655c Sysctl descriptions under vfs subtree 2004-05-25 04:44:43 +00:00
atatat 10a7ba9ef6 Tweak sysctl setup functions (the macros, actually) for use in lkms,
and tweak lkminit_*.c (where applicable) to call them, and to call
sysctl_teardown() when being unloaded.

This consists of (1) making setup functions not be static when being
compiled as lkms (change to sys/sysctl.h), (2) making prototypes
visible for the various setup functions in header files (changes to
various header files), and (3) making simple "load" and "unload"
functions in the actual lkminit stuff.

linux_sysctl.c also needs its root exposed (ie, made not static) for
this (when built as an lkm).
2004-05-20 06:34:24 +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
jrf bafcaa70cd Removed remaining caddr_t casts we do not need in miscfs. Recompiled
kernel and ran for a day or so. There are still some caddr_t types in
the arguments of some calls, I will do those separately (later) as
they touch a lot more of the system.
Approved by christos@NetBSD.org.
2004-04-29 16:10:54 +00:00
jrf fc97fd571a First pass for some caddr_t removal and changes to get rid of it where we
no longer use and/or need it

	- removed casts from unionfs, deadfs and fdesc
	  (there are more to hunt down still)
	- changed vfs_quotactl args argumet from caddr_t to void *
	- changed vfs_quotactl structures/callers to reflect the api change

Compiled fine and ran for about a day. Approved/reviewed by
christos@netbsd.org and gimpy@netbsd.org.
2004-04-27 17:37:30 +00:00
itojun 8bcb745d7c sprintf -> snprintf 2004-04-22 00:31:00 +00:00
christos 90345b38a6 add sys/dirent.h 2004-04-21 02:40:42 +00:00
christos 6bd1d6d4db Replace the statfs() family of system calls with statvfs().
Retain binary compatibility.
2004-04-21 01:05:31 +00:00
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