<HTML><HEAD>
<META http-equiv=Content-Type content='text/html; charset=windows-1252'>
<title>Samsung Enterprise Portal mySingle</title>
<style> P, td, li {font-family:Arial, arial; font-size:9pt; margin-top:5px;margin-bottom:5px;} body{font-family:Arial, arial; font-size:9pt;}</style>
</HEAD><BODY><p>&nbsp;Hi,</p>
<p>&nbsp;</p>
<p>Keeping connection across fork is too much hassle and not worth the effort.</p>
<p>No doubt about it. &nbsp;it violates the rule of thumb 'make it simple but 
not too simple'..</p>
<p>let the forked child process able to re-run dbus_g_bus_get.</p>
<p>&nbsp;</p>
<p>it is sufficient to have a simple API like 'dbus_g_connection_half_close' 
(half closed connection from TCP definition).</p>
<p>It should be the api works and used just like fclose(fd) on unix pipe or 
domain socket which must be closed when forked.</p>
<p>&nbsp;</p>
<p>of course.. It will be broken in Windows Socket implemetation.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Sean</p>
<p>Samsung</p>
<p>&nbsp;</p><br><br>------- <b>Original Message</b> -------<br><b>Sender</b> : Thiago Macieira&lt;thiago@kde.org&gt;<br><b>Date</b>   : 2007-04-06 01:53<br><b>Title</b>  : Re: dbus fork problem<br><br>Havoc&nbsp;Pennington&nbsp;wrote:
<br>&gt;Hi,
<br>&gt;
<br>&gt;Even&nbsp;in&nbsp;theory&nbsp;I&#39;m&nbsp;not&nbsp;sure&nbsp;how&nbsp;a&nbsp;connection&nbsp;kept&nbsp;across&nbsp;fork()&nbsp;would
<br>&gt;work...&nbsp;the&nbsp;behavior&nbsp;would&nbsp;be&nbsp;tough&nbsp;to&nbsp;define.
<br>&gt;
<br>&gt;If&nbsp;you&nbsp;can&nbsp;spec&nbsp;out&nbsp;what&nbsp;you&nbsp;need&nbsp;then&nbsp;we&nbsp;can&nbsp;discuss&nbsp;the&nbsp;API.
<br>
<br>I&nbsp;propose&nbsp;we&nbsp;don&#39;t&nbsp;do&nbsp;anything&nbsp;about&nbsp;it.&nbsp;If&nbsp;the&nbsp;application&nbsp;must&nbsp;do&nbsp;fork()&nbsp;
<br>and&nbsp;both&nbsp;processes&nbsp;have&nbsp;working&nbsp;connections,&nbsp;at&nbsp;least&nbsp;one&nbsp;of&nbsp;the&nbsp;
<br>connections&nbsp;should&nbsp;be&nbsp;a&nbsp;private&nbsp;one.&nbsp;And&nbsp;the&nbsp;connection&nbsp;used&nbsp;in&nbsp;the&nbsp;child&nbsp;
<br>process&nbsp;should&nbsp;be&nbsp;opened&nbsp;only&nbsp;after&nbsp;forking.
<br>
<br>The&nbsp;reason&nbsp;for&nbsp;that&nbsp;is&nbsp;that&nbsp;any&nbsp;other&nbsp;solution&nbsp;would&nbsp;probably&nbsp;break&nbsp;
<br>states:&nbsp;suddenly&nbsp;a&nbsp;plugin&nbsp;or&nbsp;library&nbsp;finds&nbsp;itself&nbsp;in&nbsp;a&nbsp;new&nbsp;connection&nbsp;
<br>(with&nbsp;a&nbsp;new&nbsp;unique&nbsp;name&nbsp;and&nbsp;without&nbsp;its&nbsp;well-known&nbsp;names).
<br>
<br>To&nbsp;properly&nbsp;handle&nbsp;this&nbsp;case,&nbsp;libdbus&nbsp;would&nbsp;need&nbsp;an&nbsp;entry&nbsp;point&nbsp;to&nbsp;be&nbsp;
<br>told&nbsp;&quot;we&nbsp;have&nbsp;forked&quot;,&nbsp;so&nbsp;that&nbsp;it&nbsp;can&nbsp;close&nbsp;the&nbsp;connections&nbsp;and&nbsp;reopen&nbsp;
<br>them&nbsp;(might&nbsp;fail!!),&nbsp;then&nbsp;call&nbsp;back&nbsp;to&nbsp;the&nbsp;binding&nbsp;code&nbsp;with&nbsp;such&nbsp;
<br>information.&nbsp;And&nbsp;the&nbsp;bindings&nbsp;must&nbsp;propagate&nbsp;the&nbsp;information&nbsp;down&nbsp;to&nbsp;user&nbsp;
<br>code.
<br>
<br>In&nbsp;all,&nbsp;not&nbsp;worth&nbsp;it&nbsp;IMHO.
<br>
<br>--&nbsp;
<br>&nbsp;&nbsp;Thiago&nbsp;Macieira&nbsp;&nbsp;-&nbsp;&nbsp;thiago&nbsp;(AT)&nbsp;macieira.info&nbsp;-&nbsp;thiago&nbsp;(AT)&nbsp;kde.org
<br>&nbsp;&nbsp;&nbsp;&nbsp;PGP/GPG:&nbsp;0x6EF45358;&nbsp;fingerprint:
<br>&nbsp;&nbsp;&nbsp;&nbsp;E067&nbsp;918B&nbsp;B660&nbsp;DBD1&nbsp;105C&nbsp;&nbsp;966C&nbsp;33F5&nbsp;F005&nbsp;6EF4&nbsp;5358
<br></BODY></HTML>