<?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/"
	>

<channel>
	<title>Space Station Lambda &#187; Tech</title>
	<atom:link href="http://blog.viridian-project.de/sections/tech/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.viridian-project.de</link>
	<description>Leslie P. Polzer on code, music, literature, design and free software business.</description>
	<lastBuildDate>Wed, 19 May 2010 07:44:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Paktahn 0.9 released</title>
		<link>http://blog.viridian-project.de/2010/05/19/paktahn-0-9-released/</link>
		<comments>http://blog.viridian-project.de/2010/05/19/paktahn-0-9-released/#comments</comments>
		<pubDate>Wed, 19 May 2010 07:44:12 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[package manager]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[paktahn]]></category>
		<category><![CDATA[yaourt]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=235</guid>
		<description><![CDATA[It&#8217;s out! Major highlights: Support for AUR updates: pak -Su --aur Support for .tar.xz packages Support for custom Paktahn directory More details can be found on Brit&#8217;s blog. To upgrade or install just use the quick installer.]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s out!</p>
<p>Major highlights:</p>
<ul>
<li>Support for AUR updates: <code>pak -Su --aur</code></li>
<li>Support for .tar.xz packages</li>
<li>Support for custom Paktahn directory</li>
</ul>
<p>More details can be found on <a href="http://redlinernotes.com/blog/?p=1194">Brit&#8217;s blog</a>.</p>
<p>To upgrade or install just use the <a href="http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/">quick installer</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2010/05/19/paktahn-0-9-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paktahn 0.8.3 released</title>
		<link>http://blog.viridian-project.de/2010/01/24/paktahn-0-8-3-released/</link>
		<comments>http://blog.viridian-project.de/2010/01/24/paktahn-0-8-3-released/#comments</comments>
		<pubDate>Sun, 24 Jan 2010 20:28:37 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[package manager]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[paktahn]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=231</guid>
		<description><![CDATA[As a precursor to 0.9 which will contain much desired features like AUR system upgrades we decided to release 0.8.3 which contains a bunch of bug fixes: Version comparison no longer fails on provider packages (#8) Reinstallation works properly again (#7) Trying to install or get pkgbuilds for non-existent packages is handled correctly (#5 and [...]]]></description>
			<content:encoded><![CDATA[<p>As a precursor to 0.9 which will contain much desired features like AUR system upgrades we decided to release 0.8.3 which contains a bunch of bug fixes:</p>
<ul>
<li>Version comparison no longer fails on provider packages (#8)</li>
<li>Reinstallation works properly again (#7)</li>
<li>Trying to install or get pkgbuilds for non-existent packages is handled correctly (#5 and #6)</li>
<li>Question the user in case of malformed pkgbuild dependencies (#12)</li>
<li>Proxy support works correctly now (#15, reported by nitralime)</li>
<li>update cache after package removal (proposed by Ralith)</li>
<li>handle non-Unicode strings more gracefully (#9, reported by zajca)</li>
</ul>
<h3>Syncing up</h3>
<p>Use the <a href="http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/">quickinstall</a> script or sync your Paktahn repo to get it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2010/01/24/paktahn-0-8-3-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Paktahn 0.8.2 released</title>
		<link>http://blog.viridian-project.de/2010/01/10/paktahn-0-8-2-released/</link>
		<comments>http://blog.viridian-project.de/2010/01/10/paktahn-0-8-2-released/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 21:40:52 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Lisp]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=225</guid>
		<description><![CDATA[Merry christmas everyone! It must be christmas of course since Paktahn 0.8.2 is now out as promised! ;D As it often happens in software development it&#8217;s a little later than originally expected, but there&#8217;s a lot of good stuff that has made it into this release. Highlights fixed arch=(any) case (reported by magus) proper error [...]]]></description>
			<content:encoded><![CDATA[<p>Merry christmas everyone!</p>
<p>It must be christmas of course since Paktahn 0.8.2 is now out as promised! ;D</p>
<p>As it often happens in software development it&#8217;s a little later than originally expected, but there&#8217;s a lot of good stuff that has made it into this release.</p>
<h3>Highlights</h3>
<ul>
<li>fixed <code>arch=(any)</code> case (reported by magus)</li>
<li>proper error reporting and restarts when AUR results cannot be fetched (Brit)</li>
<li>Paktahn now remembers which PKGBUILD files it <strong>already presented for review</strong> (Brit)</li>
<li>Paktahn now has proper <strong>customizepkg support</strong> for AUR packages and will automatically build packages with customizepkg definitions from source (Brit)</li>
<li>support for just getting a pkgbuild (i.e. <strong>yaourt -G</strong>) with <code>pak -G pkgnames</code> (Brit)</li>
<li>makepkg&#8217;s PKGDEST variable is detected and used correctly (reported by Stefan Husmann)</li>
<li>AUR package <strong>dependencies are no longer installed explicitly</strong> (reported by bram85)</li>
<li>Basic <strong>proxy support</strong> (no authentication) (Brit)</li>
<li>Basic <strong>versioning support</strong> (Wei Hu, Leslie)</li>
</ul>
<p>Also, we no longer depend on a custom version of SBCL!</p>
<p>Thanks to Jürgen Hötzel, Wei Hu and of course my colleague Brit Butler for their help with this release.</p>
<h3>Syncing up</h3>
<p>Use the <a href="http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/">quickinstall</a> script or sync your Paktahn repo to get it.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2010/01/10/paktahn-0-8-2-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paktahn Quickinstaller</title>
		<link>http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/</link>
		<comments>http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 16:46:58 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[package manager]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[pacman.conf]]></category>
		<category><![CDATA[paktahn]]></category>
		<category><![CDATA[quickinstall]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[yaourt]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=217</guid>
		<description><![CDATA[Here&#8217;s a one-liner that will install Paktahn. It will add the Paktahn binary repository to /etc/pacman.conf and run Pacman to install Paktahn. wget -qO- http://viridian-project.de/\~sky/paktahn/quickinstall.sh &#124; sudo sh You just need to paste this line into a terminal. Review the script here, it&#8217;s very simple: http://viridian-project.de/~sky/paktahn/quickinstall.sh]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a one-liner that will install Paktahn.</p>
<p>It will add the Paktahn binary repository to /etc/pacman.conf and run Pacman to install Paktahn.</p>
<pre>
wget -qO- http://viridian-project.de/\~sky/paktahn/quickinstall.sh | sudo sh
</pre>
<p>You just need to paste this line into a terminal. Review the script here, it&#8217;s very simple:</p>
<p><a href="http://viridian-project.de/~sky/paktahn/quickinstall.sh">http://viridian-project.de/~sky/paktahn/quickinstall.sh</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/10/04/paktahn-quickinstaller/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Paktahn 0.8.1 released</title>
		<link>http://blog.viridian-project.de/2009/10/04/paktahn-0-8-1-released/</link>
		<comments>http://blog.viridian-project.de/2009/10/04/paktahn-0-8-1-released/#comments</comments>
		<pubDate>Sun, 04 Oct 2009 12:28:44 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Lisp]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[package]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[packages]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[pak]]></category>
		<category><![CDATA[paktahn]]></category>
		<category><![CDATA[speed]]></category>
		<category><![CDATA[yaourt]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=213</guid>
		<description><![CDATA[The next version of Paktahn is ready. Just sync-install your Paktahn package; rc testers will have to remove and reinstall explicitly. New users should refer to the original blog post for instructions. Changes Bug fixes * fixed x86_64 package building/installation * fixed case when $EDITOR also had args in it (e.g. &#8220;emacsclient -l&#8221;) * throw [...]]]></description>
			<content:encoded><![CDATA[<p>The next version of Paktahn is ready.</p>
<p>Just sync-install your Paktahn package; rc testers will have to remove and reinstall explicitly.</p>
<p>New users should refer to <a href="http://blog.viridian-project.de/2009/09/19/announcement-paktahn-a-successor-to-yaourt/">the original blog post</a> for instructions.</p>
<h2>Changes</h2>
<h3>Bug fixes</h3>
<p>  * fixed x86_64 package building/installation<br />
  * fixed case when $EDITOR also had args in it (e.g. &#8220;emacsclient -l&#8221;)<br />
  * throw an error when the user attempts to build an AUR package as root<br />
  * fixed &#8211;help and -h arguments (reported by Ralith)</p>
<h3>New features</h3>
<p>  * package <b>removal</b> support<br />
  * support for <b>provider packages</b><br />
  * support for <b>reinstallation</b> of packages<br />
  * ask the user whether he wants to add his arch if it&#8217;s not listed in the PKGBUILD.</p>
<h2>Comments?</h2>
<p>As usual please let me know of any bugs and your wishes.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/10/04/paktahn-0-8-1-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Paktahn 0.8.1 release candidate</title>
		<link>http://blog.viridian-project.de/2009/09/28/paktahn-0-8-1-release-candidate/</link>
		<comments>http://blog.viridian-project.de/2009/09/28/paktahn-0-8-1-release-candidate/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 15:12:05 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[arch linux]]></category>
		<category><![CDATA[package management]]></category>
		<category><![CDATA[package manager]]></category>
		<category><![CDATA[pacman]]></category>
		<category><![CDATA[paktahn]]></category>
		<category><![CDATA[yaourt]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=210</guid>
		<description><![CDATA[Hi folks, Paktahn 0.8.1 is ready but has only been tested by me, so here&#8217;s a prerelease for you to run and help find bugs: http://viridian-project.de/~sky/paktahn/rc/paktahn-0.8.1-1-i686.pkg.tar.gz Changes: * package removal support * support for provider packages * support reinstallation of packages * throw an error when the user attempts to build an AUR package as [...]]]></description>
			<content:encoded><![CDATA[<p>Hi folks,</p>
<p>Paktahn 0.8.1 is ready but has only been tested by me, so here&#8217;s a prerelease for you to run and help find bugs:</p>
<p><a href="http://viridian-project.de/~sky/paktahn/rc/paktahn-0.8.1-1-i686.pkg.tar.gz">http://viridian-project.de/~sky/paktahn/rc/paktahn-0.8.1-1-i686.pkg.tar.gz</a></p>
<p>Changes:</p>
<p>  * package removal support<br />
  * support for provider packages<br />
  * support reinstallation of packages<br />
  * throw an error when the user attempts to build an AUR package as root</p>
<p>You&#8217;ve already been very supportive with your feedback for 0.8! Thanks!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/09/28/paktahn-0-8-1-release-candidate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Announcement: Paktahn, a successor to yaourt</title>
		<link>http://blog.viridian-project.de/2009/09/19/announcement-paktahn-a-successor-to-yaourt/</link>
		<comments>http://blog.viridian-project.de/2009/09/19/announcement-paktahn-a-successor-to-yaourt/#comments</comments>
		<pubDate>Sat, 19 Sep 2009 07:24:51 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[Lisp]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=200</guid>
		<description><![CDATA[[This post is geared towards ArchLinux users. It might confuse you if you're not part of that audience.] yaourt, the popular Pacman wrapper, doesn&#8217;t seem to be maintained anymore and has quite some problems (e.g. UI nits, security issues, huge shell codebase). And people are starting to get tired of it because basic things stop [...]]]></description>
			<content:encoded><![CDATA[<p>[This post is geared towards ArchLinux users. It might confuse you if you're not part of that audience.]</p>
<p>yaourt, the popular Pacman wrapper, doesn&#8217;t seem to be maintained anymore and has quite some problems (e.g. UI nits, security issues, huge shell codebase). And people are starting to get tired of it because basic things <a href="http://aur.archlinux.org/packages.php?ID=5863">stop working</a>.</p>
<p>But since yaourt&#8217;s interface is so great I have decided to code up an alternative called Paktahn (after a ship type from Wing Commander).</p>
<p><a href="http://blog.viridian-project.de/wp-content/uploads/2009/09/paktahn.png"><img src="http://blog.viridian-project.de/wp-content/uploads/2009/09/paktahn-150x150.png" alt="Paktahn screenshot" /></a></p>
<h2>But what can it do?</h2>
<p>For now it supports yaourt&#8217;s two most helpful (IMHO) operation modes:</p>
<dl>
<dt>pak <em>query</em></dt>
<dd>Search AUR and repositories for QUERY in packages names and descriptions and display the results. Ask for one or more packages to be installed.</dd>
<dt>pak -S <em>package</em></dt>
<dd>Install PACKAGE from repositories or AUR.</dd>
</dl>
<p>Paktahn comes with a highly efficient caching system resulting in a speed that will blow your mind if you&#8217;re used to Pacman or yaourt.</p>
<p>I&#8217;ve been using  the current version of Paktahn for weeks now and it has never failed me.</p>
<h2>How to get it</h2>
<p>Add one of the following sections to your <em>pacman.conf</em>:</p>
<pre>
# i686
[paktahn]
Server = http://viridian-project.de/~sky/paktahn/repo

# x86_64, package contributed by Gour
[paktahn]
Server = http://viridian-project.de/~sky/paktahn/repo/x86_64
</pre>
<p><strike>There&#8217;s no x86_64 package yet since I cannot build them and no one else has contributed one yet.</strike> However you can build it from source: <a href="http://aur.archlinux.org/packages.php?ID=30242">Paktahn on AUR</a>. You need to install <a href="http://aur.archlinux.org/packages.php?ID=30055">a patched version of SBCL</a> before attempting to do so.</p>
<p>Development happens here: <a href="http://developer.berlios.de/projects/paktahn/">http://developer.berlios.de/projects/paktahn/</a></p>
<p>Discussion thread: <a href="http://bbs.archlinux.org/viewtopic.php?id=77674">http://bbs.archlinux.org/viewtopic.php?id=77674</a></p>
<p>Contributions, bug reports, comments and praise are all welcome, as are donations since I&#8217;m an independent software developer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/09/19/announcement-paktahn-a-successor-to-yaourt/feed/</wfw:commentRss>
		<slash:comments>28</slash:comments>
		</item>
		<item>
		<title>Whoops! Something went wrong. Please try refreshing the page.</title>
		<link>http://blog.viridian-project.de/2009/07/29/whoops-something-went-wrong-please-try-refreshing-the-page/</link>
		<comments>http://blog.viridian-project.de/2009/07/29/whoops-something-went-wrong-please-try-refreshing-the-page/#comments</comments>
		<pubDate>Wed, 29 Jul 2009 08:25:54 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Net Culture]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web engineering]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[jabber]]></category>
		<category><![CDATA[scala]]></category>
		<category><![CDATA[scalability]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wave]]></category>
		<category><![CDATA[xmpp]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=197</guid>
		<description><![CDATA[If you&#8217;re a Twitter user then chances are you&#8217;ve seen this message. Here&#8217;s a rant based on it. The Twitter web interface allows you to take a look at older tweets in bunches of about a twenty each. And every time you want to fetch a new batch you have to click on the large [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re a Twitter user then chances are you&#8217;ve seen this message. Here&#8217;s a rant based on it.</p>
<p>The Twitter web interface allows you to take a look at older tweets in bunches of about a twenty each. And every time you want to fetch a new batch you have to click on the large &#8220;more&#8221; button. Which in turn often brings up the message features in this blog post&#8217;s title.</p>
<p>I&#8217;m annoyed as hell by this of course, but it also gives me the opportunity for a little analysis that will end in the conclusion: <em>Twitter will fail</em> (unless they take some spoons of Tech Clue and change radically, that is).</p>
<p>What&#8217;s behind the little error message? You can&#8217;t really say for sure what happened, but since these errors occur pretty randomly it&#8217;s probably just that their servers are very busy right now.</p>
<p>Plus Twitter is notoriously known for having problems with scalability. For roughly the last two years, in fact. If you ask me they must be pretty clueless about scalability issues. To my knowledge their last action to solve this was to switch to another programming language (Scala). This approach seems to be motivated more by the name of the language than the actual benefit derived from switching to it. I don&#8217;t know if they have made the switch yet or whether they changed their strategy, but chances are their scalability problems won&#8217;t be solved at all with this.</p>
<p>The only thing that could cure their scalability worries would be a proper protocol for distributed twittering. There are suitable and proven distributed protocols like XMPP. You know, that&#8217;s the thing the Jabber instant messaging network is built on. And Google Wave too. This is quite a clue on the ability of Wave to supersede Twitter. Instead the latter ones are wasting their time with fruitless efforts. Come on!</p>
<p>This is made worse by the sheer simplicity of their application. I mean, in one of my projects I&#8217;m the sole developer of a complex game application. It&#8217;s understandable that I can&#8217;t be all things for all people, and scalability is just one of many problems. But what the hell are they doing all day at Twitter? They have 29 employees right now (source: TechCrunch)! Are they all busy keeping the list of top tweets fresh, or making Excel diagrams to please their VCs?</p>
<p>What&#8217;s your opinion on Twitter, scalability and the future of micro-blogging?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/07/29/whoops-something-went-wrong-please-try-refreshing-the-page/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>POSIX thread priority and policy handling in Common Lisp</title>
		<link>http://blog.viridian-project.de/2009/07/25/posix-thread-priority-and-policy-handling-in-common-lisp/</link>
		<comments>http://blog.viridian-project.de/2009/07/25/posix-thread-priority-and-policy-handling-in-common-lisp/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 12:05:47 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[cffi]]></category>
		<category><![CDATA[common lisp]]></category>
		<category><![CDATA[ffi]]></category>
		<category><![CDATA[posix]]></category>
		<category><![CDATA[pthreads]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=192</guid>
		<description><![CDATA[The POSIX threads interface allows user applications to manage scheduling policies and priorities. Certain threads can be made to wait in favor of other threads (priority), and the order of execution for threads of equal priority can be specified (policy). Below is a humble example interface to access this API. &#40;asdf:oos 'asdf:load-op 'cffi&#41; &#160; &#40;defpackage [...]]]></description>
			<content:encoded><![CDATA[<p>The POSIX threads interface allows user applications to manage scheduling policies and priorities. Certain threads can be made to wait in favor of other threads (priority), and the order of execution for threads of equal priority can be specified (policy).</p>
<p>Below is a humble example interface to access this API.</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #66cc66;">&#40;</span>asdf<span style="color: #66cc66;">:</span><span style="color: #555;">oos</span> 'asdf<span style="color: #66cc66;">:</span><span style="color: #555;">load-op</span> 'cffi<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>defpackage <span style="color: #66cc66;">:</span><span style="color: #555;">prio</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">use</span> <span style="color: #66cc66;">:</span><span style="color: #555;">cl</span> <span style="color: #66cc66;">:</span><span style="color: #555;">cffi</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>in-package <span style="color: #66cc66;">:</span><span style="color: #555;">prio</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">;;; constants</span>
<span style="color: #808080; font-style: italic;">;; CFFI-GROVEL offers a more reliable solution for this,</span>
<span style="color: #808080; font-style: italic;">;; but let's keep it simple.</span>
<span style="color: #66cc66;">&#40;</span>defconstant +sched_other+ <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defconstant +sched_fifo+ <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#40;</span>defconstant +sched_rr+ <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">;;; define the pthread library</span>
<span style="color: #66cc66;">&#40;</span>define-foreign-library libpthread
  <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">unix</span> <span style="color: #ff0000;">&quot;libpthread.so.0&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>use-foreign-library libpthread<span style="color: #66cc66;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">;;; C structures and functions</span>
<span style="color: #66cc66;">&#40;</span>defcstruct sched_param
  <span style="color: #66cc66;">&#40;</span>sched_priority <span style="color: #66cc66;">:</span><span style="color: #555;">int</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>defcfun <span style="color: #ff0000;">&quot;pthread_getschedparam&quot;</span> <span style="color: #66cc66;">:</span><span style="color: #555;">int</span>
  <span style="color: #66cc66;">&#40;</span>thread <span style="color: #66cc66;">:</span><span style="color: #555;">pointer</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>policy <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">pointer</span> <span style="color: #66cc66;">:</span><span style="color: #555;">int</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>param <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">pointer</span> sched_param<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>defcfun <span style="color: #ff0000;">&quot;pthread_setschedparam&quot;</span> <span style="color: #66cc66;">:</span><span style="color: #555;">int</span>
  <span style="color: #66cc66;">&#40;</span>thread <span style="color: #66cc66;">:</span><span style="color: #555;">pointer</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>policy <span style="color: #66cc66;">:</span><span style="color: #555;">int</span><span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>param <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">:</span><span style="color: #555;">pointer</span> sched_param<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">;;; Lisp interface</span>
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> get-thread-policy-and-priority <span style="color: #66cc66;">&#40;</span>thread<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>with-foreign-object <span style="color: #66cc66;">&#40;</span>policy-ptr <span style="color: #66cc66;">:</span><span style="color: #555;">int</span><span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span>with-foreign-object <span style="color: #66cc66;">&#40;</span>param-ptr 'sched_param<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span>* <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>result <span style="color: #66cc66;">&#40;</span>pthread-getschedparam <span style="color: #66cc66;">&#40;</span>make-pointer <span style="color: #66cc66;">&#40;</span>sb-thread<span style="color: #66cc66;">::</span><span style="color: #555;">thread-os-thread</span> thread<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                                            policy-ptr
                                            param-ptr<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span>policy <span style="color: #66cc66;">&#40;</span>mem-ref policy-ptr <span style="color: #66cc66;">:</span><span style="color: #555;">int</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
             <span style="color: #66cc66;">&#40;</span>prio <span style="color: #66cc66;">&#40;</span>foreign-slot-<span style="color: #b1b100;">value</span> param-ptr 'sched_param 'sched_priority<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>declare <span style="color: #66cc66;">&#40;</span>fixnum prio policy<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>values policy prio result<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> set-thread-policy-and-priority <span style="color: #66cc66;">&#40;</span>thread policy priority<span style="color: #66cc66;">&#41;</span>
  <span style="color: #66cc66;">&#40;</span>with-foreign-object <span style="color: #66cc66;">&#40;</span>param-ptr 'sched_param<span style="color: #66cc66;">&#41;</span>
    <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">setf</span> <span style="color: #66cc66;">&#40;</span>foreign-slot-<span style="color: #b1b100;">value</span> param-ptr 'sched_param 'sched_priority<span style="color: #66cc66;">&#41;</span> priority<span style="color: #66cc66;">&#41;</span>
      <span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">let</span> <span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#40;</span>result <span style="color: #66cc66;">&#40;</span>pthread-setschedparam <span style="color: #66cc66;">&#40;</span>make-pointer <span style="color: #66cc66;">&#40;</span>sb-thread<span style="color: #66cc66;">::</span><span style="color: #555;">thread-os-thread</span> thread<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
                                           policy
                                           param-ptr<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        <span style="color: #66cc66;">&#40;</span>declare <span style="color: #66cc66;">&#40;</span>fixnum result<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
        result<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #808080; font-style: italic;">;;; test</span>
<span style="color: #66cc66;">&#40;</span>format t <span style="color: #ff0000;">&quot;~A~%&quot;</span> <span style="color: #66cc66;">&#40;</span>multiple-value-<span style="color: #b1b100;">list</span> <span style="color: #66cc66;">&#40;</span>get-thread-policy-and-priority sb-thread<span style="color: #66cc66;">:</span>*current-thread*<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>format t <span style="color: #ff0000;">&quot;~A~%&quot;</span> <span style="color: #66cc66;">&#40;</span>set-thread-policy-and-priority sb-thread<span style="color: #66cc66;">:</span>*current-thread* +sched_fifo+ <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span>format t <span style="color: #ff0000;">&quot;~A~%&quot;</span> <span style="color: #66cc66;">&#40;</span>multiple-value-<span style="color: #b1b100;">list</span> <span style="color: #66cc66;">&#40;</span>get-thread-policy-and-priority sb-thread<span style="color: #66cc66;">:</span>*current-thread*<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span></pre></div></div>

<p>This is by no means a comprehensive solution. In particular POSIX only guarantees a minimum 32 distinct priority values, and the SCHED_OTHER policy doesn&#8217;t support non-zero priorities at all. As pointed out in <code>sched_setscheduler(2)</code> (man page for the Linux implementation of <code>sched_setscheduler</code>) the functions <code>sched_get_priority_min</code> and <code>sched_get_priority_max</code> should be used to check the priority range supported by a policy.</p>
<p>You will also note the tiny SBCL-specific bits. To port this to other implementations that use pthreads you need to find out how to get the pointer to the thread&#8217;s underlying <code>pthread_t</code> object.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/07/25/posix-thread-priority-and-policy-handling-in-common-lisp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SBCL: Getting started with mmap()</title>
		<link>http://blog.viridian-project.de/2009/07/24/sbcl-getting-started-with-mmap/</link>
		<comments>http://blog.viridian-project.de/2009/07/24/sbcl-getting-started-with-mmap/#comments</comments>
		<pubDate>Fri, 24 Jul 2009 08:44:46 +0000</pubDate>
		<dc:creator>Leslie</dc:creator>
				<category><![CDATA[Lisp]]></category>
		<category><![CDATA[files]]></category>
		<category><![CDATA[mmap]]></category>
		<category><![CDATA[sbcl]]></category>

		<guid isPermaLink="false">http://blog.viridian-project.de/?p=183</guid>
		<description><![CDATA[The POSIX mmap() system call provides a convenient way to access a file&#8217;s content. Basically you just tell the kernel that you want a specific file accessible in memory. This shifts the responsibility for efficient and organized file access from your application to the kernel. In the meantime you simply work with an in-memory array [...]]]></description>
			<content:encoded><![CDATA[<p>The POSIX mmap() system call provides a convenient way to access a file&#8217;s content.</p>
<p>Basically you just tell the kernel that you want a specific file accessible in memory.</p>
<p>This shifts the responsibility for efficient and organized file access from your application to the kernel. In the meantime you simply work with an in-memory array of the file&#8217;s contents.</p>
<p>SBCL provides access to this system call via its SB-POSIX package.</p>
<p>Here&#8217;s a small hands-on example using SB-POSIX:MMAP to read a few eight-bit characters from the beginning of my system&#8217;s fstab, which starts with this line:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># This file is edited by fstab-sync - see 'man fstab-sync' for details</span></pre></div></div>

<p>Let&#8217;s start with a basic convenience function in a file.</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">;;; mmap.lisp</span>
<span style="color: #66cc66;">&#40;</span>require <span style="color: #66cc66;">:</span><span style="color: #555;">sb-posix</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #66cc66;">&#40;</span><span style="color: #b1b100;">defun</span> mmap-file <span style="color: #66cc66;">&#40;</span>file-stream<span style="color: #66cc66;">&#41;</span>
  <span style="color: #ff0000;">&quot;Use mmap() to map FILE-STREAM into memory.&quot;</span>
  <span style="color: #66cc66;">&#40;</span>sb-posix<span style="color: #66cc66;">:</span><span style="color: #555;">mmap</span> <span style="color: #b1b100;">nil</span> <span style="color: #808080; font-style: italic;">; where to map (NIL if you don't care)?</span>
                 <span style="color: #66cc66;">&#40;</span>file-<span style="color: #b1b100;">length</span> file-stream<span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">; how much?</span>
                 sb-posix<span style="color: #66cc66;">:</span><span style="color: #555;">prot-read</span>
                 sb-posix<span style="color: #66cc66;">:</span><span style="color: #555;">map-shared</span>
                 <span style="color: #66cc66;">&#40;</span>sb-sys<span style="color: #66cc66;">:</span><span style="color: #555;">fd-stream-fd</span> file-stream<span style="color: #66cc66;">&#41;</span>
                 <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #808080; font-style: italic;">; offset into the file</span></pre></div></div>

<p>Now we load this file into a fresh SBCL session and work with it:</p>

<div class="wp_syntax"><div class="code"><pre class="lisp" style="font-family:monospace;">CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>load <span style="color: #ff0000;">&quot;mmap.lisp&quot;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">; loading system definition from</span>
<span style="color: #808080; font-style: italic;">; /home/sky/projects/lisp/sbcl.git/contrib/sb-grovel/sb-grovel.asd into</span>
<span style="color: #808080; font-style: italic;">; #&amp;lt;PACKAGE &quot;ASDF1&quot;&gt;</span>
<span style="color: #808080; font-style: italic;">; registering #&amp;lt;SYSTEM SB-GROVEL {AAC1E19}&gt; as SB-GROVEL</span>
T
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>mmap-file <span style="color: #66cc66;">&#40;</span>open <span style="color: #ff0000;">&quot;/etc/fstab&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#<span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#40;</span>SB-SYS<span style="color: #66cc66;">:</span><span style="color: #555;">INT-SAP</span> #XB7FD3000<span style="color: #66cc66;">&#41;</span>
<span style="color: #808080; font-style: italic;">;; This is just a 32-bit pointer to memory; keep it around.</span>
<span style="color: #808080; font-style: italic;">;; Note the readable representation, it's just a wrapped integer.</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>defparameter p *<span style="color: #66cc66;">&#41;</span>
&nbsp;
P
<span style="color: #808080; font-style: italic;">;; Let's convert this pointer to a so-called &quot;alien&quot;.</span>
<span style="color: #808080; font-style: italic;">;; See below for an explanation of what an alien is.</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>sap-alien p <span style="color: #66cc66;">&#40;</span>* char<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#<span style="color: #66cc66;">&amp;</span>lt<span style="color: #808080; font-style: italic;">;sb -ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB7FD3000 :TYPE (* (SIGNED 8))&gt;</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>defparameter myalien <span style="color: #66cc66;">&#40;</span>sap-alien p <span style="color: #66cc66;">&#40;</span>* char<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
MYALIEN
<span style="color: #808080; font-style: italic;">;; An alien is just a typed pointer, let's use DESCRIBE to take a look:</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">6</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>describe myalien<span style="color: #66cc66;">&#41;</span>
&nbsp;
#<span style="color: #66cc66;">&amp;</span>lt<span style="color: #808080; font-style: italic;">;SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #XB7FD3000 :TYPE (* (SIGNED 8))&gt;</span>
  <span style="color: #66cc66;">&#91;</span>structure-object<span style="color: #66cc66;">&#93;</span>
&nbsp;
Slots with <span style="color: #66cc66;">:</span><span style="color: #555;">INSTANCE</span> allocation<span style="color: #66cc66;">:</span>
  <span style="color: #555;">SAP</span>   <span style="color: #66cc66;">=</span> #<span style="color: #66cc66;">.</span><span style="color: #66cc66;">&#40;</span>SB-SYS<span style="color: #66cc66;">:</span><span style="color: #555;">INT-SAP</span> #XB7FD3000<span style="color: #66cc66;">&#41;</span>
  TYPE  <span style="color: #66cc66;">=</span> #<span style="color: #66cc66;">&amp;</span>lt<span style="color: #808080; font-style: italic;">;SB-ALIEN-INTERNALS:ALIEN-POINTER-TYPE (* (SIGNED 8))&gt;</span>
<span style="color: #808080; font-style: italic;">;; Now we're ready to access our memory-mapped file. Get the first octet:</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">7</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>deref myalien<span style="color: #66cc66;">&#41;</span>
&nbsp;
<span style="color: #cc66cc;">35</span>
<span style="color: #808080; font-style: italic;">;; Well, I'm not *that* good at ASCII...</span>
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">8</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #cc66cc;">35</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\#
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">9</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #66cc66;">&#40;</span>deref myalien <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #66cc66;">&#40;</span>deref myalien <span style="color: #cc66cc;">2</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\T
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">11</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #66cc66;">&#40;</span>deref myalien <span style="color: #cc66cc;">3</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\h
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">12</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #66cc66;">&#40;</span>deref myalien <span style="color: #cc66cc;">4</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\i
CL-USER<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">13</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">:</span> <span style="color: #66cc66;">&#40;</span>code-char <span style="color: #66cc66;">&#40;</span>deref myalien <span style="color: #cc66cc;">5</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
&nbsp;
#\s
<span style="color: #808080; font-style: italic;">;; Looks good.</span></pre></div></div>

<p>There are many knobs to fiddle with when you&#8217;re working with memory-mapped files. Read mmap(3P) to find out more.</p>
<p>Clozure CL also supports memory-mapped files, see the manual for details.</p>
<p>I hope this post helps newbies to get started with SB-POSIX and SB-ALIEN and helps them to see that it&#8217;s not as hard as it might look at first sight.</p>
<p>Sorry for the dodgy escaping of opening braces, WordPress sucks.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.viridian-project.de/2009/07/24/sbcl-getting-started-with-mmap/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
