--- /usr/src/share/man/man9/rwlock.9 Fri Mar 30 20:07:26 2007 +++ share/man/man9/rwlock.9 Sat Nov 24 22:43:32 2007 @@ -30,6 +30,7 @@ .Sh NAME .Nm rwlock , .Nm rw_init , +.Nm rw_init_flags, .Nm rw_destroy , .Nm rw_rlock , .Nm rw_wlock , @@ -50,6 +51,8 @@ .Ft void .Fn rw_init "struct rwlock *rw" "const char *name" .Ft void +.Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts" +.Ft void .Fn rw_destroy "struct rwlock *rw" .Ft void .Fn rw_rlock "struct rwlock *rw" @@ -108,7 +111,7 @@ Another important property is that shared holders of .Nm can recurse, -but exclusive locks are not allowed to recurse. +and exclusive locks can be made recursive selectively. .Ss Macros and Functions .Bl -tag -width indent .It Fn rw_init "struct rwlock *rw" "const char *name" @@ -119,6 +122,30 @@ The description is used solely for debugging purposes. This function must be called before any other operations on the lock. +.It Fn rw_init_flags "struct rwlock *rw" "const char *name" "int opts" +Initialize the rw lock just like +.Fn rw_init +function, but specifing a set of optional flags to alter the +behaviour of +.Fa rw , +through the +.Fa opts +argument. It contains one or more of the following flags: +.Bl -tag -width ".Dv RW_NOPROFILE" +.It Dv RW_DUPOK +Witness should not log messages about duplicate locks being acquired. +.It Dv RW_NOPROFILE +Do not profile this lock. +.It Dv RW_NOWITNESS +Instruct +.Xr witness 4 +to ignore this lock. +.It Dv RW_QUIET +Do not log any operations for this lock via +.Xr ktr 4 . +.It Dv RW_RECURSE +Allow threads to recursively acquire exclusive locks for +.Fa rw . .It Fn rw_rlock "struct rwlock *rw" Lock .Fa rw @@ -139,7 +166,11 @@ If there are any shared owners of the lock, the current thread blocks. The .Fn rw_wlock -function cannot be called recursively. +function can be called recursively only if +.Fa rw +has been initialized with the +.Dv RW_RECURSE +option enabled. .It Fn rw_runlock "struct rwlock *rw" This function releases a shared lock previously acquired by .Fn rw_rlock . --- /usr/src/share/man/man9/sx.9 Sat May 19 23:26:05 2007 +++ share/man/man9/sx.9 Sat Nov 24 23:17:22 2007 @@ -36,6 +36,8 @@ .Nm sx_destroy , .Nm sx_slock , .Nm sx_xlock , +.Nm sx_slock_sig , +.Nm sx_xlock_sig , .Nm sx_try_slock , .Nm sx_try_xlock , .Nm sx_sunlock , @@ -64,6 +66,10 @@ .Ft void .Fn sx_xlock "struct sx *sx" .Ft int +.Fn sx_slock_sig "struct sx *sx" +.Ft int +.Fn sx_xlock_sig "struct sx *sx" +.Ft int .Fn sx_try_slock "struct sx *sx" .Ft int .Fn sx_try_xlock "struct sx *sx" @@ -147,7 +153,8 @@ must not be locked by any thread when it is destroyed. .Pp Threads acquire and release a shared lock by calling -.Fn sx_slock +.Fn sx_slock , +.Fn sx_slock_sig or .Fn sx_try_slock and @@ -155,7 +162,8 @@ or .Fn sx_unlock . Threads acquire and release an exclusive lock by calling -.Fn sx_xlock +.Fn sx_xlock , +.Fn sx_xlock_sig or .Fn sx_try_xlock and @@ -180,6 +188,13 @@ will return 0 if the shared lock cannot be upgraded to an exclusive lock immediately; otherwise the exclusive lock will be acquired and a non-zero value will be returned. +.Pp +.Fn sx_slock_sig +and +.Fn sx_xlock_sig +do the same as their normal versions but performing an interruptible sleep. +They return a non-zero value if the sleep has been interrupted by a signal +or an interrupt, otherwise 0. .Pp A thread can atomically release a shared/exclusive lock while waiting for an event by calling