Index: sys/sys/refcnt.h =================================================================== RCS file: /cvs/src/sys/sys/refcnt.h,v retrieving revision 1.3 diff -u -p -r1.3 refcnt.h --- sys/sys/refcnt.h 23 Nov 2015 10:56:20 -0000 1.3 +++ sys/sys/refcnt.h 9 Dec 2015 10:44:32 -0000 @@ -29,6 +29,7 @@ struct refcnt { void refcnt_init(struct refcnt *); void refcnt_take(struct refcnt *); +void refcnt_take_n(struct refcnt *, unsigned int); int refcnt_rele(struct refcnt *); void refcnt_rele_wake(struct refcnt *); void refcnt_finalize(struct refcnt *, const char *); Index: sys/kern/kern_synch.c =================================================================== RCS file: /cvs/src/sys/kern/kern_synch.c,v retrieving revision 1.126 diff -u -p -r1.126 kern_synch.c --- sys/kern/kern_synch.c 23 Nov 2015 10:56:20 -0000 1.126 +++ sys/kern/kern_synch.c 9 Dec 2015 10:44:32 -0000 @@ -610,6 +610,12 @@ refcnt_take(struct refcnt *r) atomic_inc_int(&r->refs); } +void +refcnt_take_n(struct refcnt *r, unsigned int n) +{ + atomic_add_int(&r->refs, n); +} + int refcnt_rele(struct refcnt *r) { Index: share/man/man9/Makefile =================================================================== RCS file: /cvs/src/share/man/man9/Makefile,v retrieving revision 1.268 diff -u -p -r1.268 Makefile --- share/man/man9/Makefile 9 Dec 2015 06:29:02 -0000 1.268 +++ share/man/man9/Makefile 9 Dec 2015 10:44:32 -0000 @@ -324,7 +324,8 @@ MLINKS+=arc4random.9 add_true_randomness arc4random.9 arc4random_buf.9 \ arc4random.9 arc4random_uniform.9 MLINKS+=rasops.9 rasops_init.9 rasops.9 rasops_reconfig.9 -MLINKS+=refcnt_init.9 refcnt_take.9 refcnt_init.9 refcnt_rele.9 \ +MLINKS+=refcnt_init.9 refcnt_take.9 refcnt_init.9 refcnt_take_n.9 \ + refcnt_init.9 refcnt_rele.9 \ refcnt_init.9 refcnt_rele_wake.9 refcnt_init.9 refcnt_finalize.9 \ refcnt_init.9 REFCNT_INITIALIZER.9 MLINKS+=rssadapt.9 ieee80211_rssadapt_choose.9 \ Index: share/man/man9/refcnt_init.9 =================================================================== RCS file: /cvs/src/share/man/man9/refcnt_init.9,v retrieving revision 1.1 diff -u -p -r1.1 refcnt_init.9 --- share/man/man9/refcnt_init.9 11 Sep 2015 19:13:22 -0000 1.1 +++ share/man/man9/refcnt_init.9 9 Dec 2015 10:44:32 -0000 @@ -20,6 +20,7 @@ .Sh NAME .Nm refcnt_init , .Nm refcnt_take , +.Nm refcnt_take_n , .Nm refcnt_rele , .Nm refcnt_rele_wake , .Nm refcnt_finalize , @@ -31,6 +32,8 @@ .Fn "refcnt_init" "struct refcnt *r" .Ft void .Fn "refcnt_take" "struct refcnt *r" +.Ft void +.Fn "refcnt_take_n" "struct refcnt *r" "unsigned int n" .Ft int .Fn "refcnt_rele" "struct refcnt *r" .Ft void @@ -51,6 +54,13 @@ is used to acquire a new reference. It is the responsibility of the caller to guarantee that it holds a valid reference before taking a new reference. .Pp +.Fn refcnt_take_n +is used to acquire +.Fa n +additional references. +It is the responsibility of the caller to guarantee that it holds +a valid reference before taking more references. +.Pp .Fn refcnt_rele is used to release an existing reference. .Pp @@ -73,6 +83,7 @@ initialises a declaration of a refcnt to .Sh CONTEXT .Fn refcnt_init , .Fn refcnt_take , +.Fn refcnt_take_n , .Fn refcnt_rele , and .Fn refcnt_rele_wake