tag:blogger.com,1999:blog-323104442023-11-15T20:30:18.792+05:30Solaris KidTech Blabber ...
A lil of this and a lil of that as they come alongAnonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-32310444.post-6009378347805617382007-05-02T22:51:00.000+05:302007-05-02T23:11:16.173+05:30SSH TunnelsSSH allows us to play some tricks with the local ports and enable ssh tunnels for port forwarding. This allows for some nifty tricks in restricted corporate environments, to access the real world wide web and nothing else ofcourse.<br /><br />There is small nuance while configuring ssh tunnels. The tunnels are bound to the localhost:portnum. Now trying to access localhost_ip:portnum doesnt resolve to the same port (remember a port is always referred to as a combination of ip+portnum).<br /><br />127.0.0.1:605 = localhost:605 != localhost_ip:605<br /><br />This is because [ man ssh(1) ] while doing port forwarding<br /><pre><br /> -L port:host:hostport<br /> Specifies that the given port on the local (client) host<br /> is to be forwarded to the given host and port on the<br /> remote side. This works by allocating a socket to listen<br /> to the port on the local side. Then, whenever a connec-<br /> tion is made to this port, the connection is forwarded<br /> over the secure channel and a connection is made to host<br /> port hostport from the remote machine. Port forwardings<br /> can also be specified in the configuration file...<br /></pre><br /><br />Now what if you want to use the localhost_ip:port instead then [ man ssh(1) ]<br /><pre><br /> -g<br /> Allows remote hosts to connect to local forwarded ports.<br /></pre><br /><br />Chillax... Have funAnonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com1tag:blogger.com,1999:blog-32310444.post-4797759381268497012007-04-26T10:59:00.000+05:302007-04-26T11:06:02.400+05:30Some OpenSolaris Annoyances1) There is no -R option in most of the basic shell utilities. Yeah I know I can always download the gnu equivalent too.<br />2) 64 bit libraries are placed in <libpath>/lib/am64. This is crappy especially when you are compiling from source and most configures would expect the libpath to end at <libpath>/lib<br />3) Too man locations for libs and binaries. We have /usr/[bin,lib] /usr/local/[bin,lib] /opt/csw/[bin,lib] /usr/sfw/[bin,lib]. Worse most of them are not included in the path by default, we need to set them up.<br />4) Compilations on 64 bit systems dont generate 64bit binaries by default<br />5) Even the Sun Studio compilers use dumb options for default... remember stlport. Comeon guys.<br /><br />Maybe we are sacrificing a lot for ensuring backward compatibility. At the end of the day we need to assure that we have a easily usable system.<br /><br />Note: Binary compatility rocks but maintaining everything just doesnt seem to make sense. After all how many people use Solaris 7 binaries on Solaris 10.Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-3834199287086088522007-04-03T01:51:00.000+05:302007-04-04T11:55:35.565+05:30OpenSolaris Custom Search EngineSitting idle I just went ahead and created a custom search engine for <a href="http://opensolaris.org">OpenSolaris</a> on the <a href="http://google.com/coop">Google Co-op website</a><br /><br /><a href="http://google.com/coop/cse?cx=012886971415044075467%3Adwfahvt73u4">OpenSolaris Custom Search</a><br /><br />I've just added some 17 sites that I find useful for my solaris problems. Will add more as I go along and if I get some inputs from anyone.<br /><br />CheersAnonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-74268057108191613272007-03-29T01:47:00.000+05:302007-05-02T23:04:26.959+05:30boosting your c++ apps<span style="font-family:arial;">Boost seems to be the answer to most of my prayers when it comes to getting some extended C++ help. But there is one thing that is totally unknown to me and that is how to understand "bjam". Now I was trying to compile boost on a 64bit system and by default the compilation results in 32bit shared objects. Tried high and low to search for someone who managed to get it compiled in 64bit but well I couldnt, maybe because boost shows up as something else on google :)</span><br /><br /><span style="font-family:arial;">Anyways here is the simple way to do it.</span><br /><pre><br />(get into the tools/build/jam_src dir)<br />./build.sh<br />(go back to the boost home dir)<br />./tools/build/jam_src/bin.solarisx86/bjam -sTOOLS="gcc" -sBUILD=" < cxxflags > -m64 < linkflags > -m64"<br /></pre><br /><br />Now if you want to go ahead and use the sun studio compilers you need to do this<br /><pre><br />(get into the tools/build/jam_src dir)<br />./build.sh sunpro<br />(go back to the boost home dir)<br />./tools/build/jam_src/bin.solaris/bjam -sBUILD=" < threading > multi < runtime-link > dynamic <br> < cxxflags > -xarch=native64" -sTOOLS="sunpro"<br />-sSUNPRO_CXX="/opt/SUNWspro/bin/CC -library=stlport4 -xarch=native64" <br> -sSUNPRO_ROOT_DIRECTORY="/opt/SUNWspro/"</cxxflags></runtime-link></threading><br /></pre><br /><br />Now you should have a working 64bit copy of all the boost libraries.Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.comtag:blogger.com,1999:blog-32310444.post-1577331311458028282007-03-28T23:07:00.000+05:302007-03-28T23:09:53.425+05:30Opensolaris installed. What next?<div> </div> <div>Done with the solaris installation and want to play around now. Here are some of the sites that I use to learn more about my favourite OS.</div> <div> </div> <div><a href="http://developers.sun.com/sunstudio/articles/amd64_migration.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://developers.sun.com<wbr>/sunstudio/articles/amd64<wbr>_migration.html</a> - tips on migrating code from x86 to x64 and some tips on moving from gcc to sunstudio </div> <div><a href="http://blogs.sun.com/rie/date/20061219" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://blogs.sun.com/rie/date<wbr>/20061219</a> - on why ld cant exactly locate _init and _fini</div> <div><a href="http://blogs.sun.com/sga/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://blogs.sun.com/sga/</a> - tips and tricks for getting boost c++ libs going</div> <div><a href="http://forum.java.sun.com/thread.jspa?threadID=5075258&messageID=9274275" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://forum.java.sun.com<wbr>/thread.jspa?threadID=5075258<wbr>&messageID=9274275</a> - getting started with dtrace on available binaries </div> <div><a href="http://prefetch.net/articles/dtracecookbook.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://prefetch.net/articles<wbr>/dtracecookbook.html</a> - collection mechanisms/tools and what do they exactly display</div> <div><a href="http://blogs.sun.com/brendan/" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://blogs.sun.com/brendan/</a> - brendan gregg's cool dtrace toolbox and all his other gyan on zones, zfs and more</div> <div><a href="http://solaris.reys.net/english/categories/3-DTrace/P4.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://solaris.reys.net<wbr>/english/categories/3-DTrace<wbr>/P4.html</a> - cool dtrace guy with some nift tricks other than those from Brendan Gregg<br /><br /><br /> </div>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-31020402346198773432007-03-20T09:51:00.000+05:302007-03-21T09:51:02.496+05:30Yippe Yaah!!Ian Murdoch, the founder of the extremely popular Debian system, <a href="http://ianmurdock.com/2007/03/19/joining-sun/">has just picked up an offer from Sun Microsystems</a>. He will be joining them towards aligning the strategy of the company towards fighting the competitive edge that linux has ( and yes it does have an edge on things like drivers and usability features ). Maybe fighting is not the right word but aligning is.<br /><br /><a href="http://ianmurdock.com/?p=278">Ian has been supportive of the Debian/Ubuntu packaged OpenSolaris distro -Nexenta</a> and has giving his reasoning on his blog. He essentially beleives that open source under any license serves the end goal of being better for the community eventually. Ofcourse the blinded and half baked comments of the so called Linux gurus on his site show how much people are blinded by their incomplete facts based faith.<br /><br />There's no doubt that he is good, the bonus is that he has a soft spot for Sun too. And the fact that Sun is actually hiring such a guy shows that Sun is really fighting hard to make sure it understands all the aspects of the open source game and Ian is just the right kinda person to help.Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-20298355562618546712007-02-28T22:51:00.000+05:302007-03-02T09:21:38.681+05:30some nagging c++ questionsC++ always has some tricks in there that you just don't know about. Here are a couple of features/issues that I've run into. Am sure this list is pretty huge but lets start with three of them and my explanations for the same.<br /><span style="font-style: italic;"><br /><br />a) using "using namespace" in your header files</span><br /><br />I was once asked why I go ahead and take the trouble to do a std::string in my header files instead of just including the "using namespace std" statement and moving along. There are a variety of reasons why the former is considered to be a good practice. Some of those are written in Herb Sutter's More Exceptional C++ book and many newgroups have their own threads on this issue (see namespace pollution).<br /><br />For me the main reason was because of the namespace pollution caused when I have some headers with the "using" statement and some without and then being included in a particular sequence in a third header file. This as I remember caused some collisions. Other than that it also causes problems when you go ahead and include all these headers in your own namespace, thereby also including the "using" statement into your namespace, more problems.<br /><br /><span style="font-style: italic;"><br />b) the need to have template class functions as inline</span><br /><br />Template classes are essentially compiled on demand. Once the compiler seems a template instantiation it goes back to where the declaration was seen and generates the type specific code of the template class immediately. Now while doing so it needs to generate the entire object code for the class. If we go ahead and sperate our template class into a .h declaration and .cpp definitions files then the compiler is left with incomplete information about what needs to be generated for this class. This is the reason why most compilers will cribb here. But this is a compiler issue rather than the C++ standard itself.<br /><br /><br /><span style="font-style: italic;">c) template functions in tempate classes</span><br /><br />yes it is possible to do that. you just need to be a lil carefull thats all.<br /><br /><pre><br />template < class x ><br />class tclass<br />{<br /> public:<br /> x var;<br /> tempate < typename y ><br /> void func(y);<br />};<br /><br />template < class x ><br />template < typename y ><br />void func( y fvar )<br />{ ... }<br /></pre>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-23240823408967657012007-02-08T10:47:00.000+05:302007-02-21T22:34:41.900+05:30Adding a second SATA diskHere is <a href="http://docs.sun.com/app/docs/doc/817-5093/6mkisoq3f?a=view">the sundocs link</a> that tells you what all is needed to be done for adding a new disk on your machine.<br /><br />Step-by-Step:<br /><span style="font-style: italic;">- Connect your disk on your motherboard</span><br /><span style="font-style: italic;">- open a terminal and login as superuser</span><br /><span style="font-style: italic;">% format</span><br /><span style="font-style: italic;"> (choose the new disk)</span><br /><span style="font-style: italic;">format> fdisk</span><br /><span style="font-style: italic;"> (create your partitions here and save before exiting ie choose 5)</span><br /><span style="font-style: italic;">format> parition</span><br /><span style="font-style: italic;">partition> print</span><br /><span style="font-style: italic;">partition> modify</span><br /><span style="font-style: italic;"> (modify your partitions and note down the serial numbers)</span><br /><span style="font-style: italic;">partition> quit</span><br /><span style="font-style: italic;">format> quit</span><br /><br />Now you have the serial numbers of the disk that you just worked on<br /><span style="font-style: italic;">% newfs <disk></span><disk><br /><span style="font-style: italic;">% mount <disk> <location></span><partition><br /><br />Hope this helps... Now to playing with zfs</partition></disk>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-3771963584251349312007-02-07T14:23:00.000+05:302007-05-02T23:04:39.872+05:30OpenCV on OpenSolarisI had some problems getting OpenCV working on OpenSolaris.<br /><br />Finally found a solution. Just do a <br />./configure AR=ar<br />else<br />./configure && make AR=ar<br /><br />Couldn't find any link for OpenCV on OpenSolaris/Solaris so hope this helps people who are trying this out.<br /><br />Technorati Tags: <a href="http://technorati.com/tag/OpenSolaris" rel="tag">OpenSolaris</a>, <a href="http://technorati.com/tag/Solaris" rel="tag">Solaris</a>, <a href="http://technorati.com/tag/OpenCV" rel="tag">OpenCV</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com1tag:blogger.com,1999:blog-32310444.post-54327765243953353072006-11-13T23:22:00.000+05:302006-11-13T23:27:09.279+05:30Sun GPL's JavaWell if you haven't heard this I guess you have been under a rock or are working at either Novell or Microsoft. Anyways Sun has just (as this is typed) released the entire Java source tree, atleast SE and ME, under the GPLv2 license.<br /><br />I took a hard look at the comments on <a href="http://developers.slashdot.org/developers/06/11/13/0724252.shtml">/.</a> and frankly this is the first time that 90% of the comments seem to be positive. Now thats a major thumbs up, if releasing your IP as free software isn't enough to get your spirits high:)<br /><br />Good luck Java.Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-31225685674329790972006-10-19T06:13:00.000+05:302006-10-19T10:20:48.359+05:30Coolest Looking Sun ProductBy now all of us have heard about <a href="http://sun.com/blackbox">Project BlackBox</a> and what it actually is. I don't know the product details and the specs as such but what strikes me with this product is that Sun has finally managed to get in some good product design engineers in place. This is by far the coolest looking Sun product I have ever seen. The color combination, plexi and everything in there is not just functionally necessary but also aesthetically well placed. Good job!<br /><br />Technorati Tags: <a href="http://technorati.com/tag/sunmicrosystems" rel="tag">sunmicrosystmes</a> <a href="http://technorati.com/tag/projectblackbox" rel="tag">projectblackbox</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-81738665917324797282006-09-23T10:53:00.000+05:302006-09-23T11:29:55.227+05:30Google testing OpenSolarisThere are rumors running all over the place that <a href="http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9003492">Google is Testing Sun's OpenSolaris</a>. In fact even <a href="http://digg.com/software/Google_testing_Sun_s_OpenSolaris">digg featured the article</a> and the comments are quite interesting. Now leaving out the Linux fanatics who seem to be blindfolded in their love for their OS the reasonable amongst them can argue about the benefits about it. Now that would be a really fruitful discussion, which unfortunately never happens. Most threads of this nature are dominated by the "I am good and all else is bad" comments.<br /><br />But taking a look at this from an unbiased perspective (I am really trying to be unbiased here) Google can seriously benefit from a lot of what OpenSolaris has to offer.<br /><br /><span style="font-weight:bold;">OpenSolaris is a BSD variant</span><br />All Unix and Linux faithful can't deny the fact that the BSD variants are for some reason the more sturdier class of *nixes. Be if FreeBSD, NetBSD, OpenBSD, Solaris of Apple's Darwin all of these have been very successful on high end systems. And high end today does not mean high cost but its more in terms of their scale. The up times shown by Solaris servers are legendary in their own right. And ofcourse now OpenSolaris is <span style="font-weight:bold;">Trusted by default</span>.<br /><br /><span style="font-weight:bold;">OpenSolaris has the bells and whistles</span><br />Dtrace, Zones, Zfs, FMA, x64 support and a lot more. Sun has gone all out while developing Solaris and has gone ahead and released all of this as OpenSolaris. Yes they are currently using the same code base for both, Solaris and OpenSolaris. So someone like Google can benefit by using zfs and scaling their mhamoth data centers even further while running dtrace to figure out the real time patterns in usage and code segments. So catch those algorithms while they are lazing around or eating more resources and improve them.<br /><br /><span style="font-weight:bold;">OpenSolaris provides for binary compatibility</span><br />Now I am sure Linux guys dint know what that means but it has been an assurance given by Sun on all Solaris systems for nearly 2 decades or more now. And hey its not just OpenSolaris that will let you maintain binary compatibility but because of the way the code is structured there should be no reason why this guarantee shouldn't be maintained between OpenSolaris variants as well.<br /><br /><span style="font-weight:bold;">OpenSolaris is Open</span><br />Ignore GPL devotees. If you don't like CDDL tough luck. But even with CDDL in place Google can go ahead and create a custom version of OpenSolaris for themselves and deploy it all over and heck even redistribute it if they like. Golaris sounds kiddish but well you never know:)<br /><br /><span style="font-weight:bold;">Suggestion to Google: Use Niagara ie USIV+ processors</span><br />The Niagara family of processors are targetted at customers such as Google that need a higher throughput on their front ends. With 8 cores and 4 threads per core in the Niagara1 family these processors can go ahead and eat up web queries on the Google website while the back end servers churn up the results. And NO the cost of the Niagara based systems is not prohibitive at all. In fact you could compare them with many desktop processors while comparing the cost/GHz and well the beat all of them in the cost/watt category. Am sure Google will be thinking about energy costs in the huge facility that they are supposedly coming up with in collaboration with the US government.<br /><br />Well Netcraft shows <a href="http://www.gmail.com">gmail</a> running some servers on Solaris 8 already. So I guess in a couple of months we should know if these rumors have any meat in them at all. And yeah being realistic even if Google adopts OpenSolaris it will be for very specific reasons. Their deployment of Linux is humongously distributed and very customized, from what I have heard. So we wont see them going on OpenSolaris 100% in the near future. And of course they too will have to douse off the in house Linux flame throwers too right. That may be the toughest challenge!<br /><br /><span style="font-style:italic;">Well moving to OpenSolaris will simply mean that Google is definitely not resting on its laurels and is in constant search of whatever will let it improve further.<br /></span><br /><br />Technorati Tags: <a href="http://www.technorati.com/rel/OpenSolaris" rel="tag">OpenSolaris</a> <a href="http://www.technorati.com/rel/Google" rel="tag">Google</a> <a href="http://www.technorati.com/rel/Linux" rel="tag">Linux</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-52199484218916937322006-09-19T21:10:00.000+05:302006-09-19T21:16:37.829+05:30Nevada on VMWareIt's really exciting to see OpenSolaris build 46 ie Nevada running smoothly on my laptop inside a VMWare workstation environment. I have dedicated 8GB and 512Mb RAM to its running instance and hopefully it will suffice. The main idea here is to keep up to speed with the new features being constantly integrated into Nevada while still doing my routine job. It was so much more fun while doing all this on the 7th floor of Divyasree chambers (Sun Microsystems IEC Bangalore)<br /><br />Anyways the setup procedure in VMWare turned out to be pretty straightforward. The only hiccup was when selecting the disk for the installation. You actually need to uncheck and recheck the box again and only then things go on smoothly.<br /><br />I have used VMWare a couple of times before and it seems to work alright most of the times. However there is a new kid on the block called Parallels and there were these rave reviews about it some time ago. Hope I can check that out sometime soon too.<br /><br />For VMWare there is this wonderful set of slides on how to go about doing this right <a href="http://www.virtualization.info/2005/11/how-to-install-sun-solaris-10-inside.html">here</a>. So there is no reason not to be running OpenSolaris even if you can't dedicate a complete box for it. Get onto the train now!<br /><br />Technorati Tags: <a href="http://www.technorati.com/tag/OpenSolaris" rel=tag>OpenSolaris</a> <a href="http://www.technorati.com/tag/VMWare" rel=tag>VMWare</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-58096082493376253932006-09-05T23:06:00.000+05:302006-09-05T23:10:17.302+05:30Postgresql Mod - Backup parts of a tableWell I got a chance to get into the postgres code although for a minor code addition. It turned out to be pretty cool just trying to understanding a small part of the source code.<br /><br />Requirement.<br />1] Dump out only a part of a database table. eg oldest entries first<br /> <br />Approach<br />1] Now there are multiple ways to do it. For eg. you can go ahead and make a duplicate temp table with the rows that you want to dump out and then use the pg_dump tool to get you a copy as a binary file. Now that turns out to be a good idea if the amount of data to be moved around is relatively small as compared to the database, since the duplication will require a proportionate amount of space itself right.<br />2] The other way is to go ahead and modify the pg_dump tool itself to provide you with a partial dump.<br />Ofcourse keeping in with tradition we take the tougher approach ie the second one.<br /><br /><br />Once you get into the pg_dump source you realise that all it does is a dumb COPY command which does the real man's job of accessing the data for a given table/database and putting it out a given file. Onto the COPY source code in $PGSOURCE/src/backend/commands/copy.c<br /><br />So what the COPY command does internally is to get to the database/table requested and redirect the binary file onto the specified file. Now if you want to dump out part of a table then you need some sort of query to be able to partition the part of the table that you desire. However doing this turns out to be very inefficienct since that would require you to have accesses into the table to get each row and then do comparisons on it and selectively dump to file. Not a good thing at all considering the large number of entries that we have. <br /><br />Now since our requirement specifies that we need a part of the table to be dumped out, more specifically the older data we can work on the table if it has some timelined indices. So searching high and low in the docs I came across the funda of OIDs. Now OIDs or Object Identifiers are 4byte (on a 32bit m/c) integers that are unique per tuple on every table within the database. Moreover OIDs are accessed for dumps, it is a parameter to pg_dump, lucky us. Moreover since OIDs are appended to the tuples by the database itself on insertion we can rely on an effective technique being used in there. Something better than having triggers on each insert I hope!<br /><br />So I go ahead and add two more parameters to the COPY command<br />1. from_oid<br />2. upto_oid<br />which gives us the range of OID's that we are interested in. We should be able to get these two values by checking the min and max values of the OIDs for a given table and simply do a percentage addition on the min value to get the upto_oid. You also need to make sure the parser recognises they new options so head off to $PGSOURCE/src/backend/parser/gram.y and good luck.<br /><br />so now my customised postgres works as such<br />pg_dump from_oid 1634 upto_oid 1734<br /> (internally)<br /> COPY -t tablename TO filename WITH OIDS FROM_OID 1634 UPTO_OID 1734;<br /><br /><br />And if you really want to do some meaningful stuff. Take a look at <a href="http://neilconway.org/talks/hacking/">this dude's webpage</a>. Thanks Neil the tips were really helpful.<br /><br />Technorati Tags: <a href="http://technorati.com/tag/Postgresql" rel=tag>Postgresql</a> <a href="http://technorati.com/tag/mod" rel=tag>mod</a> <a href="http://technorati.com/tag/oids" rel=tag>oids</a> <a href="http://technorati.com/tag/pg_dump" rel=tag>pg_dump</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-1155982225391389242006-08-19T15:29:00.000+05:302006-08-19T15:49:56.713+05:30cpp tasks in Apache ANTI was recently introduced to 'ant'. A very simple make tool that allows for a generic way of carrying out your build process without too many hassels. Most of the work was done for having it as the build tool for java, however it has considerably evolved and is used all over the place, especially for cpp. This is the snippet used for getting the cpp make process done... way more simpler than the standard Makefile right.<br /><pre><br /><target name="compile-cpp" depends="init"><br /> <cc debug="false" link="executable" multithreaded="true" name="g++" outfile="${basedir}/bin" warnings="none" objdir="${basedir}/tmp"><br /> <fileset dir="${basedir}/src"><br /> <include name="*.cpp"><br /> </include><br /> <compilerarg value="-Wall"><br /> <compilerarg value="-g"><br /> <compilerarg value="-c"><br /> <linkerarg value="-lpthread"><br /> </linkerarg><br /> </compilerarg><br /> </compilerarg><br /> </compilerarg><br /> </fileset><br /> </cc><br /></target><br /></pre><br />Technorati Tags: <a href="http://www.technorati.com/tag/apache" rel=tag>apache</a>,<a href="http://www.technorati.com/tag/ant" rel=tag>ant</a>,<a href="http://www.technorati.com/tag/cpptask" rel=tag>cpptask</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com1tag:blogger.com,1999:blog-32310444.post-1155016552645641802006-08-08T11:11:00.000+05:302006-08-08T19:38:58.356+05:30DTrace on OSXWell I haven't formatted my previous post correctly as yet but this news is just too good to keep out.<br /><br /><a href="http://www.apple.com/macosx/leopard/xcode.html">MacOSX Leopard will have inbuilt support for DTrace and that too within XCode.</a><br /><br />Now for those of you who haven't used OSX, guys you haven't seen a true and complete OS yet, ah if only it used OpenSolaris as its choice of BSD platform it would be a marriage made in heaven, with Solaris powering the hardware while Aqua playing the sweet enchantress for the common user and ofcourse having the luxury of running the best and advanced version of Microsoft Office. And all that on the new and improved low-power Intel beasts. Come in VMWare and Parallels to create such sweet harmony that could make the tech gods dance.<br /><br />But for now congrats to Team DTrace and the guys at Apple for recognising the beauty of the beast that is DTrace.<br /><br />Tehcnorati Tags: <a href="http://technorati.com/tags/OSX" rel=tag>OSX</a>, <a href="http://technorati.com/tags/Leopard" rel=tag>Leopard</a>,<a href="http://technorati.com/tags/OpenSolaris" rel=tag>OpenSolaris</a>, <a href="http://technorati.com/tags/DTrace" rel=tag>DTrace</a>, <a href="http://technorati.com/tags/XCode" rel=tag>XCode</a>, <a href="http://technorati.com/tags/MSOffice" rel=tag>MSOffice</a>, <a href="http://technorati.com/tags/Parallels" rel=tag>Parallels</a>, <a href="http://technorati.com/tags/VMWare" rel=tag>VMWare</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-1154928560250931482006-08-07T10:57:00.000+05:302006-08-08T21:02:36.946+05:30Stack Overflows in SPARCCausing and Thereby Avoiding Sparc stack overflows<br />--------------------------------------------------<br /><br />Have been hitting my head against the screen to get an<br />understanding of the overflow problem on a sparc machine.<br />Ran into some pretty good examples but it took me some<br />time to get a good grip on the way to do this.<br /><br />for the 32bit version of things<br />===============================<br />sample program from <a href="http://blogs.sun.com/peteh">http://blogs.sun.com/peteh</a><br /><pre><br /> main()<br /> call x();<br /> x()<br /> call y();<br /> y()<br /> int a[1];<br /> a[20]=0<br /></pre><br /><br />now why would this corrupt the stack and<br /><pre><br /> which stack and<br /> what part of the stack?<br /></pre><br /><br />Let me try to answer these questions the best I can<br /><pre><br /> PSEUDO-CODE ASSEMBLY<br /> main() save %sp,... %fp=%sp<br /> call x(); call x %o7=pc<br /> x() save %sp,... %fp=%sp<br /> call y(); call y %o7=pc<br /> y() save %sp,... %fp=%sp<br /> int a[1];<br /> a[20]=0<br /></pre><br /><br />definition int a[1];<br />What makes this offset 20 special?<br />Look at the .s file it should show you an offset of the a[] array<br />in mine it was showing these two lines for a[20]=0<br /><pre><br /> add %fp,-20,%l0<br /> st %g0,[%l0+80]<br /></pre><br /><br />Thus it shows that a is pointing to fp-20<br /><br /><pre><br /> HigherAddr<br /><br />fp of x() ----------------------<br /> fr_argx[1] _____________________________ <br /> fr_argd[6] |nothing else coz there are no|<br /> fr_stret |local variables etc in x() |<br />frame.h fr_savpc ----------------------------- <br />from fr_savfp this is the registerw of main()<br /> fr_arg[6]<br /> fr_local[8]<br />fp of y() ----------------------<br />fp-20 a <---array a<br /> register window of x<br /> is saved here<br />current sp ----------------------<br /><br /> LowerAddr<br /><br />so at fp you have fr_local %l0-%l7<br /> at fp+8 you have fr_arg %i0-i5<br /> at fp+14 you have fr_savfp %i6<br /> at fp+15 you have fr_savpc %i7 <-----return addr<br /><br />so the return address offset from a[] is<br /> = +(20B+(15*4B))<br /> = +60B<br /> = +(20*4B)<br /></pre><br />so offset a[20] messes up the i7 for main and thereby the fault<br /><br /><br />now for the 64bit version of things<br />===================================<br />definition long a[1];<br />the assembly code shows<br /><pre><br /> or %g0,1,%l3<br /> add %fp,1991,%l1<br /> stx %l3,[%l1+176]<br /></pre><br />so the array a is at fp+1991. Note the v9 arch specifies a 0x7ff stack bias<br />so this is within the stack even though you are adding to fp.<br /><br />So where exactly is %o7 ?<br />Well 2047-1995 = 52B from the fp<br /><pre><br />fp+2047 -------------------<br /><br />fp+1995 a<br /><br /><br />fp -------------------<br /></pre><br />the return address offset from a[] is<br /><pre><br /> = +(52B+(15*8B))<br /> = +172B<br /> = +(22*8B)<br /></pre><br />so offset a[22] should corrupt i7 for main and cause a fault<br /><br /><br />So here we have managed to overwrite the %i7 register which stores<br />the return address. We have corrupted the stack of the x() function<br />so it cannot return correctly.<br /><br /><br /><br /><br />Sidenote: save instruction<br />Notice that most of the save instructions put in 96 bytes for the<br />stack. Why is that?<br /><pre><br />current sp ---------------------------------<br /> %i0-%i7 and %l0-%l7<br /><br /> (input and local vars)<br /><br /><br />sp+64 --------------------------------- <- why 64? *A<br /> hidden parameter<br /> ---------------------------------<br /> %o0-%o5<br /> <br /> (store first 6 params just in<br /> case the params are passed by<br /> addr and not by value)<br />sp+92 ---------------------------------<br /> padding to be aligned<br />sp+96 --------------------------------- <- why pad? *B<br /></pre><br /><br />*A - why 64? - 8*2 registers = 8*2*(8bytes ie 4 locations) = 64<br />*B - why pad> - this is SPARC land<br />refer this link <a href="http://www.cs.unm.edu/%7Emaccabe/classes/341/labman/node12.html">http://www.cs.unm.edu/%7Emaccabe/classes/341/labman/node12.html</a><br />thats all!<br /><br />Technorati Tags: <a href="http://technorati.com/tags/OpenSolaris" rel=tag>OpenSolaris</a>, <a href="http://technorati.com/tags/stackoverflow" rel=tag>stackoverflow</a>,<a href="http://technorati.com/tags/sparc" rel=tag>sparc</a>Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0tag:blogger.com,1999:blog-32310444.post-1154926020122950052006-08-07T10:09:00.000+05:302006-08-08T21:05:25.266+05:30Intro<a href="http://allenmathias.blogspot.com">I have been blogging since quite some time but most of it has been in relation to my country India and things that I encounter on a daily basis while I am here</a>. As much as those issues are close to my heart professionally I am an engineer who has been working on Solaris for some time and the bond strengthened when I worked for Sun's Engineering Centre at Bangalore. I am a novice in front of the stalwarts at Sun but would like to put some things that I pick up out here. Personally I am not too much of a theoretical guy so these posts should be more practical pointers rather than technical revelations. As the url mentions am just a kid compared to the most out there so please feel welcome to point out the mistakes.Anonymoushttp://www.blogger.com/profile/12823448298845667753noreply@blogger.com0