Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/counter.9
Show All 19 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd March 6, 2020 | .Dd March 11, 2021 | ||||
.Dt COUNTER 9 | .Dt COUNTER 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm counter | .Nm counter | ||||
.Nd "SMP-friendly kernel counter implementation" | .Nd "SMP-friendly kernel counter implementation" | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/types.h | .In sys/types.h | ||||
.In sys/systm.h | .In sys/systm.h | ||||
▲ Show 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
argument is the | argument is the | ||||
.Xr malloc 9 | .Xr malloc 9 | ||||
wait flag, should be either | wait flag, should be either | ||||
.Va M_NOWAIT | .Va M_NOWAIT | ||||
or | or | ||||
.Va M_WAITOK . | .Va M_WAITOK . | ||||
If | If | ||||
.Va M_NOWAIT | .Va M_NOWAIT | ||||
is specified the operation may fail. | is specified the operation may fail and return | ||||
.Dv NULL . | |||||
.It Fn counter_u64_free c | .It Fn counter_u64_free c | ||||
Free the previously allocated counter | Free the previously allocated counter | ||||
.Fa c . | .Fa c . | ||||
It is safe to pass | |||||
.Dv NULL . | |||||
.It Fn counter_u64_add c v | .It Fn counter_u64_add c v | ||||
Add | Add | ||||
.Fa v | .Fa v | ||||
to | to | ||||
.Fa c . | .Fa c . | ||||
The KPI does not guarantee any protection from wraparound. | The KPI does not guarantee any protection from wraparound. | ||||
.It Fn counter_enter | .It Fn counter_enter | ||||
Enter mode that would allow the safe update of several counters via | Enter mode that would allow the safe update of several counters via | ||||
▲ Show 20 Lines • Show All 166 Lines • Show Last 20 Lines |