Commit Graph

517 Commits

Author SHA1 Message Date
Eivind Eklund
0b08f5f737 Back out DIAGNOSTIC changes. 1998-02-06 12:14:30 +00:00
KATO Takenori
87884aad6e Workarround for DIAGNOSTIC kernel's panic in union_lookup().
Union_removed_upper() clobbers cache when file is removed.
Upper vp will be removed by union_reclaim().
1998-02-06 02:42:21 +00:00
John Dyson
95461b450d 1) Start using a cleaner and more consistant page allocator instead
of the various ad-hoc schemes.
2)	When bringing in UPAGES, the pmap code needs to do another vm_page_lookup.
3)	When appropriate, set the PG_A or PG_M bits a-priori to both avoid some
	processor errata, and to minimize redundant processor updating of page
	tables.
4)	Modify pmap_protect so that it can only remove permissions (as it
	originally supported.)  The additional capability is not needed.
5)	Streamline read-only to read-write page mappings.
6)	For pmap_copy_page, don't enable write mapping for source page.
7)	Correct and clean-up pmap_incore.
8)	Cluster initial kern_exec pagin.
9)	Removal of some minor lint from kern_malloc.
10)	Correct some ioopt code.
11)	Remove some dead code from the MI swapout routine.
12)	Correct vm_object_deallocate (to remove backing_object ref.)
13)	Fix dead object handling, that had problems under heavy memory load.
14)	Add minor vm_page_lookup improvements.
15)	Some pages are not in objects, and make sure that the vm_page.c can
	properly support such pages.
16)	Add some more page deficit handling.
17)	Some minor code readability improvements.
1998-02-05 03:32:49 +00:00
Eivind Eklund
47cfdb166d Turn DIAGNOSTIC into a new-style option. 1998-02-04 22:34:03 +00:00
KATO Takenori
4e649c4174 Declare the variable `i' when UMAP_DIAGNOSTIC is defined. 1998-02-03 14:30:01 +00:00
Eivind Eklund
3f2076daf5 Make the debug options new-style.
This also zaps a DPT option from lint; it wasn't referenced from
anywhere.
1998-01-31 07:23:16 +00:00
KATO Takenori
9758931d62 Fixed typo in comment. 1998-01-25 09:44:33 +00:00
John Dyson
2d8acc0f4a VM level code cleanups.
1)	Start using TSM.
	Struct procs continue to point to upages structure, after being freed.
	Struct vmspace continues to point to pte object and kva space for kstack.
	u_map is now superfluous.
2)	vm_map's don't need to be reference counted.  They always exist either
	in the kernel or in a vmspace.  The vmspaces are managed by reference
	counts.
3)	Remove the "wired" vm_map nonsense.
4)	No need to keep a cache of kernel stack kva's.
5)	Get rid of strange looking ++var, and change to var++.
6)	Change more data structures to use our "zone" allocator.  Added
	struct proc, struct vmspace and struct vnode.  This saves a significant
	amount of kva space and physical memory.  Additionally, this enables
	TSM for the zone managed memory.
7)	Keep ioopt disabled for now.
8)	Remove the now bogus "single use" map concept.
9)	Use generation counts or id's for data structures residing in TSM, where
	it allows us to avoid unneeded restart overhead during traversals, where
	blocking might occur.
10)	Account better for memory deficits, so the pageout daemon will be able
	to make enough memory available (experimental.)
11)	Fix some vnode locking problems. (From Tor, I think.)
12)	Add a check in ufs_lookup, to avoid lots of unneeded calls to bcmp.
	(experimental.)
13)	Significantly shrink, cleanup, and make slightly faster the vm_fault.c
	code.  Use generation counts, get rid of unneded collpase operations,
	and clean up the cluster code.
14)	Make vm_zone more suitable for TSM.

This commit is partially as a result of discussions and contributions from
other people, including DG, Tor Egge, PHK, and probably others that I
have forgotten to attribute (so let me know, if I forgot.)

This is not the infamous, final cleanup of the vnode stuff, but a necessary
step.  Vnode mgmt should be correct, but things might still change, and
there is still some missing stuff (like ioopt, and physical backing of
non-merged cache files, debugging of layering concepts.)
1998-01-22 17:30:44 +00:00
KATO Takenori
bda1412586 Delete unused code in union_fsync(). 1998-01-22 02:14:59 +00:00
KATO Takenori
3ae6029808 - Move SETKLOC and CLEARKLOCK macros into uion.h.
- Set UN_ULOCK in union_lock() when UN_KLOCK is set.  Caller expects
  that vnode is locked correctly, and may call another function which
  expects locked vnode and may unlock the vnode.
- Do not assume the behavior of inside functions in FreeBSD's
  vfs_suber.c is same as 4.4BSD-Lite2.  Vnode may be locked in
  vget() even though flag is zero.  (Locked vnode is, of course,
  unlocked before returning from vget.)
1998-01-20 10:02:54 +00:00
KATO Takenori
471f80601f Workarround for locking violation while recycling vnode which union fs
used in freelist.
1998-01-18 08:17:48 +00:00
KATO Takenori
afc2a5581f Improve and revise fixes for locking violation.
Obtained from:	NetBSD/pc98
1998-01-18 07:56:41 +00:00
John Dyson
95e5e988e0 Make our v_usecount vnode reference count work identically to the
original BSD code.  The association between the vnode and the vm_object
no longer includes reference counts.  The major difference is that
vm_object's are no longer freed gratuitiously from the vnode, and so
once an object is created for the vnode, it will last as long as the
vnode does.

When a vnode object reference count is incremented, then the underlying
vnode reference count is incremented also.  The two "objects" are now
more intimately related, and so the interactions are now much less
complex.

When vnodes are now normally placed onto the free queue with an object still
attached.  The rundown of the object happens at vnode rundown time, and
happens with exactly the same filesystem semantics of the original VFS
code.  There is absolutely no need for vnode_pager_uncache and other
travesties like that anymore.

A side-effect of these changes is that SMP locking should be much simpler,
the I/O copyin/copyout optimizations work, NFS should be more ponderable,
and further work on layered filesystems should be less frustrating, because
of the totally coherent management of the vnode objects and vnodes.

Please be careful with your system while running this code, but I would
greatly appreciate feedback as soon a reasonably possible.
1998-01-06 05:26:17 +00:00
Sean Eric Fagan
dd30ff81d9 Use CHECKIO in procfs_ioctl() to ensure that any changes in UID/GID result
in the expected failure.
1998-01-06 01:37:12 +00:00
Julian Elischer
dd86d26a6d add copyrights 1998-01-02 07:31:07 +00:00
Bruce Evans
cf6347f79b Fixed missing initialization of mp->mnt_stat. At least vm depends on
at least mp->mnt_stat.f_iosize being nonzero.

PR:		5212
1998-01-01 08:28:26 +00:00
Bruce Evans
a954e88d0b Fixed a missing/misplaced/misstyled prototype. 1997-12-30 08:46:44 +00:00
John Dyson
2be70f79f6 Lots of improvements, including restructring the caching and management
of vnodes and objects.  There are some metadata performance improvements
that come along with this.  There are also a few prototypes added when
the need is noticed.  Changes include:

1) Cleaning up vref, vget.
2) Removal of the object cache.
3) Nuke vnode_pager_uncache and friends, because they aren't needed anymore.
4) Correct some missing LK_RETRY's in vn_lock.
5) Correct the page range in the code for msync.

Be gentle, and please give me feedback asap.
1997-12-29 00:25:11 +00:00
Bruce Evans
675ea6f083 Unspammed nested include of <vm/vm_zone.h>. 1997-12-27 02:56:39 +00:00
Sean Eric Fagan
d5f81602a7 Clear the p_stops field on change of user/group id, unless the correct
flag is set in the p_pfsflags field.  This, essentially, prevents an SUID
proram from hanging after being traced.  (E.g., "truss /usr/bin/rlogin" would
fail, but leave rlogin in a stopevent state.)  Yet another case where procctl
is (hopefully ;)) no longer needed in the general case.

Reviewed by:	bde (thanks bruce :))
1997-12-20 03:05:47 +00:00
Bruce Evans
b3a66dd356 Set the sender's low watermark to match the maximum size for atomic
writes that we advertise (PIPE_BUF = 512).
1997-12-19 18:58:14 +00:00
Garrett Wollman
1cbbd625cc Add support for poll(2) on files. vop_nopoll() now returns POLLNVAL
if one of the new poll types is requested; hopefully this will not break
any existing code.  (This is done so that programs have a dependable
way of determining whether a filesystem supports the extended poll types
or not.)

The new poll types added are:

	POLLWRITE - file contents may have been modified
	POLLNLINK - file was linked, unlinked, or renamed
	POLLATTRIB - file's attributes may have been changed
	POLLEXTEND - file was extended

Note that the internal operation of poll() means that it is impossible
for two processes to reliably poll for the same event (this could
be fixed but may not be worth it), so it is not possible to rewrite
`tail -f' to use poll at this time.
1997-12-15 03:09:59 +00:00
Bruce Evans
80987b7a3b Fixed EOF handing.
1. SS_CANTRCVMORE was initially set on the wrong socket, so reads
when there has never been a writer on the socket did not return 0.
Note that such reads are only possible if the fifo was opened in
(O_RDONLY | O_NONBLOCK) mode.

