Commit Graph

54 Commits

Author SHA1 Message Date
hannken 37efcf9045 Fix the last commit(s). On machines with sizeof(long) != sizeof(int)
the hash compare would fail.
2003-12-08 14:23:33 +00:00
yamt 88046c4ce5 fix a debug code to follow recent change about tailing slashes. 2003-12-06 14:17:13 +00:00
yamt e5d5094296 - turn non-verbose parts of NAMEI_DIAGNOSTIC into normal DEBUG.
- comments on #endif.
2003-12-06 14:16:11 +00:00
christos 136f9cd821 PR/15397: Jason Thorpe: directory operations on pathnames that refer to
directories and have trailing slashes should succeed. Ok'd by kjk.
Fix provided by enami.
2003-09-11 17:33:42 +00:00
cb 5f734a1850 fix a race condition between path resolution in userland
and the subsequent namei(): inform the kernel portion of
valid filenames and then disallow symlink lookups for
those filenames by means of a hook in namei().
with suggestions from provos@

also, add (currently unused) seqnr field to struct
systrace_replace, from provos@
2003-08-25 09:12:42 +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
erh 52bbca5b58 Make sure the directory is still mounted before looking things up in it.
Fixes PR kern/5683.
2003-04-10 07:26:52 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
christos 0f6167a798 name the component that should be leaf in the diagnostic. 2003-01-20 23:57:49 +00:00
simonb acc3e26536 We go to a lot of effort to choose a suitable value for "docache" in
relookup() ... then ignore it!  Remove it.
2002-10-22 03:35:10 +00:00
soren f7f75af9c5 Make NAMEI_DIAGNOSTIC compile. 2002-08-02 04:49:35 +00:00
wrstuden 6b88bf15ae If we're in a chroot, and we are looking up '..', make sure we are
still in the chroot. If not, teleport the lookup to the chroot
and log. Closes an assisted-jail escape method pointed out by
xs@kittenz.org. Patch from xs@kittenz.org and myself
2002-06-21 02:19:12 +00:00
lukem 290cc55a28 - Implement
uint32_t namei_hash(const char *p, const char **ep)
  which determines the equivalent MI hash32_str() hash for p.
  If *ep != NULL, calculate the hash to the character before ep.
  If *ep == NULL, calculate the has to the first / or NUL found, and
  point *ep to that location.
- Use namei_hash() to calculate cn_hash in lookup() and relookup().
  Hash distribution goes from 35-40% to 55-70%, with similar profiled
  time spent in cache_lookup() and cache_enter() on my P3-600.
- Use namei_hash() to calculate cn_hash in nfs_readdirplusrpc(),
  insetad of homegrown code (that differed from that in lookup() !)
  namei_hash() has better spread and is faster than previous code
  (which used a non-constant multiplication).
2001-12-08 04:09:59 +00:00
lukem adc783d537 add RCSIDs 2001-11-12 15:25:01 +00:00
thorpej 9b2f51421c Use a pool cache for namei buffers -- it's faster to allocate from
a pool cache than a pool.
2001-10-17 23:33:29 +00:00
christos 51d673156c Set the credentials to be used in the NDINIT macro so that syscalls can
hijack them.
2001-09-08 02:02:04 +00:00
thorpej 7cc27a88c0 Convert namei pathname buffer allocation to use the pool allocator. 2000-08-03 20:41:05 +00:00
sommerfeld 40339b39f9 Reduce use of curproc in several places:
- Change ktrace interface to pass in the current process, rather than
p->p_tracep, since the various ktr* function need curproc anyway.

 - Add curproc as a parameter to mi_switch() since all callers had it
handy anyway.

 - Add a second proc argument for inferior() since callers all had
curproc handy.

Also, miscellaneous cleanups in ktrace:

 - ktrace now always uses file-based, rather than vnode-based I/O
(simplifies, increases type safety); eliminate KTRFLAG_FD & KTRFAC_FD.
Do non-blocking I/O, and yield a finite number of times when receiving
EWOULDBLOCK before giving up.

 - move code duplicated between sys_fktrace and sys_ktrace into ktrace_common.

 - simplify interface to ktrwrite()
2000-05-27 00:40:29 +00:00
augustss 264f1d27c6 Get rid of register declarations. 2000-03-30 09:27:11 +00:00
wrstuden cca0c4f6de Modify how lookup walks up mount points. As suggested by Konrad
Schroder <perseant@hitl.washington.edu>, unlock the mounted on
vnode before we call VFS_ROOT so that we cover the case where the new
root vnode shares a lock with the mounted-on vnode. Note that we have
asserted vfs_busy on the new fs before unlocking, so no other process can
steal the mount out from under us.
1999-08-03 18:17:24 +00:00
wrstuden 379a26972f Modify file systems to deal with struct lock in struct vnode. All leaf
fs's other than nfs use genfs_lock() for locking.

