Add a few more manpages from Chad.

Fold major.9, minor.9, umajor.9, and uminor.9 into a single device_ids.9.
This commit is contained in:
Ruslan Ermilov 2001-07-13 18:35:48 +00:00
parent b33edd3956
commit 4772483c00
5 changed files with 188 additions and 76 deletions

@ -35,17 +35,19 @@ MAN= BUF_LOCK.9 BUF_LOCKFREE.9 BUF_LOCKINIT.9 BUF_REFCNT.9 \
device_enable.9 device_find_child.9 device_get_children.9 \ device_enable.9 device_find_child.9 device_get_children.9 \
device_get_devclass.9 device_get_driver.9 device_get_ivars.9 \ device_get_devclass.9 device_get_driver.9 device_get_ivars.9 \
device_get_softc.9 device_get_state.9 device_get_unit.9 \ device_get_softc.9 device_get_state.9 device_get_unit.9 \
device_ids.9 \
device_probe_and_attach.9 device_quiet.9 device_set_desc.9 \ device_probe_and_attach.9 device_quiet.9 device_set_desc.9 \
device_set_flags.9 devstat.9 devsw.9 devtoname.9 driver.9 \ device_set_flags.9 devstat.9 devsw.9 devtoname.9 driver.9 \
extattr.9 \ extattr.9 \
fetch.9 \ fetch.9 \
get_cyclecounter.9 \ get_cyclecounter.9 \
groupmember.9 \
ifnet.9 inittodr.9 intro.9 ithread.9 \ ifnet.9 inittodr.9 intro.9 ithread.9 \
kernacc.9 kobj.9 kthread.9 ktr.9 \ kernacc.9 kobj.9 kthread.9 ktr.9 \
lockcount.9 lockdestroy.9 lockmgr.9 lockmgr_printinfo.9 \ lockcount.9 lockdestroy.9 lockmgr.9 lockmgr_printinfo.9 \
lockstatus.9 \ lockstatus.9 \
major.9 make_dev.9 malloc.9 mbchain.9 mbuf.9 mdchain.9 \ make_dev.9 malloc.9 mbchain.9 mbuf.9 mdchain.9 \
mi_switch.9 microseq.9 microtime.9 microuptime.9 minor.9 \ mi_switch.9 microseq.9 microtime.9 microuptime.9 \
module.9 mutex.9 \ module.9 mutex.9 \
namei.9 \ namei.9 \
panic.9 pfil.9 physio.9 posix4.9 printf.9 psignal.9 \ panic.9 pfil.9 physio.9 posix4.9 printf.9 psignal.9 \
@ -54,7 +56,7 @@ MAN= BUF_LOCK.9 BUF_LOCKFREE.9 BUF_LOCKINIT.9 BUF_REFCNT.9 \
sbuf.9 scheduler.9 sleep.9 sleepqueue.9 spl.9 store.9 \ sbuf.9 scheduler.9 sleep.9 sleepqueue.9 spl.9 store.9 \
style.9 suser.9 swi.9 sx.9 sysctl_add_oid.9 sysctl_ctx_init.9 \ style.9 suser.9 swi.9 sx.9 sysctl_add_oid.9 sysctl_ctx_init.9 \
taskqueue.9 time.9 timeout.9 tvtohz.9 \ taskqueue.9 time.9 timeout.9 tvtohz.9 \
uio.9 umajor.9 uminor.9 \ ucred.9 uidinfo.9 uio.9 \
vcount.9 vfs_busy.9 vfs_mount.9 vfs_unbusy.9 vget.9 \ vcount.9 vfs_busy.9 vfs_mount.9 vfs_unbusy.9 vget.9 \
vinvalbuf.9 vn_isdisk.9 vnode.9 vput.9 vref.9 vrele.9 \ vinvalbuf.9 vn_isdisk.9 vnode.9 vput.9 vref.9 vrele.9 \
vslock.9 \ vslock.9 \
@ -101,6 +103,8 @@ MLINKS+=condvar.9 cv_waitq_empty.9
MLINKS+=condvar.9 cv_wmesg.9 MLINKS+=condvar.9 cv_wmesg.9
MLINKS+=copy.9 copyin.9 copy.9 copyinstr.9 copy.9 copyout.9 copy.9 copystr.9 MLINKS+=copy.9 copyin.9 copy.9 copyinstr.9 copy.9 copyout.9 copy.9 copystr.9
MLINKS+=critical_enter.9 critical_exit.9 MLINKS+=critical_enter.9 critical_exit.9
MLINKS+=device_ids.9 major.9 device_ids.9 minor.9
MLINKS+=device_ids.9 umajor.9 device_ids.9 uminor.9
MLINKS+=devstat.9 devicestat.9 devstat.9 devstat_add_entry.9 MLINKS+=devstat.9 devicestat.9 devstat.9 devstat_add_entry.9
MLINKS+=devstat.9 devstat_remove_entry.9 devstat.9 devstat_start_transaction.9 MLINKS+=devstat.9 devstat_remove_entry.9 devstat.9 devstat_start_transaction.9
MLINKS+=devstat.9 devstat_end_transaction.9 MLINKS+=devstat.9 devstat_end_transaction.9
@ -156,6 +160,8 @@ MLINKS+=time.9 boottime.9 time.9 mono_time.9 time.9 runtime.9
MLINKS+=timeout.9 untimeout.9 MLINKS+=timeout.9 untimeout.9
MLINKS+=timeout.9 callout_handle_init.9 timeout.9 callout_init.9 MLINKS+=timeout.9 callout_handle_init.9 timeout.9 callout_init.9
MLINKS+=timeout.9 callout_stop.9 timeout.9 callout_reset.9 MLINKS+=timeout.9 callout_stop.9 timeout.9 callout_reset.9
MLINKS+=uidinfo.9 uihashinit.9 uidinfo.9 uifind.9
MLINKS+=uidinfo.9 uihold.9 uidinfo.9 uifree.9
MLINKS+=uio.9 uiomove.9 MLINKS+=uio.9 uiomove.9
MLINKS+=vref.9 VREF.9 MLINKS+=vref.9 VREF.9
MLINKS+=vslock.9 vsunlock.9 MLINKS+=vslock.9 vsunlock.9
@ -178,6 +184,8 @@ MLINKS+=BUS_SETUP_INTR.9 bus_setup_intr.9
MLINKS+=BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9 MLINKS+=BUS_SETUP_INTR.9 BUS_TEARDOWN_INTR.9
MLINKS+=BUS_SETUP_INTR.9 bus_teardown_intr.9 MLINKS+=BUS_SETUP_INTR.9 bus_teardown_intr.9
MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9 MLINKS+=bus_generic_read_ivar.9 bus_generic_write_ivar.9
MLINKS+=ucred.9 crget.9 ucred.9 crhold.9 ucred.9 crfree.9
MLINKS+=ucred.9 crcopy.9 ucred.9 crdup.9
MLINKS+=mbchain.9 mb_init.9 MLINKS+=mbchain.9 mb_init.9
MLINKS+=mbchain.9 mb_initm.9 MLINKS+=mbchain.9 mb_initm.9