2. SS_CANTSENDMORE was initially set on the wrong socket, but this
was harmless because the wrong socket is never sent from and there
is no need to set the flag initially on the right socket (since open
in (O_WRONLY | O_NONBLOCK) mode fails if there is no reader...).

3. SS_CANTRCVMORE was cleared when read() returns.  This broke the
case where read() returns 0 - subsequent reads are supposed to
return 0 until a writer appears.  There is no need to clear the
flag when read() returns, since it is cleared correctly when a
writer appears.
1997-12-13 13:49:59 +00:00
Bruce Evans
5fb0d3e0b3 Restored fifo_pathconf() from rev.1.32. vop_stdpathconf() is too
general to be of much use.  Using it here weakened the _PC_MAX_CANON,
_PC_MAX_INPUT and _PC_VDISABLE cases.

fifo_pathconf() is not quite correct either.  _PC_CHOWN_RESTRICTED
and _PC_LINK_MAX should be handled by the host file system.  For
directories, the host file system should let us handle _PC_PIPE_BUF.
1997-12-13 12:58:09 +00:00
Sean Eric Fagan
d7b7dcba41 Change the ioctls for procfs around a bit; in particular, whever possible,
change from

	ioctl(fd, PIOC<foo>, &i);

to

	ioctl(fd, PIOC<foo>, i);

This is going from the _IOW to _IO ioctl macro.  The kernel, procctl, and
truss must be in synch for it all to work (not doing so will get errors about
inappropriate ioctl's, fortunately).  Hopefully I didn't forget anything :).
1997-12-13 03:13:49 +00:00
Sean Eric Fagan
ba9d19e99b Fix a problem with procfs_exit() that resulted in missing some procfs
nodes; this also apparantly caused a panic in some circumstances.
Also, since procfs_exit() is getting rid of the nodes when a process
exits, don't bother checking for the process' existance in procfs_inactive().
1997-12-12 03:33:43 +00:00
Sean Eric Fagan
7486d3658f Code to prevent a panic caused by procfs_exit(). Note that i don't know
what is teh root cause -- but, sometimes, a procfs vnode in pfshead is
apparantly corrupt (or a UFS vnode instead).  Without this patch, I can
get it to panic by doing (in csh)

	while (1)
		ps auxwww
	end

and it will panic when the PID's wrap.  With it, it does not panic.
Yes -- I know that this is NOT the right way to fix it.  But I haven't
been able to get it to panic yet (which confuses me).  I am going to
be looking into the vgone() code now, as that may be a part of it.
1997-12-09 05:03:41 +00:00
Sean Eric Fagan
bfcfe2e1b1 A couple of fixes from bruce: first of all, psignal is a void (stupid
me; unfortunately, also makes it hard ot check for errors); second, I had
managed to forget a change to PIOCSFL (it should be _IOW, not _IOR) I had
in my local copy, and Bruce called me on it.

Submitted by:	bde
1997-12-08 22:09:39 +00:00
Sean Eric Fagan
847e5f5f9a Use at_exit() to invoke procfs_exit() instead of calling it directly.
Note that an unload facility should be used to call rm_at_exit() (if
procfs is being loaded as an LKM and is subsequently removed), but it
was non-obvious how to do this in the VFS framework.

Reviewed by:	Julian Elischer
1997-12-08 01:06:36 +00:00
Sean Eric Fagan
d99616387e Clear the stop events and wakeup the process on teh last close of the
procfs/mem file.  While this doesn't prevent an unkillable process, it
means that a broken truss prorgam won't do it accidently now (well,
there's a small window of opportunity).  Note that this requires the
change to truss I am about to commit.
1997-12-07 04:01:03 +00:00
Sean Eric Fagan
2a024a2b05 Changes to allow event-based process monitoring and control. 1997-12-06 04:11:14 +00:00
Bruce Evans
1cd52ec333 Don't include <sys/lock.h> in headers when only `struct simplelock' is
required.  Fixed everything that depended on the pollution.
1997-12-05 19:55:52 +00:00
Poul-Henning Kamp
80b301c385 Staticize. 1997-11-18 15:07:35 +00:00
Tor Egge
b872e9c03f Don't try to obtain an excluive lock on the vm map, since a deadlock might
occur if the process owning the map is wiring pages.
1997-11-14 22:57:46 +00:00
Julian Elischer
171d1bf26d fix slight breakages from PHK's VFS work.
also remove irrelevant copyright, now that all that code has gone away.
1997-11-08 19:02:28 +00:00
Poul-Henning Kamp
4a11ca4e29 Remove a bunch of variables which were unused both in GENERIC and LINT.
Found by:	-Wunused
1997-11-07 08:53:44 +00:00
Poul-Henning Kamp
cb226aaa62 Move the "retval" (3rd) parameter from all syscall functions and put
it in struct proc instead.

This fixes a boatload of compiler warning, and removes a lot of cruft
from the sources.

I have not removed the /*ARGSUSED*/, they will require some looking at.

libkvm, ps and other userland struct proc frobbing programs will need
recompiled.
1997-11-06 19:29:57 +00:00
Bruce Evans
521166c5b2 KNFize rev.1.31. 1997-10-27 15:39:01 +00:00
Bruce Evans
72cd7335b0 Use unique sleep message strings. 1997-10-27 15:33:04 +00:00
Bruce Evans
ef91bd5734 Removed unused #includes. The need for most of them went away with
recent changes (docluster* and vfs improvements).
1997-10-27 13:33:47 +00:00
Poul-Henning Kamp
dba3870c10 VFS interior redecoration.
Rename vn_default_error to vop_defaultop all over the place.
Move vn_bwrite from vfs_bio.c to vfs_default.c and call it vop_stdbwrite.
Use vop_null instead of nullop.
Move vop_nopoll from vfs_subr.c to vfs_default.c
Move vop_sharedlock from vfs_subr.c to vfs_default.c
Move vop_nolock from vfs_subr.c to vfs_default.c
Move vop_nounlock from vfs_subr.c to vfs_default.c
Move vop_noislocked from vfs_subr.c to vfs_default.c
Use vop_ebadf instead of *_ebadf.
Add vop_defaultop for getpages on master vnode in MFS.
1997-10-26 20:55:39 +00:00
Ollivier Robert
baa42bb2cc Fix the same leak as in nullfs. Now the lowervp is properly marked inactive.
Reviewed by:	phk
1997-10-21 21:08:17 +00:00
Ollivier Robert
1fb2a62daa Fix the file leak bug. The lower layer wasn't informed the vnode was inactive
and kept a reference, preventing the blocks to be reclaimed.

Changed the comment in null_inactive to reflect the current situation.

Reviewed by:	phk
1997-10-21 21:01:34 +00:00
Poul-Henning Kamp
e9565321ea VFS clean up "hekto commit"
1.  Add defaults for more VOPs
        VOP_LOCK        vop_nolock
        VOP_ISLOCKED    vop_noislocked
        VOP_UNLOCK      vop_nounlock
    and remove direct reference in filesystems.

2.  Rename the nfsv2 vnop tables to improve sorting order.
1997-10-16 22:01:05 +00:00
Poul-Henning Kamp
987f569678 Another VFS cleanup "kilo commit"
1.  Remove VOP_UPDATE, it is (also) an UFS/{FFS,LFS,EXT2FS,MFS}
    intereface function, and now lives in the ufsmount structure.

2.  Remove VOP_SEEK, it was unused.

3.  Add mode default vops:

    VOP_ADVLOCK          vop_einval
    VOP_CLOSE            vop_null
    VOP_FSYNC            vop_null
    VOP_IOCTL            vop_enotty
    VOP_MMAP             vop_einval
    VOP_OPEN             vop_null
    VOP_PATHCONF         vop_einval
    VOP_READLINK         vop_einval
    VOP_REALLOCBLKS      vop_eopnotsupp

    And remove identical functionality from filesystems

4.   Add vop_stdpathconf, which returns the canonical stuff.  Use
     it in the filesystems.  (XXX: It's probably wrong that specfs
     and fifofs sets this vop, shouldn't it come from the "host"
     filesystem, for instance ufs or cd9660 ?)

5.   Try to make system wide VOP functions have vop_* names.

6.   Initialize the um_* vectors in LFS.

(Recompile your LKMS!!!)
1997-10-16 20:32:40 +00:00
Poul-Henning Kamp
cec0f20ce7 VFS mega cleanup commit (x/N)
1.  Add new file "sys/kern/vfs_default.c" where default actions for
    VOPs go. Implement proper defaults for ABORTOP, BWRITE, LEASE,
    POLL, REVOKE and STRATEGY.  Various stuff spread over the entire
    tree belongs here.

