<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Send Receive Reply</title>
	<atom:link href="http://sendreceivereply.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sendreceivereply.wordpress.com</link>
	<description>QNX blog for development tricks, tips and insights</description>
	<pubDate>Tue, 20 May 2008 16:52:47 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>Daddy, the network is down&#8230;</title>
		<link>http://sendreceivereply.wordpress.com/2008/05/12/daddy-the-network-is-down/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/05/12/daddy-the-network-is-down/#comments</comments>
		<pubDate>Mon, 12 May 2008 22:18:56 +0000</pubDate>
		<dc:creator>xtang</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/?p=46</guid>
		<description><![CDATA[The gateway of my home network, is not one of those &#8220;broadband router&#8221;. Instead, it&#8217;s an old Pentium 200Hz machine in my basement, running, of cause, QNX. Why am I doing this? I think it&#8217;s one of those &#8220;because I can&#8221; thing. Since I compiled my own TCPIP stack, I can really know every detail [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>The gateway of my home network, is not one of those &#8220;broadband router&#8221;. Instead, it&#8217;s an old Pentium 200Hz machine in my basement, running, of cause, QNX. Why am I doing this? I think it&#8217;s one of those &#8220;because I can&#8221; thing. Since I compiled my own TCPIP stack, I can really know every detail of the packets in and out of my gateway. Another reason is, of cause, I like to &#8220;live on the edge&#8221;.</p>
<p>Yes, it&#8217;s really &#8220;bleeding edge&#8221;, though a lot of benifit and fun of running the HEAD branch stack, one of the disadvantage is, while in it&#8217;s early stage, the stack &#8220;crashes&#8221;. The good thing is I have the core dump I could look at, but the bad thing is, that&#8217;s also when my kids started shutting at me.</p>
<p>Those of you who had been managed a home network, would really understand how stressful this is. :) Fortunatly, soon my kids find out the &#8220;engineering way&#8221; to fix the problem. They went down to the basement, press the little reset button on the old Pentinum, give it a couple of minutes, and wola, everything comes back. </p>
<p>This works well for a while, but one day while I was at home along, the stack on gateway gone again. I have to get out of my comfort couch, went down to the basement and reset it myself. I said to myself, &#8220;why can&#8217;t I just write a program to resetart the network if it&#8217;s crashed&#8221;, after all, QNX is all about Micro Kernel and Modular System, isn&#8217;t it? </p>
<p>That&#8217;s where my &#8220;sockmon&#8221; program cames from. Once started, it will keeps on monitoring if TCPIP stack is still running, if it disappered, &#8220;sockmon&#8221; will try to execute a shell script you gave it on command line, to re-start the network. If the restart somehow failed after some try, then it will just reboot the system.</p>
<p>You may wonder &#8220;how do you know if TCPIP stack is there or not&#8221;? Well, QNX resource manager have builtin notification to all connected clients if their server disappeared. So all you need is to establish a connection to the tcpip stack (by call socket()), and setup to waitfor the notification events.</p>
<p>I have include the source here, the &#8220;notification&#8221; thing above is true for ALL resource manager (unless the manager is written in such way that turned off this feature), so you can easilly extended my program to any resource manager. Just give it a config file to read about which resource manager (what namespace you care) to watch out, and what to do (which script to execute) if the manager went away.</p>
<p>I will leave this for reader exercise, but if you did that, you would realiz you just got yourself a simple, basic, HA program.</p>
<p> -xtang</p>
<blockquote><p>#include &lt;stdio.h&gt;<br />
#include &lt;errno.h&gt;<br />
#include &lt;unistd.h&gt;<br />
#include &lt;process.h&gt;<br />
#include &lt;signal.h&gt;<br />
#include &lt;string.h&gt;<br />
#include &lt;syslog.h&gt;<br />
#include &lt;sys/procmgr.h&gt;<br />
#include &lt;sys/sysmgr.h&gt;<br />
#include &lt;sys/neutrino.h&gt;<br />
#include &lt;sys/socket.h&gt;</p>
<p>int main(int argc, char **argv)<br />
{<br />
        char *script;<br />
        int sd, chid, fcount;<br />
        struct _pulse pulse;</p>
<p>        if (argc &lt; 2) {<br />
                fprintf(stderr, &#8220;sockmon &lt;re-start script&gt;\n&#8221;);<br />
                return -1;<br />
        }</p>
<p>        script = argv[1];<br />
        if (access(script, X_OK) != 0) {<br />
                fprintf(stderr, &#8220;access(&#8217;%s&#8217;): %s\n&#8221;, script, strerror(errno));<br />
                return -1;<br />
        }</p>
<p>        /* creat a channel for accept COIDDEATH pulse */<br />
        if ((chid = ChannelCreate(_NTO_CHF_COID_DISCONNECT)) == -1) {<br />
                perror(&#8221;ChannelCreate&#8221;);<br />
                return -1;<br />
        }</p>
<p>        /* don&#8217;t care about the child */<br />
        signal(SIGCHLD, SIG_IGN);</p>
<p>#ifdef NDEBUG<br />
        if (procmgr_daemon(0, PROCMGR_DAEMON_NOCLOSE) == -1) {<br />
                perror(&#8221;procmgr_daemon&#8221;);<br />
                return -1;<br />
        }<br />
#endif</p>
<p>        openlog(&#8221;sockmon&#8221;, LOG_PID, LOG_DAEMON);<br />
        setlogmask(LOG_UPTO(LOG_INFO));</p>
<p>        for (;;)<br />
        {<br />
                fcount = 0;</p>
<p>                /* connect to tcpip to monitoring, give it 30 seconds, if still can&#8217;t<br />
                 * connect, reboot the system<br />
                 */<br />
                while ((sd = socket(AF_INET, SOCK_DGRAM, 0)) == -1) {<br />
                        if (++fcount &gt;= 6) {<br />
                                syslog(LOG_ERR, &#8220;Can&#8217;t connect to socket after 3 minutes, reboot&#8230;&#8221;<br />
);<br />
                                spawnl(P_NOWAIT, &#8220;/bin/slay&#8221;, &#8220;slay&#8221;, &#8220;-f&#8221;, &#8220;syslogd&#8221;, NULL);<br />
                                sleep(1);<br />
                                sysmgr_reboot();<br />
                                return 0;<br />
                        }<br />
                        sleep(5);<br />
                        syslog(LOG_INFO, &#8220;Connect to Socket failed: %m&#8221;);<br />
                }</p>
<p>                syslog(LOG_INFO, &#8220;Connected to Network, start monitoring&#8230;&#8221;);<br />
                if (MsgReceivePulse(chid, &amp;pulse, sizeof(pulse), NULL) == -1) {<br />
                        syslog(LOG_ERR, &#8220;MsgReceivePulse(): %m&#8221;);<br />
                        return -1;<br />
                }</p>
<p>                if (pulse.code != _PULSE_CODE_COIDDEATH) {<br />
                        syslog(LOG_ERR, &#8220;MsgReceivePulse(): %m&#8221;);<br />
                        return -1;<br />
                }</p>
<p>                if (pulse.value.sival_int != sd) {<br />
                        syslog(LOG_ERR, &#8220;COIDDEATH pulse for %d\n&#8221;, pulse.value);<br />
                        continue;<br />
                }</p>
<p>                syslog(LOG_INFO, &#8220;Network gone, restarting&#8230;&#8221;);<br />
                spawnl(P_WAIT, &#8220;/bin/ksh&#8221;, &#8220;/bin/ksh&#8221;, script, NULL);<br />
        }</p>
<p>        return 0;<br />
}</p></blockquote>
<blockquote><p> </p></blockquote>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/46/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/46/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/46/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/46/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/46/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=46&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/05/12/daddy-the-network-is-down/feed/</wfw:commentRss>
		</item>
		<item>
		<title>It&#8217;s time to OD</title>
		<link>http://sendreceivereply.wordpress.com/2008/04/23/its-time-to-od/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/04/23/its-time-to-od/#comments</comments>
		<pubDate>Wed, 23 Apr 2008 19:41:25 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<category><![CDATA[Tracing]]></category>

		<category><![CDATA[dtrace]]></category>

		<category><![CDATA[kernel]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/?p=56</guid>
		<description><![CDATA[At long last, the dtrace project at Foundry27 is public.  It&#8217;s really still in the formative stages, but if you want to download the source and hack around a bit, or even just laugh at the dirty hacks, feel free!
I&#8217;m slowing working on a more thorough port, but the prototype is a nice forum [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>At long last, the <a title="dtrace project" href="http://community.qnx.com/sf/projects/dtrace">dtrace project</a> at <a href="http://community.qnx.com">Foundry27</a> is public.  It&#8217;s really still in the formative stages, but if you want to download the source and hack around a bit, or even just laugh at the dirty hacks, feel free!</p>
<p>I&#8217;m slowing working on a more thorough port, but the prototype is a nice forum to play around in.</p>
<p>Have fun&#8230;</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/56/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/56/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/56/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/56/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/56/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=56&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/04/23/its-time-to-od/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>No fault of your own&#8230;</title>
		<link>http://sendreceivereply.wordpress.com/2008/04/18/no-fault-of-your-own/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/04/18/no-fault-of-your-own/#comments</comments>
		<pubDate>Fri, 18 Apr 2008 19:42:28 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<category><![CDATA[kernel]]></category>

		<category><![CDATA[demand paging]]></category>

		<category><![CDATA[virtual memory]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/?p=55</guid>
		<description><![CDATA[If you&#8217;ve ever taken a kernel trace of an application starting up on a kernel that is 6.3.2 or later, you might have noticed a thread state in your application called STATE_WAITPAGE.
To understand what is going on here, we have to first look at mmap() and how it allocates and initializes memory.
When you allocate memory [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you&#8217;ve ever taken a kernel trace of an application starting up on a kernel that is 6.3.2 or later, you might have noticed a thread state in your application called <strong>STATE_WAITPAGE</strong>.</p>
<p>To understand what is going on here, we have to first look at <em><strong>mmap()</strong></em> and how it allocates and initializes memory.</p>
<p>When you allocate memory with <em><strong>mmap()</strong></em>, it first allocates a virtual address range, and then (unless you&#8217;ve passed <strong>MAP_LAZY</strong>), it will allocate the physical memory needed to back that object.</p>
<p>What it doesn&#8217;t do, though is setup all the page table mappings for the mapping (although in actual fact it will setup a certain amount, depending on heuristics based on the type of mapping).</p>
<p>In actual fact it will wait until the program first accesses a page before setting up a page table entry for it.</p>
<p>This is a change from pre-6.3.2 kernels, where all mappings were setup immediately.   You can re-enable the old behaviour by using the procnto option -mL in your buildfile.</p>
<p>The benefits of this scheme, known as demand paging, are a speedup when the application doesn&#8217;t actually access all of the pages in a mapping.  This is quite useful when mapping executable objects, since often there are quite a few pages in the text section which may never be referenced.</p>
<p>In some patterns of usage, though, this can induce a performance penalty, especially when there are many threads running at the same priority.</p>
<p>This brings us back to <strong>STATE_WAITPAGE</strong>.  When a process is executing and it access a page that has not been mapped, or tries to write to a page that is marked read-only, it will induce a page fault.  This is caught by the kernel.</p>
<p>The fast path in the kernel will peek at the processes pagetables, and if found it will bang it into the TLB (this is done in hardware on some architectures, such as the x86).  If it can&#8217;t find it then it needs to defer the work of handling the fault to the process manager, since it may need to do some complex work such as communicating with device drivers, and also the also the necessary structures may not be accessible/consistent.</p>
<p>This, then, is where the thread gets blocked in <strong>STATE_WAITPAGE</strong>, and a pulse is sent to procnto, to wake up a thread to handle the request.</p>
<p>The procnto worker does the dirty work of initializing the memory (it may need to read a page from a disk driver for example) and setting up the pagetables.</p>
<p>The first time a page is read it is setup with a read-only mapping, even if the mapping is writeable, unless the underlying page has already been marked as modified.  For <strong>MAP_LAZY</strong> mappings, this is the point at which physical memory is actually allocated for the page.  If the allocation fails, then the application will have a <strong>SIGBUS</strong> signal delivered to it (this was the same in pre 6.3.2 kernels).</p>
<p>This delayed initialisation supports two handy schemes.</p>
<p>This first is Copy On Write semantics (COW).  This is where we don&#8217;t bother making a private copy of a page that was originally shared with another mapping until the page is modified.</p>
<p>The second is support for writeable mappings to files.  Prior to 6.3.2 you could only map a file readonly, or with the extra flag, <strong>MAP_NOSYNCFILE</strong>.  This was because there was no tracking of modified pages.</p>
<p>When you call <strong>msync()</strong> on a shared mapping to a file, all the modified pages are written to the backing store.  Now the pages can be marked read-only again, and the modified indicator can be turned off.</p>
<p>Now all this is great, but what about that performance penalty?  Well all that context switch can make the page fault processing take quite a while if there are lots of threads in <strong>STATE_READY</strong> at the same priority.  The procnto thread will be placed at the back of the queue, wait for the others to run, the it will run, potentially talk to a device driver, and then make the original thread ready again, which will be placed at the end of the queue.</p>
<p>Another thing to think of in some circumstances you want to take the hit of talking to the backing store all at once for determinism reasons.</p>
<p>A way to control this behaviour is via the <em><strong>mlock()</strong></em> and <em><strong>mlockall()</strong></em> functions.  These tell procnto that you want the some (or all) pages made memory resident right now.</p>
<p>This means that the mapping will have been fully read in from disk by the time the <em><strong>mmap()</strong></em> call returns to your program.</p>
<p>You still get page faults on the first write to a page, though.  In that case we setup a read-only mapping (or if the underlying pages have already been modified, a read-write mapping).</p>
<p>If you TRULY don&#8217;t want page faults for mappings, then there are two options open to you.  Since device drivers may have their code run in an interrupt handler, and they may also be running code with interrupt disabled, they can&#8217;t take page faults at all.  So when you request IO privity with the <em><strong>ThreadCtl()</strong></em> call, you get marked as being <strong><em>super locked</em></strong>.  This means that all mappings are setup and ready to go.</p>
<p>Of course, only processes running with superuser privilege can request this special status.  To have all processes be marked as super locked, you can pass the -mL option to procnto.  To have all processes simply be locked (the equivalent of calling <em><strong>mlockall(MCL_FUTURE|MCL_CURRENT)</strong></em>, you can pass the -ml option.</p>
<p>Well, this post has gone all over the map &lt;groan&gt;, so I&#8217;m going to sign off.</p>
<p>Later,</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/55/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/55/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/55/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/55/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/55/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=55&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/04/18/no-fault-of-your-own/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>It&#8217;s alive!</title>
		<link>http://sendreceivereply.wordpress.com/2008/04/16/its-alive/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/04/16/its-alive/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 15:12:12 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/?p=54</guid>
		<description><![CDATA[Well sorry for not having written for so long.  We&#8217;ve all been very busy working on the 6.4 kernel.
BTW - if you&#8217;ve been wondering about the  being CoreOS source repository out of date, the sync process between the internal and external repositories broke down. :-(
The good news though is that it&#8217;s fixed now, [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Well sorry for not having written for so long.  We&#8217;ve all been very busy working on the 6.4 kernel.</p>
<p>BTW - if you&#8217;ve been wondering about the  being <a title="CoreOS source repository" href="http://community.qnx.com/sf/scm/do/listRepositories/projects.core_os/scm" target="_blank">CoreOS source repository</a> out of date, the sync process between the internal and external repositories broke down. :-(</p>
<p>The good news though is that it&#8217;s fixed now, so you can get all the goodness straight from the source. :-)</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/54/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/54/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/54/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=54&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/04/16/its-alive/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Move along, nothing to see here.</title>
		<link>http://sendreceivereply.wordpress.com/2008/01/20/move-along-nothing-to-see-here/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/01/20/move-along-nothing-to-see-here/#comments</comments>
		<pubDate>Sun, 20 Jan 2008 21:25:08 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[Debugging]]></category>

		<category><![CDATA[Tracing]]></category>

		<category><![CDATA[dtrace]]></category>

		<category><![CDATA[dtrace mac osx broken]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2008/01/20/move-along-nothing-to-see-here/</guid>
		<description><![CDATA[As some of you may know, Thomas and I have been working on a port of dtrace, mostly in our spare time.  I was intrigued and enthused to see that it had also been ported to FreeBSD and Mac OS X Leopard.
I was dismayed, however, to read this blog entry by one of dtrace&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>As some of you may <a href="http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/" title="I trace, you trace, what about dtrace?">know</a>, Thomas and I have been working on a port of <a href="http://www.sun.com/bigadmin/content/dtrace" title="Dtrace" target="_blank">dtrace</a>, mostly in our spare time.  I was intrigued and enthused to see that it had also been ported to FreeBSD and Mac OS X Leopard.</p>
<p>I was dismayed, however, to read <a href="http://blogs.sun.com/ahl/entry/mac_os_x_and_the" title="Max OS X and the missing probes">this blog entry</a> by one of dtrace&#8217;s inventors, <a href="http://blogs.sun.com/ahl" title="Adam Levelthat's Blog">Adam Leventhal</a>, on a discovery he had made about the Leopard port.</p>
<p>I won&#8217;t repeat the details of it here, but the gist of it is that Apple allows for certain processes to be hidden from any debug/tracing systems.  While you may or may not agree on whether that is Truly Evil Behaviour or not, it doesn&#8217;t really matter - what it means for sure is that the Leopard dtrace port is severely broken.</p>
<blockquote><p><i>When a system wide tracer cannot trace the whole system, it pretty much ceases to be of any use! </i></p></blockquote>
<p>You might as well pack up, and go home, folks!</p>
<p>The really sad thing is the way they broke it!  They basically disable <i>any</i> probes from running at the same time as a protected process, the prime example being iTunes.</p>
<p>This means, for example, that anything based on the timer tick is useless, since you lose the regular heartbeat, and that any kernel activity that may have been deferred (say disk io) is lost, unnoticed by your dtrace probes!</p>
<p>It really means that you cannot trust any of the data that dtrace is supplying, as it may be at best incomplete, at worst incorrect.</p>
<p>I shake my head, I really do.</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/52/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/52/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/52/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/52/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/52/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=52&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/01/20/move-along-nothing-to-see-here/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Work your Pocketgeek!</title>
		<link>http://sendreceivereply.wordpress.com/2008/01/16/work-your-pocketgeek/</link>
		<comments>http://sendreceivereply.wordpress.com/2008/01/16/work-your-pocketgeek/#comments</comments>
		<pubDate>Wed, 16 Jan 2008 16:53:24 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2008/01/16/work-your-pocketgeek/</guid>
		<description><![CDATA[In the spirit of open development, QNX has created a new product - the Pocket Geek! He works in transparent cube (get it, transparent development!!)
Head over to http://thepocketgeek.com for some recreational fun, trying to drive your little pocketgeek to complete his tasks without exploding. There&#8217;s also a contest at the end of it all.
Have fun!
Colin
 [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>In the spirit of open development, QNX has created a new product - the Pocket Geek! He works in transparent cube (get it, transparent development!!)</p>
<p>Head over to <a href="http://thepocketgeek.com" target="_blank">http://thepocketgeek.com</a> for some recreational fun, trying to drive your little pocketgeek to complete his tasks without exploding. There&#8217;s also a contest at the end of it all.</p>
<p>Have fun!</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/51/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/51/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/51/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/51/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/51/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=51&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2008/01/16/work-your-pocketgeek/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Happy Holidays! Colin&#8217;s in Charge!</title>
		<link>http://sendreceivereply.wordpress.com/2007/12/28/happy-holidays-colins-in-charge/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/12/28/happy-holidays-colins-in-charge/#comments</comments>
		<pubDate>Fri, 28 Dec 2007 18:09:18 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/12/28/happy-holidays-colins-in-charge/</guid>
		<description><![CDATA[Most of QNX is off this week on a yearly holiday break that lasts from Christmas to New Years.  
Most of the developers end up being busy playing with new toys (thanks Santa) or tinkering with pet projects (CDT integration with Mylar) that they&#8217;ve had brewing on the side, so January ends up being a pretty [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Most of QNX is off this week on a yearly holiday break that lasts from Christmas to New Years.  </p>
<p>Most of the developers end up being busy playing with new toys (<a href="http://www.openmoko.com/">thanks Santa</a>) or tinkering with pet projects (<a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=162558">CDT integration with Mylar</a>) that they&#8217;ve had brewing on the side, so January ends up being a pretty exciting time to be back in the office finding out what everyone&#8217;s been up to.</p>
<p>However, this year I&#8217;m going to miss out on that.  Starting in January I&#8217;m turning main responsability of SRR over to my partner in crime Colin as I&#8217;m starting three months of parental leave to hang out with my 9 month old son and teach him the essentials of life:</p>
<ul>
<li>
<div>Recursion, can&#8217;t program effectively without thinking it!</div>
</li>
<li>
<div>Snow fort construction, can&#8217;t live in Ottawa without it!</div>
</li>
<li>
<div>Appreciation for solid foods &#8230; just makes sense!</div>
</li>
</ul>
<p>So as this is my last post for a while (likely, but not certainly) I want to wish you all a happy holiday and a wonderful new year!</p>
<p>Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/49/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/49/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/49/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/49/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/49/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=49&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/12/28/happy-holidays-colins-in-charge/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Why wait for the next release &#8230;</title>
		<link>http://sendreceivereply.wordpress.com/2007/12/08/why-wait-for-the-next-release/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/12/08/why-wait-for-the-next-release/#comments</comments>
		<pubDate>Sat, 08 Dec 2007 18:12:19 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/12/08/why-wait-for-the-next-release/</guid>
		<description><![CDATA[OK &#8230; so I promise that this will be my last post about foundry27for a while and I&#8217;ll get back to talking about QNX technology.  But I couldn&#8217;t help myself, I needed to put out one more plug for some of the QNX Neutrino software that is being made more accessible to developers.
This time it [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>OK &#8230; so I promise that this will be my last post about <a href="http://www.foundry27.com">foundry27</a>for a while and I&#8217;ll get back to talking about QNX technology.  But I couldn&#8217;t help myself, I needed to put out one more plug for some of the QNX Neutrino software that is being made more accessible to developers.</p>
<p>This time it is the availability of the IDE, also commonly known as QNX Momentics, although that statement will get me in trouble since QNX Momentics is more than just the IDE, but it is the complete assembly of a development environment for QNX Neutrino &#8230; but I digress.</p>
<p>The IDE is not part of the current roadmap for source publishing, but the QNX tools development team is shifting to performing its development work more transparently.  To that end there are two community projects, the <a href="http://community.qnx.com/sf/projects/toolchain">Core Development Tools project</a> and the the <a href="http://community.qnx.com/sf/projects/ide">Integrated Development Environment (IDE) project</a>.  From the Core Development Tools project you can get the bleeding edge versions of the GNU toolchain as they are developed &#8230; which is interesting, but most commercial projects currently under development aren&#8217;t likely to switch to a non-released (by QNX) compiler for their production work.   The IDE also offers <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/Builds_Tau_Integration">bleeding edge integration build downloads</a> and since the IDE pretty much sits on top of any core tool or runtime components, it can be updated with far less risk to a production development environment.   While I hate to compare the IDE to an editor, updating your IDE is like updating your editor:  In theory new features and functionality should only make you more productive!</p>
<p>The IDE team is tracking what <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/Whats_New_IDE_Tau">significant new and noteworthy features</a> are being added to each of the integration builds so you can get an immediate idea of what areas you might want to explore.  A more visual page is also<a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.ide/wiki/WhatIsNewInIDE4.5">tracking the general IDE 4.5 features </a>that you might also want to take a look at.  There is a lot of goodness in these downloads, ranging from the source navigation and usability improvements in the C/C++ development environment to the brand new Application Profiler functionality and a range of smaller, but equally rewarding, fixes and enhancements.</p>
<p>The other benefit to trying it out early is that the IDE team is actively looking for feedback and there is still time in the schedule before the<em> </em>next major release &#8230; <em>codenamed Athens</em> &#8230; to respond to feedback and feature requests.</p>
<p>Of course I&#8217;m a bit biased since I&#8217;ve had a hand in putting some of the new IDE features in, but I&#8217;ve switched for my C/C++ development and I&#8217;m not going back!</p>
<p>Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/48/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/48/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/48/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=48&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/12/08/why-wait-for-the-next-release/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Software ports galore!</title>
		<link>http://sendreceivereply.wordpress.com/2007/11/26/software-ports-galore/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/11/26/software-ports-galore/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 14:12:59 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/11/26/software-ports-galore/</guid>
		<description><![CDATA[A couple of weeks ago I wrote about the port of dtrace that Colin and I have got up and running under Neutrino.   For the most part, porting software to Neutrino is a pretty straightforward matter.  Since Neutrino runs self-hosted (ie you work and build in the same environment that you deploy) it means that all [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A couple of weeks ago I wrote about the <a href="http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/">port of dtrace</a> that Colin and I have got up and running under Neutrino.   For the most part, porting software to Neutrino is a pretty straightforward matter.  Since Neutrino runs self-hosted (ie you work and build in the same environment that you deploy) it means that all of the &#8216;configure/make&#8217; style projects work without too much hassle.  In fact most of the time if the source is coming from Linux, *BSD, Solaris or some other unix flavour you can get it up and running in a couple of hours.  The main challenge is almost always figuring out the build system and making sure that our compiler front end (qcc) is used to pick up all of the required environment bits and that hacks for other systems are really required for Neutrino (which is pretty well behaved).</p>
<p>Having ported software on a self-hosted system is pretty much essential for a software developer to work effectively.  There are so many essential software bits and pieces that QNX would never include with the Neutrino SDK because while they are useful, the SDK is targeted specifically at what is needed to build Neutrino applications and needs to be portable (and consistent) for use under Windows, Linux, Solaris as well as Neutrino self-hosted x86.   That doesn&#8217;t mean that the extra software bits aren&#8217;t useful, and historically a 3rd party CD was provided for Neutrino self-hosted developers that came with loads of useful extras, from scripting languages (perl, python, tk) to web servers (apache) and editors (vim).</p>
<p>A couple of developers here at QNX, Sean B. and Xiaodan T., with the help of some QNX community members have been working on a <a href="http://community.qnx.com/sf/projects/pkgsrc">wicked awesome project </a>that pretty much replaces the 3rd party CD with something even better!  They have been working to port the <a href="http://en.wikipedia.org/wiki/Pkgsrc">BSD pkgsrc tool/project</a> to support the QNX Neutrino self-hosted environment.   Just the other day I got a message in my mailbox indicating that the project had hit a critical milestone and that QNX Neutrino was now considered a full fledged supported platform:</p>
<p><font size="2"></p>
<blockquote><p>&#8220;we are proud to welcome QNX, thanks to Sean Boudreaux.&#8221;  <a href="http://mail-index.netbsd.org/pkgsrc-users/2007/10/15/0005.html"><u><font size="2" color="#0000ff">http://mail-index.netbsd.org/pkgsrc-users/2007/10/15/0005.html</font></u></a></p></blockquote>
<p></font></p>
<p align="left">It is even listed on the <a href="http://www.netbsd.org/docs/software/packages.html#available-packages">projects main documentation page</a> &#8230; now that is super cool news!  There are 7000+ different software packages part of this collection, and to have all of them available pre-ported and on-demand is a pretty awesome feat.</p>
<p align="left">So if you are running Neutrino self-hosted, (<em>and why wouldn&#8217;t you be!</em>) and you want more than just the stock installed software, then you should definitely take a look at the <a href="http://community.qnx.com/sf/projects/pkgsrc">pkgsrc community project</a>. </p>
<p align="left">Congratulations and thanks to Sean, Xiaodan and all the others who&#8217;ve been working on getting this up and running!</p>
<p align="left">Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/47/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/47/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=47&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/11/26/software-ports-galore/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Mutex madness?</title>
		<link>http://sendreceivereply.wordpress.com/2007/11/15/mutex-madness/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/11/15/mutex-madness/#comments</comments>
		<pubDate>Thu, 15 Nov 2007 19:23:44 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<category><![CDATA[Tracing]]></category>

		<category><![CDATA[kernel trace]]></category>

		<category><![CDATA[mutex]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/11/15/mutex-madness/</guid>
		<description><![CDATA[I recently received an interesting kernel trace from a customer.  It showed several threads going from STATE_RUNNING to STATE_MUTEX without an intervening SyncMutexLock kernel call.  He wondered if perhaps the trace was corrupted.
After looking at the trace it seemed to be sane, but the behaviour shown was somewhat puzzling.  However it is [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I recently received an interesting kernel trace from a customer.  It showed several threads going from STATE_RUNNING to STATE_MUTEX without an intervening SyncMutexLock kernel call.  He wondered if perhaps the trace was corrupted.</p>
<p>After looking at the trace it seemed to be sane, but the behaviour shown was somewhat puzzling.  However it is explainable, and it has to do with our implementation of mutexes.</p>
<h3><span id="more-45"></span> No kernel calls?</h3>
<p>One of the first things you must realize, when looking at a QNX kernel trace, is that a pthread_mutex_lock() doesn&#8217;t always result in a SyncMutexLock() kernel call.  This is because we implement an optimisation where an <em>uncontested mutex</em> can be aquired without entry to the kernel.  Likewise, unlocking a mutex on which no-one is waiting will not result in a SyncMutexUnlock() kernel call.  This is implemented using atomic compare-and-exchange operations.  How they are implemented depends on which cpu you are using.  Take a look at $QNX_TARGET/usr/include/&lt;cpu&gt;/smpcmp.h if you are interested in the various ways of doing this.</p>
<h3> Not our man though&#8230;</h3>
<p>State changes without seeing kernel calls might point us in that direction then, but the fact is that we are seeing a change to STATE_MUTEX, which would indicate a contested mutex.</p>
<p>The next clue though is that we ARE, in fact, seeing these state changes while in the kernel.  The kernel call was a MsgReceivev().  This led me to the answer.</p>
<p>When we unlock a mutex that other threads are being waited on, we call SyncMutexUnlock(), which checks a priority ordered list of waiting threads.  It then will remove  the first thread from the list and mark it runnable (ie it will transition to STATE_READY).  It also sets a thread flag, <strong>_NTO_TF_ACQUIRE_MUTEX</strong>, which indicates that the thread should aquire the mutex it was waiting on upon exit from the kernel.  The address of the mutex was saved in the thread kernel calls arguments when it called SyncMutexLock(), some time in the past.</p>
<p>The point is, though, that the thread has not yet aquired the mutex.  This can lead to some interesting behaviour.</p>
<p>In the log that was sent to me, the holding thread unlocked the mutex, and then immediately tried to relock it.  The first unlock makes a waiting thread ready.  SyncMutexUnlock() is not a blocking call though, so the thread remains running.</p>
<p>At this point, no-one holds the lock, although the lock indicates that people are waiting on it.</p>
<p>The following call to SyncMutexLock detects that there are threads waiting, and readies another thread (it has no knowledge that there was already a thread readied) to attempt to acquire the mutex.  It then blocks the calling thread, and at this point the first thread that wanted to aquire the mutex will be made running.</p>
<p>Time passes, at at some point the second thread that was marked ready may actually be made running.  As it exits the kernel, the kernel exit code processing notices the aquire flag is set on the thread, and attempts to aquire the mutex.  Of course it is still held by the earlier thread, and thus we need to block this thread and choose another.</p>
<h3>Capice?</h3>
<p>And there you have it.  I&#8217;m sure it&#8217;s all a little odd without better knowledge of how kernel is implemented.  The good news is that you can checkout the <a href="http://community.qnx.com/sf/scm/do/listRepositories/projects.core_os/scm" title="source" target="_blank">source</a> and see for yourself.  Also don&#8217;t forget to checkout the evolving docs on the <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/HomePage" title="project wiki page">project wiki page</a>.</p>
<p>The moral of this story is to not get too upset by multiple thread state changes when we are within the kernel.  The kernel can change it&#8217;s mind several times on which thread will ultimately make it out of the kernel and become running.  The last state change before you see a kernel exit is the one to believe.</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/45/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/45/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/45/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/45/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/45/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=45&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/11/15/mutex-madness/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>I trace, you trace &#8230; what about dtrace?</title>
		<link>http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 15:48:27 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/</guid>
		<description><![CDATA[Anyone who has been plugged into the OS scene is surely aware of the latest Mac OS X Leopardrelease.  It is hard to miss since the news is pretty much splashing up all over the place in news articles and product reviews and in my case filling my mailbox with Google Alerts.  I don&#8217;t have an alert [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="left">Anyone who has been plugged into the OS scene is surely aware of the latest <a href="http://www.apple.com/macosx/">Mac OS X Leopard</a>release.  It is hard to miss since the news is pretty much splashing up all over the place in news articles and product reviews and in my case filling my mailbox with Google Alerts.  I don&#8217;t have an alert set for Max OS X, but I do have one set for <a href="http://www.sun.com/bigadmin/content/dtrace/">DTrace</a> and this tracing functionality has now been included in the latest Mac OS X release and people seem to be pretty jazzed about it.</p>
<p>I&#8217;m jazzed about it too &#8230; but for a different reason all together. </p>
<p>Colin and I have been following the work of <a href="http://blogs.sun.com/bmc/">Bryan</a>, <a href="http://blogs.sun.com/mws/">Mike</a> and <a href="http://blogs.sun.com/ahl/">Adam</a>on dtrace since it was released as part of the <a href="http://www.opensolaris.org/os/">Open Solaris</a>.  We head up most of the <a href="http://www.qnx.com/download/feature.html?programid=9374">kernel instrumentation</a> and <a href="http://www.qnx.com/download/feature.html?programid=9328">system profiling</a>development on Neutrino and have always felt that dtrace, with its focus on runtime safety and use in a production environment, would be a perfect match for embedded developers and compliment our existing instrumentation and tracing strategy for Neutrino very nicely.  </p>
<p>So why were we jazzed by the Max OS X release? The more platforms that dtrace is ported to, the more generic the code base will become.  It is exciting to us because now dtrace is running on Solaris, NetBSD, Max OS X and oh yeah &#8230; <em>Neutrino!</em></p>
<p><a href="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap1.jpg" title="dtrace on Neutrino"></a></p>
<p style="text-align:center;"><em><img src="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap1.jpg" alt="dtrace on Neutrino" /></em></p>
<p>You can see here that this is a system that is running the 6.3.0 release of Neutrino and this is the basic dtrace command help.  The initial port to Neutrino that Colin and I have done is slightly different from the other OS ports.  Since Neutrino is an micro-kernel, we wanted to see how far we could go keeping the dtrace module out  of the kernel &#8230; and if possible even outside of the process manager.  The current implementation has all of the dtrace system code, normally found in the kernel or a kernel module, encapsulated in a resource manager, io-dtrace, and the utility is a straight port of the Solaris utility.</p>
<p style="text-align:center;"><img src="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap2.jpg" alt="dtrace provider listing" /></p>
<p>We&#8217;ve only implemented three sets of providers currently. </p>
<ul>
<li><strong>dtrace</strong>:  This is the standard dtrace provider with the BEGIN, END and ERROR probes</li>
<li><strong>instr</strong>: This is a provider based on the existing kernel instrumentation hook and can provide kernel calls, thread state, interrupt information</li>
<li><strong>profile:</strong> This provider is pretty much the same as the Solaris provider and provides statistical sampling at a user controlled rate</li>
</ul>
<p>Even with this minimal set of providers, you can extract some pretty interesting information.  For example, we can re-write the <em>hogs</em> utility, that tracks the runtime of the top few processes, with a simple dtrace script:</p>
<p align="center"><a href="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap3.jpg" title="HOGS dtrace script"><img src="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap3.jpg" alt="HOGS dtrace script" /></a></p>
<p align="left">We are missing a lot of the standard dtrace built-ins that allow you to get much deeper into the application space, such as providing the user stack information, but even by recording the instruction pointer we can get some usefull information about where an application is spending its time &#8230; expanding on the idea of an application specific statistical profiler, we can gather information about the whole system or target just one process or thread:</p>
<p align="center"><a href="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap4.jpg" title="Mapping the IP address"><img src="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap4.jpg" alt="Mapping the IP address" /></a></p>
<p align="left">Since dtrace can work directly with C constructs, we can pull in code directly from the Neutrino system headers.  If you wanted to take a look at the kind of messaging operations that were going on in a process, you could write a script to catch all of the MsgSend&#8217;s via the instrumentation hook and decode the first few bytes of data based on the message header to determine what an application is doing:</p>
<p align="center"><a href="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap5.jpg" title="Decoding the message"><img src="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap5.jpg" alt="Decoding the message" /></a></p>
<p align="left">Pretty cool huh! It is a nice extension to the capabilities of the System Profiler that provides the graphical analysis capabilities, but in a development environment back on the host.</p>
<p align="left">There is still have a lot to do and the port is far from complete.  Before we can go much further, we are likely going to have to do the kernel and/or process manager integration to be able to efficiently provide things like the equivalent of the pid provider and the function boundary tracing.  The good news is that as a proof of concept this is already usefull &#8230; and so far architecturally independent (running on MIPS, SH, ARM, PPC and of course x86), although the hard bits are still ahead of us. </p>
<p align="left">Hats off to Bryan, Mike and Adam for a wicked awesome technology and to Sun to making it available to the software development community.  Since the port isn&#8217;t quite complete, certainly not production ready, Colin and I are hoping that we can get our prototype posted up to the <a href="http://www.foundry27.com">Foundry27 QNX community</a> site so that we aren&#8217;t the only ones who get a chance to play around with this. </p>
<p align="left">Stay tuned &#8230;</p>
<p align="left">Thomas (&amp; Colin who is onsite with a customer &#8230; likely using the dtrace prototype right now)</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/39/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/39/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=39&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/11/08/i-trace-you-trace-what-about-dtrace/feed/</wfw:commentRss>
	
		<media:content url="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap1.jpg" medium="image">
			<media:title type="html">dtrace on Neutrino</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap2.jpg" medium="image">
			<media:title type="html">dtrace provider listing</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap3.jpg" medium="image">
			<media:title type="html">HOGS dtrace script</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap4.jpg" medium="image">
			<media:title type="html">Mapping the IP address</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/11/dtrace-snap5.jpg" medium="image">
			<media:title type="html">Decoding the message</media:title>
		</media:content>
	</item>
		<item>
		<title>Published source &#8230; the greatest thing ever!</title>
		<link>http://sendreceivereply.wordpress.com/2007/10/18/published-source-the-greatest-thing-ever/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/10/18/published-source-the-greatest-thing-ever/#comments</comments>
		<pubDate>Thu, 18 Oct 2007 15:48:29 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/10/18/published-source-the-greatest-thing-ever/</guid>
		<description><![CDATA[One of the hardest things about working through problems with some of our customers is the fact that since I work here at the QNX mothership office I have full and complete visibility into all source from our products &#8230; and they do not.  This of course means that I can almost always come out looking like [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>One of the hardest things about working through problems with some of our customers is the fact that since I work here at the <a target="_blank" href="http://maps.google.com/maps/mm?ie=UTF8&amp;hl=en&amp;ll=45.286022,-75.872312&amp;spn=0.003042,0.007135&amp;t=k&amp;z=18&amp;om=1">QNX mothership</a> office I have full and complete visibility into all source from our products &#8230; and they do not.  This of course means that I can almost always come out looking like a hero since for any hard question a customer has about how something works (or appear not to as the case may be) I can generally root through the source repository, figure out what is going on and explain it back to them.</p>
<p>It is nice to be a hero &#8230; but sometimes things just get lost in translation.</p>
<p>Since it used to be that I couldn&#8217;t just share the code with the customer&#8217;s engineers, we spend a lot of time going back and forth discussing topics in the &#8220;abstract&#8221; until I can paint enough of a mental picture for them about a particular implementation of technology.  By the time that they understand what to do about the problem they are facing, I&#8217;ve pretty much given them a tour through our code.  Kind of a  waste of time considering that most of the software developers I end up working with can read through a blob of C, C++ or Java code just as easily as a paperback novel.</p>
<p>This is why I think that <a href="http://www.foundry27.com">Foundry27</a> is an awesome idea.  We are working to get to the point where for nearly all of the Neutrino technology that has been developed, I&#8217;ll be able to talk customers through a problem and bring them right into the guts of the code during the explanation.   It is going to take some time to get all of that source out, but we have already pushed out the <a target="_blank" href="http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/lib/c/?root=coreos_pub&amp;system=exsy1001">C library source code</a> and the <a target="_blank" href="http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/services/system/?root=coreos_pub&amp;system=exsy1001">kernel/process manager code </a>and that represents quite a bit of important glue bits that help you understand how to get the most out of your applications.</p>
<p>Even better than the fact that the source is being published, is the fact that the different development teams within QNX are starting to take on much more active public roles themselves and helping others to interpret and navigate through the source code.  If you missed it, you should really check out the  <a href="http://www.qnx.com/news/web_seminars/microkernel.html">webinar</a> that Colin and Sebastien presented as a bit of a guided tour through some of the source code included in the <a href="http://community.qnx.com/sf/projects/core_os">QNX Operating System</a> project.  Also we&#8217;ve got most of the kernel developers (and a large number of other QNX developers) online now and monitoring the forums so there is lots of good information flowing around.</p>
<p>Next up on the source release roadmap is the networking stack and driver source and I&#8217;m also going to see if I can get a set of missing OS utilities out the door as well before Christmas!</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/38/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/38/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/38/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/38/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/38/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=38&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/10/18/published-source-the-greatest-thing-ever/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Finding an unblock victim</title>
		<link>http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/#comments</comments>
		<pubDate>Fri, 05 Oct 2007 01:58:44 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[Tracing]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/</guid>
		<description><![CDATA[Dan posted recently on his blog about implementing an unblock handler in one of our media servers.  Unblock handling is tricky and it can take a bit of fiddling to get an implementation that makes the appropriate trade off between unblock response time and the complexity of implementation.  In this case a significant customer needed the work done in short order [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><a href="http://mediatype.ca/">Dan</a> posted recently on his blog about <a href="http://mediatype.ca/2007/09/21/unblock-handler/">implementing an unblock handler</a> in one of our media servers.  Unblock handling is tricky and it can take a bit of fiddling to get an implementation that makes the appropriate trade off between unblock response time and the complexity of implementation.  In this case a significant customer needed the work done in short order so it was done.</p>
<p align="left">The funny thing is that a few days later the customer was then starting to get all sort of spurious errors in their system.  Normally this isn&#8217;t a challenge to track down, but in this case the system was tightly coupled and composed of hundreds of threads with tens of processes and close to a dozen active interrupts.  There was enough other system activity going on that a small failure in one path took a long time to ripple through to a point where the error was noticeable.  The gut feeling was that some part of the client software was being unblocked as a result of the recent server unblock changes and the client wasn&#8217;t ready to deal with the consequences.</p>
<p>&#8230; but we needed to prove it &#8230;</p>
<p>The good news is that the system was running the instrumented kernel and we could take some traces and take a look at the entire system, so traces we took and then we loaded them into the System Profiler.</p>
<p align="center"><a rel="attachment wp-att-35" href="http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/initial-load/" title="System Profiler"><img src="http://sendreceivereply.files.wordpress.com/2007/10/initial.thumbnail.jpg" alt="System Profiler" /></a> </p>
<p align="left">The question was, how can we quickly check and see if the unblock behaviour is at fault?  Well the first thing to do is to see if there is any unblock activity in the log.  This is easily accomplished with using the Trace Search capability,  <strong>Search</strong> &gt; <strong>Search&#8230; </strong>(or CTRL+H for the keyboard addicts).  Click <strong>Add</strong> to create a new search condition.  The condition we want to look for is the <em>Communication</em> class events with the code of <em>Unblock Pulse</em>.  This will pull up all of the unblock pulses generated in the trace.  In this case we didn&#8217;t have very many to consider:</p>
<p align="center"><a href="http://sendreceivereply.files.wordpress.com/2007/10/search-all.jpg" title="Unblock Search Results"><img src="http://sendreceivereply.files.wordpress.com/2007/10/search-all.thumbnail.jpg" alt="Unblock Search Results" /></a></p>
<p align="left">We could have gone through and taken a look at each instance, but in this case we knew that we had just put the unblock handling code into the mme server.  The unblock pulse event contains the name of the target process, so we could take a look specifically to see if we had targeted our server.  We can do this by going back into the Trace Search and either editing the existing condition or creating a new condition.  We will still specify the <em>Communication </em>class and the<em> Unblock Pulse</em> event, but this time we will also add in a specific search for instances where the <em>process</em>data is equal to the mme server.</p>
<p align="center"><a rel="attachment wp-att-37" href="http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/mme-unblock-search/" title="MME Unblock Search"><img src="http://sendreceivereply.files.wordpress.com/2007/10/mme-unblock.thumbnail.jpg" alt="MME Unblock Search" /></a></p>
<p align="left">Now when we run the search <strong>BINGO!</strong>we get just one single hit.  From this point it is easy now to look at the Timeline editor pane and track the behaviour of the client process and thread that the mme unblocks and what happens after the unblock (bad things it turns out).</p>
<p align="left">Also, with the system trace we can take a look at the specific cause of the signal.  It turns out in this case that there was a timer firing a signal that got dropped on the thread which caused it to unblock.  This in turn exposed a general flaw in the customer&#8217;s design since they were running a multi-threaded application where any thread could have potentially been blasted by this signal instead of the process having a dedicated signal handling thread.</p>
<p align="left">Hopefully this quick example gives you some more ideas how you can effectively navigate through the instrumentation trace files, Trace Search is a powerful tool.</p>
<p align="left">Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/34/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/34/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/34/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=34&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/10/05/finding-an-unblock-victim/feed/</wfw:commentRss>
	
		<media:content url="http://sendreceivereply.files.wordpress.com/2007/10/initial.thumbnail.jpg" medium="image">
			<media:title type="html">System Profiler</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/10/search-all.thumbnail.jpg" medium="image">
			<media:title type="html">Unblock Search Results</media:title>
		</media:content>

		<media:content url="http://sendreceivereply.files.wordpress.com/2007/10/mme-unblock.thumbnail.jpg" medium="image">
			<media:title type="html">MME Unblock Search</media:title>
		</media:content>
	</item>
		<item>
		<title>More time than you want</title>
		<link>http://sendreceivereply.wordpress.com/2007/09/25/more-time-than-you-want/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/09/25/more-time-than-you-want/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 02:08:09 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/09/25/more-time-than-you-want/</guid>
		<description><![CDATA[I was discussing with one of the other developers here some source code that comes from a very popular open source database that has been ported to QNX and that is going to be shipping with the next release of the OS. It is funny the way that developers get into this mindset that the code [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was discussing with one of the other developers here some source code that comes from a very popular open source database that has been ported to QNX and that is going to be shipping with the next release of the OS. It is funny the way that developers get into this mindset that the code they are writing will be the only code in the entire universe running.</p>
<p>The snippet of code we were looking at looked something like the following (code changes made to protect those who should know better):</p>
<p>/*<br />
** Sleep for a little while.  Return the amount of time slept.<br />
** The argument is the number of milliseconds we want to sleep.<br />
*/<br />
<font color="#228b22"><strong>int</strong></font> <strong><font color="#0000ff">OSSleep</font></strong>(<font color="#228b22"><strong>int</strong></font> ms){<br />
  usleep(ms*1000);<br />
  <strong><font color="#a020f0">return</font></strong> ms;<br />
}</p>
<p>Can you see what the flaw in the logic is here? Perhaps if we put the code into a context the problem will become clearer. The OSSleep function is being called in order to walk our way through a series of progressively longer timeouts .. based on the return value of how long this function has slept.</p>
<p>If the application containing this source code was the only thing running on the system, then there would be no problem. However, in most modern operating systems, QNX Neutrino counted among them, there are multiple tasks that are all running concurrently and being managed by the OS.  This means that while surely the code above will delay for N milliseconds, it could in fact be much longer than that if some other thread pre-empts this thread before or after it makes it into (or out of) the system call.</p>
<p>So .. what could we do to make it better?  Well we could snapshot the time on input and snapshotting it on exit and returning the difference.   This makes things incrementally better by narrowing down the window of error, but the window is still there. </p>
<p>The reality is that this kind of API, and this application&#8217;s use of it, is fundamentally flawed.  What the application is trying to emulate is allowing multiple threads of execution the ability to acquire a resource.  If the resource can&#8217;t be acquired, then the thread backs off or may choose to cancel the operation all together. </p>
<p>This is a perfect scenario for a condition variable &#8230; something available under Neutrino, but not necessarily under the other Unix flavours that this source was ported to.  By switching to a condition variable, we can be much more precise with respect to when we signal client applications to &#8220;try again&#8221; &#8230; which can result in a surprisingly large reduction in overall CPU consumption and system churn (due to all the extra context switches and cycles through the scheduling READY queue).</p>
<p>So in these days of thinking about multiple threads of execution running on separate CPU cores, we should also remind ourselves that using &#8220;time&#8221; as a basis for control needs to be carefully planned on systems where there is more than a single thread of execution.</p>
<p>Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=28&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/09/25/more-time-than-you-want/feed/</wfw:commentRss>
		</item>
		<item>
		<title>More on BEEP</title>
		<link>http://sendreceivereply.wordpress.com/2007/09/18/more-on-beep/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/09/18/more-on-beep/#comments</comments>
		<pubDate>Tue, 18 Sep 2007 02:09:50 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/09/18/more-on-beep/</guid>
		<description><![CDATA[A few months ago, back in the dark agains, BF (Before Foundry27), I hurriedly blogged about trying to turn off the annoying Beep - the bane of laptop owners anywhere.
Well, today I had a few minutes, and so I went of in search of a more complete solution.
Switching Modes
As you may remember, one of the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A few months ago, back in the dark agains, BF (Before <a href="http://community.qnx.com" title="Foundry27" target="_blank">Foundry27</a>), I hurriedly blogged about trying to turn off the annoying <a href="http://sendreceivereply.wordpress.com/2007/07/27/beepn-beeps/" title="Beep">Beep</a> - the bane of laptop owners anywhere.</p>
<p>Well, today I had a few minutes, and so I went of in search of a more complete solution.</p>
<h3><span id="more-33"></span>Switching Modes</h3>
<p>As you may remember, one of the issues was that the beep control sequence, was only understood by <a href="http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/utilities/d/devc-con.html" title="devc-con">devc-con</a> when it was running QNX4 Terminal emulation mode, which is not the default.</p>
<p>I was telling this to my colleague, <a href="http://community.qnx.com/sf/docman/do/downloadDocument/projects.core_os/docman.root.os_docs/doc1073" title="PeterV">Peterv</a>, and he said - well just emit the code to switch to QNX emulation and back.</p>
<p>Well, it was one of those &#8216;Duh&#8217; moments. :-)</p>
<p>Of course, the fun part was figuring out the codes to emit.  I couldn&#8217;t find a decent doc of the QNX4 Terminal Emulator codes, and the ANSI code to switch to QNX4 was a private vendor extension.</p>
<p>After a bit of mucking around though, I figured it out&#8230;</p>
<h3>The Dark Majik</h3>
<p>And yeah shall chant&#8230;</p>
<pre name="code" class="cpp">
#!/bin/sh

# switch to QNX4 emulation
printf "%c[?+q" 0x1b

# set beep tick count = 1, frequency divider to 1

printf "%cs%c%c%c" 0x1b 33 33 32

# switch back to ANSI emulation
printf "%c?1+q" 0x1b
</pre>
<p>Now, make sure you put this output to /dev/con1, because that is the device that actually talks to the PC beep port.  Photon pterm terminals do understand these codes, but they just send a bell character to /dev/con1!</p>
<p>Enjoy a beepless world, my friends.</p>
<p>BTW - you can muck around with the parameters.  You might find you like a beep but just a bit shorter - each tick is 50ms.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/33/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/33/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=33&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/09/18/more-on-beep/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Devc-ditto, the principle, the usage</title>
		<link>http://sendreceivereply.wordpress.com/2007/09/14/devc-ditto-the-principle-the-usage/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/09/14/devc-ditto-the-principle-the-usage/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 02:40:31 +0000</pubDate>
		<dc:creator>xtang</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/09/14/devc-ditto-the-principle-the-usage/</guid>
		<description><![CDATA[Ever since I get my hands on QNET, the question &#8220;where is ditto&#8221; seems following me. At some point, I decided to give it a try, to see what&#8217;s the problem. Turns out the ditto functionality on QNX4, is mostly built into the console device. The character devices on QNX6 has a different architecture, to [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ever since I get my hands on QNET, the question &#8220;where is ditto&#8221; seems following me. At some point, I decided to give it a try, to see what&#8217;s the problem. Turns out the ditto functionality on QNX4, is mostly built into the console device. The character devices on QNX6 has a different architecture, to do the samething, I would have to &#8220;port&#8221; those functionality into, right, libio-char; Not only libio-char is owned by Dan Dodge at the time (I am not kidding :D), at the time it already built into a whole lot character devices, including those non-x86s. So basically I am stuck.</p>
<p>One day I realized all &#8220;ditto&#8221; doing (or need to do), is to &#8221;sniff&#8221; characters between applications and the character device. Just like a network packet sniffer. Applications are going to write() into, for example, /dev/con1; All Ineed to do, is to find out what has benn written in, buffer them, for someone else to read out.</p>
<p>So how do I do this? QNX6 resource manager allow you register already exist path name, to, un, hijack it. So all I need to do, is write my own resrouce manager (called devc-ditto :D), it also attach to /dev/con1; The default behavior of resource manager pathname attach, is the &#8221;latest attched got message first&#8221;, which works very well. So once devc-ditto attached to /dev/con1, any one open(&#8221;/dev/con1&#8243;, ..) it will end up with a connection from application to devc-ditto. All the applications write() would comes to me, I buffer those data it is written, then relay it to the resource manager who is really managing /dev/con1 (devc-con); Done!</p>
<p>Well almost done, this only allow me to sniff out the datas, how do I pass it to another application? This is easy, if I take over /dev/con1 for example, I would then create a /dev/con1.ditto, read from this device, you got all it buffered.</p>
<p>So here is how you use it:</p>
<p>On a console 2, try </p>
<p><em><strong>  # devc-ditto /dev/con1<br />
  # cat /dev/con1.ditto</strong></em></p>
<p>Then go back to console 1, do &#8220;<strong><em>ls &gt;/dev/con1</em></strong>&#8220;, and come back, you should see all the &#8220;ls&#8221; output (from cat).</p>
<p>Wait, this is not what ditto doing right? Why is the 2 character &#8220;ls&#8221; not showing up in &#8220;cat&#8221; ? Think what happened, you hit &#8220;l&#8221; key, devc-con got it, give it to your shell, youe shell will echo it, by sending it to /dev/con1&#8230; but hey devc-ditto doesn&#8217;t see this &#8220;l&#8221;, why?</p>
<p>Because, the shell made a connection directly to devc-con, not to me. OK, so if I exit the shell, and re-login, that would do it, right? Sorry, no, because &#8220;login&#8221; spawned &#8220;sh&#8221;, the shell inherite stdin, stdout, stderr from &#8220;login&#8221;, in other words, the shell never open() the /dev/con1 device. Hm, so I have to run devc-ditto before &#8220;login&#8221; running? Yes, you can do that, by put devc-ditto in /etc/rc.d/rc.local, it actually works&#8230;.</p>
<p>But, but I don&#8217;t like that. I want to be able to start/stop/restart devc-ditto freely. After talk to some expert, I have put this in my .kshrc.</p>
<p>  alias reopen &#8216;exec 0&lt;$TTY 1&gt;$TTY 2&gt;$TTY&#8217;</p>
<p>Now, exit and login again on console 1, and type</p>
<p>   <strong><em># reopen</em></strong></p>
<p>Wohoo, after that, anything you type in concole 1, you should be able to see it in &#8220;cat&#8221;.</p>
<p>&#8220;But that&#8217;s now all &#8216;ditto&#8217; doing, I also want to type in from &#8216;the other window&#8217;&#8221;, yes, I hear you. To allow inject key, I made it so any character write() into /dev/con1.ditto device, would be read() out from the /dev/con1. So what do you need to inject key? Yes, use &#8220;qtalk&#8221;.  Now there are a few gocha of &#8220;qtalk&#8221;, first of all, you need a qtalk support &#8220;-O&#8221; option, which ignores file open count; Also qtalk tend to open a character device in &#8220;edit&#8221; mode, we want &#8220;raw&#8221; mode.  So here is what you do, (assume you are on /dev/con2)</p>
<p>    <em><strong># qtalk -O -m /dev/con1.ditto<br />
    </strong></em>&lt;in qtalk&gt;<br />
    <strong><em># stty raw &lt;/dev/con2</em></strong></p>
<p>After this, whatever you type in qtalk, would show up in /dev/con1, and processed by the shell running there. This ultimatlly gives you the same &#8220;ditto&#8221; experence. And of cause, all these are standard utilities (cat, qtalk), so they work over QNET just fine.</p>
<p>But this is not all of it. Since the principle is just hijack a device name, devc-ditto not limited to only console, you can use it against any character device, /dev/ser1, or maybe /dev/ttypX. Wait, &#8220;/dev/ttypX&#8221;, isn&#8217;t that means I can &#8221;ditto&#8221; into a telnet session? Exactly. I will leave the practice for you, to figure out how to &#8221;ditto&#8221; into a telnet session.</p>
<p>That&#8217;s all I have to say.  come to <a target="_blank" href="http://community.qnx.com/sf/discussion/do/listTopics/projects.core_os/discussion.newcode">ostech forum</a> if you want to discuss more, enhance it if you have more idea. Oh, one more thing, I made the devc-ditto also handle mount/umount, so you don&#8217;t need to start a lot of them if you want to monitor multiple interfaces.</p>
<p>   <strong><em># mount -Tditto /dev/ttyp5</em></strong></p>
<p>Now you can tap into /dev/ttyp5.ditto, after you done:</p>
<p>   <em><strong># umount /dev/ttyp5.ditto</strong></em></p>
<p>xtang</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/32/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/32/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/32/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=32&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/09/14/devc-ditto-the-principle-the-usage/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ditto Delivered!</title>
		<link>http://sendreceivereply.wordpress.com/2007/09/12/ditto-delivered/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/09/12/ditto-delivered/#comments</comments>
		<pubDate>Wed, 12 Sep 2007 11:01:31 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/09/12/ditto-delivered/</guid>
		<description><![CDATA[A couple of months ago we wrote about the missing QNX4 ditto for Neutrino and while script is an interesting alternative, the comments coming from some of you indicated that you just weren&#8217;t going to be happy until you got your ditto back!
The good news is that a QNX developer, Xiaodan Tang, took it upon himself [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>A couple of months ago we wrote about the <a href="http://sendreceivereply.wordpress.com/2007/06/21/ditto-everyones-favourite-missing-tool/">missing QNX4 ditto for Neutrino</a> and while script is an interesting alternative, the <a href="http://sendreceivereply.wordpress.com/2007/06/21/ditto-everyones-favourite-missing-tool/#comments">comments</a> coming from some of you indicated that you just weren&#8217;t going to be happy until you got your ditto back!</p>
<p>The good news is that a QNX developer, Xiaodan Tang, took it upon himself to help out and solve this ditto dilemma.  Xiaodan has written a new Neutrino service, aptly called devc-ditto, that will allow character buffer replication and general terminal emulation.</p>
<p>While solving a lingering problem is always good news, the next question people will inevitably ask is &#8220;<em>When can I get devc-ditto?</em>&#8220;. </p>
<p>The new devc-ditto is a <a href="http://en.wikipedia.org/wiki/Bad_Thing">good thing</a>.  As a general rule, we like to include good things in our product distribution.  Here is where the bad news<strong> <em>used to</em></strong> have to be delivered.  Our software releases are &#8220;<em>steady and stable</em>&#8221; which at times can be an euphamism for &#8220;<em>glacially paced</em>&#8220;.  This means that to get devc-ditto you would either have to wait for the commercial release (potentially a long time) or give your QNX sales rep a call and figure out a way to get this excellent piece of accellerated technology into your hands.</p>
<p><em>&#8230; but the times they are a changin&#8217;</em></p>
<p>QNX is shifting its entire R&amp;D team to a new <a href="http://community.qnx.com/sf/projects/community">Transparent Development model</a>.  In this model the source code for our products is being published live and the work on those products is taking place publicly.    Still commercial software development but with a flavour that should make open source developers, who like probing the product source and interacting with the authors/maintainers the source, much more at home.</p>
<p>I can hear you thinking &#8220;<em>Yeah yeah &#8230; neat.  Now how does this help me get devc-ditto?!</em>&#8220;</p>
<p>Well QNX has a lot of source to release, and it will take some time to clean it up into publically presentable form, but working with Xiaodan and the <a href="http://community.qnx.com/sf/projects/core_os">Core OS team</a> we have been able to get <a href="http://community.qnx.com/integration/viewcvs/viewcvs.cgi/trunk/services/devc-ditto/?root=coreos_pub&amp;system=exsy1001">devc-ditto included in the first OS source release</a>, which means you can <strong>get it</strong>, <strong>build it</strong>, <strong>use it</strong>, <strong>change it</strong> all to your hearts content!</p>
<ol>
<li><a href="https://www.qnx.com/account/login.html">Get a community username (aka your MyQNX username)</a></li>
<li><a href="http://www.qnx.com/products/getmomentics/">Get the latest development tools and distribution </a>(if you just want devc-ditto, and you have a dev seat, you can skip this)</li>
<li>Get the source: svn co &#8211;username=&lt;community_username&gt; <a href="http://community.qnx.com/svn/repos/coreos_pub/trunk/services/devc-ditto">http://community.qnx.com/svn/repos/coreos_pub/trunk/services/devc-ditto</a></li>
<li>Build it: make</li>
</ol>
<p>I&#8217;ll leave the <em>use-it</em> up to you to figure out now &#8230; if in doubt, post to the <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/OS_Forums_guide">OS forums</a> with your questions!  If you want to <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/GetTheOSSource">get more </a>and <a href="http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/BuildTheOSSource">build more</a> then you should really check out the whole <a href="http://">Core OS project</a> as well as the other community projects.</p>
<p>Thomas </p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=29&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/09/12/ditto-delivered/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Anticip&#8230;&#8230;&#8230;..ation!</title>
		<link>http://sendreceivereply.wordpress.com/2007/09/11/anticipation/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/09/11/anticipation/#comments</comments>
		<pubDate>Tue, 11 Sep 2007 00:40:33 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<category><![CDATA[Tease]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/09/11/anticipation/</guid>
		<description><![CDATA[Back in the day, some 10 years ago, when I was a young Kiwi programmer on the far end of a very long copper wire into 175 Terence Matthews Crescent, being a QNX customer was a lot of fun.  QUICS was cool (and I heard they were going to move their BBS system to [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Back in the day, some 10 years ago, when I was a young Kiwi programmer on the <a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;q=19+Newton+Rd,+Newton,+Auckland+1010,+New+Zealand&amp;sll=45.286256,-75.872923&amp;sspn=0.002691,0.007167&amp;ie=UTF8&amp;cd=1&amp;geocode=0,-36.860897,174.753577&amp;ll=-36.860961,174.753106&amp;spn=0.00306,0.007167&amp;t=h&amp;z=18&amp;iwloc=addr&amp;om=1" target="_blank" title="far end">far end</a> of a very long copper wire into <a href="http://maps.google.com/maps?f=q&amp;hl=en&amp;geocode=&amp;q=175+Terence+Matthews+Crescent,+Kanata,+ON,+Canada&amp;sll=37.0625,-95.677068&amp;sspn=24.912343,58.710937&amp;ie=UTF8&amp;ll=45.286256,-75.872923&amp;spn=0.002691,0.007167&amp;t=h&amp;z=18&amp;iwloc=addr&amp;om=1" title="175 Terence Matthews Crescent" target="_blank">175 Terence Matthews Crescent</a>, being a QNX customer was a lot of fun.  QUICS was cool (and I heard they were going to move their BBS system to a Usenet based NNTP reader!  WOW!), and you really got a sense of working WITH the team of talented individuals in far off, exotic Ottawa.</p>
<p>More often that not bug reports would be greeted with a friendly post saying - &#8220;Thanks!  Try this and let me know if it fixes your problem!&#8221;, and you&#8217;d be downloading a binary straight from the desk of Real Live Kernel Engineer.</p>
<p>Ah, the thrill of finding hidden paths and filenames embedded in that debug binary.</p>
<p>What it must be like to be a PART of that select club, to be involved directly in the creation of the most successful micro-kernel RTOS out there&#8230;</p>
<p>Wouldn&#8217;t you want to be part of that?</p>
<p>Well, I&#8217;ve been there over 10 years now, and all I can say is&#8230; <a href="http://www.qnx.com" title="Wednesday">I can&#8217;t wait until Wednesday!!!!!</a></p>
<p>:-D</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/30/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/30/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=30&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/09/11/anticipation/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Help! I can&#8217;t debug!</title>
		<link>http://sendreceivereply.wordpress.com/2007/08/22/help-i-cant-debug/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/08/22/help-i-cant-debug/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 01:08:32 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/08/22/help-i-cant-debug/</guid>
		<description><![CDATA[I was just coming off of my holidays and thought that I should run a quick check of my mailbox to see what new and exciting things had transpired while I was away and blissfully ignorant of the comings and goings at the office.
What I found in my mailbox I found rather amusing.  I had [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I was just coming off of my <a target="_blank" href="http://www.poetscove.com/">holidays </a>and thought that I should run a quick check of my mailbox to see what new and exciting things had transpired while I was away and blissfully ignorant of the comings and goings at the office.</p>
<p>What I found in my mailbox I found rather amusing.  I had four separate requests for help in getting the <a target="_blank" href="http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/utilities/g/gdb.html">QNX debugger </a>up and running using the <a target="_blank" href="http://www.qnx.com/developers/docs/6.3.0SP3/ide_en/user_guide/about.html">IDE</a>. </p>
<p>I&#8217;m not doing (<em>much</em>) IDE development these days but these types of requests still manage to find their way to me because of my dogged insistance that I use our Momentics tools for all of my development and also because I think that <a target="_blank" href="http://heather.cs.ucdavis.edu/~matloff/UnixAndC/CLanguage/Debug.html"><em>printf</em>  debugging is for dinosaurs</a>.  If the IDE can&#8217;t get the job done for you, then we need to fix it so that it can &#8230; feel free to tell us so!</p>
<p>Anyway &#8230; back those e-mails.  They all were stating that they just couldn&#8217;t get the IDE debugger to work.  The platforms were all different (arm, sh, x86) and the environments were all different (Windows, Linux and Neutrino) but the problem was the same.  The application would launch, but the IDE debug session would fail with a cryptic connection error.</p>
<p>Why is this happening?  For most IDE services, the<a target="_blank" href="http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/utilities/q/qconn.html"> qconn target agent</a> is all that needs to be up and running.  However, the debugger <em>also </em>makes use of the <a target="_blank" href="http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/utilities/p/pdebug.html">pdebug debugger target </a>agent.  This is launched automatically for you when you start debugging. </p>
<p>&#8230; unless it isn&#8217;t. </p>
<p>The problem is that since the IDE is telling qconn to launch the pdebug program, pdebug needs to be in one of two places:</p>
<ul>
<li>Accessible via qconn&#8217;s PATH environment variable</li>
<li>Located in /usr/bin/pdebug</li>
</ul>
<p>If the pdebug debugger target agent can&#8217;t be launched, then the debug session will fail &#8230; and the resulting error message provides absolutely no indication of what is going on and why the debug session failed.</p>
<p>While this bit of information is <a target="_blank" href="http://www.qnx.com/developers/docs/6.3.0SP3/ide_en/user_guide/debug.html">recorded in the documentation</a> for the IDE, it isn&#8217;t the first thing you would find when things go wrong.</p>
<p>So &#8230; if debugging wasn&#8217;t working for you and you never understood why and flipped back to printf&#8217;s take a close look at your configuration (and/or make sure that pdebug is in /usr/bin) and try it again &#8230; I think you&#8217;ll like it!</p>
<p>Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=27&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/08/22/help-i-cant-debug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bleepin&#8217; Beeps!</title>
		<link>http://sendreceivereply.wordpress.com/2007/07/27/beepn-beeps/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/07/27/beepn-beeps/#comments</comments>
		<pubDate>Fri, 27 Jul 2007 18:09:37 +0000</pubDate>
		<dc:creator>colinburgess</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/07/27/beepn-beeps/</guid>
		<description><![CDATA[Ok, here you go.   I looked into the mystery that is devc-con, and I found a way to modify the beep.
The unfortunate side is that it only works if you are running devc-con in QNX mode, so you will either have to do that (by passing the -Q option) or suffer with the [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Ok, here you go.   I looked into the mystery that is devc-con, and I found a way to modify the beep.</p>
<p>The unfortunate side is that it only works if you are running devc-con in QNX mode, so you will either have to do that (by passing the -Q option) or suffer with the loud beeps (for now)</p>
<p>Ok, so go change your build file, and make sure your TERM env var is qnx</p>
<p>So we need to emit an escape sequence, which can be done thusly&#8230;</p>
<p># printf &#8220;%cs%c%c%c&#8221; 0&#215;1b, &lt;c1&gt;, &lt;c2&gt;, &lt;c3&gt;</p>
<p>Where c1 c2 and c3 are the parameters&#8230;</p>
<p>Here&#8217;s a snippet of the state machine&#8230;</p>
<pre name="code" class="cpp">

case STATE_QNX4_11:&nbsp;&nbsp;&nbsp;&nbsp; /* esc_beep_set */
s-&gt;beep_ticks = (c &lt;= ' ') ? 6 : c - ' ';
s-&gt;esc_flag = STATE_QNX4_12;
break;
case STATE_QNX4_12:
s-&gt;xpos = c - ' ';
s-&gt;esc_flag = STATE_QNX4_13;
break;
case STATE_QNX4_13:
n = (s-&gt;xpos % 192) + ((c - ' ') % 192) * 192;
if(!n)
s-&gt;beep_counter = 0x0606;
else
s-&gt;beep_counter = (n &amp;lt; 19) ? 0xffff :
(unsigned)(1193180L / (long)n);
break;
</pre>
<p>The default values for beep_ticks and beep_counter are 6 and 0&#215;0606, respectively.</p>
<p>I haven&#8217;t quite worked out the optimimum, but basically if you screw it up, the beep is gone anyways, so I&#8217;m alright with that.  You guys can have fun playing.</p>
<p>I&#8217;ll try and work a nobeep facility into the next version of devc-con.</p>
<p>Sorry this is brief, I&#8217;m running out of time today.  I&#8217;ll try and elaborate more on exactly WHAT these things mean later (or maybe Thomas will&#8230;)</p>
<p>Enjoy!</p>
<p>Colin</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/26/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/26/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/26/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/26/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/26/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=26&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/07/27/beepn-beeps/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/colinburgess-128.jpg" medium="image">
			<media:title type="html">colinburgess</media:title>
		</media:content>
	</item>
		<item>
		<title>Dog days of summer &#8230;</title>
		<link>http://sendreceivereply.wordpress.com/2007/07/13/dog-days-of-summer/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/07/13/dog-days-of-summer/#comments</comments>
		<pubDate>Fri, 13 Jul 2007 12:40:11 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/07/13/dog-days-of-summer/</guid>
		<description><![CDATA[So weeks go by and you&#8217;re probably thinking
What is up with those send receive reply guys? They haven&#8217;t posted anything in weeks!
True &#8230; it has been a few weeks, but we haven&#8217;t been idle.  There are exciting things a brew at QNX during the summer heat &#8230; air conditioning being one of them that tends [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>So weeks go by and you&#8217;re probably thinking</p>
<p><em>What is up with those send receive reply guys? They haven&#8217;t posted anything in weeks!</em></p>
<p>True &#8230; it has been a few weeks, but we haven&#8217;t been idle.  There are exciting things a brew at QNX during the summer heat &#8230; air conditioning being one of them that tends to only make sporadic appearances unfortunately.</p>
<p>One of the more interesting features that is has worked its way into the Neutrino kernel for the next release (slated for the not too distant future) is going to be the ability to report out the mapping of physical memory of a system to virtual addresses used by individual processes. </p>
<p><em>&#8220;But we live in a <a href="http://en.wikipedia.org/wiki/Virtual_address">virtual address world</a>&#8220;,  </em>you say &#8220;w<em>hy would we want a physical map of a systems memory</em>?&#8221;</p>
<p>That was certainly my first impression.  Particularly with the fact that you can get a complete virtual address mapping for a process using the <a href="http://en.wikipedia.org/wiki/Procfs">/proc filesystem </a>and the appropriate devctl() and the entries for &lt;sys/procfs.h&gt; and &lt;sys/debug.h&gt;, you should be able to paint a fairly complete memory story all using virtual address information.</p>
<p>Turns out that that isn&#8217;t quite the case.  You can get close, but there are still some missing details when it comes to how particular shared libraries and executables are mapped within other mapped areas (for example using <a target="_blank" href="http://www.qnx.com/developers/docs/momentics621_docs/neutrino/utilities/m/mkifs.html#XIPvsCopy">execute in place</a> within secondary <a href="http://www.qnx.com/developers/docs/momentics621_docs/neutrino/technotes/multiple.html">image file systems</a>).  Getting access to the physical address allows you to resolve that ambiguity quite nicely.</p>
<p>Also, while I mentioned in the <a target="_blank" href="http://sendreceivereply.wordpress.com/2007/06/04/fragmentation-meeting-rooms-and-memory-allocators/">article on fragmentation</a> (yes &#8230; we will get back to that issue =;-) that the OS nominally hands out memory uniformly in ~4K chunks, it does have the ability to fragment over time.  In general this isn&#8217;t a problem since the MMU for the processor provides the mapping giving you virtual continuity over fragmented physical memory.</p>
<p>Unless you need (or want) physically contiguous memory.  This can lead to improved performance in some device drivers that can leverage DMA and direct IO data transfers.  It is also a requirement by some tooling like the instrumented kernel, that arranges its data buffers as one contiguous ring.</p>
<p>The interface for extracting this additional memory information will be through the <a target="_blank" href="http://en.wikipedia.org/wiki/Procfs">/proc interface</a> and is a multi-stage procedure, but the fact that the information is now available is great news.  </p>
<p>Now all we need is a tool to showcase this new information &#8230; nothing like writing a handy utility to help beat the heat!</p>
<p> Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/25/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/25/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/25/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/25/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/25/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=25&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendreceivereply.wordpress.com/2007/07/13/dog-days-of-summer/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ditto &#8230; everyone&#8217;s favourite missing tool</title>
		<link>http://sendreceivereply.wordpress.com/2007/06/21/ditto-everyones-favourite-missing-tool/</link>
		<comments>http://sendreceivereply.wordpress.com/2007/06/21/ditto-everyones-favourite-missing-tool/#comments</comments>
		<pubDate>Thu, 21 Jun 2007 11:14:14 +0000</pubDate>
		<dc:creator>sendreceivereply</dc:creator>
		
		<category><![CDATA[QNX]]></category>

		<guid isPermaLink="false">http://sendreceivereply.wordpress.com/2007/06/21/ditto-everyones-favourite-missing-tool/</guid>
		<description><![CDATA[This week I&#8217;m celebrating my nine year anniversary working with QNX.  When I started at QNX the company was in the throes of a major product development effort to bring QNX 6/Neutrino to market as its next generation operating system with full support for processor families other than x86. 
When I started MIPS, PPC ports were well [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This week I&#8217;m celebrating my nine year anniversary working with QNX.  When I started at QNX the company was in the throes of a major product development effort to bring QNX 6/Neutrino to market as its next generation operating system with full support for processor families other than x86. </p>
<p align="left">When I started MIPS, PPC ports were well underway with ARM and SH support starting up.   I&#8217;m not an expert in any particular processor architecture, so I ended up working through a lot of the general system bugs and polishing some of the rough edges of this new OS.  By necessity this meant spending a lot of time interacting with the very active set of QNX developers, who at that time were steeped in QNX 4 knowledge and trying to migrate their systems and software to this new OS.   There are a lot of basic similarities between QNX 4 and QNX 6 but there are enough differences that migration wasn&#8217;t a zero effort affair, despite a fairly comprehensive software migration kit.</p>
<p>About once a month I&#8217;d receive a request from QNX4 developers:</p>
<blockquote><p><em>&#8220;When will ditto be ported to Neutrino?&#8221; </em></p></blockquote>
<p>Of course, the first time I heard this comment I was intrigued since <em><a target="_blank" href="http://www.qnx.com/developers/docs/qnx_4.25_docs/qnx4/utils/d/ditto.html">ditto</a></em> is not a standard *nix utility, so I thought I&#8217;d look into it.  It turned out that porting this particular utility (which provides terminal replication and remote terminal access) to Neutrino was going to take some signficiant work and more or less be an entire re-write since the utility took specific advantage of how QNX 4 character device drivers were written.  Under Neutrino the serial driver code was completely different,  so at the time I turned my focus to other areas where fixes could be made more short term with a plan to come back to do the ditto re-write.</p>
<p>Here we are, nine years later and there <a target="_blank" href="http://sendreceivereply.wordpress.com/about/">are still people asking for <em>ditto </em>for Neutrino</a><em>.</em> </p>
<p>Boy do I feel bad about never getting back to that work =;-(</p>
<p>Well since <em>I </em>still<em> </em>haven&#8217;t ported ditto yet, the first thing I&#8217;m going to do is suggest an alternative that may be a more mainstream solution in these days of Linux fervor.  The <a target="_blank" href="http://www.gnu.org/software/screen/screen.html">GNU Screen</a> utility provides much of the same terminal multiplexing and remote or shared control that ditto did.  The source compiles, with a few minor changes, out of the box for Neutrino. While I haven&#8217;t taken it for a full test drive yet, this looks like it might be the best immediate solution and maybe even long term since there are <a target="_blank" href="http://www.kuro5hin.org/story/2004/3/9/16838/14935">several screen resources</a> available in the community.</p>
<p>However, ditto ain&#8217;t totally dead yet.  The other day walking through our source tree on a related project I noticed that one of our aspiring developers has done some work to make some of the ditto remote monitoring (no interaction) capabilities available for Neutrino.  This is still internal goods, and not in the next OS release, but perhaps this article might nudge it along if there is some competition.</p>
<p>Thomas</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/sendreceivereply.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/sendreceivereply.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sendreceivereply.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sendreceivereply.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sendreceivereply.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sendreceivereply.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sendreceivereply.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sendreceivereply.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sendreceivereply.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sendreceivereply.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sendreceivereply.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sendreceivereply.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sendreceivereply.wordpress.com&blog=858631&post=24&subd=sendreceivereply&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sendrecei