History log of /netbsd-current/sys/kern/vfs_lockf.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.81 23-Sep-2023 ad

Repply this change with a couple of bugs fixed:

- Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


# 1.80 12-Sep-2023 ad

Back out recent change to replace pool_cache with then general allocator.
Will return to this when I have time again.


# 1.79 10-Sep-2023 ad

- Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


Revision tags: netbsd-10-base
# 1.78 25-Nov-2022 riastradh

kern/vfs_lockf.c: Parenthesize to make arithmetic match check.

We verified start + (fl->fl_len - 1) would not overflow, but then
computed (start + fl->fl_len) - 1 instead, and it is possible for
start + fl->fl_len to overflow before we subtract 1.

Reported-by: syzbot+762480b00cb14085f63a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d69313b2460a12715315f9f5f74fbe44b8bc38ba


Revision tags: bouyer-sunxi-drm-base
# 1.77 03-Aug-2022 riastradh

kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a1516747c8@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


# 1.76 01-Jul-2022 riastradh

vfs(9): Avoid arithmetic overflow in lf_advlock.

syzbot+897abbbe59467cbf6e98@syzkaller.appspotmail.com


# 1.75 16-Apr-2022 andvar

fix various typos in comments and log messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.74 27-Jul-2021 manu

Tie the maximum file lock per unprivilegied uid to kern.maxfiles

This makes the limit simple to raise at run time. While there, document
that fcntl(2) and flock(2) may return ENOMEM when this limit is reached.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.73 31-Jan-2011 dholland

branches: 1.73.60; 1.73.72;
Fix build with LOCKF_DEBUG on LP64 platforms; from Alexander Nasonov
in PR 44490.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.72 05-Aug-2009 dsl

branches: 1.72.4; 1.72.6; 1.72.8;
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!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.71 10-Jun-2009 yamt

don't make F_GETLK or the common case of F_UNLCK fail for per-user limit.


# 1.70 10-Jun-2009 yamt

lf_split: cv_destroy a condvar before clobbering it.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.69 11-Oct-2008 pooka

branches: 1.69.4; 1.69.8; 1.69.10;
Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.68 11-Aug-2008 yamt

lf_setlock: g/c dead code.


# 1.67 07-Aug-2008 skrll

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()).


# 1.66 01-Aug-2008 skrll

Improve the debug output ever so slightly.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.65 28-May-2008 ad

branches: 1.65.4;
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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.64 24-Apr-2008 ad

branches: 1.64.2; 1.64.4;
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.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.63 18-Mar-2008 mrg

branches: 1.63.2;
need <sys/atomic.h> now.


# 1.62 17-Mar-2008 rmind

- 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>.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 02-Jan-2008 ad

branches: 1.61.2; 1.61.6;
Merge vmlocking2 to head.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.60 09-Jul-2007 ad

branches: 1.60.8; 1.60.14; 1.60.16; 1.60.20;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.59 12-Mar-2007 ad

branches: 1.59.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.


# 1.58 04-Mar-2007 christos

branches: 1.58.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.56 17-Aug-2006 christos

branches: 1.56.2;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.55 23-Jul-2006 ad

Use the LWP cached credentials where sane.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.54 20-May-2006 yamt

remove NOLOCKF and use normal NULL instead.


# 1.53 20-May-2006 yamt

remove an debug printf slipped into the previous.


# 1.52 20-May-2006 yamt

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.


# 1.51 20-May-2006 yamt

make lockfpool static.


# 1.50 20-May-2006 yamt

move lockf implementation details from sys/lockf.h to kern/vfs_lockf.c.


# 1.49 14-May-2006 elad

branches: 1.49.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.48 24-Dec-2005 perry

branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.47 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.46 28-Oct-2005 christos

use ap->a_flags instead of fl->f_type; pointed out by: Devon H. O'Dell


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.45 05-Jun-2005 thorpej

branches: 1.45.2; 1.45.4;
Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".


# 1.44 29-May-2005 christos

- add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.


# 1.43 22-May-2005 christos

No 0x in front of %p...


# 1.42 09-May-2005 christos

don't unlock twice.


# 1.41 09-May-2005 christos

lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.


# 1.40 07-May-2005 christos

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.


Revision tags: yamt-km-base4 kent-audio2-base
# 1.39 25-Mar-2005 christos

Don't free the wrong lock. Pointed out by Konrad Schroder


# 1.38 20-Mar-2005 christos

Keep track and limit the number of locks per uid. From OpenBSD


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.37 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.36 19-Nov-2004 peter

branches: 1.36.4; 1.36.6;
Fix a typo, dependancy -> dependency

ok wiz@


# 1.35 25-Apr-2004 simonb

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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 25-Oct-2003 christos

fix uninitialized variable


# 1.33 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.32 25-Jun-2003 yamt

branches: 1.32.2;
revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.


# 1.31 03-May-2003 fvdl

Make gcc3 happy ("label at end of compound statement").


# 1.30 03-May-2003 yamt

get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.


# 1.29 01-May-2003 yamt

- KNF.
- remove unneeded caddr_t casts.


# 1.28 01-May-2003 yamt

use FREE instead of free for MALLOC'ed memory.


# 1.27 01-May-2003 yamt

MP locking.


# 1.26 01-May-2003 yamt

remove a part of comment that isn't true anymore.


# 1.25 01-May-2003 yamt

ANSIfy.


# 1.24 01-May-2003 yamt

don't export lockf internal functions.


# 1.23 05-Mar-2003 mycroft

DANGER WILL ROBINSON!

We cannot store LWP pointers permanently in lock structures, for two reasons:
1) They are somewhat ephemeral. Dangling pointers are bad.
2) A different LWP may issue the unlock, and in this case, we were not actually
doing the unlock at all. This was causing processes to exit without undoing
fcntl(2) locks. Furthermore, the locks are process-specific to begin with,
so the test was just plain wrong.