2.  Change VOP_BLKATOFF to a normal function in cd9660.

3.  Kill VOP_BLKATOFF, VOP_TRUNCATE, VOP_VFREE, VOP_VALLOC.  These
    are private interface functions between UFS and the underlying
    storage manager layer (FFS/LFS/MFS/EXT2FS).  The functions now
    live in struct ufsmount instead.

4.  Remove a kludge of VOP_ functions in all filesystems, that did
    nothing but obscure the simplicity and break the expandability.
    If a filesystem doesn't implement VOP_FOO, it shouldn't have an
    entry for it in its vnops table.  The system will try to DTRT
    if it is not implemented.  There are still some cruft left, but
    the bulk of it is done.

5.  Fix another VCALL in vfs_cache.c (thanks Bruce!)
1997-10-16 10:50:27 +00:00
Julian Elischer
67d65825cf remove forgotten debug printf() 1997-10-16 08:18:38 +00:00
Julian Elischer
2daae425f5 1/ by default make all versions of the same device get the same vnode.
2/ Show the dummy mount in the mount list. it cannot be reached (that I know of)
	but puting it there, means that disks mounted from devfs will have their	things such as the superblock and the bitmaps, synced to disk :)
1997-10-16 07:28:50 +00:00
Julian Elischer
2a5e970deb some cleanups of init code, and changes needed to support disk layering. 1997-10-16 06:29:27 +00:00
Poul-Henning Kamp
138ec1f71a vnops megacommit
1.  Use the default function to access all the specfs operations.
2.  Use the default function to access all the fifofs operations.
3.  Use the default function to access all the ufs operations.
4.  Fix VCALL usage in vfs_cache.c
5.  Use VOCALL to access specfs functions in devfs_vnops.c
6.  Staticize most of the spec and fifofs vnops functions.
7.  Make UFS panic if it lacks bits of the underlying storage handling.
1997-10-15 13:24:07 +00:00
Poul-Henning Kamp
6a525123aa Hmm, realign the vnops into two columns. 1997-10-15 10:05:29 +00:00
Poul-Henning Kamp
539ef70c2d Stylistic overhaul of vnops tables.
1. Remove comment stating the blatantly obvious.
        2. Align in two columns.
        3. Sort all but the default element alphabetically.
        4. Remove XXX comments pointing out entries not needed.
1997-10-15 09:22:02 +00:00
Julian Elischer
d9c15b1f71 if we free all the links to a node, then by definition
we freed the name we used to find it..
SO DON'T free it again later!

pointy hat over here please..
1997-10-12 22:27:11 +00:00
Poul-Henning Kamp
a1c995b626 Last major round (Unless Bruce thinks of somthing :-) of malloc changes.
Distribute all but the most fundamental malloc types.  This time I also
remembered the trick to making things static:  Put "static" in front of
them.

A couple of finer points by:	bde
1997-10-12 20:26:33 +00:00
Poul-Henning Kamp
55166637cd Distribute and statizice a lot of the malloc M_* types.
Substantial input from:	bde
1997-10-11 18:31:40 +00:00
Julian Elischer
d5ad8952dc Allow a deleted deveice to delte it's nodes in other mounted devfs
filesystems even if not in SPLIT_DEVS mode.
1997-10-10 07:54:05 +00:00
KATO Takenori
81bca6ddae Clustered read and write are switched at mount-option level.
1. Clustered I/O is switched by the MNT_NOCLUSTERR and MNT_NOCLUSTERW
   bits of the mnt_flag.  The sysctl variables, vfs.foo.doclusterread
   and vfs.foo.doclusterwrite are deleted.  Only mount option can
   control clustered I/O from userland.
2. When foofs_mount mounts block device, foofs_mount checks D_CLUSTERR
   and D_CLUSTERW bits of the d_flags member in the block device switch
   table.  If D_NOCLUSTERR / D_NOCLUSTERW are set, MNT_NOCLUSTERR /
   MNT_NOCLUSTERW bits will be set.  In this case, MNT_NOCLUSTERR and
   MNT_NOCLUSTERW cannot be cleared from userland.
3. Vnode driver disables both clustered read and write.
4. Union filesystem disables clutered write.

