Angelo's Soapbox

Friday Oct 03, 2008

Using DTrace to change OS version

You may have heard about Solaris' legendary binary compatibility guarantee. Basically we guarantee that any binary that runs on Solaris 7,8 & 9 will run unmodified on Solaris 10.

In spite of this excellent binary compatability we have seen some of our partner's Solaris 9 apps fail to install on Solaris 10 because the installer thinks that "10" is less than "9" (using ASCII compare). I figured that we can use DTrace to fix the version number to allow the installer to work.

So I wrote a simple script that will fix the version of Solaris. Here is the script

#!/usr/sbin/dtrace -qws
	
syscall::uname:entry
/progenyof($1)/
{
	self->addr = arg0;
}

syscall::uname:return
/progenyof($1)/
{
	copyoutstr("5.9", self->addr+(257*2), 257);
}

This script takes the pid of the shell that runs the installer. (echo $$ on the terminal to get the pid) While this script is running, uname -a on that shell will return 5.9 as a the Solaris version.

Comments:

Post a Comment:
Comments are closed for this entry.

Archives
Links
Referrers