2 .\" Copyright (c) 2010 The DragonFly Project. All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
8 .\" 1. Redistributions of source code must retain the above copyright
9 .\" notice, this list of conditions and the following disclaimer.
10 .\" 2. Redistributions in binary form must reproduce the above copyright
11 .\" notice, this list of conditions and the following disclaimer in
12 .\" the documentation and/or other materials provided with the
14 .\" 3. Neither the name of The DragonFly Project nor the names of its
15 .\" contributors may be used to endorse or promote products derived
16 .\" from this software without specific, prior written permission.
18 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
21 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
23 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
24 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
26 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
27 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
28 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 .Nm udev_monitor_new ,
36 .Nm udev_monitor_ref ,
37 .Nm udev_monitor_unref ,
38 .Nm udev_monitor_get_udev ,
39 .Nm udev_monitor_get_fd ,
40 .Nm udev_monitor_receive_device ,
41 .Nm udev_monitor_enable_receiving ,
42 .Nm udev_monitor_filter_add_match_subsystem_devtype ,
43 .Nm udev_monitor_filter_add_match_expr ,
44 .Nm udev_monitor_filter_add_match_property ,
45 .Nm udev_monitor_filter_add_nomatch_expr ,
46 .Nm udev_monitor_filter_add_nomatch_property ,
47 .Nm udev_monitor_filter_add_match_regex ,
48 .Nm udev_monitor_filter_add_nomatch_regex
49 .Nd device event monitor functions
54 .Ft struct udev_monitor *
55 .Fn udev_monitor_new "struct udev *udev_ctx"
56 .Ft struct udev_monitor *
57 .Fn udev_monitor_ref "struct udev_monitor *udev_monitor"
59 .Fn udev_monitor_unref "struct udev_monitor *udev_monitor"
61 .Fn udev_monitor_get_udev "struct udev_monitor *udev_monitor"
63 .Fn udev_monitor_get_fd "struct udev_monitor *udev_monitor"
64 .Ft struct udev_device *
65 .Fn udev_monitor_receive_device "struct udev_monitor *udev_monitor"
67 .Fn udev_monitor_enable_receiving "struct udev_monitor *udev_monitor"
69 .Fn udev_monitor_filter_add_match_subsystem_devtype "struct udev_monitor *udev_monitor" "const char *subsystem" "const char *devtype"
71 .Fn udev_monitor_filter_add_match_expr "struct udev_monitor *udev_monitor" "const char *key" "char *expr"
73 .Fn udev_monitor_filter_add_match_property "struct udev_monitor *udev_monitor" "const char *key" "const char *expr"
75 .Fn udev_monitor_filter_add_nomatch_expr "struct udev_monitor *udev_monitor" "const char *key" "char *expr"
77 .Fn udev_monitor_filter_add_nomatch_property "struct udev_monitor *udev_monitor" "const char *key" "const char *expr"
79 .Fn udev_monitor_filter_add_match_regex "struct udev_monitor *udev_monitor" "const char *key" "char *expr"
81 .Fn udev_monitor_filter_add_nomatch_regex "struct udev_monitor *udev_monitor" "const char *key" "char *expr"
85 function creates a new udev_monitor object in the specified udev context
89 if no such object could be created.
94 .Fn udev_monitor_unref
95 functions increase or decrease the reference count on a
98 When the reference count drops to 0, the object is automatically destroyed and
99 any remaining event socket closed.
102 function returns the same object that was passed in.
105 .Fn udev_monitor_get_udev
106 function returns the udev context in which the
111 .Fn udev_monitor_enable_receiving
112 function enables receiving event notifications matching the filters added by
114 .Fn udev_monitor_filter_* .
115 The function returns -1 if an error occurs.
118 .Fn udev_monitor_receive_device
119 function reads a udev_device, once the monitor has been enabled for receiving.
120 This call will block until a device is available.
123 if a read error occurs.
126 .Fn udev_monitor_get_fd
127 returns the raw file descriptor on which events are notified after a call to
128 .Fn udev_monitor_enable_receiving .
129 This file descriptor can then be used in conjunction with
134 .Fn udev_monitor_receive_device
135 call must be used to read from the descriptor.
136 The function returns -1 if the socket is not connected.
139 .Fn udev_monitor_filter_add_match_subsystem_devtype
140 function adds a filter that matches the given
150 that argument is ignored.
151 The function returns 0 in case of success and a negative value if an error
153 NOTE: Currently devtype matching is not implemented.
156 .Fn udev_monitor_filter_add_match_expr ,
157 .Fn udev_monitor_filter_add_match_property ,
158 .Fn udev_monitor_filter_add_nomatch_expr
160 .Fn udev_monitor_filter_add_nomatch_property
161 functions add a filter to match or not to match, respectively, devices with the
168 can contain wildcards.
169 On error, these functions return a negative value and 0 if no error occurred.
172 .Fn udev_monitor_filter_add_match_regex ,
174 .Fn udev_monitor_filter_add_nomatch_regex
175 functions add a filter to match or not to match, respectively, devices with the
182 can contain regular expressions according to
184 On error, these functions return a negative value and 0 if no error occurred.
189 .Xr udev_enumerate 3 ,