@ -27,31 +27,49 @@
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 9, 2001 .Dd July 9, 2001
.Dt MINOR 9 .Dt DEVICE_IDS 9
.Os .Os
.Sh NAME .Sh NAME
.Nm minor .Nm device_ids ,
.Nd "returns the minor number for the device" .Nm major ,
.Nm minor ,
.Nm umajor ,
.Nm uminor
.Nd "calculate device ids"
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/types.h
.In sys/systm.h .In sys/systm.h
.Ft int .Ft int
.Fn major "dev_t dev"
.Ft int
.Fn minor "dev_t dev" .Fn minor "dev_t dev"
.Ft int
.Fn umajor "udev_t id"
.Ft int
.Fn uminor "udev_t id"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn minor .Nm
function returns the minor device number for the given device. family of functions take either the raw device ID,
.Fa id ,
or a pointer to the device structure,
.Fa dev ,
and return the integer
value that is the major or minor device ID as requested.
.Pp .Pp
Its argument is: The actual major and minor device IDs are values masked from of the raw device ID.
.Bl -tag -width ".Fa dev" For details on the actual calculations used to determine the major or minor IDs see
.It Fa dev the actual source in
The device whose minor device number should be returned. .Pa kern_conf.c .
.El
.Sh RETURN VALUES .Sh RETURN VALUES
An integer greater than zero, or An integer greater than zero and less than
.Dv NUMCDEVSW .
.Fn major
and
.Fn minor
will return
.Dv NOUDEV .Dv NOUDEV
if the device is invalid. if the device is invalid.
.Sh SEE ALSO
.Xr major 9
.Sh AUTHORS .Sh AUTHORS
This man page was written by This man page was written by
.An Chad David . .An Chad David Aq davidc@acns.ab.ca .

@ -27,33 +27,34 @@
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 9, 2001 .Dd July 9, 2001
.Dt MAJOR 9 .Dt GROUPMEMBER 9
.Os .Os
.Sh NAME .Sh NAME
.Nm major .Nm groupmember
.Nd "returns the major number for the device" .Nd checks group set for a group ID
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/systm.h .In sys/param.h
.In sys/ucred.h
.Ft int .Ft int
.Fn major "dev_t dev" .Fn groupmember "gid_t gid" "struct ucred *cred"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn major .Fn groupmember
function returns the major device number for the given device. function checks to see if the given
.Fa gid
is in the group set of the credentials.
.Pp .Pp
Its argument is: Its arguments are:
.Bl -tag -width ".Fa dev" .Bl -tag -width ".Fa cred"
.It Fa dev .It Fa gid
The device whose major device number should be returned. The group ID to check for.
.It Fa cred
The credentials to search for the group in.
.El .El
.Sh RETURN VALUES .Sh RETURN VALUES
An integer greater than zero and less than If the
.Dv NUMCDEVSW , .Fa gid
or is found, 1 is returned; otherwise, 0 is returned.
.Dv NOUDEV
if the device is invalid.
.Sh SEE ALSO
.Xr minor 9
.Sh AUTHORS .Sh AUTHORS
This man page was written by This man page was written by
.An Chad David . .An Chad David Aq davidc@acns.ab.ca .

