abstracted by itry, ithrow, icatch et.al. macros
there is problem with these in stack setup for FreeBSD/ia64 at least,
and in general the rewritten explicit code is slighly more optimal
and smaller in size
the NetBSD code change is somewhat different to what was done in FreeBSD,
to improve readability of the code
on error returns paths with parent still locked, which would
cause 'locking against myself' panic with nonrecursive lock
fixes problem where invalid share name would cause a panic
via smb_sm_lookup() -> smb_share_put()
many thanks to Matthias Drochner for pointing out easy way how to
trigger this problem
incorrectly bombed when the exclusive lock was help by different process
(*yuck*)
lockmgr() checks for 'locking against myself' type of locking problems itself,
so no need to do any additional checks
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.