Reviewed by:	bde
1997-09-27 13:40:20 +00:00
John Dyson
99448ed11d Change the M_NAMEI allocations to use the zone allocator. This change
plus the previous changes to use the zone allocator decrease the useage
of malloc by half.  The Zone allocator will be upgradeable to be able
to use per CPU-pools, and has more intelligent usage of SPLs.  Additionally,
it has reasonable stats gathering capabilities, while making most calls
inline.
1997-09-21 04:24:27 +00:00
Poul-Henning Kamp
18ecdb585c Executing binaries on a nullfs (or nullfs-based) filesystem results in
a trap.
PR:		3104
Reviewed by:	phk
Submitted by:	Dan Walters hannibal@cyberstation.net
1997-09-18 18:33:23 +00:00
Julian Elischer
72963672f5 devfs changes to allow old (better) and newer (braindamaged) behaviour.
I'm going to try migrate back, while keeping the newer code.
1997-09-16 09:10:18 +00:00
Peter Wemm
a6aeade2c4 Convert select -> poll.
Delete 'always succeed' select/poll handlers, replaced with generic call.
Flag missing vnode op table entries.
1997-09-14 02:58:12 +00:00
Bruce Evans
41fadeeb28 Removed yet more vestiges of config-time swap configuration and/or
cleaned up nearby cruft.
1997-09-07 16:21:11 +00:00
Bruce Evans
a910e75cdc Removed vestiges of config-time "argument processing" configuration. 1997-09-07 13:49:56 +00:00
Bruce Evans
c109c5775a Staticized. 1997-09-07 06:46:34 +00:00
Bruce Evans
bea0f0be7b Some staticized variables were still declared to be extern. 1997-09-07 05:27:26 +00:00
KATO Takenori
6ca02614a5 Support read-only mount. 1997-09-04 03:14:49 +00:00
Bruce Evans
e4ba6a82b0 Removed unused #includes. 1997-09-02 20:06:59 +00:00
KATO Takenori
1bf978ce42 Include "opt_ddb.h" only when NULLFS_DIAGNOSTIC is defined. 1997-08-28 00:44:43 +00:00
KATO Takenori
e958d078c4 Fixed NULLFS_DIAGNOSTIC stuff. 1997-08-27 08:44:43 +00:00
Julian Elischer
139c7c8e2d remove un-needed if statement (now the poul removed the 'then' clause) 1997-08-27 02:58:40 +00:00
Julian Elischer
bdb9147f65 two fixes submitted by Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
fixes problems in unmounting and propogation.
1997-08-26 17:17:52 +00:00
Poul-Henning Kamp
013739386f Copy&Paste considered harmful:
Remove all traces of the name_cache from devfs.  It is hardly sensible to
use the namecache for an all-RAM filesystem.
1997-08-25 20:31:00 +00:00
Garrett Wollman
57bf258e3d Fix all areas of the system (or at least all those in LINT) to avoid storing
socket addresses in mbufs.  (Socket buffers are the one exception.)  A number
of kernel APIs needed to get fixed in order to make this happen.  Also,
fix three protocol families which kept PCBs in mbufs to not malloc them
instead.  Delete some old compatibility cruft while we're at it, and add
some new routines in the in_cksum family.
1997-08-16 19:16:27 +00:00
KATO Takenori
f5a5311ee8 Added DIAGNOSTIC routine to test inconsistency of vnode when cnp
points `.'.

Obtained from:	NetBSD
1997-08-15 02:36:28 +00:00
KATO Takenori
a03a24c901 Deleted unused code which adjust UN_UNLOCK flag. 1997-08-15 02:35:00 +00:00
KATO Takenori
5842d4e5b2 If the user doesn't have read permission, union_copyup should not copy
a file to upper layer.

Reviewed by:	Naofumi Honda <honda@Kururu.math.sci.hokudai.ac.jp>
1997-08-14 03:57:46 +00:00
KATO Takenori
3dc942bbe9 Backed out part of previous change. The example of -b mount in
manpage works again.
1997-08-14 03:52:27 +00:00
KATO Takenori
f8fc96b551 Fixed vnode corruption by undefined case in union_lookup(). When
uerror == 0 && lerror == EACCES, lowervp == NULLVP and union_allocvp
doesn't find existing union node and new union node is created.

Sicne it is dificult to cover all the case, union_lookup always
returns when union_lookup1() returns EACCES.

Submitted by:	Naofumi Honda <honda@Kururu.math.sci.hokudai.ac.jp>
Obtained from:	NetBSD/pc98
1997-08-12 07:18:59 +00:00
Sean Eric Fagan
66ad7973ce Check permissions for fp regs as well as normal regs. 1997-08-12 05:23:51 +00:00
Sean Eric Fagan
49356a1f4a Fix procfs security hole -- check permissions on meaningful I/Os (namely,
reading/writing of mem and regs).  Also have to check for the requesting
process being group KMEM -- this is a bit of a hack, but ps et al need it.

Reviewed by:	davidg
1997-08-12 04:34:30 +00:00
Bruce Evans
1fd0b0588f Removed unused #includes. 1997-08-02 14:33:27 +00:00
Julian Elischer
0ec278018b two tiny typo's 1997-07-14 04:53:52 +00:00
Julian Elischer
5897e2693a remove annoying debug message 1997-07-14 04:30:22 +00:00
Alexander Langer
ee97e537f7 More comment cleanup. 1997-06-26 17:12:59 +00:00
Alexander Langer
09c8ff4a78 Typo police. 1997-06-26 16:13:56 +00:00
Alexander Langer
2c39c8177b Style fix my previous commit. 1997-06-26 16:12:53 +00:00
Alexander Langer
8a77722ad7 Block all write operations to /proc/1/* when securelevel > 0.
The additional check in procfs_ctl.c could be backed out, but
I'm leaving it in for good measure.

Reviewed by:	Theo de Raadt <deraadt@OpenBSD.org>
1997-06-21 16:09:49 +00:00
Tor Egge
14a4b83067 Don't remove the controlling tty from the session if the vnode is being
cleaned. This should help for PR kern/3581.
1997-05-29 13:29:13 +00:00
Peter Wemm
e9f7506f89 Fix some warnings (missing prototypes, wrong "generic" args etc)
umapfs uses one of nullfs's functions...
1997-05-25 04:50:02 +00:00
KATO Takenori
c9bf011176 1. Added cast and parenthesis in block size calculaion in
union_statfs().
2. staticized union vops.

Submitted by:	Doug Rabson <dfr@nlsystems.com>
1997-05-07 14:37:32 +00:00
Joerg Wunsch
ce34628b4b Fix the umount problems for DEVFS.
PR:		3276 & 3469 (the fixes), 2738, 2033 (reports)
Submitted by:	Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
1997-05-03 21:19:54 +00:00
KATO Takenori
32cfb899a6 Fixed panic message in union_lock(): union_link --> union_lock. 1997-05-03 01:55:19 +00:00
KATO Takenori
5f3f68a8ba Access correct union mount point in union_access. Old vnode is saved
in savedvp variable and it is used for the argument of
MOUNTTOUNIONMOUNT().  I didn't realize ap->a_vp is modified before
MOUNTTOUNIONMOUNT(), so the change by revision 1.22 is incorrect.
1997-05-02 03:21:54 +00:00
Søren Schmidt
e34cbf1f59 Remove the dependancy on DEV_BSIZE, now specfs works on != 512byte
sector devices given that the fs uses a blocksize of at least a physical
sector size.
1997-05-01 19:12:22 +00:00
KATO Takenori
a9320ff3bd Revised fix for locking violation when unionfs calls vput with
UN_KLOCK flag.

When UN_KLOCK is set, VOP_UNLOCK should keep uppervp locked and clear
UN_ULOCK flag.  To do this, when UN_KLOCK is set, (1) union_unlock
clears UN_ULOCK and does not clear UN_KLOCK, (2) union_lock() does not
access uppervp and does not clear UN_KLOCK, and (3) callers of
vput/VOP_UNLOCK should clear UN_KLOCK.  For example, vput becomes:

	SETKLOCK(union_node);
	vput(vnode);
	CLEARKLOCK(union_node);

where SETKLOCK macro sets UN_KLOCK and CLEARKLOCK macro clears
UN_KLOCK.
1997-04-29 02:06:07 +00:00
Alexander Langer
898fcb3b84 Removed bogon from previous commit: doubly included sys/systm.h. 1997-04-27 21:32:21 +00:00
Alexander Langer
ee7877dfec Prevent debugger attachment to init when securelevel > 0.
Noticed by:	Brian Buchanan <brian@wasteland.calbbs.com>
1997-04-27 19:02:37 +00:00
KATO Takenori
c4ace78562 Undo 1.29. 1997-04-27 10:49:37 +00:00
KATO Takenori
a18ac0ffaf Do nothing instead of adjusting un_flags when (uppervp is locked) &&
(UN_ULOCK is not set) in union_lock.  This condition may indicate
race.  DIAGNOSTIC kernel still panic here.
1997-04-26 13:43:25 +00:00
KATO Takenori
928e13b6a1 Do not clear UN_ULOCK in certain case.
Our vput calls vm_object_deallocate() --> vm_object_terminate().  The
vm_object_terminate() calls vn_lock(), since UN_LOCKED has been
already cleared in union_unlock().  Then, union_lock locks upper vnode
when UN_ULOCK is not set.  The upper vnode is not unlocked when
UN_KLOCK is set in union_unlock(), thus, union_lock tries to lock
locked vnode and we get panic.
1997-04-26 04:09:40 +00:00
KATO Takenori
18b4c8e206 Dirty change in union_lock(). Sometimes upper vnode is locked without
UN_ULOCK flag.  This shows a locking violation but I couldn't find the
reason UN_ULOCK is not set or upper vnode is not unlocked.  I added
the code that detect this case and adjust un_flags.  DIAGNOSTIC kernel
doesn't adjust un_flags, but just panic here to help debug by kernel
hackers.
1997-04-21 15:32:24 +00:00
KATO Takenori
077f31be53 Replace VOP_LOCK with vn_lock. 1997-04-21 12:40:42 +00:00
John Dyson
7cac787bee Fix both a problem with accessing backing objects, and also release
the process map on nonexistant pages.
PR:		kern/3327
Submitted by:	Tor Egge <Tor.Egge@idi.ntnu.no>
1997-04-20 17:12:11 +00:00
KATO Takenori
747e915757 Avoid `lock against myself' panic by following operation:
# mount -t union (or null) dir1 dir2
	# mount -t union (or null) dir2 dir1

The function namei in union_mount calls union_root.  The upper vnode
has been already locked and vn_lock in union_root causes above panic.

Add printf's included in `#ifdef DIAGNOSTIC' for EDEADLK cases.
1997-04-19 06:04:13 +00:00
KATO Takenori
f85e8fc5ca Fix `locking against myself' panic by multi nullfs mount of same
directory pair.
1997-04-17 11:24:57 +00:00
KATO Takenori
c5e17d9e2b Use NULLVP instead of NULL. 1997-04-17 11:17:30 +00:00
KATO Takenori
b69aa7f11a Do not set the uppervp to NULLVP in union_removed_upper. If lowervp
is NULLVP, union node will have neither uppervp nor lowervp.  This
causes page fault trap.

The union_removed_upper just remove union node from cache and it
doesn't set uppervp to NULLVP.  Since union node is removed from
cache, it will not be referenced.

The code that remove union node from cache was copied from
union_inactive.
1997-04-16 16:24:24 +00:00
KATO Takenori
93d71a483c Undo previous commit to avoid panic, and fix order of argument of
VOP_LINK().  The reason of strange behavior was wrong order of the
argument, that is, the operation

	# ln foo bar

in a union fs tried to do

	# ln bar foo

in ufs layer.

Now we can make a link in a union fs.
1997-04-16 03:08:34 +00:00
KATO Takenori
9095719e2b Quick-hack to avoid `lock against myself' panic. It is not the real
fix!

The ufs_link() assumes that vnode is not unlocked and tries to lock it
in certain case.  Because union_link calls VOP_LINK after locking vnode,
vn_lock in ufs_link causes above panic.

Currently, I don't know the real fix for a locking violation in
union_link, but I think it is important to avoid panic.

A vnode is unlocked before calling VOP_LINK and is locked after it if
the vnode is not union fs.  Even though panic went away, the process
that access the union fs in which link was made will hang-up.

Hang-up can be easily reproduced by following operation:

	mount -t union a b
	cd b
	ln foo bar
	ls
1997-04-15 12:56:57 +00:00
KATO Takenori
6db918e371 Fix `lockmgr: locking against myself' panic by multi union mount of
same directory pair.

If we do:
    mount -t union a b
    mount -t union a b
then, (1) namei tries to lock fs which has been already locked by
first union mount and (2) union_root() tries to lock locked fs.  To
avoid first deadlock condition, unlock vnode if lowerrootvp is union
node, and to avoid second case, union_mount returns EDEADLK when multi
union mount is detected.
1997-04-14 10:52:25 +00:00
KATO Takenori
ee582cdff0 Fix locking violation when accessing `..'.
Obtained from:	NetBSD
1997-04-14 05:13:55 +00:00
KATO Takenori
3a946335ae Access correct union mount point in union_access. 1997-04-13 13:12:12 +00:00
Poul-Henning Kamp
363ad70091 The function union_fsync tries to lock overlaying vnode object when
dolock is not set (that is, targetvp == overlaying vnode object).
Current code use FIXUP macro to do this, and never unlocks overlaying
vnode object in union_fsync.  So, the vnode object will be locked
twice and never unlocked.

