1:255.16-alt1
[systemd_ALT.git] / man / udev_new.xml
blobcf360f6fe849b3e81fb82d891435433d08bf6f0b
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
4 <!ENTITY % entities SYSTEM "custom-entities.ent" >
5 %entities;
6 ]>
7 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
9 <refentry id="udev_new"
10   xmlns:xi="http://www.w3.org/2001/XInclude">
12   <refentryinfo>
13     <title>udev_new</title>
14     <productname>systemd</productname>
15   </refentryinfo>
17   <refmeta>
18     <refentrytitle>udev_new</refentrytitle>
19     <manvolnum>3</manvolnum>
20   </refmeta>
22   <refnamediv>
23     <refname>udev_new</refname>
24     <refname>udev_ref</refname>
25     <refname>udev_unref</refname>
27     <refpurpose>Create, acquire and release a udev context object</refpurpose>
28   </refnamediv>
30   <refsynopsisdiv>
31     <funcsynopsis>
32       <funcsynopsisinfo>#include &lt;libudev.h&gt;</funcsynopsisinfo>
34       <funcprototype>
35         <funcdef>struct udev *<function>udev_new</function></funcdef>
36         <paramdef><parameter>void</parameter></paramdef>
37       </funcprototype>
39       <funcprototype>
40         <funcdef>struct udev *<function>udev_ref</function></funcdef>
41         <paramdef>struct udev *<parameter>udev</parameter></paramdef>
42       </funcprototype>
44       <funcprototype>
45         <funcdef>struct udev *<function>udev_unref</function></funcdef>
46         <paramdef>struct udev *<parameter>udev</parameter></paramdef>
47       </funcprototype>
49     </funcsynopsis>
50   </refsynopsisdiv>
52   <refsect1>
53     <title>Description</title>
55     <para><function>udev_new()</function> allocates a new udev context
56     object and returns a pointer to it. This object is opaque and must
57     not be accessed by the caller via different means than functions
58     provided by libudev. Initially, the reference count of the context
59     is 1. You can acquire further references, and drop gained references
60     via <function>udev_ref()</function> and
61     <function>udev_unref()</function>. Once the reference count hits 0,
62     the context object is destroyed and freed.</para>
63   </refsect1>
65   <refsect1>
66     <title>Return Value</title>
68     <para>On success, <function>udev_new()</function> returns a pointer
69     to the allocated udev context. On failure, <constant>NULL</constant>
70     is returned. <function>udev_ref()</function> returns the argument
71     that it was passed, unmodified. <function>udev_unref()</function>
72     always returns <constant>NULL</constant>.</para>
73   </refsect1>
75   <refsect1>
76     <title>History</title>
77     <para><function>udev_new()</function>,
78     <function>udev_ref()</function>, and
79     <function>udev_unref()</function> were added in version 221.</para>
80   </refsect1>
82   <refsect1>
83     <title>See Also</title>
85     <para>
86       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
87     </para>
88   </refsect1>
90 </refentry>