Instead, we go back to storing a proc pointer for POSIX locks. In addition, we
add an extra pointer to the LWP, which is used in deadlock detection. After
the lock is granted, this pointer is 0ed and there is no reference to the LWP.

Now evolution can inc my mail again.


# 1.22 01-Feb-2003 thorpej

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.


# 1.21 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge
# 1.20 22-Oct-2002 simonb

"ovcase" is set but not used in lf_getblock(); remove it.


Revision tags: kqueue-base
# 1.19 04-Sep-2002 matt

Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly. Use *_FOREACH whenever possible.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 22-Jul-2000 jdolecek

branches: 1.17.2; 1.17.4; 1.17.8;
change the lf_advlock() arguments from

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));
to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).


Revision tags: netbsd-1-5-base
# 1.16 12-Jun-2000 sommerfeld

branches: 1.16.2;
Fix several problems with lockf/fcntl byte range locks:
- document a data structure invariant in lockf.h
- add KASSERT() to check the invariant.
- be more consistent about dequeuing ourselves from the blocked list
after a tsleep().
- Fix two places where the invariant is violated.
- correct a few comments here and there
- If we're still following a lock dependancy chain after maxlockdepth
processes and haven't gotten back to the start, assume that we're in a
cycle anyway and return EDEADLK.

Fix is a superset of an existing fix in FreeBSD, but independantly
derived.

Fixes kern/3860.


Revision tags: minoura-xpg4dl-base
# 1.15 30-Mar-2000 augustss

branches: 1.15.2;
Get rid of register declarations.


Revision tags: netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base
# 1.14 04-Aug-1998 perry

branches: 1.14.6; 1.14.12;
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)


# 1.13 31-Jul-1998 perry

fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.


Revision tags: eeh-paddr_t-base
# 1.12 01-Mar-1998 fvdl

branches: 1.12.2;
Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Apr-1997 jtk

make it compile with -DLOCKF_DEBUG


# 1.10 02-Apr-1997 kleink

