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.\" 2794b1839dSChris Costello.Dd September 25, 1999 2894b1839dSChris Costello.Os 2994b1839dSChris Costello.Dt MAKE_DEV 9 3094b1839dSChris Costello.Sh NAME 3194b1839dSChris Costello.Nm make_dev , 32bd00dbfaSBruce Evans.Nm destroy_dev 33bd00dbfaSBruce Evans.Nd "Create or destroy dev_t and devfs registration for a new device" 3494b1839dSChris Costello.Sh SYNOPSIS 3594b1839dSChris Costello.Fd #include <sys/types.h> 3694b1839dSChris Costello.Fd #include <sys/conf.h> 3794b1839dSChris Costello.Ft dev_t 38bd00dbfaSBruce Evans.Fn make_dev "struct cdevsw *cdevsw" "int minor" "uid_t uid" "gid_t gid" "int perms" "char *fmt" ... 39792b2369SMatt Jacob.Ft dev_t 40792b2369SMatt Jacob.Fn make_dev_alias "dev_t pdev" "char *fmt" ... 4194b1839dSChris Costello.Ft void 42bd00dbfaSBruce Evans.Fn destroy_dev "dev_t dev" 4394b1839dSChris Costello.Sh DESCRIPTION 4494b1839dSChris CostelloThe 4594b1839dSChris Costello.Fn make_dev 4694b1839dSChris Costellofunction creates a 4794b1839dSChris Costello.Fa dev_t 4894b1839dSChris Costellostructure for a new device. If DEVFS is available, it is also notified of 4994b1839dSChris Costellothe presence of the new device. The device will be owned by 5094b1839dSChris Costello.Va uid , 5194b1839dSChris Costellowith the group ownership as 5294b1839dSChris Costello.Va gid , 5394b1839dSChris Costelloand with the name as specified in 5494b1839dSChris Costello.Va name . 5594b1839dSChris CostelloThe permissions of the file specified in 5694b1839dSChris Costello.Va perms 5794b1839dSChris Costelloare defined in 5894b1839dSChris Costello.Aq Pa sys/stat.h : 5994b1839dSChris Costello.Pp 6094b1839dSChris Costello.Bd -literal -offset indent -compact 6194b1839dSChris Costello#define S_IRWXU 0000700 /* RWX mask for owner */ 6294b1839dSChris Costello#define S_IRUSR 0000400 /* R for owner */ 6394b1839dSChris Costello#define S_IWUSR 0000200 /* W for owner */ 6494b1839dSChris Costello#define S_IXUSR 0000100 /* X for owner */ 6594b1839dSChris Costello 6694b1839dSChris Costello#define S_IRWXG 0000070 /* RWX mask for group */ 6794b1839dSChris Costello#define S_IRGRP 0000040 /* R for group */ 6894b1839dSChris Costello#define S_IWGRP 0000020 /* W for group */ 6994b1839dSChris Costello#define S_IXGRP 0000010 /* X for group */ 7094b1839dSChris Costello 7194b1839dSChris Costello#define S_IRWXO 0000007 /* RWX mask for other */ 7294b1839dSChris Costello#define S_IROTH 0000004 /* R for other */ 7394b1839dSChris Costello#define S_IWOTH 0000002 /* W for other */ 7494b1839dSChris Costello#define S_IXOTH 0000001 /* X for other */ 7594b1839dSChris Costello 7694b1839dSChris Costello#define S_ISUID 0004000 /* set user id on execution */ 7794b1839dSChris Costello#define S_ISGID 0002000 /* set group id on execution */ 7894b1839dSChris Costello#define S_ISVTX 0001000 /* sticky bit */ 7994b1839dSChris Costello#ifndef _POSIX_SOURCE 8094b1839dSChris Costello#define S_ISTXT 0001000 8194b1839dSChris Costello#endif 8294b1839dSChris Costello.Ed 8394b1839dSChris Costello.Pp 8494b1839dSChris CostelloThe 85792b2369SMatt Jacob.Fn make_dev_alias 86792b2369SMatt Jacobfunction takes the returned 87792b2369SMatt Jacob.Fa dev_t 88792b2369SMatt Jacobfrom 89792b2369SMatt Jacob.Fn make_dev 90792b2369SMatt Jacoband makes another (aliased) name for this device. It is an error to call 91792b2369SMatt Jacob.Fn make_dev_alias 92792b2369SMatt Jacobprior to calling 93792b2369SMatt Jacob.Fn make_dev . 94792b2369SMatt Jacob.Pp 95792b2369SMatt JacobThe 96bd00dbfaSBruce Evans.Fn destroy_dev 9794b1839dSChris Costellofunction takes the returned 9894b1839dSChris Costello.Fa dev_t 9994b1839dSChris Costellofrom 10094b1839dSChris Costello.Fn make_dev 101792b2369SMatt Jacoband destroys the registration for that device. Do not call 102792b2369SMatt Jacob.Fn destroy_dev 103792b2369SMatt Jacobon devices that were created with 104792b2369SMatt Jacob.Fn make_dev_alias . 10594b1839dSChris Costello.Sh HISTORY 10694b1839dSChris CostelloThe 10794b1839dSChris Costello.Fn make_dev 10894b1839dSChris Costelloand 109bd00dbfaSBruce Evans.Fn destroy_dev 11094b1839dSChris Costellofunctions first appeared in 11194b1839dSChris Costello.Fx 4.0 . 112792b2369SMatt JacobThe function 113792b2369SMatt Jacob.Fn make_dev_alias 114792b2369SMatt Jacobfirst appeared in 115792b2369SMatt Jacob.Fx 4.1 . 116