Modify lookup routines to set PDIRUNLOCK when they unlock the parrent.
1999-07-08 01:05:58 +00:00
thorpej 16936c9565 Break cdir/rdir/cmask info out of struct filedesc, and put it in a new
substructure, `cwdinfo'.  Implement optional sharing of this substructure.

This is required for clone(2).
1999-04-30 18:42:58 +00:00
wrstuden 2e1fa90ecb Fix obscure bug in namei(), which was the cause of PR 7306.
The problem is that if "sl" is a symbolic link, a lookup on "sl/"
will be flagged as the last component. Thus VOP_LOOKUP will lock
the parent directory if LOCKPARENT is set. In order for the symbolic
link to be resolved, this lock needs to be released. namei() would
test for this by checking if ni_pathlen == 1, which it wouldn't as
"/" is left in the name, and namei() would not unlock the parent.
The next call to lookup() to resolve the symbolic link would fail
as the parent was still locked.
1999-04-07 05:47:37 +00:00
perry 275d1554aa Abolition of bcopy, ovbcopy, bcmp, and bzero, phase one.
bcopy(x, y, z) ->  memcpy(y, x, z)
ovbcopy(x, y, z) -> memmove(y, x, z)
   bcmp(x, y, z) ->  memcmp(x, y, z)
  bzero(x, y)    ->  memset(x, 0, y)
1998-08-04 04:03:10 +00:00
thorpej 808867c7cf defopt KTRACE 1998-06-25 21:17:15 +00:00
fvdl e5bc90f40c Merge with Lite2 + local changes 1998-03-01 02:20:01 +00:00
enami 4589c896eb Conditionalize the recognition of symbolic link permission by
per fs mount option `symperm'.
1997-10-30 22:47:06 +00:00
enami 8092be0770 Check exec bit of symbolic link when traversing path and do it in vfs layer.
Suggested by der Mouse.  Ok'ed by Jason R. Thorpe.
1997-10-11 00:08:08 +00:00
mycroft 07ba5e5ac3 Snapshot of namei() cleanup:
1) Eliminate all of the null component name special cases; handle runs of
slashes and leading and trailing slashes completely differently.
2) Return ENOENT when doing a lookup through an empty symlink.
3) Enforce that we're doing a lookup through a directory in in chdir() and
lookup() rather than in foo_lookup().

Not yet finished.
1997-05-08 14:55:22 +00:00
kleink 513465cc2c Added a sanity check to the force-directory routine, as the CREATE and
RENAME namei() operations may succeed without returning a vnode.
1997-04-08 16:11:48 +00:00
kleink 43bd8d5456 POSIX.1 changes to namei():
(1) "" no longer refers to the current working directory;
	    looking this up will now result in ENOENT.

	(2) by stripping off trailing slashes and setting a `forcedir'
	    flag, make code such as {  mkdir("dir", m); rmdir("dir/"); }
	    actually work.
1997-04-08 10:11:55 +00:00
cgd ce53653783 make the namei struct members ni_dirp and ni_next, and the componentname
struct member cn_nameptr 'const', since they should never be used to
modify the path name.  (Only the pathname buffer, cn_pnbuf, should be
modified.)  Propagate the const poisoning to code that uses the namei
and componentname structs.
1996-10-25 23:13:58 +00:00
christos f443b89c92 backout previous kprintf change 1996-10-13 02:32:29 +00:00
christos 60d201973e printf -> kprintf, sprintf -> ksprintf 1996-10-10 22:46:11 +00:00
christos 09afd77655 More proto fixes 1996-02-09 18:59:18 +00:00
christos e630447d8c First pass at prototyping 1996-02-04 02:17:43 +00:00
cgd 4f2d1996e7 needs systm.h 1995-03-08 01:20:50 +00:00
mycroft 70f25af085 Sync with CSRG. 1994-12-14 19:41:23 +00:00
cgd cf92afd66e New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD' 1994-06-29 06:29:24 +00:00
mycroft 699bbb84b6 Update to 4.4-Lite fs code. 1994-06-08 11:28:29 +00:00
cgd 21a03cca53 mostly-machine-indepedent switch, and changes to match. also, hack init_main 1994-05-18 05:12:10 +00:00
cgd 91cf0fbaf3 copyright foo 1994-05-17 04:21:49 +00:00
cgd a83f6577b0 minor cleanup; extra spaces, patchkit info, etc. 1994-01-05 13:49:52 +00:00
cgd 2c5c3a2774 add support for union and loopback mounts, from jsp 1994-01-04 14:10:48 +00:00
mycroft 7f50bd1829 Canonicalize all #includes. 1993-12-18 04:21:37 +00:00
cgd facd69a0ee do something better with lookup return values; suggested by BSDI's msdosfs mod 1993-11-20 09:40:32 +00:00
ws 053f138dae Changes to VFS readdir semantics
NFS changes for better cookie support
ISOFS changes for better Rockridge support and support for generation numbers
1993-09-07 15:40:14 +00:00