194b1839dSChris Costello.\" Copyright (c) 1999 Chris Costello 294b1839dSChris Costello.\" All rights reserved. 394b1839dSChris Costello.\" 494b1839dSChris Costello.\" Redistribution and use in source and binary forms, with or without 594b1839dSChris Costello.\" modification, are permitted provided that the following conditions 694b1839dSChris Costello.\" are met: 794b1839dSChris Costello.\" 1. Redistributions of source code must retain the above copyright 894b1839dSChris Costello.\" notice, this list of conditions and the following disclaimer. 994b1839dSChris Costello.\" 2. Redistributions in binary form must reproduce the above copyright 1094b1839dSChris Costello.\" notice, this list of conditions and the following disclaimer in the 1194b1839dSChris Costello.\" documentation and/or other materials provided with the distribution. 1294b1839dSChris Costello.\" 1394b1839dSChris Costello.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1494b1839dSChris Costello.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1594b1839dSChris Costello.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1694b1839dSChris Costello.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1794b1839dSChris Costello.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 1894b1839dSChris Costello.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 1994b1839dSChris Costello.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2094b1839dSChris Costello.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2194b1839dSChris Costello.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2294b1839dSChris Costello.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2394b1839dSChris Costello.\" SUCH DAMAGE. 2494b1839dSChris Costello.\" 2594b1839dSChris Costello.\" $FreeBSD$ 2694b1839dSChris Costello.\" 27f14b89faSDima Dorfman.Dd May 27, 2001 2894b1839dSChris Costello.Os 2994b1839dSChris Costello.Dt MAKE_DEV 9 3094b1839dSChris Costello.Sh NAME 3194b1839dSChris Costello.Nm make_dev , 32f14b89faSDima Dorfman.Nm make_dev_alias , 33f14b89faSDima Dorfman.Nm destroy_dev , 3444c63b64SDima Dorfman.Nm dev_depends 35e3718e31SRuslan Ermilov.Nd manage 36c97dc39fSChristian Brueffer.Vt cdev Ns 's 37e3718e31SRuslan Ermilovand DEVFS registration for devices 3894b1839dSChris Costello.Sh SYNOPSIS 39212c98aaSBruce Evans.In sys/param.h 4032eef9aeSRuslan Ermilov.In sys/conf.h 41c97dc39fSChristian Brueffer.Ft struct cdev 42212c98aaSBruce Evans.Fn make_dev "struct cdevsw *cdevsw" "int minor" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ... 43c97dc39fSChristian Brueffer.Ft struct cdev 44c97dc39fSChristian Brueffer.Fn make_dev_alias "struct cdev pdev" "const char *fmt" ... 4594b1839dSChris Costello.Ft void 46c97dc39fSChristian Brueffer.Fn destroy_dev "struct cdev dev" 47f14b89faSDima Dorfman.Ft void 48c97dc39fSChristian Brueffer.Fn dev_depends "struct cdev pdev" "struct cdev cdev" 4994b1839dSChris Costello.Sh DESCRIPTION 5094b1839dSChris CostelloThe 5194b1839dSChris Costello.Fn make_dev 5294b1839dSChris Costellofunction creates a 53c97dc39fSChristian Brueffer.Fa cdev 54a0942a60SHiten Pandyastructure for a new device. 55a0942a60SHiten PandyaIf DEVFS is available, it is also notified of 56a0942a60SHiten Pandyathe presence of the new device. 57a0942a60SHiten PandyaThe device will be owned by 5894b1839dSChris Costello.Va uid , 5994b1839dSChris Costellowith the group ownership as 6094b1839dSChris Costello.Va gid , 6194b1839dSChris Costelloand with the name as specified in 6294b1839dSChris Costello.Va name . 6394b1839dSChris CostelloThe permissions of the file specified in 6494b1839dSChris Costello.Va perms 6594b1839dSChris Costelloare defined in 66fe08efe6SRuslan Ermilov.In sys/stat.h : 6794b1839dSChris Costello.Pp 6894b1839dSChris Costello.Bd -literal -offset indent -compact 6994b1839dSChris Costello#define S_IRWXU 0000700 /* RWX mask for owner */ 7094b1839dSChris Costello#define S_IRUSR 0000400 /* R for owner */ 7194b1839dSChris Costello#define S_IWUSR 0000200 /* W for owner */ 7294b1839dSChris Costello#define S_IXUSR 0000100 /* X for owner */ 7394b1839dSChris Costello 7494b1839dSChris Costello#define S_IRWXG 0000070 /* RWX mask for group */ 7594b1839dSChris Costello#define S_IRGRP 0000040 /* R for group */ 7694b1839dSChris Costello#define S_IWGRP 0000020 /* W for group */ 7794b1839dSChris Costello#define S_IXGRP 0000010 /* X for group */ 7894b1839dSChris Costello 7994b1839dSChris Costello#define S_IRWXO 0000007 /* RWX mask for other */ 8094b1839dSChris Costello#define S_IROTH 0000004 /* R for other */ 8194b1839dSChris Costello#define S_IWOTH 0000002 /* W for other */ 8294b1839dSChris Costello#define S_IXOTH 0000001 /* X for other */ 8394b1839dSChris Costello 8494b1839dSChris Costello#define S_ISUID 0004000 /* set user id on execution */ 8594b1839dSChris Costello#define S_ISGID 0002000 /* set group id on execution */ 8694b1839dSChris Costello#define S_ISVTX 0001000 /* sticky bit */ 8794b1839dSChris Costello#ifndef _POSIX_SOURCE 8894b1839dSChris Costello#define S_ISTXT 0001000 8994b1839dSChris Costello#endif 9094b1839dSChris Costello.Ed 9194b1839dSChris Costello.Pp 9294b1839dSChris CostelloThe 93792b2369SMatt Jacob.Fn make_dev_alias 94792b2369SMatt Jacobfunction takes the returned 95c97dc39fSChristian Brueffer.Ft cdev 96792b2369SMatt Jacobfrom 97792b2369SMatt Jacob.Fn make_dev 98edf0984dSRuslan Ermilovand makes another (aliased) name for this device. 99edf0984dSRuslan ErmilovIt is an error to call 100792b2369SMatt Jacob.Fn make_dev_alias 101792b2369SMatt Jacobprior to calling 102792b2369SMatt Jacob.Fn make_dev . 103792b2369SMatt Jacob.Pp 104792b2369SMatt JacobThe 105bd00dbfaSBruce Evans.Fn destroy_dev 10694b1839dSChris Costellofunction takes the returned 107c97dc39fSChristian Brueffer.Fa cdev 10894b1839dSChris Costellofrom 10994b1839dSChris Costello.Fn make_dev 110edf0984dSRuslan Ermilovand destroys the registration for that device. 111edf0984dSRuslan ErmilovDo not call 112792b2369SMatt Jacob.Fn destroy_dev 113792b2369SMatt Jacobon devices that were created with 114792b2369SMatt Jacob.Fn make_dev_alias . 115f14b89faSDima Dorfman.Pp 116f14b89faSDima DorfmanThe 11744c63b64SDima Dorfman.Fn dev_depends 118f14b89faSDima Dorfmanfunction establishes a parent-child relationship between two devices. 119f14b89faSDima DorfmanThe net effect is that a 120f14b89faSDima Dorfman.Fn destroy_dev 121f14b89faSDima Dorfmanof the parent device will also result in the destruction of the 122f14b89faSDima Dorfmanchild device(s), 123f14b89faSDima Dorfmanif any exist. 124f14b89faSDima DorfmanA device may simultaneously be a parent and a child, 125b82af3f5SMike Pritchardso it is possible to build a complete hierarchy. 126e07f1d5fSHiten Pandya.Sh SEE ALSO 127e07f1d5fSHiten Pandya.Xr devfs 5 12894b1839dSChris Costello.Sh HISTORY 12994b1839dSChris CostelloThe 13094b1839dSChris Costello.Fn make_dev 13194b1839dSChris Costelloand 132bd00dbfaSBruce Evans.Fn destroy_dev 13394b1839dSChris Costellofunctions first appeared in 13494b1839dSChris Costello.Fx 4.0 . 135792b2369SMatt JacobThe function 136792b2369SMatt Jacob.Fn make_dev_alias 137792b2369SMatt Jacobfirst appeared in 138792b2369SMatt Jacob.Fx 4.1 . 139f14b89faSDima DorfmanThe function 14044c63b64SDima Dorfman.Fn dev_depends 141f14b89faSDima Dorfmanfirst appeared in 142f14b89faSDima Dorfman.Fx 5.0 . 143