<?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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>1n1r2&#039;s Fascinating Crawl</title>
	<atom:link href="http://1n1r2.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://1n1r2.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sat, 01 May 2010 19:10:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='1n1r2.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>1n1r2&#039;s Fascinating Crawl</title>
		<link>http://1n1r2.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://1n1r2.wordpress.com/osd.xml" title="1n1r2&#039;s Fascinating Crawl" />
	<atom:link rel='hub' href='http://1n1r2.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Minimal open source build for Windows</title>
		<link>http://1n1r2.wordpress.com/2009/12/10/minimal-open-source-build-for-windows/</link>
		<comments>http://1n1r2.wordpress.com/2009/12/10/minimal-open-source-build-for-windows/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 01:28:31 +0000</pubDate>
		<dc:creator>1n1r2</dc:creator>
				<category><![CDATA[Windows software]]></category>

		<guid isPermaLink="false">http://1n1r2.wordpress.com/?p=17</guid>
		<description><![CDATA[How to create a unix style build system on Windows.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=17&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Minimum open source development on Windows</h1>
<div><strong>Minimum</strong> &#8230; I like small things: <a href="http://www.tcl.tk/">TCL/Tk</a>, <a href="http://www.rebol.com/">Rebol</a>, <a href="http://en.wikipedia.org/wiki/REXX">Rexx</a>, <a href="http://kx.com/">K</a>, <a href="http://en.wikipedia.org/wiki/C_(programming_language)">C</a>, <a href="http://www.gnu.org/software/bash/">bash</a>, <a href="http://www.perforce.com/jam/jam.html">jam</a>, <a href="http://www.autoitscript.com/autoit3/">autoit</a>, <a href="http://users.ugent.be/~bpuype/wget/">wget</a>, <a href="http://www.tinyedit.com/">tinyedit</a>, <a href="http://en.wikipedia.org/wiki/Go_(game)">Go</a></div>
<div>This is a minimum tool set to deploy whiz-bang software tools on Windows:</div>
<ul>
<li><strong>Minimum GNU for Windows</strong> <a id="dgl2" title="Minimslist GNU for Windows" href="http://mingw.org/">(MinGW</a>) builds native Windows executables.</li>
<li><strong>Minimum System</strong> (Msys) is the build infrastructure</li>
</ul>
<p>There is a lot of churn on the web:  an all volunteer army, duplicate effort, conflicting information.<br />
After studying this for a week, this is the minumum effort to create a Windows build environment.</p>
<div>I have tested this on an  HP Netbook running Win7 Starter.</div>
<div>Here&#8217;s the receipe &#8230; I&#8217;ll provide justification for my choices later.</div>
<h2>Bare machine to Build (15 minutes)</h2>
<ol>
<li>Start command prompt &#8220;as administrator&#8221;<br />
On Win7, Start / All Programs / Accessories / Command Prompt<br />
Right-Click and choose &#8220;Run as administrator&#8221;<br />
<pre class="brush: plain; light: true;">
mkdir \Msys
cd    \Msys
</pre></li>
<li>Installation bootstrap tool:<br />
Use the browser to download <a id="wl18" title="wget.exe" href="http://users.ugent.be/~bpuype/cgi-bin/fetch.pl?dl=wget/wget.exe" target="_blank">wget.exe</a> 1.11.4 to <strong>C:\Msys</strong> (400K)<br />
Copy <strong>MinInstall.bat</strong> and <strong>MinInstall.html </strong>to C:\Msys</li>
<li>Back to the command prompt.<br />
<pre class="brush: plain; light: true;">
MinInstall.bat
</pre></li>
<li>Launch Msys using the desktop icon. Note forward slash (/).<br />
<pre class="brush: plain; light: true;">
cd C:/Msys/tcl8.5.8
configure
make
make install

cd ../tk8.5.8
configure
make
make install
</pre></li>
</ol>
<h2>MinInstall.bat</h2>
<p><pre class="brush: plain; collapse: true; light: false; toolbar: true; wrap-lines: false;">
@echo off
time /T
:: wget progress messages are displayed in command title line
  Path=C:\Msys\bin;%Path%
  mkdir C:\Msys\bin
  mkdir C:\Msys\.D
  chdir C:\Msys

:: Bootstrap the essential tools:  7-zip, bsdtar
   wget -P .D   &quot;http://sourceforge.net/projects/sevenzip/files/7-Zip/9.07 beta/7z907.exe/download&quot;
   echo &quot;Choose C:\Msys\7-Zip as the install directory
   pause
  .D\7z907.exe /SILENT /SP- /DIR=C:\Msys\7-Zip
   xcopy 7-Zip\7z.* bin\

::  Msys and MinGW required downloads
  wget -N -P .D -a .D\wget.log -B http://sourceforge.net/projects/mingw/files/ -i MinInstall.html
  7z.exe x -obin .D\bsdtar-2.7.900a_r1628-20091110-mingw32-alpha-bin.zip bsdtar.exe

:Install  MinGW into c:\_Msys
  bsdtar xzf  .D\binutils-2.20-1-mingw32-bin.tar.gz
  bsdtar xzf  .D\mingw-utils-0.4-1-mingw32-bin.tar.lzma
  bsdtar xzf  .D\gcc-core-4.4.0-mingw32-bin.tar.gz
  bsdtar xzf  .D\gcc-core-4.4.0-mingw32-dll.tar.gz
  bsdtar xzf  .D\libgmp-4.3.1-1-msys-1.0.11-dev.tar.lzma
  bsdtar xzf  .D\libgmp-4.3.1-1-msys-1.0.11-dll-3.tar.lzma
  bsdtar xzf  .D\gcc-full-4.4.0-mingw32-bin-2.tar.lzma   bin/cpp.exe bin/libgmp-3.dll
  bsdtar xzf  .D\libiconv-1.13.1-1-mingw32-bin.tar.lzma
  bsdtar xzf  .D\libiconv-1.13.1-1-mingw32-dev.tar.lzma
  bsdtar xzf  .D\libiconv-1.13.1-1-mingw32-dll-2.tar.lzma
  bsdtar xzf  .D\libintl-0.17-1-mingw32-dll-8.tar.lzma
  bsdtar xzf  .D\make-3.81-20090914-mingw32-bin.tar.gz
  bsdtar xzf  .D\mingwrt-3.17-mingw32-dev.tar.gz
  bsdtar xzf  .D\mingwrt-3.17-mingw32-dll.tar.gz
  bsdtar xzf  .D\mpfr-2.4.1-mingw32-dll.tar.gz
  bsdtar xzf  .D\pthreads-w32-2.8.0-mingw32-dll.tar.gz
  bsdtar xzf  .D\w32api-3.14-mingw32-dev.tar.gz

:: Msys packages
  .D\MSYS-1.0.11.exe /SILENT /SP- /SUPPRESSMSGBOXES /DIR=C:\Msys
  bsdtar xzf  .D\msysCORE-1.0.11-bin.tar.gz
  bsdtar xzf  .D\msysCORE-1.0.11-msys-1.0.11-base-bin.tar.lzma
  bsdtar xzf  .D\autoconf-7-1-mingw32-bin.tar.lzma
  bsdtar xzf  .D\automake-1.11-1-msys-1.0.11-bin.tar.lzma
  bsdtar xzf  .D\file-5.03-1-msys-1.0.11-bin.tar.lzma
  bsdtar xzf  .D\libltdl-2.2.7a-1-msys-1.0.11-dev.tar.lzma
  bsdtar xzf  .D\libltdl-2.2.7a-1-msys-1.0.11-dll-7.tar.lzma
  bsdtar xzf  .D\libmagic-5.03-1-msys-1.0.11-dev.tar.lzma
  bsdtar xzf  .D\libmagic-5.03-1-msys-1.0.11-dll-1.tar.lzma
  bsdtar xzf  .D\libregex-0.12-1-msys-1.0.11-dll-0.tar.lzma
  bsdtar xzf  .D\libregex-1.20090805-1-msys-1.0.11-dev.tar.lzma
  bsdtar xzf  .D\libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma
  bsdtar xzf  .D\man-1.6f-1-msys-1.0.11-bin.tar.lzma

:Opt  Optional packages
  bsdtar xzf  .D\bzip2-1.0.5-2-mingw32-bin.tar.gz
  bsdtar xzf  .D\bzip2-1.0.5-2-mingw32-dev.tar.gz
  bsdtar xzf  .D\cygutils-dos2unix-1.3.4-3-msys-1.0.11-bin.tar.lzma bin/d2u.exe bin/u2d.exe
  bsdtar xzf  .D\file-5.03-1-msys-1.0.11-bin.tar.lzma
  bsdtar xzf  .D\libmagic-5.03-1-msys-1.0.11-dev.tar.lzma
  bsdtar xzf  .D\libmagic-5.03-1-msys-1.0.11-dll-1.tar.lzma
  bsdtar xzf  .D\gdb-7.0-2-mingw32-bin.tar.gz
  bsdtar xzf  .D\locate-4.4.2-1-msys-1.0.11-bin.tar.lzma
  bsdtar xzf  .D\tar-1.22-1-msys-1.0.11-ext.tar.lzma
  bsdtar xzf  .D\vim-7.2-1-msys-1.0.11-bin.tar.lzma

  wget  -P bin &quot;http://www.tinyedit.com/tinyedit.exe&quot;
  rename  bin\tinyedit.exe t.exe

:Tcl
  mkdir .S
  wget    -P .S http://prdownloads.sourceforge.net/tcl/tcl8.5.8-src.tar.gz
  wget    -P .S http://prdownloads.sourceforge.net/tcl/tk8.5.8-src.tar.gz
  bsdtar xzf .S\tcl8.5.8-src.tar.gz
  bsdtar xzf .S\tk8.5.8-src.tar.gz
time /T
</pre></p>
<h2>MinInstall.html</h2>
<p><pre class="brush: plain; collapse: true; light: false; toolbar: true; wrap-lines: false;">
GCC%20Version%204/Current%20Release_%20gcc-4.4.0/gcc-4.4.0-mingw32-notes.txt/downloadGCC%20Version%204/Current%20Release_%20gcc-4.4.0/gcc-core-4.4.0-mingw32-bin.tar.gz/download
GCC%20Version%204/Current%20Release_%20gcc-4.4.0/gcc-core-4.4.0-mingw32-dll.tar.gz/download
GCC%20Version%204/Current%20Release_%20gcc-4.4.0/gcc-full-4.4.0-mingw32-bin-2.tar.lzma/download
GCC%20Version%204/Current%20Release_%20gcc-4.4.0/mpfr-2.4.1-mingw32-dll.tar.gz/download
GCC%20Version%204/Current%20Release_%20gcc-4.4.0/pthreads-w32-2.8.0-mingw32-dll.tar.gz/download
GNU%20Binutils/binutils-2.20/binutils-2.20-1-mingw32-bin.tar.gz/download
GNU%20Source-Level%20Debugger/GDB-7.0/gdb-7.0-2-mingw32-bin.tar.gz/download
MSYS%20Base%20System/msys-1.0.11/MSYS-1.0.11.exe/download
MSYS%20Base%20System/msys-1.0.11/msysCORE-1.0.11-bin.tar.gz/download
MSYS%20Base%20System/msys-1.0.11/msysCORE-1.0.11-msys-1.0.11-base-bin.tar.lzma/download
MSYS%20automake/automake-1.11-1/automake-1.11-1-msys-1.0.11-bin.tar.lzma/download
MSYS%20cygutils/cygutils-1.3.4-3/cygutils-dos2unix-1.3.4-3-msys-1.0.11-bin.tar.lzma/download
MSYS%20file/file-5.03-1/file-5.03-1-msys-1.0.11-bin.tar.lzma/download
MSYS%20file/file-5.03-1/libmagic-5.03-1-msys-1.0.11-dev.tar.lzma/download
MSYS%20file/file-5.03-1/libmagic-5.03-1-msys-1.0.11-dll-1.tar.lzma/download
MSYS%20findutils/findutils-4.4.2-1/locate-4.4.2-1-msys-1.0.11-bin.tar.lzma/download
MSYS%20gmp/gmp-4.3.1-1/libgmp-4.3.1-1-msys-1.0.11-dev.tar.lzma/download
MSYS%20gmp/gmp-4.3.1-1/libgmp-4.3.1-1-msys-1.0.11-dll-3.tar.lzma/download
MSYS%20libtool/libtool-2.2.7a-1/libltdl-2.2.7a-1-msys-1.0.11-dev.tar.lzma/download
MSYS%20libtool/libtool-2.2.7a-1/libltdl-2.2.7a-1-msys-1.0.11-dll-7.tar.lzma/download
MSYS%20libtool/libtool-2.2.7a-1/libtool-2.2.7a-1-msys-1.0.11-bin.tar.lzma/download
MSYS%20man/man-1.6f-1/man-1.6f-1-msys-1.0.11-bin.tar.lzma/download
MSYS%20regex/regex-0.12-1/libregex-0.12-1-msys-1.0.11-dll-0.tar.lzma/download
MSYS%20regex/regex-1.20090805-1/libregex-1.20090805-1-msys-1.0.11-dev.tar.lzma/download
MSYS%20tar/tar-1.22-1/tar-1.22-1-msys-1.0.11-ext.tar.lzma/download
MSYS%20vim/vim-7.2-1/vim-7.2-1-msys-1.0.11-bin.tar.lzma/download
MinGW%20API%20for%20MS-Windows/w32api-3.14/w32api-3.14-mingw32-dev.tar.gz/download
MinGW%20Runtime/mingwrt-3.17/mingwrt-3.17-mingw32-dev.tar.gz/download
MinGW%20Runtime/mingwrt-3.17/mingwrt-3.17-mingw32-dll.tar.gz/download
MinGW%20Utilities/basic%20bsdtar/bsdtar-2.7.900a_r1628-20091110/bsdtar-2.7.900a_r1628-20091110-mingw32-alpha-bin.zip/download
MinGW%20Utilities/mingw-utils/mingw-utils-0.4-1/mingw-utils-0.4-1-mingw32-bin.tar.lzma/download
MinGW%20autoconf/wrapper/autoconf-7-1/autoconf-7-1-mingw32-bin.tar.lzma/download
MinGW%20bzip2/release%201.0.5-2/bzip2-1.0.5-2-mingw32-bin.tar.gz/download
MinGW%20bzip2/release%201.0.5-2/bzip2-1.0.5-2-mingw32-dev.tar.gz/download
MinGW%20bzip2/release%201.0.5-2/libbz2-1.0.5-2-mingw32-dll-2.tar.gz/download
MinGW%20gettext/gettext-0.17-1/libintl-0.17-1-mingw32-dll-8.tar.lzma/download
MinGW%20libiconv/libiconv-1.13.1-1/libiconv-1.13.1-1-mingw32-bin.tar.lzma/download
MinGW%20libiconv/libiconv-1.13.1-1/libiconv-1.13.1-1-mingw32-dev.tar.lzma/download
MinGW%20libiconv/libiconv-1.13.1-1/libiconv-1.13.1-1-mingw32-dll-2.tar.lzma/download
MinGW%20make/make-3.81-20090914-mingw32/make-3.81-20090914-mingw32-bin.tar.gz/download
MinGW%20make/mingw32-make-3.81-2/mingw32-make-3.81-2.tar.gz/download
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1n1r2.wordpress.com/17/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1n1r2.wordpress.com/17/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1n1r2.wordpress.com/17/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=17&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://1n1r2.wordpress.com/2009/12/10/minimal-open-source-build-for-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88c7d48d90da87b3a845652f90ca0fd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1n1r2</media:title>
		</media:content>
	</item>
		<item>
		<title>Sometimes the crawl is uphill.</title>
		<link>http://1n1r2.wordpress.com/2009/09/11/test/</link>
		<comments>http://1n1r2.wordpress.com/2009/09/11/test/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 07:05:16 +0000</pubDate>
		<dc:creator>1n1r2</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://1n1r2.wordpress.com/2009/09/11/test/</guid>
		<description><![CDATA[<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=11&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://1n1r2.files.wordpress.com/2009/09/vmguy2.jpg"><img class="alignnone size-full wp-image-12" title="vmguy2" src="http://1n1r2.files.wordpress.com/2009/09/vmguy2.jpg?w=450" alt="vmguy2"   /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1n1r2.wordpress.com/11/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1n1r2.wordpress.com/11/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1n1r2.wordpress.com/11/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=11&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://1n1r2.wordpress.com/2009/09/11/test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88c7d48d90da87b3a845652f90ca0fd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1n1r2</media:title>
		</media:content>

		<media:content url="http://1n1r2.files.wordpress.com/2009/09/vmguy2.jpg" medium="image">
			<media:title type="html">vmguy2</media:title>
		</media:content>
	</item>
		<item>
		<title>GetHostByName</title>
		<link>http://1n1r2.wordpress.com/2009/09/09/gethostbyname/</link>
		<comments>http://1n1r2.wordpress.com/2009/09/09/gethostbyname/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 00:23:46 +0000</pubDate>
		<dc:creator>1n1r2</dc:creator>
				<category><![CDATA[Linux software]]></category>

		<guid isPermaLink="false">http://1n1r2.wordpress.com/?p=3</guid>
		<description><![CDATA[One of the oldest, deprecated unix network interface just refuses to die.
Modern code, written by people who should know better, continues to use this buggy, unreliable interface that is neither thread-safe nor thread-efficient.

So many surprising issues come up in the Linux environment trying to solve the problem, I decided to chronicle the adventure.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=3&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:center;"><em>Pardon me, I just crashed this party<br />
(or maybe the party crashed me).<br />
Could you point out the host and tell me her name?</em></p>
<p style="text-align:left;">I&#8217;m a couple of weeks into this project,  drowning myself in documentation and so I thought I better write this down somewhere before I forget.   Where is baseball first mentioned in the Bible?  Genesis 1:1  &#8220;In the big inning &#8230;&#8221;, so I&#8217;ll start at the beginning that I know.</p>
<p style="text-align:left;">Threads &#8230; that&#8217;s what started this about 1991 &#8230; more than one &#8220;thread of execution&#8221; running in a single process.  I was working at (not for) Sybase at the time where they were perfecting their database engine using hand-rolled, exquisitely crafted, user threads and maintaining state.   The other database products (Oracle, Informix, DB2) achieved scalability for multiple requests using multiple processes.</p>
<p style="text-align:left;">The overhead to communicate among those processes was heavy, but it solved the problem of &#8220;blocking system calls&#8221; which would serialize all of the concurrent calls.   So the first rule in Sybase was &#8220;no blocking system calls&#8221; &#8230; these had to be scheduled.</p>
<p style="text-align:left;">Fast forward to 1992 when Sun released their first multithreaded kernel. See Phil Harman&#8217;s <a title="Mini history of Solaris Threads" href="http://mediacast.sun.com/users/pgdh/media/ABHOS-rev0.2a-web.pdf" target="_blank">mini-history of Solaris</a>, page 8.</p>
<ul>
<li>
<div style="text-align:left;">1992 Solaris 2.0  threaded kernel</div>
</li>
<li>
<div style="text-align:left;">1993 Solaris 2.2 thr_create</div>
</li>
<li>
<div style="text-align:left;">1995 Solaris 2.5 pthread_create (Posix)</div>
</li>
</ul>
<p style="text-align:left;">Threads, signals, dynamic loaded libraries all converged about the same time.  The problem with gethostbyname() was that it was not &#8220;thread-safe&#8221;.  Two threads executing the system call at the same time would confuse the kernel and almost certainly crash the process.   Two methods of dealing with this class of system calls:</p>
<ul>
<li>
<div style="text-align:left;">wrap gethostbyname() with a mutex to prevent simultaneous execution by threads.</div>
</li>
<li>
<div style="text-align:left;">create a new class of reentrant system calls, gethostbyname_r() that would return data to the caller&#8217;s storage, to prevent threads from stepping on each other&#8217;s data.</div>
</li>
</ul>
<p style="text-align:left;">Not good enough.  The struct hostent data returned by gethostbyname contained pointers to kernel data, which would be stepped on by the next caller to the service.   The OS vendors decided they could make the original gethostbyname() thread-safe by wrapping the service in a more efficient kernel mutex.</p>
<p style="text-align:left;">Not so fast &#8230; this is struct hostent  ( /usr/include/netdb.h ) which is returned as a gethostbyname() pointer, or copied by gethostbyname_r() into the caller&#8217;s storage.</p>
<pre style="text-align:left;">struct _hostent {           /* netdb.h deep local copy */
    char   *h_name;         /* Official name of host.  */
    char  **h_aliases;      /* Alias list.             */
    int     h_addrtype;     /* Host address type.      */
    int     h_length;       /* Length of address.      */
    char  **h_addr_list;    /* List of addresses from name server.  */</pre>
<p style="text-align:left;">h_name, h_aliases, h__addr_list are all pointers &#8230; to kernel memory that gets re-used by the next gethostbyname() caller.</p>
<p style="text-align:left;">In order to preserve the returned results, the caller must do a &#8220;deep copy&#8221; of that data, and do so before gethostbyname gets called again.</p>
<p style="text-align:left;">Not only is this interface not thread-safe, it&#8217;s not thread-efficient and the data is not guaranteed.   What to do?  Posix deprecated this interface, and replaced it with system calls that are thread-safe, thread-efficient, and return data in heap storage which the caller is obliged to free, or a memory leak is produced.</p>
<p style="text-align:left;">There we have it;  problem solved;  a new interface to obtain this information that everyone can use.   So what&#8217;s the purpose of this blog?</p>
<p style="text-align:left;">The problem, of course, is that the application providers of libraries are not exactly in a hurry to rewrite their code, make sure these new interfaces are available on all the platforms they support, and tested.  They weren&#8217;t in a hurry to use the so-called &#8220;reentrant&#8221; form of the system call either, especially when the vendors let them off the hook and declared it &#8220;thread-safe&#8221;.</p>
<p style="text-align:left;">Tested?  Are these applications actually being stress tested?  The apps are getting the wrong answers, so what is the purpose of using these deprecated interfaces at all.</p>
<p style="text-align:left;">I think the answer is that the applications are not crashing, just making randomly wrong decisions based on faulty data.</p>
<p style="text-align:left;">I still don&#8217;t get it &#8230; these applications have been failing since 1992, so what is the interest in fixing it now?</p>
<p style="text-align:left;">Old third-party libraries for database clients, ldap, etc are causing problems for the large applications I support with hundreds and thousands of concurrent users.   I do not have source for these proprietary commercial libraries, so I can&#8217;t fix them directly.</p>
<h3 style="text-align:left;">Symptoms of failure:</h3>
<ul>
<li>
<div style="text-align:left;">100% thread cpu usage on Linux; the application becomes unresponsive and needs to be forcibly restarted.</div>
</li>
<li>
<div style="text-align:left;">Thread blocks on AIX, which eventually clear, but the user experience is dreadful response time</div>
</li>
<li>
<div style="text-align:left;">Other unix vendors experience unexplained performance delays</div>
</li>
</ul>
<p style="text-align:left;">Solving this problem on Linux is the focus of this thread.<br />
I  know, I know &#8230;  I have to edit this, apologies if you&#8217;re reading it before I got a-round-tuit.</p>
<p style="text-align:left;"><em>&#8220;Je n&#8217;ai fait celle-ci plus longue que parceque je n&#8217;ai pas eu le loisir de la faire plus courte.&#8221; Pascal. Lettres provinciales, 16, Dec.14,1656.</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/1n1r2.wordpress.com/3/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/1n1r2.wordpress.com/3/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/1n1r2.wordpress.com/3/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=1n1r2.wordpress.com&amp;blog=9391832&amp;post=3&amp;subd=1n1r2&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://1n1r2.wordpress.com/2009/09/09/gethostbyname/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/88c7d48d90da87b3a845652f90ca0fd8?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">1n1r2</media:title>
		</media:content>
	</item>
	</channel>
</rss>
