make_dev.9 (353429bfd2579bf697e8e2a6f182a50c49345083) make_dev.9 (8137364f6e36a56d49fb82b57fab04eb1bce4b9c)
1.\" Copyright (c) 1999 Chris Costello
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
1.\" Copyright (c) 1999 Chris Costello
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\" notice, this list of conditions and the following disclaimer.

--- 10 unchanged lines hidden (view full) ---

19.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23.\" SUCH DAMAGE.
24.\"
25.\" $FreeBSD$
26.\"
27.Dd October 24, 2010
27.Dd May 03, 2011
28.Dt MAKE_DEV 9
29.Os
30.Sh NAME
31.Nm make_dev ,
32.Nm make_dev_cred ,
33.Nm make_dev_credf ,
34.Nm make_dev_p ,
35.Nm make_dev_alias ,
28.Dt MAKE_DEV 9
29.Os
30.Sh NAME
31.Nm make_dev ,
32.Nm make_dev_cred ,
33.Nm make_dev_credf ,
34.Nm make_dev_p ,
35.Nm make_dev_alias ,
36.Nm make_dev_alias_p ,
36.Nm destroy_dev ,
37.Nm destroy_dev_sched ,
38.Nm destroy_dev_sched_cb ,
39.Nm destroy_dev_drain ,
40.Nm dev_depends
41.Nd manage
42.Vt cdev Ns 's
43and DEVFS registration for devices

--- 5 unchanged lines hidden (view full) ---

49.Ft struct cdev *
50.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
51.Ft struct cdev *
52.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
53.Ft int
54.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
55.Ft struct cdev *
56.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
37.Nm destroy_dev ,
38.Nm destroy_dev_sched ,
39.Nm destroy_dev_sched_cb ,
40.Nm destroy_dev_drain ,
41.Nm dev_depends
42.Nd manage
43.Vt cdev Ns 's
44and DEVFS registration for devices

--- 5 unchanged lines hidden (view full) ---

50.Ft struct cdev *
51.Fn make_dev_cred "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
52.Ft struct cdev *
53.Fn make_dev_credf "int flags" "struct cdevsw *cdevsw" "int unit" "struct ucred *cr" "uid_t uid" "gid_t gid" "int perms" "const char *fmt" ...
54.Ft int
55.Fn make_dev_p "int flags" "struct cdev **cdev" "struct cdevsw *devsw" "struct ucred *cr" "uid_t uid" "gid_t gid" "int mode" "const char *fmt" ...
56.Ft struct cdev *
57.Fn make_dev_alias "struct cdev *pdev" "const char *fmt" ...
58.Ft int
59.Fn make_dev_alias_p "int flags" "struct cdev **cdev" "struct cdev *pdev" "const char *fmt" ...
57.Ft void
58.Fn destroy_dev "struct cdev *dev"
59.Ft void
60.Fn destroy_dev_sched "struct cdev *dev"
61.Ft void
62.Fn destroy_dev_sched_cb "struct cdev *dev" "void (*cb)(void *)" "void *arg"
63.Ft void
64.Fn destroy_dev_drain "struct cdevsw *csw"

--- 79 unchanged lines hidden (view full) ---

144.It MAKEDEV_WAITOK
145allow the function to sleep to satisfy malloc
146.It MAKEDEV_ETERNAL
147created device will be never destroyed
148.It MAKEDEV_CHECKNAME
149return an error if the device name is invalid or already exists
150.El
151.Pp
60.Ft void
61.Fn destroy_dev "struct cdev *dev"
62.Ft void
63.Fn destroy_dev_sched "struct cdev *dev"
64.Ft void
65.Fn destroy_dev_sched_cb "struct cdev *dev" "void (*cb)(void *)" "void *arg"
66.Ft void
67.Fn destroy_dev_drain "struct cdevsw *csw"

--- 79 unchanged lines hidden (view full) ---

147.It MAKEDEV_WAITOK
148allow the function to sleep to satisfy malloc
149.It MAKEDEV_ETERNAL
150created device will be never destroyed
151.It MAKEDEV_CHECKNAME
152return an error if the device name is invalid or already exists
153.El
154.Pp
155Only
156.Dv MAKEDEV_NOWAIT ,
157.Dv MAKEDEV_WAITOK
158and
159.Dv MAKEDEV_CHECKNAME
160values are accepted for the
161.Fn make_dev_alias_p
162function.
163.Pp
152The
153.Dv MAKEDEV_WAITOK
154flag is assumed if none of
155.Dv MAKEDEV_WAITOK ,
156.Dv MAKEDEV_NOWAIT
157is specified.
158.Pp
159The

--- 49 unchanged lines hidden (view full) ---

209from
210.Fn make_dev
211and makes another (aliased) name for this device.
212It is an error to call
213.Fn make_dev_alias
214prior to calling
215.Fn make_dev .
216.Pp
164The
165.Dv MAKEDEV_WAITOK
166flag is assumed if none of
167.Dv MAKEDEV_WAITOK ,
168.Dv MAKEDEV_NOWAIT
169is specified.
170.Pp
171The

--- 49 unchanged lines hidden (view full) ---

221from
222.Fn make_dev
223and makes another (aliased) name for this device.
224It is an error to call
225.Fn make_dev_alias
226prior to calling
227.Fn make_dev .
228.Pp
229.Fn make_dev_alias_p
230function is similar to
231.Fn make_dev_alias
232but it takes a pointer to the resulting
233.Ft *cdev
234as an argument and may return an error.
235.Pp
217The
218.Fa cdev
219returned by
220.Fn make_dev
221and
222.Fn make_dev_alias
223has two fields,
224.Fa si_drv1

--- 91 unchanged lines hidden (view full) ---

316.Fn make_dev_credf
317will return a valid
318.Fa cdev
319pointer, otherwise it will return
320.Dv NULL .
321.Sh ERRORS
322The
323.Fn make_dev_p
236The
237.Fa cdev
238returned by
239.Fn make_dev
240and
241.Fn make_dev_alias
242has two fields,
243.Fa si_drv1

--- 91 unchanged lines hidden (view full) ---

335.Fn make_dev_credf
336will return a valid
337.Fa cdev
338pointer, otherwise it will return
339.Dv NULL .
340.Sh ERRORS
341The
342.Fn make_dev_p
343and
344.Fn make_dev_alias_p
324call will fail and the device will be not registered if:
325.Bl -tag -width Er
326.It Bq Er ENOMEM
327The
328.Dv MAKEDEV_NOWAIT
329flag was specified and a memory allocation request could not be satisfied.
330.It Bq Er ENAMETOOLONG
331The

--- 48 unchanged lines hidden ---
345call will fail and the device will be not registered if:
346.Bl -tag -width Er
347.It Bq Er ENOMEM
348The
349.Dv MAKEDEV_NOWAIT
350flag was specified and a memory allocation request could not be satisfied.
351.It Bq Er ENAMETOOLONG
352The

--- 48 unchanged lines hidden ---