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 -->
8
9<refentry id="udev_new"
10  xmlns:xi="http://www.w3.org/2001/XInclude">
11
12  <refentryinfo>
13    <title>udev_new</title>
14    <productname>systemd</productname>
15  </refentryinfo>
16
17  <refmeta>
18    <refentrytitle>udev_new</refentrytitle>
19    <manvolnum>3</manvolnum>
20  </refmeta>
21
22  <refnamediv>
23    <refname>udev_new</refname>
24    <refname>udev_ref</refname>
25    <refname>udev_unref</refname>
26
27    <refpurpose>Create, acquire and release a udev context object</refpurpose>
28  </refnamediv>
29
30  <refsynopsisdiv>
31    <funcsynopsis>
32      <funcsynopsisinfo>#include &lt;libudev.h&gt;</funcsynopsisinfo>
33
34      <funcprototype>
35        <funcdef>struct udev *<function>udev_new</function></funcdef>
36        <paramdef><parameter>void</parameter></paramdef>
37      </funcprototype>
38
39      <funcprototype>
40        <funcdef>struct udev *<function>udev_ref</function></funcdef>
41        <paramdef>struct udev *<parameter>udev</parameter></paramdef>
42      </funcprototype>
43
44      <funcprototype>
45        <funcdef>struct udev *<function>udev_unref</function></funcdef>
46        <paramdef>struct udev *<parameter>udev</parameter></paramdef>
47      </funcprototype>
48
49    </funcsynopsis>
50  </refsynopsisdiv>
51
52  <refsect1>
53    <title>Description</title>
54
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>
64
65  <refsect1>
66    <title>Return Value</title>
67
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>
74
75  <refsect1>
76    <title>See Also</title>
77
78    <para>
79      <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
80    </para>
81  </refsect1>
82
83</refentry>
84