Moved the `unlocking a lock-free inode' shortcut behind
the l_whence and starting offset sanity checks.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 13-Oct-1996 christos

backout previous kprintf change


# 1.8 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.7 04-Feb-1996 christos

First pass at prototyping


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.6 19-Mar-1995 mycroft

Use %p.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.5 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.4 19-May-1994 mycroft

Update to 4.4-Lite, plus some local changes.


# 1.3 19-May-1994 cgd

stupidity for prototypes...


# 1.2 25-Apr-1994 cgd

some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.


# 1.1 09-Mar-1994 ws

Make FFS optional


# 1.80 12-Sep-2023 ad

Back out recent change to replace pool_cache with then general allocator.
Will return to this when I have time again.


# 1.79 10-Sep-2023 ad

- Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


Revision tags: netbsd-10-base
# 1.78 25-Nov-2022 riastradh

kern/vfs_lockf.c: Parenthesize to make arithmetic match check.

We verified start + (fl->fl_len - 1) would not overflow, but then
computed (start + fl->fl_len) - 1 instead, and it is possible for
start + fl->fl_len to overflow before we subtract 1.

Reported-by: syzbot+762480b00cb14085f63a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d69313b2460a12715315f9f5f74fbe44b8bc38ba


Revision tags: bouyer-sunxi-drm-base
# 1.77 03-Aug-2022 riastradh

kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a1516747c8@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


# 1.76 01-Jul-2022 riastradh

vfs(9): Avoid arithmetic overflow in lf_advlock.

syzbot+897abbbe59467cbf6e98@syzkaller.appspotmail.com


# 1.75 16-Apr-2022 andvar

fix various typos in comments and log messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.74 27-Jul-2021 manu

Tie the maximum file lock per unprivilegied uid to kern.maxfiles

This makes the limit simple to raise at run time. While there, document
that fcntl(2) and flock(2) may return ENOMEM when this limit is reached.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.73 31-Jan-2011 dholland

branches: 1.73.60; 1.73.72;
Fix build with LOCKF_DEBUG on LP64 platforms; from Alexander Nasonov
in PR 44490.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.72 05-Aug-2009 dsl

branches: 1.72.4; 1.72.6; 1.72.8;
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!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.71 10-Jun-2009 yamt

don't make F_GETLK or the common case of F_UNLCK fail for per-user limit.


# 1.70 10-Jun-2009 yamt

lf_split: cv_destroy a condvar before clobbering it.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.69 11-Oct-2008 pooka

branches: 1.69.4; 1.69.8; 1.69.10;
Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.68 11-Aug-2008 yamt

lf_setlock: g/c dead code.


# 1.67 07-Aug-2008 skrll

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()).


# 1.66 01-Aug-2008 skrll

Improve the debug output ever so slightly.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.65 28-May-2008 ad

branches: 1.65.4;
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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.64 24-Apr-2008 ad

branches: 1.64.2; 1.64.4;
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.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.63 18-Mar-2008 mrg

branches: 1.63.2;
need <sys/atomic.h> now.


# 1.62 17-Mar-2008 rmind

- 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>.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 02-Jan-2008 ad

branches: 1.61.2; 1.61.6;
Merge vmlocking2 to head.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.60 09-Jul-2007 ad

branches: 1.60.8; 1.60.14; 1.60.16; 1.60.20;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.59 12-Mar-2007 ad

branches: 1.59.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.


# 1.58 04-Mar-2007 christos

branches: 1.58.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.56 17-Aug-2006 christos

branches: 1.56.2;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.55 23-Jul-2006 ad

Use the LWP cached credentials where sane.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.54 20-May-2006 yamt

remove NOLOCKF and use normal NULL instead.


# 1.53 20-May-2006 yamt

remove an debug printf slipped into the previous.


# 1.52 20-May-2006 yamt

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.


# 1.51 20-May-2006 yamt

make lockfpool static.


# 1.50 20-May-2006 yamt

move lockf implementation details from sys/lockf.h to kern/vfs_lockf.c.


# 1.49 14-May-2006 elad

branches: 1.49.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.48 24-Dec-2005 perry

branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.47 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.46 28-Oct-2005 christos

use ap->a_flags instead of fl->f_type; pointed out by: Devon H. O'Dell


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.45 05-Jun-2005 thorpej

branches: 1.45.2; 1.45.4;
Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".


# 1.44 29-May-2005 christos

- add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.


# 1.43 22-May-2005 christos

No 0x in front of %p...


# 1.42 09-May-2005 christos

don't unlock twice.


# 1.41 09-May-2005 christos

lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.


# 1.40 07-May-2005 christos

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.


Revision tags: yamt-km-base4 kent-audio2-base
# 1.39 25-Mar-2005 christos

Don't free the wrong lock. Pointed out by Konrad Schroder


# 1.38 20-Mar-2005 christos

Keep track and limit the number of locks per uid. From OpenBSD


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.37 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.36 19-Nov-2004 peter

branches: 1.36.4; 1.36.6;
Fix a typo, dependancy -> dependency

ok wiz@


# 1.35 25-Apr-2004 simonb

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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 25-Oct-2003 christos

fix uninitialized variable


# 1.33 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.32 25-Jun-2003 yamt

branches: 1.32.2;
revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.


# 1.31 03-May-2003 fvdl

Make gcc3 happy ("label at end of compound statement").


# 1.30 03-May-2003 yamt

get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.


# 1.29 01-May-2003 yamt

- KNF.
- remove unneeded caddr_t casts.


# 1.28 01-May-2003 yamt

use FREE instead of free for MALLOC'ed memory.


# 1.27 01-May-2003 yamt

MP locking.


# 1.26 01-May-2003 yamt

remove a part of comment that isn't true anymore.


# 1.25 01-May-2003 yamt

ANSIfy.


# 1.24 01-May-2003 yamt

don't export lockf internal functions.


# 1.23 05-Mar-2003 mycroft

DANGER WILL ROBINSON!

We cannot store LWP pointers permanently in lock structures, for two reasons:
1) They are somewhat ephemeral. Dangling pointers are bad.
2) A different LWP may issue the unlock, and in this case, we were not actually
doing the unlock at all. This was causing processes to exit without undoing
fcntl(2) locks. Furthermore, the locks are process-specific to begin with,
so the test was just plain wrong.

Instead, we go back to storing a proc pointer for POSIX locks. In addition, we
add an extra pointer to the LWP, which is used in deadlock detection. After
the lock is granted, this pointer is 0ed and there is no reference to the LWP.

Now evolution can inc my mail again.


# 1.22 01-Feb-2003 thorpej

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.


# 1.21 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge
# 1.20 22-Oct-2002 simonb

"ovcase" is set but not used in lf_getblock(); remove it.


Revision tags: kqueue-base
# 1.19 04-Sep-2002 matt

Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly. Use *_FOREACH whenever possible.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 22-Jul-2000 jdolecek

branches: 1.17.2; 1.17.4; 1.17.8;
change the lf_advlock() arguments from

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));
to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).


Revision tags: netbsd-1-5-base
# 1.16 12-Jun-2000 sommerfeld

branches: 1.16.2;
Fix several problems with lockf/fcntl byte range locks:
- document a data structure invariant in lockf.h
- add KASSERT() to check the invariant.
- be more consistent about dequeuing ourselves from the blocked list
after a tsleep().
- Fix two places where the invariant is violated.
- correct a few comments here and there
- If we're still following a lock dependancy chain after maxlockdepth
processes and haven't gotten back to the start, assume that we're in a
cycle anyway and return EDEADLK.

Fix is a superset of an existing fix in FreeBSD, but independantly
derived.

Fixes kern/3860.


Revision tags: minoura-xpg4dl-base
# 1.15 30-Mar-2000 augustss

branches: 1.15.2;
Get rid of register declarations.


Revision tags: netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base
# 1.14 04-Aug-1998 perry

branches: 1.14.6; 1.14.12;
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)


# 1.13 31-Jul-1998 perry

fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.


Revision tags: eeh-paddr_t-base
# 1.12 01-Mar-1998 fvdl

branches: 1.12.2;
Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Apr-1997 jtk

make it compile with -DLOCKF_DEBUG


# 1.10 02-Apr-1997 kleink

Moved the `unlocking a lock-free inode' shortcut behind
the l_whence and starting offset sanity checks.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 13-Oct-1996 christos

backout previous kprintf change


# 1.8 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.7 04-Feb-1996 christos

First pass at prototyping


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.6 19-Mar-1995 mycroft

Use %p.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.5 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.4 19-May-1994 mycroft

Update to 4.4-Lite, plus some local changes.


# 1.3 19-May-1994 cgd

stupidity for prototypes...


# 1.2 25-Apr-1994 cgd

some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.


# 1.1 09-Mar-1994 ws

Make FFS optional


# 1.80 12-Sep-2023 ad

Back out recent change to replace pool_cache with then general allocator.
Will return to this when I have time again.


# 1.79 10-Sep-2023 ad

- Do away with separate pool_cache for some kernel objects that have no special
requirements and use the general purpose allocator instead. On one of my
test systems this makes for a small (~1%) but repeatable reduction in system
time during builds presumably because it decreases the kernel's cache /
memory bandwidth footprint a little.
- vfs_lockf: cache a pointer to the uidinfo and put mutex in the data segment.


Revision tags: netbsd-10-base
# 1.78 25-Nov-2022 riastradh

kern/vfs_lockf.c: Parenthesize to make arithmetic match check.

We verified start + (fl->fl_len - 1) would not overflow, but then
computed (start + fl->fl_len) - 1 instead, and it is possible for
start + fl->fl_len to overflow before we subtract 1.

Reported-by: syzbot+762480b00cb14085f63a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d69313b2460a12715315f9f5f74fbe44b8bc38ba


Revision tags: bouyer-sunxi-drm-base
# 1.77 03-Aug-2022 riastradh

kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a1516747c8@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