PR:		3271
Submitted by:	kato
1997-04-13 06:29:13 +00:00
Poul-Henning Kamp
b422956c56 The path name buffer, cn->cn_pnbuf, is FREEed by VOP_MKDIR when
relookup() in union_relookup() is succeeded.  However, if relookup()
returns non-zero value, that is relookup fails, VOP_MKDIR is never
called (c.f. union_mkshadow).  Thus, pathname buffer is never FREEed.

Reviewed by:	phk
Submitted by:	kato
PR:		3262
1997-04-13 06:27:09 +00:00
Poul-Henning Kamp
9fa6ee7671 Though malloc allocates only cn.cn_namelen bytes for cn.cn_pnbuf in
union_vn_create(), following bcopy copies cn.cn_namlen + 1 bytes to
cn.cn_pnbuf

PR:		3255
Reviewed by:	phk
Submitted by:	kato
1997-04-13 06:25:03 +00:00
KATO Takenori
ae9d2b47e0 Removed libc stuffs. Lite/2 merged libc contains unionfs support, and
we don't have to use the libc related files in sys/misc/unionfs
directory.
1997-04-13 06:12:13 +00:00
Bruce Evans
c90607ba7f Get the declaration of `struct dirent' from <sys/dirent.h>, not from
<sys/dir.h>, and use the new macro GENERIC_DIRSIZ() instead of DIRSIZ().

Removed unused #includes.
1997-04-10 15:05:38 +00:00
Bruce Evans
1a2efb7550 Removed unused or apparently-unused #includes, especially of the
deprecated header <sys/dir.h>.
1997-04-10 14:35:32 +00:00
John Dyson
a04c970a7a Fix the gdb executable modify problem. Thanks to the detective work
by Alan Cox <alc@cs.rice.edu>, and his description of the problem.

The bug was primarily in procfs_mem, but the mistake likely happened
due to the lack of vm system support for the operation.  I added
better support for selective marking of page dirty flags so that
vm_map_pageable(wiring) will not cause this problem again.

The code in procfs_mem is now less bogus (but maybe still a little
so.)
1997-04-06 02:29:45 +00:00
Bruce Evans
71455815cc Don't include <sys/ioctl.h> in the kernel. Stage 3: include
<sys/filio.h> instead of <sys/ioctl.h> in non-network non-tty files.
1997-03-24 11:37:53 +00:00
Bruce Evans
fce002fdef Don't include <sys/ioctl.h> in the kernel. Stage 1: don't include
it when it is not used.  In most cases, the reasons for including it
went away when the special ioctl headers became self-sufficient.
1997-03-24 11:25:10 +00:00
Bruce Evans
3ac4d1ef0c Don't #include <sys/fcntl.h> in <sys/file.h> if KERNEL is defined.
Fixed everything that depended on getting fcntl.h stuff from the wrong
place.  Most things don't depend on file.h stuff at all.
1997-03-23 03:37:54 +00:00
Bruce Evans
90106ad38b Fixed missing initialisation of vp->v_type for types Pfile and Pmem
in procfs_allocvp().  This fixes at least stat() of /proc/*/mem.

stat() of /proc/*/file already worked.  I think procfs_allocvp() isn't
actually called for type Pfile.
1997-03-08 16:06:34 +00:00
Bruce Evans
9135a51377 Use Lite2's stub locking vops instead of nullop. 1997-02-24 17:08:49 +00:00
Bruce Evans
a3d13e5054 Fixed procfs's locking vops. They were missed in the Lite2 merge,
partly because the #define's for them were moved to a different
file.  At least the null VOP_LOCK() no longer works, since vclean()
expects VOP_LOCK( ..., LK_DRAIN | LK_INTERLOCK, ...) to clear the
interlock.  This probably only matters when simple_lock() is not
null, i.e., when there are multiple CPUs or SIMPLELOCK_DEBUG is
defined.
1997-02-24 16:44:11 +00:00
Peter Wemm
6875d25465 Back out part 1 of the MCFH that changed $Id$ to $FreeBSD$. We are not
ready for it yet.
1997-02-22 09:48:43 +00:00
Mike Pritchard
f3a778f288 Eliminate the last of the compile warnings in this module by
correctly casting the arguments to all of the null_bypass() calls.
1997-02-12 18:06:08 +00:00
Mike Pritchard
fdc0430e50 Restore of #include <sys/kernel.h> so that this compiles without
warnings again.
1997-02-12 17:47:28 +00:00
Mike Pritchard
10546e217e Rstored #include of <sys/kernel.h> so that this compiles
without warnings again.

Submitted by:	bde
1997-02-12 16:26:37 +00:00
Mike Pritchard
fd7a659f2f Make this compile again after the Lite2 merge.
Call vget/VOP_UNLOCK with the correct number of
arguments.  Call vn_lock where appropriate.
vfs_goneall is now replaced by VOP_REVOKE.

Submitted by:	bde
1997-02-12 16:19:11 +00:00
Mike Pritchard
63f50488b0 Make this compile again after the Lite2 merge.
Also add missing function prototypes.
1997-02-12 14:55:01 +00:00
Mike Pritchard
aae8d53e0e Add missing function prototypes. 1997-02-12 14:54:14 +00:00
Bruce Evans
938958b97f Added parameter names to prototypes that were added in the last commit to
match nearby style.
1997-02-12 14:45:23 +00:00
Bruce Evans
9e67ea79f0 Restored #include of <sys/kernel.h> so that this compiles again. 1997-02-12 14:31:11 +00:00
Mike Pritchard
72a5ee14de Add function protypes for the new Lite2 unionfs functions. 1997-02-12 07:54:22 +00:00
Mike Pritchard
724ab19569 Add function prototypes for most of the new Lite2 functions.
Also made a few of the miscfs routines static to be
consistent.  Some modules simply required some additional
#includes to remove -Wall warnings.
1997-02-12 06:52:51 +00:00
John Dyson
996c772f58 This is the kernel Lite/2 commit. There are some requisite userland
changes, so don't expect to be able to run the kernel as-is (very well)
without the appropriate Lite/2 userland changes.

The system boots and can mount UFS filesystems.

Untested: ext2fs, msdosfs, NFS
Known problems: Incorrect Berkeley ID strings in some files.
		Mount_std mounts will not work until the getfsent
		library routine is changed.

Reviewed by:	various people
Submitted by:	Jeffery Hsu <hsu@freebsd.org>
1997-02-10 02:22:35 +00:00
John Dyson
afa07f7e83 Change the map entry flags from bitfields to bitmasks. Allows
for some code simplification.
1997-01-16 04:16:22 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Bruce Evans
bb65f5a1cc Fixed lseek() on named pipes. It always succeeded but should always fail.
Broke locking on named pipes in the same way as locking on non-vnodes
(wrong errno).  This will be fixed later.

The fix involves negative logic.  Named pipes are now distinguished from
other types of files with vnodes, and there is additional code to handle
vnodes and named pipes in the same way only where that makes sense (not
for lseek, locking or TIOCSCTTY).
1996-12-19 19:42:37 +00:00
Bruce Evans
2cec12807d Fixed errno for unsupported advisory locks. The errno is now EINVAL
fcntl() and EOPNOTSUPP for flock().  POSIX specifies the weaker EINVAL
errno and the man page agrees.

Not fixed:
deadfs: always returns wrong EBADF
devfs, msdosfs: always return sometimes-wrong EINVAL
cd9660, fdesc, kernfs, portal: always return sometimes-wrong EOPNOTSUPP
procfs: always returns wrong EIO
mfs: panic?!
nfs: fudged

NetBSD uses a generic file system genfs to do return the sometimes-wrong
EOPNOTSUPP more consistently :-)(.

Found by:	NIST-PCTS
1996-12-19 18:16:33 +00:00
Julian Elischer
acdbeb6b1c changes to make devfs more 'normal'
also fixes a bug I've been chasing for a LONG TIME,
due to the fact that spec_bwrite is a NOP and I didn't realise it..

old symptom:
mount -t devfs devfs /mnt
mount /mnt/wd0e /mnt/mnt2
umount /mnt2 <process hangs>

there are some pretty large structural differences internal to devfs
but outwards it should look the same.
I have not yet tested extensively but will do so and fix 3 warnings tomorrow.
1996-11-21 07:19:00 +00:00
John Dyson
d700038439 Fix a potential deadlock from the previous commit. 1996-10-30 03:52:57 +00:00
John Dyson
56673451a7 Fix the /proc/???/map file so that it is possible to read an arbitrarily
large process map.  Another commit will follow to fix a problem just found
during this one... Sorry!!! :-(.
1996-10-30 03:45:00 +00:00
Poul-Henning Kamp
7f6a56eff7 devfs_tree.c: improve our bdevvp() function.
devfs_vnops.c:	move a debug printf to be consistent.
1996-10-28 11:36:06 +00:00
John Dyson
c864a7c0a9 Fix setting breakpoints in shared regions. 1996-10-24 02:47:05 +00:00
Julian Elischer
24b3bdfe8d Just because something doesn't make sense doesn't mean it should be illegal..
just ignore it instead.
===================================================================
RCS file: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v
retrieving revision 1.30
diff -r1.30 devfs_vnops.c
631d630
<           (vap->va_size != VNOVAL) || /* doesn't make sense in devfs */
1996-10-17 22:47:23 +00:00
Julian Elischer
138e4d769c actually impliment permissions for teh chown/chmod/etc functions
that resemble what the man pages say.
also fix braino (type last week)
1996-10-16 23:14:00 +00:00
Julian Elischer
336cf5014e Allow the utimes call to work on devfs nodes. 1996-10-16 18:02:53 +00:00
Julian Elischer
1737b9d383 reads and writes to devices update m and a times
add some security onn the chmod/chown operations
should now be root or owner
(still needs more thought but kinda-plugs tow holes pointed out by bde)
1996-10-12 00:07:53 +00:00
John Dyson
66166d45de Substitution of a long divide by a shift. Other cosmetic improvements.
Submitted by:	bde
1996-10-06 21:19:33 +00:00
Bruce Evans
dc927d0c6b Started unspamming <sys/systm.h>. Don't include <machine/stdarg.h>
to get the declaration of va_list; just use _BSD_VA_LIST.  Fixed
the 2 places that need <machine.stdarg.h> but didn't include it
explicitly.
1996-09-29 15:00:37 +00:00
Nate Williams
d977b72dbd Whoops, I should've used the LINT config file. More ts -> tv changes
for timespec structure.
1996-09-20 05:56:36 +00:00
Julian Elischer
99892d2317 fix the ability of the VFS to reclaim devfs nodes correctly..
(was resulting in panics, especially when DIAGNOSTIC was set.)
1996-09-11 07:52:18 +00:00
Bruce Evans
f313170d3c Updated #includes to 4.4Lite style. 1996-09-10 08:32:01 +00:00
Bruce Evans
b71fec07db Eliminated nested include of <sys/unistd.h> in <sys/file.h> in the kernel.
Include it directly in the few places where it is used.

Reduced some #includes of <sys/file.h> to #includes of <sys/fcntl.h> or
nothing.
1996-09-03 14:25:27 +00:00
Bruce Evans
e0c95ed947 Fixed the easy cases of const poisoning in the kernel. Cosmetic. 1996-08-31 16:52:44 +00:00
John Dyson
6476c0d204 Even though this looks like it, this is not a complex code change.
The interface into the "VMIO" system has changed to be more consistant
and robust.  Essentially, it is now no longer necessary to call vn_open
to get merged VM/Buffer cache operation, and exceptional conditions
such as merged operation of VBLK devices is simpler and more correct.

This code corrects a potentially large set of problems including the
problems with ktrace output and loaded systems, file create/deletes,
etc.

Most of the changes to NFS are cosmetic and name changes, eliminating
a layer of subroutine calls.  The direct calls to vput/vrele have
been re-instituted for better cross platform compatibility.

Reviewed by: davidg
1996-08-21 21:56:23 +00:00
Julian Elischer
def534af64 Submitted by: doug Rabson (dfr@render.com)
cleaning up some of the vnode usage..

(I'm sure it still needs more..)
where can one find out what each vfs call expects to be locked
on completion, and how can one find out what each layer expects
to be freed on error.?
1996-08-13 19:48:41 +00:00
Julian Elischer
ed9a71b7fc symlink support in devfs.
it only barely works so don't get too carried away..
I noticed that teh symlink is length 0..
I guess I'll fix that tomorrow..
it also sometimes panics with "cleaned vnode isn't" but it's not more
broken than it was before.. I really want to go over it with someone
who understands the lifecycle of a vnode better than I do..

terry?
kirk?
david?
john?
1996-08-13 07:21:45 +00:00
Bruce Evans
8c2ff39670 Only use the special bdevvp() for DEVFS if DEVFS_ROOT is defined. This
makes option DEVFS safe to use again (although mounting devfs is unsafe).
1996-07-30 18:00:32 +00:00
John Dyson
3c087a2f30 Modify slightly the output from the map file in /proc. Now the
executable bit is shown.
1996-07-27 19:47:04 +00:00
John Dyson
34e95a26ec Under certain circumstances, reading the /proc/*/map file can
crash the system.  Nonexistant objects were not handled correctly.
1996-07-27 18:28:10 +00:00
John Dyson
29387b7bb6 Remove a totally unneeded (and as of the last VM commit, incorrect) call
to pmap_clear_modify.
1996-07-27 03:50:31 +00:00
Poul-Henning Kamp
c74bb98638 DEVFS needs a special bdevvp().
I just noticed some junk in my patch.  I'll remove that in a sec.
1996-07-24 21:22:36 +00:00
Poul-Henning Kamp
41e4eb70b4 Comment out rootdev & rrootdev so a ls -l doesn't panic the machine. 1996-07-03 03:48:46 +00:00
John Dyson
688bbd5b76 Implement locking for pfs nodes, when at the leaf. Concurrent access
to information from a single process causes hangs.  Specifically, this
fixes problems (hangs) with concurrent ps commands, when the system is under
heavy memory load.
Reviewed by:	davidg
1996-07-02 13:38:10 +00:00
John Dyson
c6c4b08e59 Fix a serious problem, with a window where an object lock is needed,
but not there.  The extent of the object lock is expanded to be over the
range that it is needed.  Additionally, clean up the code so that it conforms
to better coding style.
1996-07-02 01:40:52 +00:00
John Dyson
32acf9a16a Add procfs_type.c to the repository. 1996-06-18 05:22:45 +00:00
John Dyson
6ead3edd9c Clean-up the new VM map procfs code, and also add support for executable
format file "etype".  It contains a description of the binary type for
a process.
1996-06-18 05:16:00 +00:00
John Dyson
975dcaa94f This file is the "meat" of the process address space capability. If you
would like other things added, just ask!!!  It might be pretty easy to add.
1996-06-17 22:53:27 +00:00
John Dyson
9353aadd89 Add a feature to procfs to allow display of the process address map
with multiple entries as follows:

	start address, end address, resident pages in range, private pages
		in range, RW/RO, COW or not, (vnode/device/swap/default).
1996-06-17 22:43:36 +00:00
Gary Palmer
75cc5f07de Cosmetic change: make the ``ready to run'' line match the
``ready for devices'' printed out earlier by changing `devs '
to be `DEVFS: '
1996-06-15 20:37:22 +00:00
Gary Palmer
c23670e294 Clean up -Wunused warnings.
Reviewed by:		bde
1996-06-12 05:11:41 +00:00
Gary Palmer
1409e0b384 Clean up -Wunused warnings. Julian asked me to just ifdef
out unused code as this is still work in progress.

Reviewed by:		bde
1996-06-12 05:08:34 +00:00
David Greenman
2f9bae59d6 Moved the fsnode MALLOC to before the call to getnewvnode() so that the
process won't possibly block before filling in the fsnode pointer (v_data)
which might be dereferenced during a sync since the vnode is put on the
mnt_vnodelist by getnewvnode.

Pointed out by Matt Day <mday@artisoft.com>
1996-06-12 03:37:57 +00:00
John Dyson
dc48d43a6c Properly lock the vm space when accessing the memory in a process. This
fix could solve some "interesting" problems that could happen during
process rundown.
1996-06-11 23:52:27 +00:00
Joerg Wunsch
cbe4630780 Fix the reproto.sh script that was broken after my KNFification.
Pointed out by: bde
1996-04-07 01:15:03 +00:00
Joerg Wunsch
d9fb9dd03e KNFify the function definitions. It's harder to grep around when the
function names don't start in column 1.
1996-04-06 13:34:37 +00:00
Marc G. Fournier
ad98bd0b24 Merged devfs_add_devsw() into devfs_add_devswf() 1996-04-03 03:03:27 +00:00
Marc G. Fournier
2523e82c8b Made the src code match the man page.
Removed dev_link() and dev_linkf(), replacing dev_linkf() with devfs_link()
1996-04-02 04:53:05 +00:00
Marc G. Fournier
0d5b12e38e Added dev_linkf() function (dev_link() + printf-style arguments)
Reviewed by:	julian@freebsd.org
1996-03-28 14:32:27 +00:00
Julian Elischer
54a5291b37 Submitted by: "Marc G. Fournier" <scrappy@ki.net>
allows correct creation of subdirectories in devfs_add_devswf()
1996-03-25 21:56:59 +00:00
John Dyson
ad5dd2341c Fix the problem that unmounting filesystems that are backed by a VMIO
device have reference count problems.  We mark the underlying object
ono-persistent, and account for the reference count that the VM system
maintainsfor the special device close.  This should fix the removable
device problem.
1996-03-19 05:13:22 +00:00
Peter Wemm
89be462c47 This commit was generated by cvs2svn to compensate for changes in r14557,
which included commits to RCS files with non-trunk default branches.
1996-03-11 19:29:25 +00:00
Peter Wemm
5e5861b9c6 Import 4.4BSD-Lite2 onto the vendor branch, note that in the kernel, all
files are off the vendor branch, so this should not change anything.

A "U" marker generally means that the file was not changed in between
the 4.4Lite and Lite-2 releases, and does not need a merge.  "C" generally
means that there was a change.
[two new auxillary files in miscfs/union]
1996-03-11 19:29:25 +00:00
Jeffrey Hsu
5a18c60a63 For Lite2: proc LIST changes.
Reviewed by:	davidg & bde
1996-03-11 06:13:09 +00:00
John Dyson
46d66d275b Make sure that the zero flag is cleared upon completion of paging I/O. 1996-03-09 07:02:52 +00:00
Julian Elischer
e9ee430593 really stupid mistake that stopped devices from appearing on the fly in mounted
DEVFS filesystems..

- 		if ( error = dev_add_name(child->name,parent->dnp
+ 		if ( error = dev_add_name(child->name,falias->dnp

Ok bruce, this is the one you were seeing..
1996-02-18 07:29:53 +00:00
Garrett Wollman
dc915e7cfc Kill XNS.
While we're at it, fix socreate() to take a process argument.  (This
was supposed to get committed days ago...)
1996-02-13 18:16:31 +00:00
Wolfram Schneider
1d08058f65 add ruid and rgid to file 'status' 1996-02-02 05:19:20 +00:00
Mike Pritchard
6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
Poul-Henning Kamp
02ae573ca8 make devfs_add_devswf a little smarter about '/'; 1996-01-28 10:07:55 +00:00
Poul-Henning Kamp
831e28a67a Make devfs_add_devfsf() which takes printf style args. 1996-01-25 07:17:31 +00:00
Peter Wemm
f863805df0 This time, really make the procfs work when reading stuff from the UPAGES.
This is a really ugly bandaid on the problem, but it works well enough for
'ps -u' to start working again.  The problem was caused by the user
address space shrinking by a little bit and the UPAGES being "cast off" to
become a seperate entity rather than being at the top of the process's
vmspace.  That optimization was part of John's most recent VM speedups.

Now, rather than decoding the VM space, it merely ensures the pages are
in core and accesses them the same way the ptrace(PT_READ_U..) code does,
ie: off the p->p_addr pointer.
1996-01-25 06:05:38 +00:00
Peter Wemm
0cc7521383 Major fixes for procfs..
Implement a "variable" directory structure. Files that do not make
sense for the given process do not "appear" and cannot be opened.
For example, "system" processes do not have "file", "regs" or "fpregs",
because they do not have a user area.

"attempt" to fill in the user area of a given process when it is being
accessed via /proc/pid/mem (the user struct is just after
VM_MAXUSER_ADDRESS in the process address space.)

Dont do IO to the U area while it's swapped, hold it in place if possible.

Lock off access to the "ctl" file if it's done a setuid like the other
pseudo-files in there.
1996-01-24 18:41:41 +00:00
Julian Elischer
da798be901 Slightly improved debug messages for inserting new items 1996-01-21 09:43:31 +00:00
Julian Elischer
b10669ebad oops.
get the last edit right
1996-01-21 09:07:58 +00:00
Julian Elischer
3daaa0c3bc Submitted by: Bruce Evans (bde)
better naming for  exported devfs function
and better place for the prototype
1996-01-21 09:03:15 +00:00
John Dyson
bd7e5f992e Eliminated many redundant vm_map_lookup operations for vm_mmap.
Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish
	overhead for merged cache.
Efficiency improvement for vfs_cluster.  It used to do alot of redundant
	calls to cluster_rbuild.
Correct the ordering for vrele of .text and release of credentials.
Use the selective tlb update for 486/586/P6.
Numerous fixes to the size of objects allocated for files.  Additionally,
	fixes in the various pagers.
Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs.
Fixes in the swap pager for exhausted resources.  The pageout code
	will not as readily thrash.
Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into
	page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE),
	thereby improving efficiency of several routines.
Eliminate even more unnecessary vm_page_protect operations.
Significantly speed up process forks.
Make vm_object_page_clean more efficient, thereby eliminating the pause
	that happens every 30seconds.
Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the
	case of filesystems mounted async.
Fix a panic with busy pages when write clustering is done for non-VMIO
	buffers.
1996-01-19 04:00:31 +00:00
Peter Wemm
689d68d9c2 Remove unnecessary debug printf's ("no references", "bad-id") - these
were development aids :-) and normal events.

Initialise the "hidden" blueprint mount "mnt_op" and "mnt_vfc" fields so
that a statfs() on a devfs file would not panic anymore. Fixes PR#911.

Head-scratching by: Julian and Peter
1996-01-02 09:14:49 +00:00
Poul-Henning Kamp
18e73f4fb6 I have some problem here, which shows up in the ahc0 driver. It isn't where
it originates, so I catch it here and fail.
This may expose the same bug on other disk controllers (both scsi & ide).
1996-01-01 20:20:45 +00:00
Peter Wemm
a5b996a7ec recording cvs-1.6 file death 1995-12-30 19:02:48 +00:00
Bruce Evans
f2c6b65bab Fixed 1TB filesize changes. Some pindexes had bogus names and types
but worked because vm_pindex_t is indistinuishable from vm_offset_t.
1995-12-17 07:19:58 +00:00
Bruce Evans
a899362e40 Restored lost prototypes. 1995-12-14 19:04:09 +00:00
Julian Elischer
e9fc6a73db another case where cdevsw becoming a pointer makes it neccesary to
check if it's NULL
1995-12-14 18:26:55 +00:00
Poul-Henning Kamp
f708ef1b9e Another mega commit to staticize things. 1995-12-14 09:55:16 +00:00
Julian Elischer
6ba9ebce28 devsw tables are now arrays of POINTERS to struct [cb]devsw
seems to work hre just fine though  I can't check every file
that changed due to limmited h/w, however I've checked enught to be petty
happy withe hte code..

WARNING... struct lkm[mumble] has changed
so it might be an idea to recompile any lkm related programs
1995-12-13 15:13:57 +00:00
Poul-Henning Kamp
3724793e05 Back out this one, must have screwed up somewhere :-( 1995-12-11 10:26:34 +00:00
Poul-Henning Kamp
d4b7a3694b Staticize. 1995-12-11 09:24:58 +00:00
John Dyson
a316d390bd Changes to support 1Tb filesizes. Pages are now named by an
(object,index) pair instead of (object,offset) pair.
1995-12-11 04:58:34 +00:00
Julian Elischer
4d92e19833 clean a few DEVFS things..
fix a bug where you couldn't place devices in the root directory
of devfs

remove deprecated routines

On my machine devfs now shows:
julian@erf.tfs.com:
julian@erf.tfs.com: ls -RF
bpf0            mem             ptypb           spkr            ttyp8
bpf1            null            ptypc           stderr          ttyp9
bpf2            pcaudio         ptypd           stdin           ttypa
bpf3            pcaudioctl      ptype           stdout          ttypb
console         pt              ptypf           tty             ttypc
cuaa0           ptyp0           random          ttyd0           ttypd
cuaia0          ptyp1           rsd0            ttyid0          ttype
cuala0          ptyp2           rsd1            ttyld0          ttypf
fd/             ptyp3           rvn             ttyp0           tun0
fd0.1440        ptyp4           rworm           ttyp1           urandom
fd1.1200        ptyp5           scsi/           ttyp2           vn
io              ptyp6           sd0             ttyp3           zero
kmem            ptyp7           sd1             ttyp4
lkm             ptyp8           snp0            ttyp5
log             ptyp9           snp1            ttyp6
lpt0            ptypa           snp2            ttyp7

./fd:
0       15      21      28      34      40      47      53      6       9
1       16      22      29      35      41      48      54      60
10      17      23      3       36      42      49      55      61
11      18      24      30      37      43      5       56      62
12      19      25      31      38      44      50      57      63
13      2       26      32      39      45      51      58      7
14      20      27      33      4       46      52      59      8

./scsi:
sctarg  ssc
julian@erf.tfs.com:

which is all devices really there except for disk slices/partitions..
(if I don't have it it's not there, which has GOT to be an improvement..)

no DEVFS fixes from device maintainers yet?
1995-12-09 09:11:25 +00:00
Julian Elischer
87f6c6625d Pass 3 of the great devsw changes
most devsw referenced functions are now static, as they are
in the same file as their devsw structure. I've also added DEVFS
support for nearly every device in the system, however
many of the devices have 'incorrect' names under DEVFS
because I couldn't quickly work out the correct naming conventions.
(but devfs won't be coming on line for a month or so anyhow so that doesn't
matter)

If you "OWN" a device which would normally have an entry in /dev
then search for the devfs_add_devsw() entries and munge to make them right..
check out similar devices to see what I might have done in them in you
can't see what's going on..
for a laugh compare conf.c conf.h defore and after... :)
I have not doen DEVFS entries for any DISKSLICE devices yet as that will be
a much more complicated job.. (pass 5 :)

pass 4 will be to make the devsw tables of type (cdevsw * )
rather than (cdevsw)
seems to work here..
complaints to the usual places.. :)
1995-12-08 11:19:42 +00:00
David Greenman
efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Bruce Evans
4cb03b1b55 Include <vm/vm.h> or <vm/vm_page.h> explicitly to avoid breaking when
vnode_if.h doesn't include vm stuff.
1995-12-05 21:51:45 +00:00
Bruce Evans
c66c72d1b4 Restored #include of <sys/tty.h>. fdesc_vnops.c needs to know too much
about tty_tty.c's cdevswitch functions.
1995-12-05 19:12:05 +00:00
Bruce Evans
9b5e8b3aa5 Added prototypes.
Removed some unnecessary #includes.
1995-12-03 14:54:48 +00:00
Bruce Evans
2e52c1f9e5 null_node_find() and umap_node_find() were sometimes called without a
`struct mount *' arg.  I don't know what the effects of this were.
1995-12-03 14:38:57 +00:00
Poul-Henning Kamp
a20e0ea8d7 staticize. 1995-12-02 17:14:34 +00:00
Julian Elischer
adb2dc299a #ifdef out nearly the entire file of conf.c when JREMOD is defined
add a few safety checks in specfs because
now it's possible to get entries in [cd]devsw[] which are ALL NULL
so it's better to discover this BEFORE jumping into the d_open() entry..

