]>
Commit | Line | Data |
---|---|---|
06255d6f DH |
1 | <?xml version='1.0'?> <!--*-nxml-*--> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [ | |
4 | <!ENTITY % entities SYSTEM "custom-entities.ent" > | |
5 | %entities; | |
6 | ]> | |
7 | ||
8 | <!-- | |
572eb058 ZJS |
9 | SPDX-License-Identifier: LGPL-2.1+ |
10 | ||
06255d6f DH |
11 | This file is part of systemd. |
12 | ||
13 | Copyright 2015 David Herrmann <dh.herrmann@gmail.com> | |
14 | ||
15 | systemd is free software; you can redistribute it and/or modify it | |
16 | under the terms of the GNU Lesser General Public License as published by | |
17 | the Free Software Foundation; either version 2.1 of the License, or | |
18 | (at your option) any later version. | |
19 | ||
20 | systemd is distributed in the hope that it will be useful, but | |
21 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
23 | Lesser General Public License for more details. | |
24 | ||
25 | You should have received a copy of the GNU Lesser General Public License | |
26 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
27 | --> | |
28 | ||
29 | <refentry id="udev_new" | |
30 | xmlns:xi="http://www.w3.org/2001/XInclude"> | |
31 | ||
32 | <refentryinfo> | |
33 | <title>udev_new</title> | |
34 | <productname>systemd</productname> | |
35 | ||
36 | <authorgroup> | |
37 | <author> | |
38 | <contrib>Developer</contrib> | |
39 | <firstname>David</firstname> | |
40 | <surname>Herrmann</surname> | |
41 | <email>dh.herrmann@gmail.com</email> | |
42 | </author> | |
43 | </authorgroup> | |
44 | </refentryinfo> | |
45 | ||
46 | <refmeta> | |
47 | <refentrytitle>udev_new</refentrytitle> | |
48 | <manvolnum>3</manvolnum> | |
49 | </refmeta> | |
50 | ||
51 | <refnamediv> | |
52 | <refname>udev_new</refname> | |
53 | <refname>udev_ref</refname> | |
54 | <refname>udev_unref</refname> | |
55 | ||
56 | <refpurpose>Create, acquire and release a udev context object</refpurpose> | |
57 | </refnamediv> | |
58 | ||
59 | <refsynopsisdiv> | |
60 | <funcsynopsis> | |
61 | <funcsynopsisinfo>#include <libudev.h></funcsynopsisinfo> | |
62 | ||
63 | <funcprototype> | |
64 | <funcdef>struct udev *<function>udev_new</function></funcdef> | |
65 | <paramdef><parameter>void</parameter></paramdef> | |
66 | </funcprototype> | |
67 | ||
68 | <funcprototype> | |
69 | <funcdef>struct udev *<function>udev_ref</function></funcdef> | |
70 | <paramdef>struct udev *<parameter>udev</parameter></paramdef> | |
71 | </funcprototype> | |
72 | ||
73 | <funcprototype> | |
74 | <funcdef>struct udev *<function>udev_unref</function></funcdef> | |
75 | <paramdef>struct udev *<parameter>udev</parameter></paramdef> | |
76 | </funcprototype> | |
77 | ||
78 | </funcsynopsis> | |
79 | </refsynopsisdiv> | |
80 | ||
81 | <refsect1> | |
82 | <title>Description</title> | |
83 | ||
84 | <para><function>udev_new()</function> allocates a new udev context | |
85 | object and returns a pointer to it. This object is opaque and must | |
86 | not be accessed by the caller via different means than functions | |
87 | provided by libudev. Initially, the reference count of the context | |
88 | is 1. You can acquire further references, and drop gained references | |
89 | via <function>udev_ref()</function> and | |
90 | <function>udev_unref()</function>. Once the reference count hits 0, | |
91 | the context object is destroyed and freed.</para> | |
92 | </refsect1> | |
93 | ||
94 | <refsect1> | |
95 | <title>Return Value</title> | |
96 | ||
97 | <para>On success, <function>udev_new()</function> returns a pointer | |
98 | to the allocated udev context. On failure, <constant>NULL</constant> | |
99 | is returned. <function>udev_ref()</function> returns the argument | |
100 | that it was passed, unmodified. <function>udev_unref()</function> | |
101 | always returns <constant>NULL</constant>.</para> | |
102 | </refsect1> | |
103 | ||
104 | <refsect1> | |
105 | <title>See Also</title> | |
106 | ||
107 | <para> | |
108 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
109 | </para> | |
110 | </refsect1> | |
111 | ||
112 | </refentry> |