# 1.76 01-Jul-2022 riastradh

vfs(9): Avoid arithmetic overflow in lf_advlock.

syzbot+897abbbe59467cbf6e98@syzkaller.appspotmail.com


# 1.75 16-Apr-2022 andvar

fix various typos in comments and log messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.74 27-Jul-2021 manu

Tie the maximum file lock per unprivilegied uid to kern.maxfiles

This makes the limit simple to raise at run time. While there, document
that fcntl(2) and flock(2) may return ENOMEM when this limit is reached.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.73 31-Jan-2011 dholland

branches: 1.73.60; 1.73.72;
Fix build with LOCKF_DEBUG on LP64 platforms; from Alexander Nasonov
in PR 44490.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.72 05-Aug-2009 dsl

branches: 1.72.4; 1.72.6; 1.72.8;
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!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.71 10-Jun-2009 yamt

don't make F_GETLK or the common case of F_UNLCK fail for per-user limit.


# 1.70 10-Jun-2009 yamt

lf_split: cv_destroy a condvar before clobbering it.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.69 11-Oct-2008 pooka

branches: 1.69.4; 1.69.8; 1.69.10;
Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.68 11-Aug-2008 yamt

lf_setlock: g/c dead code.


# 1.67 07-Aug-2008 skrll

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()).


# 1.66 01-Aug-2008 skrll

Improve the debug output ever so slightly.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.65 28-May-2008 ad

branches: 1.65.4;
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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.64 24-Apr-2008 ad

branches: 1.64.2; 1.64.4;
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.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.63 18-Mar-2008 mrg

branches: 1.63.2;
need <sys/atomic.h> now.


# 1.62 17-Mar-2008 rmind

- 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>.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 02-Jan-2008 ad

branches: 1.61.2; 1.61.6;
Merge vmlocking2 to head.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.60 09-Jul-2007 ad

branches: 1.60.8; 1.60.14; 1.60.16; 1.60.20;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.59 12-Mar-2007 ad

branches: 1.59.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.


# 1.58 04-Mar-2007 christos

branches: 1.58.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.56 17-Aug-2006 christos

branches: 1.56.2;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.55 23-Jul-2006 ad

Use the LWP cached credentials where sane.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.54 20-May-2006 yamt

remove NOLOCKF and use normal NULL instead.


# 1.53 20-May-2006 yamt

remove an debug printf slipped into the previous.


# 1.52 20-May-2006 yamt

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.


# 1.51 20-May-2006 yamt

make lockfpool static.


# 1.50 20-May-2006 yamt

move lockf implementation details from sys/lockf.h to kern/vfs_lockf.c.


# 1.49 14-May-2006 elad

branches: 1.49.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.48 24-Dec-2005 perry

branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.47 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.46 28-Oct-2005 christos

use ap->a_flags instead of fl->f_type; pointed out by: Devon H. O'Dell


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.45 05-Jun-2005 thorpej

branches: 1.45.2; 1.45.4;
Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".


# 1.44 29-May-2005 christos

- add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.


# 1.43 22-May-2005 christos

No 0x in front of %p...


# 1.42 09-May-2005 christos

don't unlock twice.


# 1.41 09-May-2005 christos

lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.


# 1.40 07-May-2005 christos

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.


Revision tags: yamt-km-base4 kent-audio2-base
# 1.39 25-Mar-2005 christos

Don't free the wrong lock. Pointed out by Konrad Schroder


# 1.38 20-Mar-2005 christos

Keep track and limit the number of locks per uid. From OpenBSD


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.37 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.36 19-Nov-2004 peter

branches: 1.36.4; 1.36.6;
Fix a typo, dependancy -> dependency

ok wiz@


# 1.35 25-Apr-2004 simonb

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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 25-Oct-2003 christos

fix uninitialized variable


# 1.33 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.32 25-Jun-2003 yamt

branches: 1.32.2;
revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.


# 1.31 03-May-2003 fvdl

Make gcc3 happy ("label at end of compound statement").


# 1.30 03-May-2003 yamt

get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.


# 1.29 01-May-2003 yamt

- KNF.
- remove unneeded caddr_t casts.


# 1.28 01-May-2003 yamt

use FREE instead of free for MALLOC'ed memory.


# 1.27 01-May-2003 yamt

MP locking.


# 1.26 01-May-2003 yamt

remove a part of comment that isn't true anymore.


# 1.25 01-May-2003 yamt

ANSIfy.


# 1.24 01-May-2003 yamt

don't export lockf internal functions.


# 1.23 05-Mar-2003 mycroft

DANGER WILL ROBINSON!

We cannot store LWP pointers permanently in lock structures, for two reasons:
1) They are somewhat ephemeral. Dangling pointers are bad.
2) A different LWP may issue the unlock, and in this case, we were not actually
doing the unlock at all. This was causing processes to exit without undoing
fcntl(2) locks. Furthermore, the locks are process-specific to begin with,
so the test was just plain wrong.

Instead, we go back to storing a proc pointer for POSIX locks. In addition, we
add an extra pointer to the LWP, which is used in deadlock detection. After
the lock is granted, this pointer is 0ed and there is no reference to the LWP.

Now evolution can inc my mail again.


# 1.22 01-Feb-2003 thorpej

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.


# 1.21 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge
# 1.20 22-Oct-2002 simonb

"ovcase" is set but not used in lf_getblock(); remove it.


Revision tags: kqueue-base
# 1.19 04-Sep-2002 matt

Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly. Use *_FOREACH whenever possible.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 22-Jul-2000 jdolecek

branches: 1.17.2; 1.17.4; 1.17.8;
change the lf_advlock() arguments from

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));
to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).


Revision tags: netbsd-1-5-base
# 1.16 12-Jun-2000 sommerfeld

