Commit Graph

73 Commits

Author SHA1 Message Date
dholland a51059cc44 Fix build with LOCKF_DEBUG on LP64 platforms; from Alexander Nasonov
in PR 44490.
2011-01-31 08:25:32 +00:00
dsl 8129ef72eb lockf() passes its arguments through to fcntl() but is supposed to
support -ve lengths (lock area before current offset).
Nothing in libc or the kernel allowed for this, so some random part
of the file would get locked (no idea which bits).
Although this could probably be fixed in libc, the stubs for posix file
locks for emulations could easily get into the kernel with -ve lengths.
So fixing in the kernel avoids those problems.
This also fixes PR/41620 (attempting to lock negative offsets) - which
is what I was looking into!
2009-08-05 19:39:50 +00:00
yamt 724fd50176 don't make F_GETLK or the common case of F_UNLCK fail for per-user limit. 2009-06-10 22:34:35 +00:00
yamt 5216f042b0 lf_split: cv_destroy a condvar before clobbering it. 2009-06-10 22:23:15 +00:00
pooka 7e5aba5af0 Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.
2008-10-11 13:40:57 +00:00
yamt eee9e229a0 lf_setlock: g/c dead code. 2008-08-11 02:44:28 +00:00
skrll 371a852414 memcpy'ing a sleepq (TAILQ) doesn't work.
Re-init the condvar after memcpy'ing so that the TAILQ is valid.

regress/sys/kern/lockf now completes rather than failing in cv_wait_sig
with KASSERT(cv_has_waiters()).
2008-08-07 07:42:06 +00:00
skrll 6fd21ccbbf Improve the debug output ever so slightly. 2008-08-01 07:11:24 +00:00
ad b5d8351e8e PR kern/38355 lockf deadlock detection is broken after vmlocking
- Fix it; tested with Sun's libMicro.
- Use pool_cache.
- Use a global lock, so the deadlock detection code is safer.
2008-05-28 13:35:32 +00:00
ad 284c2b9aef Merge proc::p_mutex and proc::p_smutex into a single adaptive mutex, since
we no longer need to guard against access from hardware interrupt handlers.

Additionally, if cloning a process with CLONE_SIGHAND, arrange to have the
child process share the parent's lock so that signal state may be kept in
sync. Partially addresses PR kern/37437.
2008-04-24 18:39:20 +00:00
mrg 5e0e0b0a59 need <sys/atomic.h> now. 2008-03-18 02:49:15 +00:00
rmind 33928e0f83 - Replace uihashtbl_lock and struct uidinfo::ui_lock with atomic operations.
This make uid_find(), chgproccnt(), chgsbsize() and lf_alloc(), lf_free()
  functions lock-less.
- Increase the size of uihashtbl in case of MP system, as suggested by <ad>.
- Add HASH_SLIST type for hashinit().

Reviewed by <ad>.
2008-03-17 21:16:03 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
ad 59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
christos 35ca6c8b5b Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!
2006-08-17 17:11:27 +00:00
ad f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
yamt 0f0124d1a9 remove NOLOCKF and use normal NULL instead. 2006-05-20 12:20:55 +00:00
yamt b22546608e remove an debug printf slipped into the previous. 2006-05-20 12:19:30 +00:00
yamt a6518311cc fix F_SETLKW deadlock detection, which has been broken since lwpify.
although this doesn't work for processes with multiple lwps, it's better
than not working at all.
2006-05-20 12:06:20 +00:00
yamt cecc761849 make lockfpool static. 2006-05-20 12:04:21 +00:00
yamt 408b7c1e5c move lockf implementation details from sys/lockf.h to kern/vfs_lockf.c. 2006-05-20 12:02:47 +00:00
elad 215bd95ba4 integrate kauth. 2006-05-14 21:15:11 +00:00
perry a2cd732268 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 19:12:23 +00:00
christos 95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
christos e30fd207ff use ap->a_flags instead of fl->f_type; pointed out by: Devon H. O'Dell 2005-10-28 15:37:23 +00:00
thorpej 30fe14b30e Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".
2005-06-05 23:10:25 +00:00
christos efb6943313 - add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.
2005-05-29 22:24:14 +00:00
christos 7cdea212c0 No 0x in front of %p... 2005-05-22 15:54:45 +00:00
christos 6919a4b65c don't unlock twice. 2005-05-09 23:40:20 +00:00
christos 3b37af53b0 lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.
2005-05-09 11:10:07 +00:00
christos 761bd09636 PR/30154: YAMAMOTO Takashi: tcp_close locking botch
chgsbsize() as mentioned in the PR can be called from an interrupt context
via tcp_close(). Avoid calling uid_find() in chgsbsize().
- Instead of storing so_uid in struct socketvar, store *so_uidinfo
- Add a simple lock to struct uidinfo.
2005-05-07 17:42:09 +00:00
christos b279845eed Don't free the wrong lock. Pointed out by Konrad Schroder 2005-03-25 22:48:23 +00:00
christos cb282cd325 Keep track and limit the number of locks per uid. From OpenBSD 2005-03-20 19:16:33 +00:00
perry da8abec863 nuke trailing whitespace 2005-02-26 21:34:55 +00:00
peter 5dc9788b36 Fix a typo, dependancy -> dependency
ok wiz@
2004-11-19 14:18:53 +00:00
simonb b5d0e6bf06 Initialise (most) pools from a link set instead of explicit calls
to pool_init.  Untouched pools are ones that either in arch-specific
code, or aren't initialiased during initial system startup.

 Convert struct session, ucred and lockf to pools.
2004-04-25 16:42:40 +00:00
christos cb02efca51 fix uninitialized variable 2003-10-25 09:06:51 +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
yamt 200e944501 revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.
2003-06-25 14:34:55 +00:00
fvdl c5b60c55a3 Make gcc3 happy ("label at end of compound statement"). 2003-05-03 15:02:54 +00:00
yamt d056e8ce9a get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.
2003-05-03 11:19:05 +00:00
yamt 300627c9c0 - KNF.
- remove unneeded caddr_t casts.
2003-05-01 15:25:06 +00:00
yamt 8565905ff8 use FREE instead of free for MALLOC'ed memory. 2003-05-01 14:59:51 +00:00
yamt 99411362c0 MP locking. 2003-05-01 14:36:43 +00:00
yamt a2e9a85481 remove a part of comment that isn't true anymore. 2003-05-01 13:14:49 +00:00
yamt 31dc0f47c6 ANSIfy. 2003-05-01 13:06:59 +00:00
yamt 4d5238a439 don't export lockf internal functions. 2003-05-01 12:49:16 +00:00