more check to come later.. this getsthe code to the stage where I
can start testing it, even if I haven't caught every little error case...
I guess I'll find them quick enough..
1995-11-29 12:38:49 +00:00
Julian Elischer
53ac6efbd8 OK, that's it..
That's EVERY SINGLE driver that has an entry in conf.c..
my next trick will be to define cdevsw[] and bdevsw[]
as empty arrays and remove all those DAMNED defines as well..

Each of these drivers has a SYSINIT linker set entry
that comes in very early.. and asks teh driver to add it's own
entry to the two devsw[] tables.

some slight reworking of the commits from yesterday (added the SYSINIT
stuff and some usually wrong but token DEVFS entries to all these
devices.

BTW does anyone know where the 'ata' entries in conf.c actually reside?
seems we don't actually have a 'ataopen() etc...

If you want to add a new device in conf.c
please  make sure I know
so I can keep it up to date too..

as before, this is all dependent on #if defined(JREMOD)
(and #ifdef DEVFS in parts)
1995-11-29 10:49:16 +00:00
Bruce Evans
512fef80a9 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Bruce Evans
cfa542ad34 KNFized spec_getpages_idone() and spec_getpages().
Moved misplaced #includes.

Completed function pointer declarations.
1995-11-18 12:49:14 +00:00
Bruce Evans
fcf985ad5d Moved declarations for static functions to the correct place (not in a
header).

Removed stupid comments.
1995-11-16 11:39:11 +00:00
Bruce Evans
d77206b33b Fixed the type of procfs_sync(). Trailing args were missing.
Fixed the type of procfs_fhtovp().  The args had little resemblance to
the correct ones.

Added prototypes.
1995-11-16 11:34:51 +00:00
Bruce Evans
10639ce2c0 Fixed the type of portal_sync(). Trailing args were missing.
Fixed the type of portal_fhtovp().  The args had little resemblance to
the correct ones.

Added prototypes.
1995-11-16 11:24:06 +00:00
Bruce Evans
9f3a4cd083 Fixed the type of kernfs_sync(). Trailing args were missing.
Fixed the type of kernfs_fhtovp().  The args had little resemblance to
the correct ones.

Added prototypes.
1995-11-16 11:16:13 +00:00
Bruce Evans
84cac4647f Fixed the type of fdesc_sync(). Trailing args were missing.
Fixed the type of fdesc_fhtovp().  The args had little resemblance to
the correct ones.

Added prototypes.
1995-11-16 10:58:35 +00:00
Poul-Henning Kamp
9565c0e60d Get rid of hostnamelen variable. 1995-11-14 09:37:22 +00:00
Bruce Evans
dace5f55ca Removed unsed function dead_nullop().
Converted incomplete function declarations to prototypes.
1995-11-11 03:36:07 +00:00
Bruce Evans
f57e65478d Introduced a type `vop_t' for vnode operation functions and used
it 1138 times (:-() in casts and a few more times in declarations.
This change is null for the i386.

The type has to be `typedef int vop_t(void *)' and not `typedef
int vop_t()' because `gcc -Wstrict-prototypes' warns about the
latter.  Since vnode op functions are called with args of different
(struct pointer) types, neither of these function types is any use
for type checking of the arg, so it would be preferable not to use
the complete function type, especially since using the complete
type requires adding 1138 casts to avoid compiler warnings and
another 40+ casts to reverse the function pointer conversions before
calling the functions.
1995-11-09 08:17:23 +00:00
Poul-Henning Kamp
159a024357 Make a lot of private stuff static.
Should anybody out there wonder about this vendetta against global
variables, it is basically to make it more visible what our interfaces
in the kernel really are.
I'm almost convinced we should have a
	#define PUBLIC /* public interface */
and use it in the #includes...
1995-11-07 13:39:31 +00:00
Poul-Henning Kamp
a98ca4699e Second batch of cleanup changes.
This time mostly making a lot of things static and some unused
variables here and there.
1995-10-29 15:33:36 +00:00
John Dyson
ff02cd98f2 Removal of unnecessary usage of PG_COPYONWRITE. 1995-10-23 04:28:59 +00:00
John Dyson
2c4488fce3 Finalize GETPAGES layering scheme. Move the device GETPAGES
interface into specfs code.  No need at this point to modify the
PUTPAGES stuff except in the layered-type (NULL/UNION) filesystems.
1995-10-23 02:23:29 +00:00
Julian Elischer
2279703911 almost entirely cosmetic changes
just keeping the sources in sync with my own set..
1995-10-10 07:12:27 +00:00
Steven Wallace
ab91e8eff2 Add #include <sys/sysproto.h> to get struct close_args and close
function prototype.
1995-10-08 00:09:00 +00:00
Poul-Henning Kamp
b67501dcda Avoid some 64bit divides. 1995-10-06 09:47:58 +00:00
Julian Elischer
56c3ab883e find some way of letting a node know where in its parent's directory structure
it was referenced from.. stops a rather annoying panic, but
introduces a rather interesting but "I can live with it" bug
`ln a b ; mv a b; echo ?`
returns a rather than b..
I know why but I need to think of the 'correct' answer. at least this is 'safe'
1995-10-04 11:05:09 +00:00
Julian Elischer
d51afe9d38 added support for link, and remove (unlink)
can now ln /devs/disks/floppy/fd1.1200 to fd1
and remove unwanted dirs and devices etc.
Still has a fatal bug.. don't use yet :)
1995-09-19 07:32:01 +00:00
Julian Elischer
55b7166d83 Submitted by: bde
prototype file follows the sources..
1995-09-14 06:17:28 +00:00
David Greenman
4590fd3a2a Fixed init functions argument type - caddr_t -> void *. Fixed a couple of
compiler warnings.
1995-09-09 18:10:37 +00:00
Julian Elischer
564643c636 More hacking on devfs..
I can  now do an mv on devices and directories in devfs
This was the hardest part.. link, delete and symlink will follow in
short order.
This code works but has definitly got vnode locking problems
I am electing to get the structure of it working before
spending too much time on the vnode confusion
so it's probably not reliable at the moment..
never-the less it looks good.
 :)
1995-09-09 12:51:56 +00:00
Julian Elischer
7090c38afc added the dev_link external registration
used to produce a second link to an already exixting device
e.g.
dev_add /disks/sd0
dev_link /scsi/bus0/targ0/lun0 to /disks/sd0
(not real syntax)
1995-09-08 04:46:14 +00:00
Julian Elischer
f5c892dd57 brought the README in to line with present code (still a bit cryptic) 1995-09-07 06:16:28 +00:00
Julian Elischer
65ba86052a more cleanups.. lots of code shuffled around too
routines renamed.. more simplifications,
some warnings squashed.
1995-09-07 06:01:36 +00:00
Julian Elischer
ab746f65c1 Suggested by: :) bde of course
added prototypes for every function and
put (void *) as the args to the vop array definitions.

can now compile with:
CWARNFLAGS?=    -W -Wreturn-type -Wcomment -Wredundant-decls -Wimplicit \
                -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes \
                -Winline -Wstrict-prototypes
and only get errors for files external to this module:
namely
./vnode_if.h
../../sys/vnode.h
../../sys/buf.h
../../miscfs/specfs/specdev.h
1995-09-06 23:15:55 +00:00
Julian Elischer
a8ea97ec7f more devfs cleanups..
if this keeps simplifying there won't be any left :)
1995-09-06 09:29:19 +00:00
Julian Elischer
5ee2a9f3b6 this file replaces two others.. I haven't removed them yet, but
when this code seems more solid, they get the bullet.
1995-09-06 08:26:51 +00:00
John Dyson
c83ebe7781 Added VOP_GETPAGES/VOP_PUTPAGES and also the "backwards" block count
for VOP_BMAP.  Updated affected filesystems...
1995-09-04 00:21:16 +00:00