branches: 1.16.2;
Fix several problems with lockf/fcntl byte range locks:
- document a data structure invariant in lockf.h
- add KASSERT() to check the invariant.
- be more consistent about dequeuing ourselves from the blocked list
after a tsleep().
- Fix two places where the invariant is violated.
- correct a few comments here and there
- If we're still following a lock dependancy chain after maxlockdepth
processes and haven't gotten back to the start, assume that we're in a
cycle anyway and return EDEADLK.

Fix is a superset of an existing fix in FreeBSD, but independantly
derived.

Fixes kern/3860.


Revision tags: minoura-xpg4dl-base
# 1.15 30-Mar-2000 augustss

branches: 1.15.2;
Get rid of register declarations.


Revision tags: netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base
# 1.14 04-Aug-1998 perry

branches: 1.14.6; 1.14.12;
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)


# 1.13 31-Jul-1998 perry

fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.


Revision tags: eeh-paddr_t-base
# 1.12 01-Mar-1998 fvdl

branches: 1.12.2;
Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Apr-1997 jtk

make it compile with -DLOCKF_DEBUG


# 1.10 02-Apr-1997 kleink

Moved the `unlocking a lock-free inode' shortcut behind
the l_whence and starting offset sanity checks.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 13-Oct-1996 christos

backout previous kprintf change


# 1.8 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.7 04-Feb-1996 christos

First pass at prototyping


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.6 19-Mar-1995 mycroft

Use %p.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.5 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.4 19-May-1994 mycroft

Update to 4.4-Lite, plus some local changes.


# 1.3 19-May-1994 cgd

stupidity for prototypes...


# 1.2 25-Apr-1994 cgd

some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.


# 1.1 09-Mar-1994 ws

Make FFS optional


# 1.78 25-Nov-2022 riastradh

kern/vfs_lockf.c: Parenthesize to make arithmetic match check.

We verified start + (fl->fl_len - 1) would not overflow, but then
computed (start + fl->fl_len) - 1 instead, and it is possible for
start + fl->fl_len to overflow before we subtract 1.

Reported-by: syzbot+762480b00cb14085f63a@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=d69313b2460a12715315f9f5f74fbe44b8bc38ba


Revision tags: bouyer-sunxi-drm-base
# 1.77 03-Aug-2022 riastradh

kern/vfs_lockf.c: Fix overflow in overflow detection.

Reported-by: syzbot+cda9440741a1516747c8@syzkaller.appspotmail.com
https://syzkaller.appspot.com/bug?id=030eb71324790093d467799263cd0789e5097229


# 1.76 01-Jul-2022 riastradh

vfs(9): Avoid arithmetic overflow in lf_advlock.

syzbot+897abbbe59467cbf6e98@syzkaller.appspotmail.com


# 1.75 16-Apr-2022 andvar

fix various typos in comments and log messages.


Revision tags: thorpej-i2c-spi-conf2-base thorpej-futex2-base thorpej-cfargs2-base thorpej-i2c-spi-conf-base
# 1.74 27-Jul-2021 manu

Tie the maximum file lock per unprivilegied uid to kern.maxfiles

This makes the limit simple to raise at run time. While there, document
that fcntl(2) and flock(2) may return ENOMEM when this limit is reached.


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 netbsd-9-2-RELEASE cjep_staticlib_x-base thorpej-cfargs-base thorpej-futex-base netbsd-9-1-RELEASE bouyer-xenpvh-base2 phil-wifi-20200421 bouyer-xenpvh-base1 phil-wifi-20200411 bouyer-xenpvh-base is-mlppp-base phil-wifi-20200406 netbsd-8-2-RELEASE ad-namecache-base3 netbsd-9-0-RELEASE netbsd-9-0-RC2 ad-namecache-base2 ad-namecache-base1 ad-namecache-base netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base phil-wifi-20190609 netbsd-8-1-RELEASE netbsd-8-1-RC1 isaki-audio2-base pgoyette-compat-merge-20190127 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 netbsd-7-2-RELEASE pgoyette-compat-0728 netbsd-8-0-RELEASE phil-wifi-base pgoyette-compat-0625 netbsd-8-0-RC2 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 netbsd-8-0-RC1 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322 pgoyette-compat-0315 netbsd-7-1-2-RELEASE pgoyette-compat-base netbsd-7-1-1-RELEASE tls-maxphys-base-20171202 matt-nb8-mediatek-base nick-nhusb-base-20170825 perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 jdolecek-ncq-base pgoyette-localcount-20170320 netbsd-7-1-RELEASE netbsd-7-1-RC2 nick-nhusb-base-20170204 netbsd-7-nhusb-base-20170116 bouyer-socketcan-base pgoyette-localcount-20170107 netbsd-7-1-RC1 nick-nhusb-base-20161204 pgoyette-localcount-20161104 netbsd-7-0-2-RELEASE nick-nhusb-base-20161004 localcount-20160914 netbsd-7-nhusb-base pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base nick-nhusb-base-20160907 nick-nhusb-base-20160529 netbsd-7-0-1-RELEASE nick-nhusb-base-20160422 nick-nhusb-base-20160319 nick-nhusb-base-20151226 netbsd-7-0-RELEASE nick-nhusb-base-20150921 netbsd-7-0-RC3 netbsd-7-0-RC2 netbsd-7-0-RC1 nick-nhusb-base-20150606 nick-nhusb-base-20150406 nick-nhusb-base netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE netbsd-7-base yamt-pagecache-base9 yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3 netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE rmind-smpnet-nbase netbsd-6-1-1-RELEASE riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base rmind-smpnet-base netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 tls-maxphys-base matt-nb6-plus-base netbsd-6-0-RC1 jmcneill-usbmp-base10 yamt-pagecache-base5 jmcneill-usbmp-base9 yamt-pagecache-base4 jmcneill-usbmp-base8 jmcneill-usbmp-base7 jmcneill-usbmp-base6 jmcneill-usbmp-base5 jmcneill-usbmp-base4 jmcneill-usbmp-base3 jmcneill-usbmp-pre-base2 jmcneill-usbmp-base2 netbsd-6-base jmcneill-usbmp-base jmcneill-audiomp3-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base rmind-uvmplock-nbase cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base rmind-uvmplock-base
# 1.73 31-Jan-2011 dholland

branches: 1.73.60; 1.73.72;
Fix build with LOCKF_DEBUG on LP64 platforms; from Alexander Nasonov
in PR 44490.


Revision tags: jruoho-x86intr-base matt-mips64-premerge-20101231 uebayasi-xip-base4 uebayasi-xip-base3 yamt-nfs-mp-base11 uebayasi-xip-base2 yamt-nfs-mp-base10 uebayasi-xip-base1 yamt-nfs-mp-base9 uebayasi-xip-base matt-premerge-20091211 yamt-nfs-mp-base8 yamt-nfs-mp-base7 jym-xensuspend-nbase
# 1.72 05-Aug-2009 dsl

branches: 1.72.4; 1.72.6; 1.72.8;
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!


Revision tags: jymxensuspend-base yamt-nfs-mp-base6 yamt-nfs-mp-base5
# 1.71 10-Jun-2009 yamt

don't make F_GETLK or the common case of F_UNLCK fail for per-user limit.


# 1.70 10-Jun-2009 yamt

lf_split: cv_destroy a condvar before clobbering it.


Revision tags: yamt-nfs-mp-base4 yamt-nfs-mp-base3 nick-hppapmap-base4 nick-hppapmap-base3 netbsd-5-0-RELEASE netbsd-5-0-RC4 netbsd-5-0-RC3 nick-hppapmap-base2 netbsd-5-0-RC2 jym-xensuspend-base netbsd-5-0-RC1 haad-dm-base2 haad-nbase2 ad-audiomp2-base netbsd-5-base nick-hppapmap-base matt-mips64-base2 haad-dm-base1 haad-dm-base mjf-devfs2-base
# 1.69 11-Oct-2008 pooka

branches: 1.69.4; 1.69.8; 1.69.10;
Move uidinfo to its own module in kern_uidinfo.c and include in rump.
No functional change to uidinfo.


Revision tags: wrstuden-revivesa-base-4 wrstuden-revivesa-base-3 wrstuden-revivesa-base-2
# 1.68 11-Aug-2008 yamt

lf_setlock: g/c dead code.


# 1.67 07-Aug-2008 skrll

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()).


# 1.66 01-Aug-2008 skrll

Improve the debug output ever so slightly.


Revision tags: wrstuden-revivesa-base-1 simonb-wapbl-nbase yamt-pf42-base4 simonb-wapbl-base yamt-pf42-base3 wrstuden-revivesa-base
# 1.65 28-May-2008 ad

branches: 1.65.4;
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.


Revision tags: hpcarm-cleanup-nbase yamt-pf42-base2 yamt-nfs-mp-base2 yamt-nfs-mp-base
# 1.64 24-Apr-2008 ad

branches: 1.64.2; 1.64.4;
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.


Revision tags: yamt-pf42-baseX yamt-pf42-base ad-socklock-base1 yamt-lazymbuf-base15 yamt-lazymbuf-base14 keiichi-mipv6-nbase keiichi-mipv6-base matt-armv6-nbase
# 1.63 18-Mar-2008 mrg

branches: 1.63.2;
need <sys/atomic.h> now.


# 1.62 17-Mar-2008 rmind

- 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>.


Revision tags: nick-net80211-sync-base bouyer-xeni386-nbase bouyer-xeni386-base mjf-devfs-base matt-armv6-base hpcarm-cleanup-base
# 1.61 02-Jan-2008 ad

branches: 1.61.2; 1.61.6;
Merge vmlocking2 to head.


Revision tags: nick-csl-alignment-base5 matt-armv6-prevmlocking vmlocking2-base3 yamt-kmem-base3 cube-autoconf-base yamt-kmem-base2 yamt-kmem-base vmlocking2-base2 reinoud-bufcleanup-nbase vmlocking2-base1 jmcneill-base bouyer-xenamd64-base2 vmlocking-nbase yamt-x86pmap-base4 bouyer-xenamd64-base yamt-x86pmap-base3 yamt-x86pmap-base2 yamt-x86pmap-base matt-mips64-base jmcneill-pm-base nick-csl-alignment-base reinoud-bufcleanup-base mjf-ufs-trans-base vmlocking-base
# 1.60 09-Jul-2007 ad

branches: 1.60.8; 1.60.14; 1.60.16; 1.60.20;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements


Revision tags: yamt-idlelwp-base8 thorpej-atomic-base
# 1.59 12-Mar-2007 ad

branches: 1.59.2;
Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.


# 1.58 04-Mar-2007 christos

branches: 1.58.2;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.


Revision tags: ad-audiomp-base post-newlock2-merge
# 1.57 09-Feb-2007 ad

branches: 1.57.2;
Merge newlock2 to head.


Revision tags: netbsd-4-0-1-RELEASE wrstuden-fixsa-newbase wrstuden-fixsa-base-1 netbsd-4-0-RELEASE netbsd-4-0-RC5 matt-nb4-arm-base netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 wrstuden-fixsa-base newlock2-nbase yamt-splraiseipl-base5 yamt-splraiseipl-base4 yamt-splraiseipl-base3 yamt-splraiseipl-base2 yamt-splraiseipl-base yamt-pdpolicy-base9 newlock2-base yamt-pdpolicy-base8 netbsd-4-base rpaulo-netinet-merge-pcb-base
# 1.56 17-Aug-2006 christos

branches: 1.56.2;
Fix all the -D*DEBUG* code that it was rotting away and did not even compile.
Mostly from Arnaud Lacombe, many thanks!


Revision tags: abandoned-netbsd-4-base yamt-pdpolicy-base7
# 1.55 23-Jul-2006 ad

Use the LWP cached credentials where sane.


Revision tags: yamt-pdpolicy-base6 chap-midi-nbase gdamore-uart-base yamt-pdpolicy-base5 chap-midi-base simonb-timecounters-base
# 1.54 20-May-2006 yamt

remove NOLOCKF and use normal NULL instead.


# 1.53 20-May-2006 yamt

remove an debug printf slipped into the previous.


# 1.52 20-May-2006 yamt

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.


# 1.51 20-May-2006 yamt

make lockfpool static.


# 1.50 20-May-2006 yamt

move lockf implementation details from sys/lockf.h to kern/vfs_lockf.c.


# 1.49 14-May-2006 elad

branches: 1.49.2;
integrate kauth.


Revision tags: yamt-pdpolicy-base4 yamt-pdpolicy-base3 peter-altq-base yamt-pdpolicy-base2 elad-kernelauth-base yamt-pdpolicy-base yamt-uio_vmspace-base5
# 1.48 24-Dec-2005 perry

branches: 1.48.4; 1.48.6; 1.48.8; 1.48.10; 1.48.12;
Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete.


# 1.47 11-Dec-2005 christos

merge ktrace-lwp.


Revision tags: yamt-readahead-base3 yamt-readahead-base2 yamt-readahead-pervnode yamt-readahead-perfile yamt-readahead-base yamt-vop-base3 ktrace-lwp-base
# 1.46 28-Oct-2005 christos

use ap->a_flags instead of fl->f_type; pointed out by: Devon H. O'Dell


Revision tags: yamt-vop-base2 thorpej-vnode-attr-base yamt-vop-base
# 1.45 05-Jun-2005 thorpej

branches: 1.45.2; 1.45.4;
Re-arrange slighty, eliminate prototypes that are unnecessary when using
ANSI function decls with "static".


# 1.44 29-May-2005 christos

- add const.
- remove unnecessary casts.
- add __UNCONST casts and mark them with XXXUNCONST as necessary.


# 1.43 22-May-2005 christos

No 0x in front of %p...


# 1.42 09-May-2005 christos

don't unlock twice.


# 1.41 09-May-2005 christos

lock all uses of uidhash. provide macros to lock and unlock. based on more
discussions with yamt.


# 1.40 07-May-2005 christos

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.


Revision tags: yamt-km-base4 kent-audio2-base
# 1.39 25-Mar-2005 christos

Don't free the wrong lock. Pointed out by Konrad Schroder


# 1.38 20-Mar-2005 christos

Keep track and limit the number of locks per uid. From OpenBSD


Revision tags: netbsd-3-1-1-RELEASE netbsd-3-0-3-RELEASE netbsd-3-1-RELEASE netbsd-3-0-2-RELEASE netbsd-3-1-RC4 netbsd-3-1-RC3 netbsd-3-1-RC2 netbsd-3-1-RC1 netbsd-3-0-1-RELEASE netbsd-3-0-RELEASE netbsd-3-0-RC6 netbsd-3-0-RC5 netbsd-3-0-RC4 netbsd-3-0-RC3 netbsd-3-0-RC2 netbsd-3-0-RC1 yamt-km-base3 netbsd-3-base
# 1.37 26-Feb-2005 perry

nuke trailing whitespace


Revision tags: yamt-km-base2 yamt-km-base kent-audio1-beforemerge kent-audio1-base
# 1.36 19-Nov-2004 peter

branches: 1.36.4; 1.36.6;
Fix a typo, dependancy -> dependency

ok wiz@


# 1.35 25-Apr-2004 simonb

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.


Revision tags: netbsd-2-0-3-RELEASE netbsd-2-1-RELEASE netbsd-2-1-RC6 netbsd-2-1-RC5 netbsd-2-1-RC4 netbsd-2-1-RC3 netbsd-2-1-RC2 netbsd-2-1-RC1 netbsd-2-0-2-RELEASE netbsd-2-0-1-RELEASE netbsd-2-base netbsd-2-0-RELEASE netbsd-2-0-RC5 netbsd-2-0-RC4 netbsd-2-0-RC3 netbsd-2-0-RC2 netbsd-2-0-RC1 netbsd-2-0-base
# 1.34 25-Oct-2003 christos

fix uninitialized variable


# 1.33 07-Aug-2003 agc

Move UCB-licensed code from 4-clause to 3-clause licence.

Patches provided by Joel Baker in PR 22364, verified by myself.


# 1.32 25-Jun-2003 yamt

branches: 1.32.2;
revert rev.1.28. (free -> FREE changes)
pointed by David Laight on source-changes about similar changes.


# 1.31 03-May-2003 fvdl

Make gcc3 happy ("label at end of compound statement").


# 1.30 03-May-2003 yamt

get pointer to v_interlock directly
as we are not interested in the rest of the vnode here.


# 1.29 01-May-2003 yamt

- KNF.
- remove unneeded caddr_t casts.


# 1.28 01-May-2003 yamt

use FREE instead of free for MALLOC'ed memory.


# 1.27 01-May-2003 yamt

MP locking.


# 1.26 01-May-2003 yamt

remove a part of comment that isn't true anymore.


# 1.25 01-May-2003 yamt

ANSIfy.


# 1.24 01-May-2003 yamt

don't export lockf internal functions.


# 1.23 05-Mar-2003 mycroft

DANGER WILL ROBINSON!

We cannot store LWP pointers permanently in lock structures, for two reasons:
1) They are somewhat ephemeral. Dangling pointers are bad.
2) A different LWP may issue the unlock, and in this case, we were not actually
doing the unlock at all. This was causing processes to exit without undoing
fcntl(2) locks. Furthermore, the locks are process-specific to begin with,
so the test was just plain wrong.

Instead, we go back to storing a proc pointer for POSIX locks. In addition, we
add an extra pointer to the LWP, which is used in deadlock detection. After
the lock is granted, this pointer is 0ed and there is no reference to the LWP.

Now evolution can inc my mail again.


# 1.22 01-Feb-2003 thorpej

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.


# 1.21 18-Jan-2003 thorpej

Merge the nathanw_sa branch.


Revision tags: nathanw_sa_before_merge fvdl_fs64_base gmcgarry_ctxsw_base gmcgarry_ucred_base nathanw_sa_base kqueue-aftermerge kqueue-beforemerge
# 1.20 22-Oct-2002 simonb

"ovcase" is set but not used in lf_getblock(); remove it.


Revision tags: kqueue-base
# 1.19 04-Sep-2002 matt

Use the queue macros from <sys/queue.h> instead of referring to the queue
members directly. Use *_FOREACH whenever possible.


Revision tags: netbsd-1-6-PATCH002-RELEASE netbsd-1-6-PATCH002 netbsd-1-6-PATCH002-RC4 netbsd-1-6-PATCH002-RC3 netbsd-1-6-PATCH002-RC2 netbsd-1-6-PATCH002-RC1 netbsd-1-6-PATCH001 netbsd-1-6-PATCH001-RELEASE netbsd-1-6-PATCH001-RC3 netbsd-1-6-PATCH001-RC2 netbsd-1-6-PATCH001-RC1 netbsd-1-6-RELEASE netbsd-1-6-RC3 netbsd-1-6-RC2 netbsd-1-6-RC1 netbsd-1-6-base gehenna-devsw-base eeh-devprop-base newlock-base ifpoll-base thorpej-mips-cache-base
# 1.18 12-Nov-2001 lukem

add RCSIDs


Revision tags: thorpej-devvp-base3 thorpej-devvp-base2 post-chs-ubcperf pre-chs-ubcperf thorpej-devvp-base thorpej_scsipi_beforemerge thorpej_scsipi_nbase thorpej_scsipi_base
# 1.17 22-Jul-2000 jdolecek

branches: 1.17.2; 1.17.4; 1.17.8;
change the lf_advlock() arguments from

int lf_advlock __P((struct lockf **,
off_t, caddr_t, int, struct flock *, int));
to

int lf_advlock __P((struct vop_advlock_args *, struct lockf **, off_t));

This matches common usage and is also compatible with similar change
in FreeBSD (though they use u_quad_t as last arg).


Revision tags: netbsd-1-5-base
# 1.16 12-Jun-2000 sommerfeld

branches: 1.16.2;
Fix several problems with lockf/fcntl byte range locks:
- document a data structure invariant in lockf.h
- add KASSERT() to check the invariant.
- be more consistent about dequeuing ourselves from the blocked list
after a tsleep().
- Fix two places where the invariant is violated.
- correct a few comments here and there
- If we're still following a lock dependancy chain after maxlockdepth
processes and haven't gotten back to the start, assume that we're in a
cycle anyway and return EDEADLK.

Fix is a superset of an existing fix in FreeBSD, but independantly
derived.

Fixes kern/3860.


Revision tags: minoura-xpg4dl-base
# 1.15 30-Mar-2000 augustss

branches: 1.15.2;
Get rid of register declarations.


Revision tags: netbsd-1-4-PATCH002 chs-ubc2-newbase wrstuden-devbsize-19991221 wrstuden-devbsize-base kame_141_19991130 comdex-fall-1999-base fvdl-softdep-base netbsd-1-4-PATCH001 kame_14_19990705 kame_14_19990628 chs-ubc2-base netbsd-1-4-RELEASE netbsd-1-4-base kenh-if-detach-base chs-ubc-base
# 1.14 04-Aug-1998 perry

branches: 1.14.6; 1.14.12;
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)


# 1.13 31-Jul-1998 perry

fix sizeofs so they comply with the KNF style guide. yes, it is pedantic.


Revision tags: eeh-paddr_t-base
# 1.12 01-Mar-1998 fvdl

branches: 1.12.2;
Merge with Lite2 + local changes


Revision tags: netbsd-1-3-PATCH003 netbsd-1-3-PATCH003-CANDIDATE2 netbsd-1-3-PATCH003-CANDIDATE1 netbsd-1-3-PATCH003-CANDIDATE0 netbsd-1-3-PATCH002 netbsd-1-3-PATCH001 netbsd-1-3-RELEASE netbsd-1-3-BETA netbsd-1-3-base thorpej-signal-base marc-pcmcia-bp marc-pcmcia-base
# 1.11 10-Apr-1997 jtk

make it compile with -DLOCKF_DEBUG


# 1.10 02-Apr-1997 kleink

Moved the `unlocking a lock-free inode' shortcut behind
the l_whence and starting offset sanity checks.


