<?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>tlrobinson.net / blog &#187; Music</title>
	<atom:link href="http://tlrobinson.net/blog/category/music/feed/" rel="self" type="application/rss+xml" />
	<link>http://tlrobinson.net/blog</link>
	<description></description>
	<lastBuildDate>Mon, 06 Apr 2009 08:37:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='tlrobinson.net' port='80' path='/blog/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Overriding library functions in Mac OS X, the easy way: DYLD_INSERT_LIBRARIES</title>
		<link>http://tlrobinson.net/blog/2007/12/21/overriding-library-functions-in-mac-os-x-the-easy-way-dyld_insert_libraries/</link>
		<comments>http://tlrobinson.net/blog/2007/12/21/overriding-library-functions-in-mac-os-x-the-easy-way-dyld_insert_libraries/#comments</comments>
		<pubDate>Fri, 21 Dec 2007 09:31:19 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[GCC]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://tlrobinson.net/blog/?p=30</guid>
		<description><![CDATA[Back at MacHack 2003 Jonathan Rentzsch talked about how to override functions and inject code in Mac OS X using several neat tricks. He also released a framework called mach_star which has two components: mach_override and mach_inject. These are great, but overkill for some simple cases.

A much easier way of doing library function overrides is [...]]]></description>
			<content:encoded><![CDATA[<p>Back at MacHack 2003 Jonathan Rentzsch talked about how to override functions and inject code in Mac OS X using <a href="http://rentzsch.com/papers/overridingMacOSX">several neat tricks</a>. He also released a framework called <a href="http://rentzsch.com/mach_star/">mach_star</a> which has two components: mach_override and mach_inject. These are great, but overkill for some simple cases.</p>

<p>A much easier way of doing library function overrides is using the DYLD_INSERT_LIBRARIES environment variable (analogous to LD_PRELOAD on Linux). The concept is simple: at load time the dynamic linker (dyld) will load any dynamic libraries specified in DYLD_INSERT_LIBRARIES before any libraries the executable wants loaded. By naming a function the same as one in a library function it will override any calls to the original.</p>

<p>The original function is also loaded, and can be retrieved using the dlsym(RTLD_NEXT, &#8220;function_name&#8221;); function. This allows a simple method of wrapping existing library functions.</p>

<p>Here&#8217;s a simple example which prints out the path of every file opened using the &#8220;fopen&#8221; function (lib_overrides.c):</p>

<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#683821;">#include &lt;stdio.h&gt;<br />
#include &lt;unistd.h&gt;<br />
#include &lt;dlfcn.h&gt;<br />
</span><br />
<span style="color:#236e25;">// for caching the original fopen implementation<br />
</span>FILE * (*original_fopen) (<span style="color:#881350;">const</span> <span style="color:#881350;">char</span> *, <span style="color:#881350;">const</span> <span style="color:#881350;">char</span> *) = <span style="color:#881350;">NULL</span>;<br />
<br />
<span style="color:#236e25;">// our fopen override implmentation<br />
</span>FILE * <span style="color:#003369;">fopen</span>(<span style="color:#881350;">const</span> <span style="color:#881350;">char</span> * filename, <span style="color:#881350;">const</span> <span style="color:#881350;">char</span> * mode)<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// if we haven&#8217;t already, retrieve the original fopen implementation<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">if</span><span style="color:#003369;"> </span>(!original_fopen)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;original_fopen = <span style="color:#003369;">dlsym</span>(RTLD_NEXT, <span style="color:#760f15;">&quot;fopen&quot;</span>);<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// do our own processing; in this case just print the parameters<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#003369;">printf</span>(<span style="color:#760f15;">&quot;== fopen: {%s,%s} ==\n&quot;</span>, filename, mode);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// call the original fopen with the same arugments<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;FILE* f = <span style="color:#003369;">original_fopen</span>(filename, mode);<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#236e25;">// return the result<br />
</span>&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">return</span> f;<br />
}</div>

<p>And a simple test program (overrides_test.c):</p>

<div style="text-align:left;color:#000000; background-color:#ffffff; border:solid black 1px; padding:0.5em 1em 0.5em 1em; overflow:auto;font-size:small; font-family:monospace; "><span style="color:#683821;">#include &lt;stdio.h&gt;<br />
#include &lt;string.h&gt;<br />
</span><br />
<span style="color:#881350;">int</span> <span style="color:#003369;">main</span>(<span style="color:#881350;">int</span> argc, <span style="color:#881350;">char</span> <span style="color:#881350;">const</span> *argv[])<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">char</span> hello[] = <span style="color:#760f15;">&quot;hello world&quot;</span>;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;FILE *fp = <span style="color:#003369;">fopen</span>(<span style="color:#760f15;">&quot;hello.txt&quot;</span>, <span style="color:#760f15;">&quot;w&quot;</span>);<br />
&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">if</span><span style="color:#003369;"> </span>(fp) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#003369;">fwrite</span>(hello, <span style="color:#0000ff;">1</span>, <span style="color:#003369;">strlen</span>(hello), fp);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#003369;">fclose</span>(fp);<br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:#881350;">return</span> <span style="color:#0000ff;">0</span>;<br />
}</div>

<p>Compiled and tested:</p>

<pre><code>tlrobinson$ gcc -Wall -o lib_overrides.dylib -dynamiclib lib_overrides.c
tlrobinson$ gcc -Wall -o overrides_test overrides_test.c
tlrobinson$ DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=lib_overrides.dylib overrides_test
== fopen: {hello.txt,w} ==
tlrobinson$
</code></pre>

<p>There are certainly scenarios far more interesting than this, though!</p>
]]></content:encoded>
			<wfw:commentRss>http://tlrobinson.net/blog/2007/12/21/overriding-library-functions-in-mac-os-x-the-easy-way-dyld_insert_libraries/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Warped Tour &#8211; Ventura (and my first iPhone camera photos)</title>
		<link>http://tlrobinson.net/blog/2007/07/02/warped-tour-ventura-and-my-first-iphone-camera-photos/</link>
		<comments>http://tlrobinson.net/blog/2007/07/02/warped-tour-ventura-and-my-first-iphone-camera-photos/#comments</comments>
		<pubDate>Mon, 02 Jul 2007 08:11:53 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Music]]></category>
		<category><![CDATA[iPhone]]></category>

		<guid isPermaLink="false">http://tlrobinson.net/blog/?p=12</guid>
		<description><![CDATA[I drove out to Ventura on Saturday to see my friend Jon who is on the Warped Tour doing some promotion for Capitol Records and absolutepunk.net. The drive there was ridiculous&#8230; about 3 hours from Los Angeles to Ventura (only about 60 miles), as was parking (I ended up parking a mile away and walking) [...]]]></description>
			<content:encoded><![CDATA[<p>I drove out to Ventura on Saturday to see my friend Jon who is on the Warped Tour doing some promotion for Capitol Records and <a href="http://www.absolutepunk.net">absolutepunk.net</a>. The drive there was ridiculous&#8230; about 3 hours from Los Angeles to Ventura (only about 60 miles), as was parking (I ended up parking a mile away and walking) but I got there just in time to see one of my favorite bands from my high school days, <a href="http://www.thematches.com/">The Matches</a>. Last time I saw them was two years ago on the same stage at Warped Tour, which was cool. I also saw New Found Glory and Bad Religion, which were both great.</p>

<p>I also got a chance to test out (and show off) my iPhone. It was great for getting directions, figuring out where the hell I was, checking out traffic (which as I mentioned, was awful), and taking photos&#8230;</p>

<p>Here are a few photos from the day:</p>

<p><a href="http://www.flickr.com/photos/tomrobinson/692677470/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1265/692677470_9a50f39d54.jpg" width="375" height="500" alt="IMG_0002.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/692707182/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1009/692707182_f0efe2d87f.jpg" width="500" height="375" alt="IMG_0049.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/691835323/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1262/691835323_49cef7420f.jpg" width="500" height="375" alt="IMG_0041.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/691831829/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1028/691831829_927085c887.jpg" width="500" height="375" alt="IMG_0036.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/692695450/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1282/692695450_85557d96ab.jpg" width="375" height="500" alt="IMG_0031.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/691827113/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1352/691827113_6cf329fc2c.jpg" width="375" height="500" alt="IMG_0028.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/691820147/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1295/691820147_7c7e3a6dec.jpg" width="500" height="375" alt="IMG_0018.JPG" /></a></p>

<p><a href="http://www.flickr.com/photos/tomrobinson/691841879/" title="Photo Sharing"><img src="http://farm2.static.flickr.com/1189/691841879_d75c2b7287.jpg" width="375" height="500" alt="IMG_0051.JPG" /></a></p>

<p>As you can see, the iPhone camera is quite good for a cell phone. The resolution isn&#8217;t high (2 megapixels), but it&#8217;s perfectly fine for photos destined for the web.</p>

<p>At first I took mostly portrait oriented photos, even when landscape would have been better. Once I realized I could take landscape photos I switched, although it was a little awkward holding the camera in landscape orientation without covering the lens.</p>

<p>I assumed iTunes would somehow transfer photos I took on the iPhone back to my computer, but it does not. To do that, you must use an application like iPhoto, Graphic Converter, or the free Image Capture application included with Mac OS X.</p>
]]></content:encoded>
			<wfw:commentRss>http://tlrobinson.net/blog/2007/07/02/warped-tour-ventura-and-my-first-iphone-camera-photos/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Concert: Most of &#8220;The New Deal&#8221; with part of &#8220;STS9&#8243; @ The Knitting Factory</title>
		<link>http://tlrobinson.net/blog/2007/05/17/the-new-deal-and-sts9-the-knitting-factory/</link>
		<comments>http://tlrobinson.net/blog/2007/05/17/the-new-deal-and-sts9-the-knitting-factory/#comments</comments>
		<pubDate>Thu, 17 May 2007 19:26:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Music]]></category>

		<guid isPermaLink="false">http://tlrobinson.net/blog/?p=9</guid>
		<description><![CDATA[Taking a little break from the normal geek stuff, last night the Canadian electronica jam band The New Deal, with the bassist from Sound Tribe Sector 9, played at the Knitting Factory in Hollywood and were awesome! I had never seen them live before, so my friends Kevin and Ariana (who introduced us to them) [...]]]></description>
			<content:encoded><![CDATA[<p>Taking a little break from the normal geek stuff, last night the Canadian electronica jam band <a href="http://www.thenewdeal.com">The New Deal</a>, with the bassist from <a href="http://www.sts9.com">Sound Tribe Sector 9</a>, played at the <a href="http://knittingfactory.com">Knitting Factory</a> in Hollywood and were awesome! I had never seen them live before, so my friends Kevin and Ariana (who introduced us to them) decided to go, and we&#8217;re glad we did.</p>

<p>These guys put tons of their <a href="http://www.archive.org/details/TheNewDeal">sets on archive.org</a>. Check it out if you&#8217;re into electronic music, or even if you&#8217;re not.</p>
]]></content:encoded>
			<wfw:commentRss>http://tlrobinson.net/blog/2007/05/17/the-new-deal-and-sts9-the-knitting-factory/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
