xref: /freebsd/share/man/man9/make_dev.9 (revision 94b1839d20ddac8b097319032bce4e9af74904f4)
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 ,
3294b1839dSChris Costello.Nm remove_dev
3394b1839dSChris Costello.Nd "Create or remove 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
3894b1839dSChris Costello.Fn make_dev "struct cdevsw *devsw" "int minor" "uid_t uid" "gid_t gid" "int perms" "char *fmt" ...
3994b1839dSChris Costello.Ft void
4094b1839dSChris Costello.Fn remove_dev "dev_t dev"
4194b1839dSChris Costello.Sh DESCRIPTION
4294b1839dSChris CostelloThe
4394b1839dSChris Costello.Fn make_dev
4494b1839dSChris Costellofunction creates a
4594b1839dSChris Costello.Fa dev_t
4694b1839dSChris Costellostructure for a new device.  If DEVFS is available, it is also notified of
4794b1839dSChris Costellothe presence of the new device.  The device will be owned by
4894b1839dSChris Costello.Va uid ,
4994b1839dSChris Costellowith the group ownership as
5094b1839dSChris Costello.Va gid ,
5194b1839dSChris Costelloand with the name as specified in
5294b1839dSChris Costello.Va name .
5394b1839dSChris CostelloThe permissions of the file specified in
5494b1839dSChris Costello.Va perms
5594b1839dSChris Costelloare defined in
5694b1839dSChris Costello.Aq Pa sys/stat.h :
5794b1839dSChris Costello.Pp
5894b1839dSChris Costello.Bd -literal -offset indent -compact
5994b1839dSChris Costello#define S_IRWXU 0000700    /* RWX mask for owner */
6094b1839dSChris Costello#define S_IRUSR 0000400    /* R for owner */
6194b1839dSChris Costello#define S_IWUSR 0000200    /* W for owner */
6294b1839dSChris Costello#define S_IXUSR 0000100    /* X for owner */
6394b1839dSChris Costello
6494b1839dSChris Costello#define S_IRWXG 0000070    /* RWX mask for group */
6594b1839dSChris Costello#define S_IRGRP 0000040    /* R for group */
6694b1839dSChris Costello#define S_IWGRP 0000020    /* W for group */
6794b1839dSChris Costello#define S_IXGRP 0000010    /* X for group */
6894b1839dSChris Costello
6994b1839dSChris Costello#define S_IRWXO 0000007    /* RWX mask for other */
7094b1839dSChris Costello#define S_IROTH 0000004    /* R for other */
7194b1839dSChris Costello#define S_IWOTH 0000002    /* W for other */
7294b1839dSChris Costello#define S_IXOTH 0000001    /* X for other */
7394b1839dSChris Costello
7494b1839dSChris Costello#define S_ISUID 0004000    /* set user id on execution */
7594b1839dSChris Costello#define S_ISGID 0002000    /* set group id on execution */
7694b1839dSChris Costello#define S_ISVTX 0001000    /* sticky bit */
7794b1839dSChris Costello#ifndef _POSIX_SOURCE
7894b1839dSChris Costello#define S_ISTXT 0001000
7994b1839dSChris Costello#endif
8094b1839dSChris Costello.Ed
8194b1839dSChris Costello.Pp
8294b1839dSChris CostelloThe
8394b1839dSChris Costello.Fn remove_dev
8494b1839dSChris Costellofunction takes the returned
8594b1839dSChris Costello.Fa dev_t
8694b1839dSChris Costellofrom
8794b1839dSChris Costello.Fn make_dev
8894b1839dSChris Costelloand removes the registration for that device.
8994b1839dSChris Costello.Sh HISTORY
9094b1839dSChris CostelloThe
9194b1839dSChris Costello.Fn make_dev
9294b1839dSChris Costelloand
9394b1839dSChris Costello.Fn remove_dev
9494b1839dSChris Costellofunctions first appeared in
9594b1839dSChris Costello.Fx 4.0 .
96