Revision tags: is-newarp-before-merge is-newarp-base
# 1.9 13-Oct-1996 christos

backout previous kprintf change


# 1.8 10-Oct-1996 christos

printf -> kprintf, sprintf -> ksprintf


Revision tags: netbsd-1-2-PATCH001 netbsd-1-2-RELEASE netbsd-1-2-BETA netbsd-1-2-base
# 1.7 04-Feb-1996 christos

First pass at prototyping


Revision tags: netbsd-1-1-PATCH001 netbsd-1-1-RELEASE netbsd-1-1-base
# 1.6 19-Mar-1995 mycroft

Use %p.


Revision tags: netbsd-1-0-PATCH06 netbsd-1-0-PATCH05 netbsd-1-0-PATCH04 netbsd-1-0-PATCH03 netbsd-1-0-PATCH02 netbsd-1-0-PATCH1 netbsd-1-0-PATCH0 netbsd-1-0-RELEASE netbsd-1-0-base
# 1.5 29-Jun-1994 cgd

New RCS ID's, take two. they're more aesthecially pleasant, and use 'NetBSD'


# 1.4 19-May-1994 mycroft

Update to 4.4-Lite, plus some local changes.


# 1.3 19-May-1994 cgd

stupidity for prototypes...


# 1.2 25-Apr-1994 cgd

some prototype cleanup, eliminate/replace bogus types (e.g. quad and
u_quad) -> use better types (e.g. quad_t & u_quad_t in inodes),
some cleanup.


# 1.1 09-Mar-1994 ws

Make FFS optional