Current File : //usr/share/doc/dbus/api/dbus-sysdeps_8c_source.html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<title>D-Bus: dbus-sysdeps.c Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">D-Bus
   &#160;<span id="projectnumber">1.8.20</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.6.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="headertitle">
<div class="title">dbus-sysdeps.c</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/* -*- mode: C; c-file-style: &quot;gnu&quot;; indent-tabs-mode: nil; -*- */</span>
<a name="l00002"></a>00002 <span class="comment">/* dbus-sysdeps.c Wrappers around system/libc features shared between UNIX and Windows (internal to D-Bus implementation)</span>
<a name="l00003"></a>00003 <span class="comment"> * </span>
<a name="l00004"></a>00004 <span class="comment"> * Copyright (C) 2002, 2003, 2006  Red Hat, Inc.</span>
<a name="l00005"></a>00005 <span class="comment"> * Copyright (C) 2003 CodeFactory AB</span>
<a name="l00006"></a>00006 <span class="comment"> *</span>
<a name="l00007"></a>00007 <span class="comment"> * Licensed under the Academic Free License version 2.1</span>
<a name="l00008"></a>00008 <span class="comment"> * </span>
<a name="l00009"></a>00009 <span class="comment"> * This program is free software; you can redistribute it and/or modify</span>
<a name="l00010"></a>00010 <span class="comment"> * it under the terms of the GNU General Public License as published by</span>
<a name="l00011"></a>00011 <span class="comment"> * the Free Software Foundation; either version 2 of the License, or</span>
<a name="l00012"></a>00012 <span class="comment"> * (at your option) any later version.</span>
<a name="l00013"></a>00013 <span class="comment"> *</span>
<a name="l00014"></a>00014 <span class="comment"> * This program is distributed in the hope that it will be useful,</span>
<a name="l00015"></a>00015 <span class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</span>
<a name="l00016"></a>00016 <span class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the</span>
<a name="l00017"></a>00017 <span class="comment"> * GNU General Public License for more details.</span>
<a name="l00018"></a>00018 <span class="comment"> * </span>
<a name="l00019"></a>00019 <span class="comment"> * You should have received a copy of the GNU General Public License</span>
<a name="l00020"></a>00020 <span class="comment"> * along with this program; if not, write to the Free Software</span>
<a name="l00021"></a>00021 <span class="comment"> * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA</span>
<a name="l00022"></a>00022 <span class="comment"> *</span>
<a name="l00023"></a>00023 <span class="comment"> */</span>
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="preprocessor">#include &lt;config.h&gt;</span>
<a name="l00026"></a>00026 <span class="preprocessor">#include &quot;dbus-internals.h&quot;</span>
<a name="l00027"></a>00027 <span class="preprocessor">#include &quot;dbus-sysdeps.h&quot;</span>
<a name="l00028"></a>00028 <span class="preprocessor">#include &quot;dbus-threads.h&quot;</span>
<a name="l00029"></a>00029 <span class="preprocessor">#include &quot;dbus-protocol.h&quot;</span>
<a name="l00030"></a>00030 <span class="preprocessor">#include &quot;dbus-string.h&quot;</span>
<a name="l00031"></a>00031 <span class="preprocessor">#include &quot;dbus-list.h&quot;</span>
<a name="l00032"></a>00032 <span class="preprocessor">#include &quot;dbus-misc.h&quot;</span>
<a name="l00033"></a>00033 
<a name="l00034"></a>00034 <span class="comment">/* NOTE: If you include any unix/windows-specific headers here, you are probably doing something</span>
<a name="l00035"></a>00035 <span class="comment"> * wrong and should be putting some code in dbus-sysdeps-unix.c or dbus-sysdeps-win.c.</span>
<a name="l00036"></a>00036 <span class="comment"> *</span>
<a name="l00037"></a>00037 <span class="comment"> * These are the standard ANSI C headers...</span>
<a name="l00038"></a>00038 <span class="comment"> */</span>
<a name="l00039"></a>00039 <span class="preprocessor">#if HAVE_LOCALE_H</span>
<a name="l00040"></a>00040 <span class="preprocessor"></span><span class="preprocessor">#include &lt;locale.h&gt;</span>
<a name="l00041"></a>00041 <span class="preprocessor">#endif</span>
<a name="l00042"></a>00042 <span class="preprocessor"></span><span class="preprocessor">#include &lt;stdlib.h&gt;</span>
<a name="l00043"></a>00043 <span class="preprocessor">#include &lt;string.h&gt;</span>
<a name="l00044"></a>00044 <span class="preprocessor">#include &lt;stdio.h&gt;</span>
<a name="l00045"></a>00045 
<a name="l00046"></a>00046 <span class="preprocessor">#ifdef HAVE_ERRNO_H</span>
<a name="l00047"></a>00047 <span class="preprocessor"></span><span class="preprocessor">#include &lt;errno.h&gt;</span>
<a name="l00048"></a>00048 <span class="preprocessor">#endif</span>
<a name="l00049"></a>00049 <span class="preprocessor"></span>
<a name="l00050"></a>00050 <span class="preprocessor">#ifdef DBUS_WIN</span>
<a name="l00051"></a>00051 <span class="preprocessor"></span><span class="preprocessor">  #include &lt;stdlib.h&gt;</span>
<a name="l00052"></a>00052 <span class="preprocessor">#elif (defined __APPLE__)</span>
<a name="l00053"></a>00053 <span class="preprocessor"></span><span class="preprocessor"># include &lt;crt_externs.h&gt;</span>
<a name="l00054"></a>00054 <span class="preprocessor"># define environ (*_NSGetEnviron())</span>
<a name="l00055"></a>00055 <span class="preprocessor"></span><span class="preprocessor">#else</span>
<a name="l00056"></a>00056 <span class="preprocessor"></span><span class="keyword">extern</span> <span class="keywordtype">char</span> **environ;
<a name="l00057"></a>00057 <span class="preprocessor">#endif</span>
<a name="l00058"></a>00058 <span class="preprocessor"></span>
<a name="l00076"></a>00076 <span class="keywordtype">void</span>
<a name="l00077"></a><a class="code" href="group__DBusSysdeps.html#ga83c51771d3c4e612522bd5ad72e6ad7a">00077</a> <a class="code" href="group__DBusSysdeps.html#ga83c51771d3c4e612522bd5ad72e6ad7a" title="Aborts the program with SIGABRT (dumping core).">_dbus_abort</a> (<span class="keywordtype">void</span>)
<a name="l00078"></a>00078 {
<a name="l00079"></a>00079   <span class="keyword">const</span> <span class="keywordtype">char</span> *s;
<a name="l00080"></a>00080   
<a name="l00081"></a>00081   <a class="code" href="group__DBusSysdeps.html#ga8646ab2ef727fcc862c7904113c88a8d" title="On GNU libc systems, print a crude backtrace to stderr.">_dbus_print_backtrace</a> ();
<a name="l00082"></a>00082   
<a name="l00083"></a>00083   s = <a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a" title="Wrapper for getenv().">_dbus_getenv</a> (<span class="stringliteral">&quot;DBUS_BLOCK_ON_ABORT&quot;</span>);
<a name="l00084"></a>00084   <span class="keywordflow">if</span> (s &amp;&amp; *s)
<a name="l00085"></a>00085     {
<a name="l00086"></a>00086       <span class="comment">/* don&#39;t use _dbus_warn here since it can _dbus_abort() */</span>
<a name="l00087"></a>00087       fprintf (stderr, <span class="stringliteral">&quot;  Process %lu sleeping for gdb attach\n&quot;</span>, <a class="code" href="group__DBusSysdeps.html#ga1b30aa55e8758ed6e1b62e0f86866543" title="The only reason this is separate from _dbus_getpid() is to allow it on Windows for logging but not fo...">_dbus_pid_for_log</a> ());
<a name="l00088"></a>00088       <a class="code" href="group__DBusSysdeps.html#ga1153b4669819148af6b3f6f2b7c9183a" title="Sleeps the given number of milliseconds.">_dbus_sleep_milliseconds</a> (1000 * 180);
<a name="l00089"></a>00089     }
<a name="l00090"></a>00090   
<a name="l00091"></a>00091   abort ();
<a name="l00092"></a>00092   <a class="code" href="group__DBusSysdeps.html#ga203e3257b50597a8fe7757c920474a20" title="Exit the process, returning the given value.">_dbus_exit</a> (1); <span class="comment">/* in case someone manages to ignore SIGABRT ? */</span>
<a name="l00093"></a>00093 }
<a name="l00094"></a>00094 
<a name="l00113"></a>00113 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00114"></a><a class="code" href="group__DBusMisc.html#gac02f6b021decd9fa35697a36ea581f86">00114</a> <a class="code" href="group__DBusMisc.html#gac02f6b021decd9fa35697a36ea581f86" title="Wrapper for setenv().">dbus_setenv</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *varname,
<a name="l00115"></a>00115              <span class="keyword">const</span> <span class="keywordtype">char</span> *value)
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117   _dbus_assert (varname != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>);
<a name="l00118"></a>00118   
<a name="l00119"></a>00119   <span class="keywordflow">if</span> (value == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00120"></a>00120     {
<a name="l00121"></a>00121 <span class="preprocessor">#ifdef HAVE_UNSETENV</span>
<a name="l00122"></a>00122 <span class="preprocessor"></span>      unsetenv (varname);
<a name="l00123"></a>00123       <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00124"></a>00124 <span class="preprocessor">#else</span>
<a name="l00125"></a>00125 <span class="preprocessor"></span>      <span class="keywordtype">char</span> *putenv_value;
<a name="l00126"></a>00126       <span class="keywordtype">size_t</span> len;
<a name="l00127"></a>00127 
<a name="l00128"></a>00128       len = strlen (varname);
<a name="l00129"></a>00129 
<a name="l00130"></a>00130       <span class="comment">/* Use system malloc to avoid memleaks that dbus_malloc</span>
<a name="l00131"></a>00131 <span class="comment">       * will get upset about.</span>
<a name="l00132"></a>00132 <span class="comment">       */</span>
<a name="l00133"></a>00133       
<a name="l00134"></a>00134       putenv_value = malloc (len + 2);
<a name="l00135"></a>00135       <span class="keywordflow">if</span> (putenv_value == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00136"></a>00136         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00137"></a>00137 
<a name="l00138"></a>00138       strcpy (putenv_value, varname);
<a name="l00139"></a>00139 <span class="preprocessor">#if defined(DBUS_WIN)</span>
<a name="l00140"></a>00140 <span class="preprocessor"></span>      strcat (putenv_value, <span class="stringliteral">&quot;=&quot;</span>);
<a name="l00141"></a>00141 <span class="preprocessor">#endif</span>
<a name="l00142"></a>00142 <span class="preprocessor"></span>      
<a name="l00143"></a>00143       <span class="keywordflow">return</span> (putenv (putenv_value) == 0);
<a name="l00144"></a>00144 <span class="preprocessor">#endif</span>
<a name="l00145"></a>00145 <span class="preprocessor"></span>    }
<a name="l00146"></a>00146   <span class="keywordflow">else</span>
<a name="l00147"></a>00147     {
<a name="l00148"></a>00148 <span class="preprocessor">#ifdef HAVE_SETENV</span>
<a name="l00149"></a>00149 <span class="preprocessor"></span>      <span class="keywordflow">return</span> (setenv (varname, value, <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>) == 0);
<a name="l00150"></a>00150 <span class="preprocessor">#else</span>
<a name="l00151"></a>00151 <span class="preprocessor"></span>      <span class="keywordtype">char</span> *putenv_value;
<a name="l00152"></a>00152       <span class="keywordtype">size_t</span> len;
<a name="l00153"></a>00153       <span class="keywordtype">size_t</span> varname_len;
<a name="l00154"></a>00154       <span class="keywordtype">size_t</span> value_len;
<a name="l00155"></a>00155 
<a name="l00156"></a>00156       varname_len = strlen (varname);
<a name="l00157"></a>00157       value_len = strlen (value);
<a name="l00158"></a>00158       
<a name="l00159"></a>00159       len = varname_len + value_len + 1 <span class="comment">/* &#39;=&#39; */</span> ;
<a name="l00160"></a>00160 
<a name="l00161"></a>00161       <span class="comment">/* Use system malloc to avoid memleaks that dbus_malloc</span>
<a name="l00162"></a>00162 <span class="comment">       * will get upset about.</span>
<a name="l00163"></a>00163 <span class="comment">       */</span>
<a name="l00164"></a>00164       
<a name="l00165"></a>00165       putenv_value = malloc (len + 1);
<a name="l00166"></a>00166       <span class="keywordflow">if</span> (putenv_value == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00167"></a>00167         <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00168"></a>00168 
<a name="l00169"></a>00169       strcpy (putenv_value, varname);
<a name="l00170"></a>00170       strcpy (putenv_value + varname_len, <span class="stringliteral">&quot;=&quot;</span>);
<a name="l00171"></a>00171       strcpy (putenv_value + varname_len + 1, value);
<a name="l00172"></a>00172       
<a name="l00173"></a>00173       <span class="keywordflow">return</span> (putenv (putenv_value) == 0);
<a name="l00174"></a>00174 <span class="preprocessor">#endif</span>
<a name="l00175"></a>00175 <span class="preprocessor"></span>    }
<a name="l00176"></a>00176 }
<a name="l00177"></a>00177 
<a name="l00184"></a>00184 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00185"></a><a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a">00185</a> <a class="code" href="group__DBusSysdeps.html#gab846071a4de54cb7e518654f9375313a" title="Wrapper for getenv().">_dbus_getenv</a> (<span class="keyword">const</span> <span class="keywordtype">char</span> *varname)
<a name="l00186"></a>00186 {  
<a name="l00187"></a>00187   <span class="keywordflow">return</span> getenv (varname);
<a name="l00188"></a>00188 }
<a name="l00189"></a>00189 
<a name="l00195"></a>00195 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00196"></a><a class="code" href="group__DBusSysdeps.html#ga38d9b871ec4fb30371d1187d8c9d3ef9">00196</a> <a class="code" href="group__DBusSysdeps.html#ga38d9b871ec4fb30371d1187d8c9d3ef9" title="Wrapper for clearenv().">_dbus_clearenv</a> (<span class="keywordtype">void</span>)
<a name="l00197"></a>00197 {
<a name="l00198"></a>00198   <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a> rc = <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00199"></a>00199 
<a name="l00200"></a>00200 <span class="preprocessor">#ifdef HAVE_CLEARENV</span>
<a name="l00201"></a>00201 <span class="preprocessor"></span>  <span class="keywordflow">if</span> (clearenv () != 0)
<a name="l00202"></a>00202      rc = <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00203"></a>00203 <span class="preprocessor">#else</span>
<a name="l00204"></a>00204 <span class="preprocessor"></span>
<a name="l00205"></a>00205   <span class="keywordflow">if</span> (environ != <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>)
<a name="l00206"></a>00206     environ[0] = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00207"></a>00207 <span class="preprocessor">#endif</span>
<a name="l00208"></a>00208 <span class="preprocessor"></span>
<a name="l00209"></a>00209   <span class="keywordflow">return</span> rc;
<a name="l00210"></a>00210 }
<a name="l00211"></a>00211 
<a name="l00220"></a>00220 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00221"></a><a class="code" href="group__DBusSysdeps.html#ga9393ded03e3b9812e4ba99b437ea992d">00221</a> <a class="code" href="group__DBusSysdeps.html#ga9393ded03e3b9812e4ba99b437ea992d" title="Split paths into a list of char strings.">_dbus_split_paths_and_append</a> (<a class="code" href="structDBusString.html">DBusString</a> *dirs, 
<a name="l00222"></a>00222                               <span class="keyword">const</span> <span class="keywordtype">char</span> *suffix, 
<a name="l00223"></a>00223                               <a class="code" href="structDBusList.html" title="A node in a linked list.">DBusList</a>  **dir_list)
<a name="l00224"></a>00224 {
<a name="l00225"></a>00225    <span class="keywordtype">int</span> start;
<a name="l00226"></a>00226    <span class="keywordtype">int</span> i;
<a name="l00227"></a>00227    <span class="keywordtype">int</span> len;
<a name="l00228"></a>00228    <span class="keywordtype">char</span> *cpath;
<a name="l00229"></a>00229    <a class="code" href="structDBusString.html">DBusString</a> file_suffix;
<a name="l00230"></a>00230 
<a name="l00231"></a>00231    start = 0;
<a name="l00232"></a>00232    i = 0;
<a name="l00233"></a>00233 
<a name="l00234"></a>00234    <a class="code" href="group__DBusString.html#ga374640ddfa2f0b27a8356e2379ba8043" title="Initializes a constant string.">_dbus_string_init_const</a> (&amp;file_suffix, suffix);
<a name="l00235"></a>00235 
<a name="l00236"></a>00236    len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (dirs);
<a name="l00237"></a>00237 
<a name="l00238"></a>00238    <span class="keywordflow">while</span> (<a class="code" href="group__DBusString.html#ga5fe47873b2838339107c3e1f03d1a703" title="Finds the given substring in the string, returning TRUE and filling in the byte index where the subst...">_dbus_string_find</a> (dirs, start, _DBUS_PATH_SEPARATOR, &amp;i))
<a name="l00239"></a>00239      {
<a name="l00240"></a>00240        <a class="code" href="structDBusString.html">DBusString</a> path;
<a name="l00241"></a>00241 
<a name="l00242"></a>00242        <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;path))
<a name="l00243"></a>00243           <span class="keywordflow">goto</span> oom;
<a name="l00244"></a>00244 
<a name="l00245"></a>00245        <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gaf5f13bc7ac7a623516930d26ae2589bf" title="Like _dbus_string_copy(), but can copy a segment from the middle of the source string.">_dbus_string_copy_len</a> (dirs,
<a name="l00246"></a>00246                                    start,
<a name="l00247"></a>00247                                    i - start,
<a name="l00248"></a>00248                                    &amp;path,
<a name="l00249"></a>00249                                    0))
<a name="l00250"></a>00250           {
<a name="l00251"></a>00251             <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00252"></a>00252             <span class="keywordflow">goto</span> oom;
<a name="l00253"></a>00253           }
<a name="l00254"></a>00254 
<a name="l00255"></a>00255         <a class="code" href="group__DBusString.html#gaa92c6ab2c5e24cbefef0a3f3fc76f98b" title="Deletes leading and trailing whitespace.">_dbus_string_chop_white</a> (&amp;path);
<a name="l00256"></a>00256 
<a name="l00257"></a>00257         <span class="comment">/* check for an empty path */</span>
<a name="l00258"></a>00258         <span class="keywordflow">if</span> (<a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (&amp;path) == 0)
<a name="l00259"></a>00259           <span class="keywordflow">goto</span> next;
<a name="l00260"></a>00260 
<a name="l00261"></a>00261         <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdeps.html#gae3a3fdc0c6001e367584bb016aca495d" title="Appends the given filename to the given directory.">_dbus_concat_dir_and_file</a> (&amp;path,
<a name="l00262"></a>00262                                         &amp;file_suffix))
<a name="l00263"></a>00263           {
<a name="l00264"></a>00264             <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00265"></a>00265             <span class="keywordflow">goto</span> oom;
<a name="l00266"></a>00266           }
<a name="l00267"></a>00267 
<a name="l00268"></a>00268         <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga7e509d4f959d19d96f83250e62287b06" title="Copies the data from the string into a char*.">_dbus_string_copy_data</a>(&amp;path, &amp;cpath))
<a name="l00269"></a>00269           {
<a name="l00270"></a>00270             <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00271"></a>00271             <span class="keywordflow">goto</span> oom;
<a name="l00272"></a>00272           }
<a name="l00273"></a>00273 
<a name="l00274"></a>00274         <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#gad99045e79db46159babe69718f343053" title="Appends a value to the list.">_dbus_list_append</a> (dir_list, cpath))
<a name="l00275"></a>00275           {
<a name="l00276"></a>00276             <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);              
<a name="l00277"></a>00277             <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (cpath);
<a name="l00278"></a>00278             <span class="keywordflow">goto</span> oom;
<a name="l00279"></a>00279           }
<a name="l00280"></a>00280 
<a name="l00281"></a>00281        next:
<a name="l00282"></a>00282         <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00283"></a>00283         start = i + 1;
<a name="l00284"></a>00284     } 
<a name="l00285"></a>00285       
<a name="l00286"></a>00286   <span class="keywordflow">if</span> (start != len)
<a name="l00287"></a>00287     { 
<a name="l00288"></a>00288       <a class="code" href="structDBusString.html">DBusString</a> path;
<a name="l00289"></a>00289 
<a name="l00290"></a>00290       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;path))
<a name="l00291"></a>00291         <span class="keywordflow">goto</span> oom;
<a name="l00292"></a>00292 
<a name="l00293"></a>00293       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#gaf5f13bc7ac7a623516930d26ae2589bf" title="Like _dbus_string_copy(), but can copy a segment from the middle of the source string.">_dbus_string_copy_len</a> (dirs,
<a name="l00294"></a>00294                                   start,
<a name="l00295"></a>00295                                   len - start,
<a name="l00296"></a>00296                                   &amp;path,
<a name="l00297"></a>00297                                   0))
<a name="l00298"></a>00298         {
<a name="l00299"></a>00299           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00300"></a>00300           <span class="keywordflow">goto</span> oom;
<a name="l00301"></a>00301         }
<a name="l00302"></a>00302 
<a name="l00303"></a>00303       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdeps.html#gae3a3fdc0c6001e367584bb016aca495d" title="Appends the given filename to the given directory.">_dbus_concat_dir_and_file</a> (&amp;path,
<a name="l00304"></a>00304                                       &amp;file_suffix))
<a name="l00305"></a>00305         {
<a name="l00306"></a>00306           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00307"></a>00307           <span class="keywordflow">goto</span> oom;
<a name="l00308"></a>00308         }
<a name="l00309"></a>00309 
<a name="l00310"></a>00310       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga7e509d4f959d19d96f83250e62287b06" title="Copies the data from the string into a char*.">_dbus_string_copy_data</a>(&amp;path, &amp;cpath))
<a name="l00311"></a>00311         {
<a name="l00312"></a>00312           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);
<a name="l00313"></a>00313           <span class="keywordflow">goto</span> oom;
<a name="l00314"></a>00314         }
<a name="l00315"></a>00315 
<a name="l00316"></a>00316       <span class="keywordflow">if</span> (!<a class="code" href="group__DBusList.html#gad99045e79db46159babe69718f343053" title="Appends a value to the list.">_dbus_list_append</a> (dir_list, cpath))
<a name="l00317"></a>00317         {
<a name="l00318"></a>00318           <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path);              
<a name="l00319"></a>00319           <a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a> (cpath);
<a name="l00320"></a>00320           <span class="keywordflow">goto</span> oom;
<a name="l00321"></a>00321         }
<a name="l00322"></a>00322 
<a name="l00323"></a>00323       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;path); 
<a name="l00324"></a>00324     }
<a name="l00325"></a>00325 
<a name="l00326"></a>00326   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00327"></a>00327 
<a name="l00328"></a>00328  oom:
<a name="l00329"></a>00329   <a class="code" href="group__DBusList.html#ga8dd69084b53361803a765e6d53d5b9d1" title="Calls the given function for each element in the list.">_dbus_list_foreach</a> (dir_list, (DBusForeachFunction)<a class="code" href="group__DBusMemory.html#ga34e666b19b015035a9a31e53da84b39a" title="Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().">dbus_free</a>, <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>); 
<a name="l00330"></a>00330   <a class="code" href="group__DBusList.html#gaa36d13444a050a923941c53650b72f9d" title="Frees all links in the list and sets the list head to NULL.">_dbus_list_clear</a> (dir_list);
<a name="l00331"></a>00331   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333 
<a name="l00348"></a>00348 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00349"></a><a class="code" href="group__DBusString.html#ga41141ca36c361f92b6029530ff83fa66">00349</a> <a class="code" href="group__DBusString.html#ga41141ca36c361f92b6029530ff83fa66" title="Appends an integer to a DBusString.">_dbus_string_append_int</a> (<a class="code" href="structDBusString.html">DBusString</a> *str,
<a name="l00350"></a>00350                          <span class="keywordtype">long</span>        value)
<a name="l00351"></a>00351 {
<a name="l00352"></a>00352   <span class="comment">/* this calculation is from comp.lang.c faq */</span>
<a name="l00353"></a>00353 <span class="preprocessor">#define MAX_LONG_LEN ((sizeof (long) * 8 + 2) / 3 + 1)  </span><span class="comment">/* +1 for &#39;-&#39; */</span>
<a name="l00354"></a>00354   <span class="keywordtype">int</span> orig_len;
<a name="l00355"></a>00355   <span class="keywordtype">int</span> i;
<a name="l00356"></a>00356   <span class="keywordtype">char</span> *buf;
<a name="l00357"></a>00357   
<a name="l00358"></a>00358   orig_len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str);
<a name="l00359"></a>00359 
<a name="l00360"></a>00360   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga8f13997d90ceed2f437706e6b7804d9b" title="Makes a string longer by the given number of bytes.">_dbus_string_lengthen</a> (str, MAX_LONG_LEN))
<a name="l00361"></a>00361     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00362"></a>00362 
<a name="l00363"></a>00363   buf = <a class="code" href="group__DBusString.html#ga7a73fb373398606e6e1d0a86c4587a3c" title="Gets a sub-portion of the raw character buffer from the string.">_dbus_string_get_data_len</a> (str, orig_len, MAX_LONG_LEN);
<a name="l00364"></a>00364 
<a name="l00365"></a>00365   snprintf (buf, MAX_LONG_LEN, <span class="stringliteral">&quot;%ld&quot;</span>, value);
<a name="l00366"></a>00366 
<a name="l00367"></a>00367   i = 0;
<a name="l00368"></a>00368   <span class="keywordflow">while</span> (*buf)
<a name="l00369"></a>00369     {
<a name="l00370"></a>00370       ++buf;
<a name="l00371"></a>00371       ++i;
<a name="l00372"></a>00372     }
<a name="l00373"></a>00373   
<a name="l00374"></a>00374   <a class="code" href="group__DBusString.html#ga7af1cbfa905f26d972ab644d890548b8" title="Makes a string shorter by the given number of bytes.">_dbus_string_shorten</a> (str, MAX_LONG_LEN - i);
<a name="l00375"></a>00375   
<a name="l00376"></a>00376   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00377"></a>00377 }
<a name="l00378"></a>00378 
<a name="l00386"></a>00386 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00387"></a><a class="code" href="group__DBusString.html#gaa63064881001085159c78204f70acde8">00387</a> <a class="code" href="group__DBusString.html#gaa63064881001085159c78204f70acde8" title="Appends an unsigned integer to a DBusString.">_dbus_string_append_uint</a> (<a class="code" href="structDBusString.html">DBusString</a>    *str,
<a name="l00388"></a>00388                           <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>  value)
<a name="l00389"></a>00389 {
<a name="l00390"></a>00390   <span class="comment">/* this is wrong, but definitely on the high side. */</span>
<a name="l00391"></a>00391 <span class="preprocessor">#define MAX_ULONG_LEN (MAX_LONG_LEN * 2)</span>
<a name="l00392"></a>00392 <span class="preprocessor"></span>  <span class="keywordtype">int</span> orig_len;
<a name="l00393"></a>00393   <span class="keywordtype">int</span> i;
<a name="l00394"></a>00394   <span class="keywordtype">char</span> *buf;
<a name="l00395"></a>00395   
<a name="l00396"></a>00396   orig_len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str);
<a name="l00397"></a>00397 
<a name="l00398"></a>00398   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga8f13997d90ceed2f437706e6b7804d9b" title="Makes a string longer by the given number of bytes.">_dbus_string_lengthen</a> (str, MAX_ULONG_LEN))
<a name="l00399"></a>00399     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00400"></a>00400 
<a name="l00401"></a>00401   buf = <a class="code" href="group__DBusString.html#ga7a73fb373398606e6e1d0a86c4587a3c" title="Gets a sub-portion of the raw character buffer from the string.">_dbus_string_get_data_len</a> (str, orig_len, MAX_ULONG_LEN);
<a name="l00402"></a>00402 
<a name="l00403"></a>00403   snprintf (buf, MAX_ULONG_LEN, <span class="stringliteral">&quot;%lu&quot;</span>, value);
<a name="l00404"></a>00404 
<a name="l00405"></a>00405   i = 0;
<a name="l00406"></a>00406   <span class="keywordflow">while</span> (*buf)
<a name="l00407"></a>00407     {
<a name="l00408"></a>00408       ++buf;
<a name="l00409"></a>00409       ++i;
<a name="l00410"></a>00410     }
<a name="l00411"></a>00411   
<a name="l00412"></a>00412   <a class="code" href="group__DBusString.html#ga7af1cbfa905f26d972ab644d890548b8" title="Makes a string shorter by the given number of bytes.">_dbus_string_shorten</a> (str, MAX_ULONG_LEN - i);
<a name="l00413"></a>00413   
<a name="l00414"></a>00414   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00415"></a>00415 }
<a name="l00416"></a>00416 
<a name="l00429"></a>00429 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00430"></a><a class="code" href="group__DBusString.html#ga93e22894a5e2e0d65c179c7d36a8b1c8">00430</a> <a class="code" href="group__DBusString.html#ga93e22894a5e2e0d65c179c7d36a8b1c8" title="Parses an integer contained in a DBusString.">_dbus_string_parse_int</a> (<span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *str,
<a name="l00431"></a>00431                         <span class="keywordtype">int</span>               start,
<a name="l00432"></a>00432                         <span class="keywordtype">long</span>             *value_return,
<a name="l00433"></a>00433                         <span class="keywordtype">int</span>              *end_return)
<a name="l00434"></a>00434 {
<a name="l00435"></a>00435   <span class="keywordtype">long</span> v;
<a name="l00436"></a>00436   <span class="keyword">const</span> <span class="keywordtype">char</span> *p;
<a name="l00437"></a>00437   <span class="keywordtype">char</span> *end;
<a name="l00438"></a>00438 
<a name="l00439"></a>00439   p = <a class="code" href="group__DBusString.html#ga8c202a65e938f9bdb859fc6705a4f1bb" title="const version of _dbus_string_get_data_len().">_dbus_string_get_const_data_len</a> (str, start,
<a name="l00440"></a>00440                                        <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str) - start);
<a name="l00441"></a>00441 
<a name="l00442"></a>00442   end = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00443"></a>00443   <a class="code" href="group__DBusInternalsUtils.html#gaf0f4cb7f145fe1f48f5302277560407a" title="Assign 0 to the global errno variable.">_dbus_set_errno_to_zero</a> ();
<a name="l00444"></a>00444   v = strtol (p, &amp;end, 0);
<a name="l00445"></a>00445   <span class="keywordflow">if</span> (end == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> || end == p || errno != 0)
<a name="l00446"></a>00446     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00447"></a>00447 
<a name="l00448"></a>00448   <span class="keywordflow">if</span> (value_return)
<a name="l00449"></a>00449     *value_return = v;
<a name="l00450"></a>00450   <span class="keywordflow">if</span> (end_return)
<a name="l00451"></a>00451     *end_return = start + (end - p);
<a name="l00452"></a>00452 
<a name="l00453"></a>00453   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00454"></a>00454 }
<a name="l00455"></a>00455 
<a name="l00468"></a>00468 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00469"></a><a class="code" href="group__DBusString.html#ga84cc8d08bb48b7915d673f7cc7886f97">00469</a> <a class="code" href="group__DBusString.html#ga84cc8d08bb48b7915d673f7cc7886f97" title="Parses an unsigned integer contained in a DBusString.">_dbus_string_parse_uint</a> (<span class="keyword">const</span> <a class="code" href="structDBusString.html">DBusString</a> *str,
<a name="l00470"></a>00470                          <span class="keywordtype">int</span>               start,
<a name="l00471"></a>00471                          <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span>    *value_return,
<a name="l00472"></a>00472                          <span class="keywordtype">int</span>              *end_return)
<a name="l00473"></a>00473 {
<a name="l00474"></a>00474   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> v;
<a name="l00475"></a>00475   <span class="keyword">const</span> <span class="keywordtype">char</span> *p;
<a name="l00476"></a>00476   <span class="keywordtype">char</span> *end;
<a name="l00477"></a>00477 
<a name="l00478"></a>00478   p = <a class="code" href="group__DBusString.html#ga8c202a65e938f9bdb859fc6705a4f1bb" title="const version of _dbus_string_get_data_len().">_dbus_string_get_const_data_len</a> (str, start,
<a name="l00479"></a>00479                                        <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str) - start);
<a name="l00480"></a>00480 
<a name="l00481"></a>00481   end = <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>;
<a name="l00482"></a>00482   <a class="code" href="group__DBusInternalsUtils.html#gaf0f4cb7f145fe1f48f5302277560407a" title="Assign 0 to the global errno variable.">_dbus_set_errno_to_zero</a> ();
<a name="l00483"></a>00483   v = strtoul (p, &amp;end, 0);
<a name="l00484"></a>00484   <span class="keywordflow">if</span> (end == <a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a> || end == p || errno != 0)
<a name="l00485"></a>00485     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00486"></a>00486 
<a name="l00487"></a>00487   <span class="keywordflow">if</span> (value_return)
<a name="l00488"></a>00488     *value_return = v;
<a name="l00489"></a>00489   <span class="keywordflow">if</span> (end_return)
<a name="l00490"></a>00490     *end_return = start + (end - p);
<a name="l00491"></a>00491 
<a name="l00492"></a>00492   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00493"></a>00493 }
<a name="l00494"></a>00494  <span class="comment">/* DBusString group */</span>
<a name="l00496"></a>00496 
<a name="l00502"></a>00502 <span class="keywordtype">void</span>
<a name="l00503"></a><a class="code" href="group__DBusSysdeps.html#gafb4454c18ee8e5bcc20dbccd93e1d9ba">00503</a> <a class="code" href="group__DBusInternalsUtils.html#gafb4454c18ee8e5bcc20dbccd93e1d9ba" title="Random numbers.">_dbus_generate_pseudorandom_bytes_buffer</a> (<span class="keywordtype">char</span> *buffer,
<a name="l00504"></a>00504                                           <span class="keywordtype">int</span>   n_bytes)
<a name="l00505"></a>00505 {
<a name="l00506"></a>00506   <span class="keywordtype">long</span> tv_usec;
<a name="l00507"></a>00507   <span class="keywordtype">int</span> i;
<a name="l00508"></a>00508   
<a name="l00509"></a>00509   <span class="comment">/* fall back to pseudorandom */</span>
<a name="l00510"></a>00510   _dbus_verbose (<span class="stringliteral">&quot;Falling back to pseudorandom for %d bytes\n&quot;</span>,
<a name="l00511"></a>00511                  n_bytes);
<a name="l00512"></a>00512   
<a name="l00513"></a>00513   <a class="code" href="group__DBusSysdeps.html#gae10ee21ab353beadbe2493728065f600" title="Get current time, as in gettimeofday().">_dbus_get_real_time</a> (<a class="code" href="group__DBusMacros.html#ga070d2ce7b6bb7e5c05602aa8c308d0c4" title="A null pointer, defined appropriately for C or C++.">NULL</a>, &amp;tv_usec);
<a name="l00514"></a>00514   srand (tv_usec);
<a name="l00515"></a>00515   
<a name="l00516"></a>00516   i = 0;
<a name="l00517"></a>00517   <span class="keywordflow">while</span> (i &lt; n_bytes)
<a name="l00518"></a>00518     {
<a name="l00519"></a>00519       <span class="keywordtype">double</span> r;
<a name="l00520"></a>00520       <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> b;
<a name="l00521"></a>00521           
<a name="l00522"></a>00522       r = rand ();
<a name="l00523"></a>00523       b = (r / (double) RAND_MAX) * 255.0;
<a name="l00524"></a>00524 
<a name="l00525"></a>00525       buffer[i] = b;
<a name="l00526"></a>00526 
<a name="l00527"></a>00527       ++i;
<a name="l00528"></a>00528     }
<a name="l00529"></a>00529 }
<a name="l00530"></a>00530 
<a name="l00537"></a>00537 <span class="keywordtype">void</span>
<a name="l00538"></a><a class="code" href="group__DBusSysdeps.html#gaa32f87746e9264b2425736043d02fad4">00538</a> <a class="code" href="group__DBusInternalsUtils.html#gaa32f87746e9264b2425736043d02fad4" title="Fills n_bytes of the given buffer with random bytes.">_dbus_generate_random_bytes_buffer</a> (<span class="keywordtype">char</span> *buffer,
<a name="l00539"></a>00539                                     <span class="keywordtype">int</span>   n_bytes)
<a name="l00540"></a>00540 {
<a name="l00541"></a>00541   <a class="code" href="structDBusString.html">DBusString</a> str;
<a name="l00542"></a>00542 
<a name="l00543"></a>00543   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusString.html#ga348252317f7bb8ac43529972945830ae" title="Initializes a string.">_dbus_string_init</a> (&amp;str))
<a name="l00544"></a>00544     {
<a name="l00545"></a>00545       <a class="code" href="group__DBusInternalsUtils.html#gafb4454c18ee8e5bcc20dbccd93e1d9ba" title="Random numbers.">_dbus_generate_pseudorandom_bytes_buffer</a> (buffer, n_bytes);
<a name="l00546"></a>00546       <span class="keywordflow">return</span>;
<a name="l00547"></a>00547     }
<a name="l00548"></a>00548 
<a name="l00549"></a>00549   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdeps.html#gac9fd08af5e54c0e9b3db108b48a65778" title="Generates the given number of random bytes, using the best mechanism we can come up with...">_dbus_generate_random_bytes</a> (&amp;str, n_bytes))
<a name="l00550"></a>00550     {
<a name="l00551"></a>00551       <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;str);
<a name="l00552"></a>00552       <a class="code" href="group__DBusInternalsUtils.html#gafb4454c18ee8e5bcc20dbccd93e1d9ba" title="Random numbers.">_dbus_generate_pseudorandom_bytes_buffer</a> (buffer, n_bytes);
<a name="l00553"></a>00553       <span class="keywordflow">return</span>;
<a name="l00554"></a>00554     }
<a name="l00555"></a>00555 
<a name="l00556"></a>00556   <a class="code" href="group__DBusString.html#gaf97b18e419678dbf967d9b9ad1112ca6" title="Copies the contents of a DBusString into a different buffer.">_dbus_string_copy_to_buffer</a> (&amp;str, buffer, n_bytes);
<a name="l00557"></a>00557 
<a name="l00558"></a>00558   <a class="code" href="group__DBusString.html#ga781ca91acda49a834dce7d0ed0eef212" title="Frees a string created by _dbus_string_init().">_dbus_string_free</a> (&amp;str);
<a name="l00559"></a>00559 }
<a name="l00560"></a>00560 
<a name="l00569"></a>00569 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00570"></a><a class="code" href="group__DBusSysdeps.html#ga709ce349c6ee05263850444fb4e0177d">00570</a> <a class="code" href="group__DBusInternalsUtils.html#ga709ce349c6ee05263850444fb4e0177d" title="Generates the given number of random bytes, where the bytes are chosen from the alphanumeric ASCII su...">_dbus_generate_random_ascii</a> (<a class="code" href="structDBusString.html">DBusString</a> *str,
<a name="l00571"></a>00571                              <span class="keywordtype">int</span>         n_bytes)
<a name="l00572"></a>00572 {
<a name="l00573"></a>00573   <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> letters[] =
<a name="l00574"></a>00574     <span class="stringliteral">&quot;ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz&quot;</span>;
<a name="l00575"></a>00575   <span class="keywordtype">int</span> i;
<a name="l00576"></a>00576   <span class="keywordtype">int</span> len;
<a name="l00577"></a>00577   
<a name="l00578"></a>00578   <span class="keywordflow">if</span> (!<a class="code" href="group__DBusSysdeps.html#gac9fd08af5e54c0e9b3db108b48a65778" title="Generates the given number of random bytes, using the best mechanism we can come up with...">_dbus_generate_random_bytes</a> (str, n_bytes))
<a name="l00579"></a>00579     <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00580"></a>00580   
<a name="l00581"></a>00581   len = <a class="code" href="group__DBusString.html#gaa5136e6fd2c5188f4b88de7863369c6d" title="Gets the length of a string (not including nul termination).">_dbus_string_get_length</a> (str);
<a name="l00582"></a>00582   i = len - n_bytes;
<a name="l00583"></a>00583   <span class="keywordflow">while</span> (i &lt; len)
<a name="l00584"></a>00584     {
<a name="l00585"></a>00585       <a class="code" href="group__DBusString.html#gab6c823e9406208363fcb5e96d580e738" title="Sets the value of the byte at the given position.">_dbus_string_set_byte</a> (str, i,
<a name="l00586"></a>00586                              letters[<a class="code" href="group__DBusString.html#gac1cb7b207eac3c6527a5d42fbc5449b1" title="Gets the byte at the given position.">_dbus_string_get_byte</a> (str, i) %
<a name="l00587"></a>00587                                      (<span class="keyword">sizeof</span> (letters) - 1)]);
<a name="l00588"></a>00588 
<a name="l00589"></a>00589       ++i;
<a name="l00590"></a>00590     }
<a name="l00591"></a>00591 
<a name="l00592"></a>00592   _dbus_assert (<a class="code" href="group__DBusString.html#gaa4324cd667e21beb31a5481cb0c12b6d" title="Checks that the given range of the string is valid ASCII with no nul bytes.">_dbus_string_validate_ascii</a> (str, len - n_bytes,
<a name="l00593"></a>00593                                              n_bytes));
<a name="l00594"></a>00594 
<a name="l00595"></a>00595   <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa8cecfc5c5c054d2875c03e77b7be15d" title="Expands to &quot;1&quot;.">TRUE</a>;
<a name="l00596"></a>00596 }
<a name="l00597"></a>00597 
<a name="l00608"></a>00608 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00609"></a><a class="code" href="group__DBusSysdeps.html#ga2212aa0e5732257598a6597748c658e4">00609</a> <a class="code" href="group__DBusInternalsUtils.html#ga2212aa0e5732257598a6597748c658e4" title="Converts a UNIX errno, or Windows errno or WinSock error value into a DBusError name.">_dbus_error_from_errno</a> (<span class="keywordtype">int</span> error_number)
<a name="l00610"></a>00610 {
<a name="l00611"></a>00611   <span class="keywordflow">switch</span> (error_number)
<a name="l00612"></a>00612     {
<a name="l00613"></a>00613     <span class="keywordflow">case</span> 0:
<a name="l00614"></a>00614       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gabb62fd6340d0787fbd56ff8dd2f326c7" title="A generic error; &quot;something went wrong&quot; - see the error message for more.">DBUS_ERROR_FAILED</a>;
<a name="l00615"></a>00615       
<a name="l00616"></a>00616 <span class="preprocessor">#ifdef EPROTONOSUPPORT</span>
<a name="l00617"></a>00617 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EPROTONOSUPPORT:
<a name="l00618"></a>00618       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga33122bcaf8f5896ec222c755b6effb40" title="Requested operation isn&#39;t supported (like ENOSYS on UNIX).">DBUS_ERROR_NOT_SUPPORTED</a>;
<a name="l00619"></a>00619 <span class="preprocessor">#elif defined(WSAEPROTONOSUPPORT)</span>
<a name="l00620"></a>00620 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAEPROTONOSUPPORT:
<a name="l00621"></a>00621       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga33122bcaf8f5896ec222c755b6effb40" title="Requested operation isn&#39;t supported (like ENOSYS on UNIX).">DBUS_ERROR_NOT_SUPPORTED</a>;
<a name="l00622"></a>00622 <span class="preprocessor">#endif</span>
<a name="l00623"></a>00623 <span class="preprocessor"></span><span class="preprocessor">#ifdef EAFNOSUPPORT</span>
<a name="l00624"></a>00624 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EAFNOSUPPORT:
<a name="l00625"></a>00625       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga33122bcaf8f5896ec222c755b6effb40" title="Requested operation isn&#39;t supported (like ENOSYS on UNIX).">DBUS_ERROR_NOT_SUPPORTED</a>;
<a name="l00626"></a>00626 <span class="preprocessor">#elif defined(WSAEAFNOSUPPORT)</span>
<a name="l00627"></a>00627 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAEAFNOSUPPORT:
<a name="l00628"></a>00628       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga33122bcaf8f5896ec222c755b6effb40" title="Requested operation isn&#39;t supported (like ENOSYS on UNIX).">DBUS_ERROR_NOT_SUPPORTED</a>;
<a name="l00629"></a>00629 <span class="preprocessor">#endif</span>
<a name="l00630"></a>00630 <span class="preprocessor"></span><span class="preprocessor">#ifdef ENFILE</span>
<a name="l00631"></a>00631 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ENFILE:
<a name="l00632"></a>00632       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga7c96d165c4ebee51e939969934d18027" title="Some limited resource is exhausted.">DBUS_ERROR_LIMITS_EXCEEDED</a>; <span class="comment">/* kernel out of memory */</span>
<a name="l00633"></a>00633 <span class="preprocessor">#endif</span>
<a name="l00634"></a>00634 <span class="preprocessor"></span><span class="preprocessor">#ifdef EMFILE</span>
<a name="l00635"></a>00635 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EMFILE:
<a name="l00636"></a>00636       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga7c96d165c4ebee51e939969934d18027" title="Some limited resource is exhausted.">DBUS_ERROR_LIMITS_EXCEEDED</a>;
<a name="l00637"></a>00637 <span class="preprocessor">#endif</span>
<a name="l00638"></a>00638 <span class="preprocessor"></span><span class="preprocessor">#ifdef EACCES</span>
<a name="l00639"></a>00639 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EACCES:
<a name="l00640"></a>00640       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga6d3940075c1fbd1bfe06626b59723a16" title="Security restrictions don&#39;t allow doing what you&#39;re trying to do.">DBUS_ERROR_ACCESS_DENIED</a>;
<a name="l00641"></a>00641 <span class="preprocessor">#endif</span>
<a name="l00642"></a>00642 <span class="preprocessor"></span><span class="preprocessor">#ifdef EPERM</span>
<a name="l00643"></a>00643 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EPERM:
<a name="l00644"></a>00644       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga6d3940075c1fbd1bfe06626b59723a16" title="Security restrictions don&#39;t allow doing what you&#39;re trying to do.">DBUS_ERROR_ACCESS_DENIED</a>;
<a name="l00645"></a>00645 <span class="preprocessor">#endif</span>
<a name="l00646"></a>00646 <span class="preprocessor"></span><span class="preprocessor">#ifdef ENOBUFS</span>
<a name="l00647"></a>00647 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ENOBUFS:
<a name="l00648"></a>00648       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gac32eaf0b92f798307853cd4fe0cf11c2" title="There was not enough memory to complete an operation.">DBUS_ERROR_NO_MEMORY</a>;
<a name="l00649"></a>00649 <span class="preprocessor">#endif</span>
<a name="l00650"></a>00650 <span class="preprocessor"></span><span class="preprocessor">#ifdef ENOMEM</span>
<a name="l00651"></a>00651 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ENOMEM:
<a name="l00652"></a>00652       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gac32eaf0b92f798307853cd4fe0cf11c2" title="There was not enough memory to complete an operation.">DBUS_ERROR_NO_MEMORY</a>;
<a name="l00653"></a>00653 <span class="preprocessor">#endif</span>
<a name="l00654"></a>00654 <span class="preprocessor"></span><span class="preprocessor">#ifdef ECONNREFUSED</span>
<a name="l00655"></a>00655 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ECONNREFUSED:
<a name="l00656"></a>00656       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga72b375fab2486ee165e1cca2bd145695" title="Unable to connect to server (probably caused by ECONNREFUSED on a socket).">DBUS_ERROR_NO_SERVER</a>;
<a name="l00657"></a>00657 <span class="preprocessor">#elif defined(WSAECONNREFUSED)</span>
<a name="l00658"></a>00658 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAECONNREFUSED:
<a name="l00659"></a>00659       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga72b375fab2486ee165e1cca2bd145695" title="Unable to connect to server (probably caused by ECONNREFUSED on a socket).">DBUS_ERROR_NO_SERVER</a>;
<a name="l00660"></a>00660 <span class="preprocessor">#endif</span>
<a name="l00661"></a>00661 <span class="preprocessor"></span><span class="preprocessor">#ifdef ETIMEDOUT</span>
<a name="l00662"></a>00662 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ETIMEDOUT:
<a name="l00663"></a>00663       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga0e4674c42373ee449ddf08aab8bce9ce" title="Certain timeout errors, possibly ETIMEDOUT on a socket.">DBUS_ERROR_TIMEOUT</a>;
<a name="l00664"></a>00664 <span class="preprocessor">#elif defined(WSAETIMEDOUT)</span>
<a name="l00665"></a>00665 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAETIMEDOUT:
<a name="l00666"></a>00666       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga0e4674c42373ee449ddf08aab8bce9ce" title="Certain timeout errors, possibly ETIMEDOUT on a socket.">DBUS_ERROR_TIMEOUT</a>;
<a name="l00667"></a>00667 <span class="preprocessor">#endif</span>
<a name="l00668"></a>00668 <span class="preprocessor"></span><span class="preprocessor">#ifdef ENETUNREACH</span>
<a name="l00669"></a>00669 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ENETUNREACH:
<a name="l00670"></a>00670       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gab18c0e4eee0936dc042319803730b62e" title="No network access (probably ENETUNREACH on a socket).">DBUS_ERROR_NO_NETWORK</a>;
<a name="l00671"></a>00671 <span class="preprocessor">#elif defined(WSAENETUNREACH)</span>
<a name="l00672"></a>00672 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAENETUNREACH:
<a name="l00673"></a>00673       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gab18c0e4eee0936dc042319803730b62e" title="No network access (probably ENETUNREACH on a socket).">DBUS_ERROR_NO_NETWORK</a>;
<a name="l00674"></a>00674 <span class="preprocessor">#endif</span>
<a name="l00675"></a>00675 <span class="preprocessor"></span><span class="preprocessor">#ifdef EADDRINUSE</span>
<a name="l00676"></a>00676 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EADDRINUSE:
<a name="l00677"></a>00677       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga3d13424a19bb774cf3481216bf4ba366" title="Can&#39;t bind a socket since its address is in use (i.e.">DBUS_ERROR_ADDRESS_IN_USE</a>;
<a name="l00678"></a>00678 <span class="preprocessor">#elif defined(WSAEADDRINUSE)</span>
<a name="l00679"></a>00679 <span class="preprocessor"></span>    <span class="keywordflow">case</span> WSAEADDRINUSE:
<a name="l00680"></a>00680       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga3d13424a19bb774cf3481216bf4ba366" title="Can&#39;t bind a socket since its address is in use (i.e.">DBUS_ERROR_ADDRESS_IN_USE</a>;
<a name="l00681"></a>00681 <span class="preprocessor">#endif</span>
<a name="l00682"></a>00682 <span class="preprocessor"></span><span class="preprocessor">#ifdef EEXIST</span>
<a name="l00683"></a>00683 <span class="preprocessor"></span>    <span class="keywordflow">case</span> EEXIST:
<a name="l00684"></a>00684       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#ga7c65e9730331eb19b7d6b128a79361ef" title="Existing file and the operation you&#39;re using does not silently overwrite.">DBUS_ERROR_FILE_EXISTS</a>;
<a name="l00685"></a>00685 <span class="preprocessor">#endif</span>
<a name="l00686"></a>00686 <span class="preprocessor"></span><span class="preprocessor">#ifdef ENOENT</span>
<a name="l00687"></a>00687 <span class="preprocessor"></span>    <span class="keywordflow">case</span> ENOENT:
<a name="l00688"></a>00688       <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gaf5ad9572cc5935d4655635003073c21a" title="Missing file.">DBUS_ERROR_FILE_NOT_FOUND</a>;
<a name="l00689"></a>00689 <span class="preprocessor">#endif</span>
<a name="l00690"></a>00690 <span class="preprocessor"></span>    }
<a name="l00691"></a>00691 
<a name="l00692"></a>00692   <span class="keywordflow">return</span> <a class="code" href="group__DBusProtocol.html#gabb62fd6340d0787fbd56ff8dd2f326c7" title="A generic error; &quot;something went wrong&quot; - see the error message for more.">DBUS_ERROR_FAILED</a>;
<a name="l00693"></a>00693 }
<a name="l00694"></a>00694 
<a name="l00700"></a>00700 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00701"></a><a class="code" href="group__DBusSysdeps.html#gaf4f1db48d66dcb310b9771beb955578e">00701</a> <a class="code" href="group__DBusInternalsUtils.html#gaf4f1db48d66dcb310b9771beb955578e" title="Converts the current system errno value into a DBusError name.">_dbus_error_from_system_errno</a> (<span class="keywordtype">void</span>)
<a name="l00702"></a>00702 {
<a name="l00703"></a>00703   <span class="keywordflow">return</span> <a class="code" href="group__DBusInternalsUtils.html#ga2212aa0e5732257598a6597748c658e4" title="Converts a UNIX errno, or Windows errno or WinSock error value into a DBusError name.">_dbus_error_from_errno</a> (errno);
<a name="l00704"></a>00704 }
<a name="l00705"></a>00705 
<a name="l00709"></a>00709 <span class="keywordtype">void</span>
<a name="l00710"></a><a class="code" href="group__DBusSysdeps.html#gaf0f4cb7f145fe1f48f5302277560407a">00710</a> <a class="code" href="group__DBusInternalsUtils.html#gaf0f4cb7f145fe1f48f5302277560407a" title="Assign 0 to the global errno variable.">_dbus_set_errno_to_zero</a> (<span class="keywordtype">void</span>)
<a name="l00711"></a>00711 {
<a name="l00712"></a>00712 <span class="preprocessor">#ifdef DBUS_WINCE</span>
<a name="l00713"></a>00713 <span class="preprocessor"></span>  SetLastError (0);
<a name="l00714"></a>00714 <span class="preprocessor">#else</span>
<a name="l00715"></a>00715 <span class="preprocessor"></span>  errno = 0;
<a name="l00716"></a>00716 <span class="preprocessor">#endif</span>
<a name="l00717"></a>00717 <span class="preprocessor"></span>}
<a name="l00718"></a>00718 
<a name="l00723"></a>00723 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00724"></a><a class="code" href="group__DBusSysdeps.html#gab9ccdfee5c7986ff236a6cde66a9af2f">00724</a> <a class="code" href="group__DBusInternalsUtils.html#gab9ccdfee5c7986ff236a6cde66a9af2f" title="See if errno is set.">_dbus_get_is_errno_nonzero</a> (<span class="keywordtype">void</span>)
<a name="l00725"></a>00725 {
<a name="l00726"></a>00726   <span class="keywordflow">return</span> errno != 0;
<a name="l00727"></a>00727 }
<a name="l00728"></a>00728 
<a name="l00733"></a>00733 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00734"></a><a class="code" href="group__DBusSysdeps.html#gaec2ce24907adaedd1bf88bb28d82c96d">00734</a> <a class="code" href="group__DBusInternalsUtils.html#gaec2ce24907adaedd1bf88bb28d82c96d" title="See if errno is ENOMEM.">_dbus_get_is_errno_enomem</a> (<span class="keywordtype">void</span>)
<a name="l00735"></a>00735 {
<a name="l00736"></a>00736   <span class="keywordflow">return</span> errno == ENOMEM;
<a name="l00737"></a>00737 }
<a name="l00738"></a>00738 
<a name="l00743"></a>00743 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00744"></a><a class="code" href="group__DBusSysdeps.html#ga08e67a10b197995c101c89f248c24105">00744</a> <a class="code" href="group__DBusInternalsUtils.html#ga08e67a10b197995c101c89f248c24105" title="See if errno is EINTR.">_dbus_get_is_errno_eintr</a> (<span class="keywordtype">void</span>)
<a name="l00745"></a>00745 {
<a name="l00746"></a>00746   <span class="keywordflow">return</span> errno == EINTR;
<a name="l00747"></a>00747 }
<a name="l00748"></a>00748 
<a name="l00753"></a>00753 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00754"></a><a class="code" href="group__DBusSysdeps.html#ga1001bb8d98eaee545a4e9b3994d13440">00754</a> <a class="code" href="group__DBusInternalsUtils.html#ga1001bb8d98eaee545a4e9b3994d13440" title="See if errno is EPIPE.">_dbus_get_is_errno_epipe</a> (<span class="keywordtype">void</span>)
<a name="l00755"></a>00755 {
<a name="l00756"></a>00756   <span class="keywordflow">return</span> errno == EPIPE;
<a name="l00757"></a>00757 }
<a name="l00758"></a>00758 
<a name="l00763"></a>00763 <a class="code" href="group__DBusTypes.html#ga39c9cb0f3a2a8ad6f55cc4855d035349" title="A boolean, valid values are TRUE and FALSE.">dbus_bool_t</a>
<a name="l00764"></a><a class="code" href="group__DBusSysdeps.html#ga69062313641c53627f5afb7be96e4ea4">00764</a> <a class="code" href="group__DBusInternalsUtils.html#ga69062313641c53627f5afb7be96e4ea4" title="See if errno is ETOOMANYREFS.">_dbus_get_is_errno_etoomanyrefs</a> (<span class="keywordtype">void</span>)
<a name="l00765"></a>00765 {
<a name="l00766"></a>00766 <span class="preprocessor">#ifdef ETOOMANYREFS</span>
<a name="l00767"></a>00767 <span class="preprocessor"></span>  <span class="keywordflow">return</span> errno == ETOOMANYREFS;
<a name="l00768"></a>00768 <span class="preprocessor">#else</span>
<a name="l00769"></a>00769 <span class="preprocessor"></span>  <span class="keywordflow">return</span> <a class="code" href="group__DBusMacros.html#gaa93f0eb578d23995850d61f7d61c55c1" title="Expands to &quot;0&quot;.">FALSE</a>;
<a name="l00770"></a>00770 <span class="preprocessor">#endif</span>
<a name="l00771"></a>00771 <span class="preprocessor"></span>}
<a name="l00772"></a>00772 
<a name="l00777"></a>00777 <span class="keyword">const</span> <span class="keywordtype">char</span>*
<a name="l00778"></a><a class="code" href="group__DBusSysdeps.html#ga56de84795d6df4162ad79b3be7af7588">00778</a> <a class="code" href="group__DBusInternalsUtils.html#ga56de84795d6df4162ad79b3be7af7588" title="Get error message from errno.">_dbus_strerror_from_errno</a> (<span class="keywordtype">void</span>)
<a name="l00779"></a>00779 {
<a name="l00780"></a>00780   <span class="keywordflow">return</span> _dbus_strerror (errno);
<a name="l00781"></a>00781 }
<a name="l00782"></a>00782 
<a name="l00785"></a>00785 <span class="comment">/* tests in dbus-sysdeps-util.c */</span>
</pre></div></div><!-- contents -->


<hr class="footer"/><address class="footer"><small>
Generated on Thu Mar 3 2016 17:50:31 for D-Bus by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.7.6.1
</small></address>

</body>
</html>