From 4772483c009be91716eb583c23c484b06bdd8f50 Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Fri, 13 Jul 2001 18:35:48 +0000 Subject: [PATCH] Add a few more manpages from Chad. Fold major.9, minor.9, umajor.9, and uminor.9 into a single device_ids.9. --- share/man/man9/Makefile | 14 +++- share/man/man9/{minor.9 => device_ids.9} | 46 +++++++++---- share/man/man9/{major.9 => groupmember.9} | 39 ++++++----- share/man/man9/{uminor.9 => ucred.9} | 84 ++++++++++++++++++----- share/man/man9/{umajor.9 => uidinfo.9} | 81 ++++++++++++++++------ 5 files changed, 188 insertions(+), 76 deletions(-) rename share/man/man9/{minor.9 => device_ids.9} (70%) rename share/man/man9/{major.9 => groupmember.9} (77%) rename share/man/man9/{uminor.9 => ucred.9} (53%) rename share/man/man9/{umajor.9 => uidinfo.9} (58%) diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index f9fdc6638cd1..011a48ea4e18 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -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_get_devclass.9 device_get_driver.9 device_get_ivars.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_set_flags.9 devstat.9 devsw.9 devtoname.9 driver.9 \ extattr.9 \ fetch.9 \ get_cyclecounter.9 \ + groupmember.9 \ ifnet.9 inittodr.9 intro.9 ithread.9 \ kernacc.9 kobj.9 kthread.9 ktr.9 \ lockcount.9 lockdestroy.9 lockmgr.9 lockmgr_printinfo.9 \ lockstatus.9 \ - major.9 make_dev.9 malloc.9 mbchain.9 mbuf.9 mdchain.9 \ - mi_switch.9 microseq.9 microtime.9 microuptime.9 minor.9 \ + make_dev.9 malloc.9 mbchain.9 mbuf.9 mdchain.9 \ + mi_switch.9 microseq.9 microtime.9 microuptime.9 \ module.9 mutex.9 \ namei.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 \ style.9 suser.9 swi.9 sx.9 sysctl_add_oid.9 sysctl_ctx_init.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 \ vinvalbuf.9 vn_isdisk.9 vnode.9 vput.9 vref.9 vrele.9 \ vslock.9 \ @@ -101,6 +103,8 @@ MLINKS+=condvar.9 cv_waitq_empty.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+=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 devstat_remove_entry.9 devstat.9 devstat_start_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 callout_handle_init.9 timeout.9 callout_init.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+=vref.9 VREF.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_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_initm.9 diff --git a/share/man/man9/minor.9 b/share/man/man9/device_ids.9 similarity index 70% rename from share/man/man9/minor.9 rename to share/man/man9/device_ids.9 index 7af2af9900fa..ccb97aced3d3 100644 --- a/share/man/man9/minor.9 +++ b/share/man/man9/device_ids.9 @@ -27,31 +27,49 @@ .\" $FreeBSD$ .\" .Dd July 9, 2001 -.Dt MINOR 9 +.Dt DEVICE_IDS 9 .Os .Sh NAME -.Nm minor -.Nd "returns the minor number for the device" +.Nm device_ids , +.Nm major , +.Nm minor , +.Nm umajor , +.Nm uminor +.Nd "calculate device ids" .Sh SYNOPSIS +.In sys/types.h .In sys/systm.h .Ft int +.Fn major "dev_t dev" +.Ft int .Fn minor "dev_t dev" +.Ft int +.Fn umajor "udev_t id" +.Ft int +.Fn uminor "udev_t id" .Sh DESCRIPTION The -.Fn minor -function returns the minor device number for the given device. +.Nm +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 -Its argument is: -.Bl -tag -width ".Fa dev" -.It Fa dev -The device whose minor device number should be returned. -.El +The actual major and minor device IDs are values masked from of the raw device ID. +For details on the actual calculations used to determine the major or minor IDs see +the actual source in +.Pa kern_conf.c . .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 if the device is invalid. -.Sh SEE ALSO -.Xr major 9 .Sh AUTHORS This man page was written by -.An Chad David . +.An Chad David Aq davidc@acns.ab.ca . diff --git a/share/man/man9/major.9 b/share/man/man9/groupmember.9 similarity index 77% rename from share/man/man9/major.9 rename to share/man/man9/groupmember.9 index 879b0945eb0b..70b2d9d3dcfd 100644 --- a/share/man/man9/major.9 +++ b/share/man/man9/groupmember.9 @@ -27,33 +27,34 @@ .\" $FreeBSD$ .\" .Dd July 9, 2001 -.Dt MAJOR 9 +.Dt GROUPMEMBER 9 .Os .Sh NAME -.Nm major -.Nd "returns the major number for the device" +.Nm groupmember +.Nd checks group set for a group ID .Sh SYNOPSIS -.In sys/systm.h +.In sys/param.h +.In sys/ucred.h .Ft int -.Fn major "dev_t dev" +.Fn groupmember "gid_t gid" "struct ucred *cred" .Sh DESCRIPTION The -.Fn major -function returns the major device number for the given device. +.Fn groupmember +function checks to see if the given +.Fa gid +is in the group set of the credentials. .Pp -Its argument is: -.Bl -tag -width ".Fa dev" -.It Fa dev -The device whose major device number should be returned. +Its arguments are: +.Bl -tag -width ".Fa cred" +.It Fa gid +The group ID to check for. +.It Fa cred +The credentials to search for the group in. .El .Sh RETURN VALUES -An integer greater than zero and less than -.Dv NUMCDEVSW , -or -.Dv NOUDEV -if the device is invalid. -.Sh SEE ALSO -.Xr minor 9 +If the +.Fa gid +is found, 1 is returned; otherwise, 0 is returned. .Sh AUTHORS This man page was written by -.An Chad David . +.An Chad David Aq davidc@acns.ab.ca . diff --git a/share/man/man9/uminor.9 b/share/man/man9/ucred.9 similarity index 53% rename from share/man/man9/uminor.9 rename to share/man/man9/ucred.9 index 3df5e1cc2889..ec9c113fa2f1 100644 --- a/share/man/man9/uminor.9 +++ b/share/man/man9/ucred.9 @@ -27,32 +27,78 @@ .\" $FreeBSD$ .\" .Dd July 9, 2001 -.Dt UMINOR 9 +.Dt UCRED 9 .Os .Sh NAME -.Nm uminor -.Nd "returns the minor number from the raw device number" +.Nm ucred , +.Nm crget , +.Nm crhold , +.Nm crfree , +.Nm crcopy , +.Nm crdup +.Nd "functions related to user credentials" .Sh SYNOPSIS -.In sys/systm.h -.Ft int -.Fn uminor "udev_t dev" +.In sys/param.h +.In sys/ucred.h +.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 The -.Fn uminor -function returns the minor device number from the raw device number. +.Nm +family of functions is used to manage user credential structures +.Pq Vt "struct ucred" +within the kernel. .Pp -Its argument is: -.Bl -tag -width ".Fa dev" -.It Fa dev -The raw device number from which the minor device number should be -calculated. -.El +The +.Fn crget +function allocates memory +for a new structure, sets its reference count to 1, and +initializes its lock. +.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 -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 -.Xr major 9 , -.Xr minor 9 , -.Xr umajor 9 +.Xr uihold 9 .Sh AUTHORS This man page was written by -.An Chad David . +.An Chad David Aq davidc@acns.ab.ca . diff --git a/share/man/man9/umajor.9 b/share/man/man9/uidinfo.9 similarity index 58% rename from share/man/man9/umajor.9 rename to share/man/man9/uidinfo.9 index a71e4562ea2e..806ea64b171a 100644 --- a/share/man/man9/umajor.9 +++ b/share/man/man9/uidinfo.9 @@ -26,33 +26,72 @@ .\" .\" $FreeBSD$ .\" -.Dd July 9, 2001 -.Dt UMAJOR 9 +.Dd July 10, 2001 +.Dt UIDINFO 9 .Os .Sh NAME -.Nm umajor -.Nd "returns the major number from the raw device number" +.Nm uidinfo , +.Nm uihashinit , +.Nm uifind , +.Nm uihold , +.Nm uifree +.Nd "functions for managing UID information" .Sh SYNOPSIS -.In sys/systm.h -.Ft int -.Fn umajor "udev_t dev" +.In sys/param.h +.In sys/resourcevar.h +.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 The -.Fn umajor -function returns the major device number form the given raw device -number. +.Nm +family of functions +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 -Its argument is: -.Bl -tag -width ".Fa dev" -.It Fa dev -The device number whose major ID should be calculated and returned. -.El +The +.Fn uihashinit +function initializes the +.Vt uidinfo +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 -An integer greater than or equal to zero. -.Sh SEE ALSO -.Xr major 9 , -.Xr minor 9 , -.Xr uminor 9 +The functions that return values all return a pointer to a +.Vt uidinfo +structure. .Sh AUTHORS This man page was written by -.An Chad David . +.An Chad David Aq davidc@acns.ab.ca .