alloc_unr man page on FreeBSD

Man page or keyword search:  
man Server   9747 pages
apropos Keyword Search (all sections)
Output format
FreeBSD logo
[printable version]

ALLOC_UNR(9)		 BSD Kernel Developer's Manual		  ALLOC_UNR(9)

NAME
     new_unrhdr, delete_unrhdr, alloc_unr, free_unr — kernel unit number allo‐
     cator

SYNOPSIS
     #include <sys/systm.h>

     struct unrhdr *
     new_unrhdr(int low, int high, struct mtx *mutex);

     void
     delete_unrhdr(struct unrhdr *uh);

     int
     alloc_unr(struct unrhdr *uh);

     int
     alloc_unrl(struct unrhdr *uh);

     void
     free_unr(struct unrhdr *uh, u_int item);

DESCRIPTION
     The kernel unit number allocator is a generic facility, which allows to
     allocate unit numbers within a specified range.

     new_unrhdr(low, high, mutex)
	     Initialize a new unit number allocator entity.  The low and high
	     arguments specify minimum and maximum number of unit numbers.
	     There is no cost associated with the range of unit numbers, so
	     unless the resource really is finite, INT_MAX can be used.	 If
	     mutex is not NULL, it is used for locking when allocating and
	     freeing units.  Otherwise, internal mutex is used.

     delete_unrhdr(uh)
	     Destroy specified unit number allocator entity.

     alloc_unr(uh)
	     Return a new unit number.	The lowest free number is always allo‐
	     cated.  This function does not allocate memory and never sleeps,
	     however it may block on a mutex.  If no free unit numbers are
	     left, -1 is returned.

     alloc_unrl(uh)
	     Same as alloc_unr() except that mutex is assumed to be already
	     locked and thus is not used.

     free_unr(uh, item)
	     Free a previously allocated unit number.  This function may
	     require allocating memory, and thus it can sleep.	There is no
	     pre-locked variant.

CODE REFERENCES
     The above functions are implemented in sys/kern/subr_unit.c.

HISTORY
     Kernel unit number allocator first appeared in FreeBSD 6.0.

AUTHORS
     Kernel unit number allocator was written by Poul-Henning Kamp.  This man‐
     page was written by Gleb Smirnoff.

BSD			       February 7, 2010				   BSD
[top]

List of man pages available for FreeBSD

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
...................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net