<?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>MAC &#8211; swigger&#039;s BLOG</title>
	<atom:link href="https://www.swigger.net/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.swigger.net</link>
	<description>醉卧沙场君莫笑 古来征战几人回</description>
	<lastBuildDate>Sun, 08 Jan 2012 08:06:17 +0000</lastBuildDate>
	<language>zh-Hans</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>some notes for mac osx dev.</title>
		<link>https://www.swigger.net/2012/01/08/some-notes-for-mac-osx-dev/</link>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sun, 08 Jan 2012 08:06:17 +0000</pubDate>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[开发]]></category>
		<guid isPermaLink="false">http://www.swigger.net/?p=323</guid>

					<description><![CDATA[set install_name for dylib g++ -install_ &#8230; <a href="https://www.swigger.net/2012/01/08/some-notes-for-mac-osx-dev/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>set install_name for dylib<br />
g++ -install_name xxx.o -o xxx.dylib</p>
<p>view install_name:<br />
method1:   otool -L xxx.dylib         see the first row.</p>
<p>change install_name<br />
install_name_tool -change old.dylib  new.dylib  xxx.dylib</p>
<p>pack libs<br />
lipo -create a_32.dylib a_64.dylib -output  a.dylib</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>calling task_for_pid on MAC OS X</title>
		<link>https://www.swigger.net/2011/07/02/calling-task_for_pid-on-mac-os-x/</link>
					<comments>https://www.swigger.net/2011/07/02/calling-task_for_pid-on-mac-os-x/#comments</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 01 Jul 2011 19:41:40 +0000</pubDate>
				<category><![CDATA[MAC]]></category>
		<category><![CDATA[开发]]></category>
		<guid isPermaLink="false">http://www.swigger.net/?p=262</guid>

					<description><![CDATA[from mac 10.5 on, task_for_pid fails if  &#8230; <a href="https://www.swigger.net/2011/07/02/calling-task_for_pid-on-mac-os-x/">继续阅读 <span class="meta-nav">&#8594;</span></a>]]></description>
										<content:encoded><![CDATA[<p>from mac 10.5 on, task_for_pid fails if the calling process has no root privilege.</p>
<p>today I wrote a small app that needs this function, so I decided to make it run.</p>
<p>Finding out the web , I found the result.</p>
<p>There are something wrong or outdated on sites talk about it, so I wrote this article to helper those meet this problem.</p>
<p>Just follow these steps:</p>
<p>1. Find your .plist file in XCode and add a new entry &#8220;SecTaskAccess&#8221; and set it to string value &#8220;allowed&#8221;. Make sure the Info.plist file generated in your bundle actually has this value in it.</p>
<p>2. You need get a real code signing certificate NOT a self made one. Some websites are still talking making a self-signed certificate. This is outdated. An iphone certificate is OK while I think a MAC dev center certificate is better.</p>
<p>3. Make XCode sign the executable during the build process, or sign it yourself manually using the codesign command line utility.</p>
<p>4.Call the following method before making calls to task_for_pid()</p>
<p>[code lang=&#8221;cpp&#8221;]</p>
<p>#include &lt;Security/Authorization.h&gt;</p>
<p>int acquireTaskportRight()<br />
{<br />
OSStatus status;<br />
AuthorizationItem taskport_item = {&#8220;system.privilege.taskport&#8221;};<br />
AuthorizationRights rights = {1, &amp;taskport_item}, *out_rights = NULL;<br />
AuthorizationRef author;<br />
AuthorizationFlags authorizationFlags = kAuthorizationFlagExtendRights | kAuthorizationFlagPreAuthorize	|<br />
kAuthorizationFlagInteractionAllowed | (1 &lt;&lt; 5);<br />
status = AuthorizationCreate(NULL,   kAuthorizationEmptyEnvironment, authorizationFlags, &amp;author);<br />
if (status != errAuthorizationSuccess) {  return -1;  }<br />
status = AuthorizationCopyRights(author, &amp;rights, kAuthorizationEmptyEnvironment,<br />
authorizationFlags, &amp;out_rights);<br />
if (status != errAuthorizationSuccess) {  return -2;  }<br />
return 0;<br />
}</p>
<p>[/code]</p>
<p>NOTE:</p>
<p>If you&#8217;re writing a command-line tool which has no info.plist file, you should make one and add the following arguments to your link command:</p>
<p>-sectcreate __TEXT   __info_plist  Info.plist.file.path</p>
<div>where Info.plist.file.path is the path to the Info.plist file.</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.swigger.net/2011/07/02/calling-task_for_pid-on-mac-os-x/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