@ -27,32 +27,78 @@
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 9, 2001 .Dd July 9, 2001
.Dt UMINOR 9 .Dt UCRED 9
.Os .Os
.Sh NAME .Sh NAME
.Nm uminor .Nm ucred ,
.Nd "returns the minor number from the raw device number" .Nm crget ,
.Nm crhold ,
.Nm crfree ,
.Nm crcopy ,
.Nm crdup
.Nd "functions related to user credentials"
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/systm.h .In sys/param.h
.Ft int .In sys/ucred.h
.Fn uminor "udev_t dev" .Ft "struct ucred *"
.Fn crget void
.Ft void
.Fn crhold "struct ucred *cr"
.Ft void
.Fn crfree "struct ucred *cr"
.Ft "struct ucred *"
.Fn crcopy "struct ucred *cr"
.Ft "struct ucred *"
.Fn crdup "struct ucred *cr"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn uminor .Nm
function returns the minor device number from the raw device number. family of functions is used to manage user credential structures
.Pq Vt "struct ucred"
within the kernel.
.Pp .Pp
Its argument is: The
.Bl -tag -width ".Fa dev" .Fn crget
.It Fa dev function allocates memory
The raw device number from which the minor device number should be for a new structure, sets its reference count to 1, and
calculated. initializes its lock.
.El .Pp
The
.Fn crhold
function increases the reference count on the credential.
.Pp
The
.Fn crfree
function decreases the reference count on the credential.
If the count drops to 0, the storage for the structure is freed.
.Pp
The
.Fn crcopy
function calls
.Fn crdup
to create a new structure, and copies the old credentials,
if the reference count is greater than 1;
otherwise, the original is returned.
.Pp
The
.Fn crdup
function allocates memory for a new structure,
copies the contents of the original structure
into it, references the
.Va cr_uidinfo
and
.Va cr_ruidinfo
fields, sets the reference count
to 1, and then returns the new structure.
.Sh RETURN VALUES .Sh RETURN VALUES
An integer greater than or equal to zero. The functions that return values all return a pointer to a
.Vt ucred
structure.
In the case of
.Fn crcopy ,
the return value may be the same structure you passed to it.
.Sh SEE ALSO .Sh SEE ALSO
.Xr major 9 , .Xr uihold 9
.Xr minor 9 ,
.Xr umajor 9
.Sh AUTHORS .Sh AUTHORS
This man page was written by This man page was written by
.An Chad David . .An Chad David Aq davidc@acns.ab.ca .

@ -26,33 +26,72 @@
.\" .\"
.\" $FreeBSD$ .\" $FreeBSD$
.\" .\"
.Dd July 9, 2001 .Dd July 10, 2001
.Dt UMAJOR 9 .Dt UIDINFO 9
.Os .Os
.Sh NAME .Sh NAME
.Nm umajor .Nm uidinfo ,
.Nd "returns the major number from the raw device number" .Nm uihashinit ,
.Nm uifind ,
.Nm uihold ,
.Nm uifree
.Nd "functions for managing UID information"
.Sh SYNOPSIS .Sh SYNOPSIS
.In sys/systm.h .In sys/param.h
.Ft int .In sys/resourcevar.h
.Fn umajor "udev_t dev" .Ft void
.Fn uihashinit void
.Ft "struct uidinfo *"
.Fn uifind "uid_t uid"
.Ft void
.Fn uihold "struct uidinfo *uip"
.Ft void
.Fn uifree "struct uidinfo *uip"
.Sh DESCRIPTION .Sh DESCRIPTION
The The
.Fn umajor .Nm
function returns the major device number form the given raw device family of functions
number. is used to manage
.Vt uidinfo
structures.
The
.Vt uidinfo
structure maintains the process count and socket buffer space usage
for a given UID.
.Pp .Pp
Its argument is: The
.Bl -tag -width ".Fa dev" .Fn uihashinit
.It Fa dev function initializes the
The device number whose major ID should be calculated and returned. .Vt uidinfo
.El hash table.
This function should only be called during system initialization.
.Pp
The
.Fn uifind
function looks up and returns the
.Vt uidinfo
structure for the
.Fa uid .
If the
.Vt uidinfo
is not found, a new structure is allocated.
.Pp
The
.Fn uihold
function increases the reference count on the
.Vt uidinfo
structure.
.Pp
The
.Fn uifree
function decreases the reference count on the
.Vt uidinfo
structure.
If the count reaches 0, the storage for the structure is freed.
.Sh RETURN VALUES .Sh RETURN VALUES
An integer greater than or equal to zero. The functions that return values all return a pointer to a
.Sh SEE ALSO .Vt uidinfo
.Xr major 9 , structure.
.Xr minor 9 ,
.Xr uminor 9
.Sh AUTHORS .Sh AUTHORS
This man page was written by This man page was written by
.An Chad David . .An Chad David Aq davidc@acns.ab.ca .