This chapter provides a list of issues that you may need to address when porting an application from an IRIX to a Linux system.
The IRIX syssgi(2) system call is not available on Linux systems. In some cases, you can replace the functionality of a syssgi call with the sysctl() function.
For example, the following IRIX code will need to be modified:
syssgi(SGI_CELL, SGI_GET_CLUSTER_CONFIG, &clconfig) |
On Linux, the following code provides the same functionality:
if(cis_syssgi(SGI_CELL, SGI_GET_CLUSTER_CONFIG, PTR_TO_U64(&clconfig), PTR_TO_U64(NULL), PTR_TO_U64(NULL), PTR_TO_U64(NULL), PTR_TO_U64(NULL), PTR_TO_U64(NULL))) |
Where cis_syssgi is the following routine:
int
cis_syssgi(int64_t cmd, int64_t arg1, int64_t arg2, int64_t arg3,
int64_t arg4, int64_t arg5, int64_t arg6, int64_t arg7)
{
int r;
uint64_t args[8];
int name[] = {CTL_KERN, CTL_SYSSGI, 1};
args[0] = cmd; args[1] = arg1; args[2] = arg2; args[3]
= arg3;
args[4] = arg4; args[5] = arg5; args[6] = arg6; args[7]
= arg7;
r = sysctl(name, 3, NULL, NULL, args,
sizeof(args));
return r;
}
|
Some variable definitions for the above code are as follows:
#define SGI_CELL 1060 #define SGI_GET_CLUSTER_CONFIG 22 |
Additionally, the IRIX sysmp(2) call is not available on Linux systems. The following examples show some equivalent Linux functionality:
To find number of processors, replace sysmp(MP_NPROCS) with: sysconf(_SC_NPROCESSORS_CONF).
To pin a process to a CPU, replace sysmp(MP_MUSTRUN, pCpu) with the following:
unsigned long cpuMask[8]; int offset, bit, ullen = sizeof( unsigned long ); memset( cpuMask, 0, ullen * 8 ); offset = pCpu / (ullen * 8); bit = pCpu % (ullen * 8); cpuMask[offset] = ((unsigned long)1) << bit; return syscall( __NR_sched_setaffinity, getpid(), ullen * 8, cpuMask ); |
To find the number of nodes replace sysmp(MP_NUMNODES) with a function:
int getNumNodes() {
int nodeCount = 0;
int goOn=1;
struct stat statData;
char path[128];
do
{
snprintf( path, 128, “/proc/sgi_sn/node%d”, nodeCount );
if( stat( path, &statData ) == 0 ) nodeCount++;
else goOn = 0;
} while( goOn );
if( nodeCount == 0 ) nodeCount == -1;
return nodeCount;
}
|
Additionally, in some circumstances you may need to replace syssgi(2) calls with ioctl(2) calls.
If you are porting code from the ATT Korn shell on IRIX to a public domain Korn shell on Linux, you may need to modify your scripts.
A common procedure in a sh/ksh script is in the following format:
1 Some-command | while read a b c; do 2 [set var foo to something] 3 done 4 echo $foo |
In PD ksh, the while-loop will be in a subshell and when foo is set at line 2 it will be in the subshell. The foo at line 4 will not reflect the change that happened at line 2. This behavior may not be expected.
Note that this situation holds in for-loops as well.
The workaround works for PD ksh as well as the AT&T ksh that runs on Irix is to modify the script as follows:
1 some-command |& 2 while read -p a b c; do 3 [Set var foo to something] 4 done 5 echo $foo |
This arrangement flips things around, pushing “some-command” into the subshell and allowing the while-loop to be in the main shell. Now any change to foo at line 3 will be seen at line 5.
The |& syntax and the matching read -p provide an example of ksh co-processes and reading from pipes.
While most Linux distributions use PD ksh, the AT&T ksh is also open-source and you may choose to install that in place of the PD kshd.
AT&T ksh can find it at http://www.kornshell.com/ . The source is free, but the license is not GPL or BSD.
Serial port devices have a different naming scheme under IRIX than under Linux. A /dev/ttyd[N] device in IRIX corresponds to /dev/ttyS[N-1] in Linux.
Table 8-1. IRIX and Linux device naming examples
| IRIX device name | Linux device name |
|---|---|---|
serial port 1 | /dev/ttyd1 | /dev/ttyS0 |
serial port 2 | /dev/ttyd2 | /dev/ttyS1 |
Table 8-2 summarizes the system security available on IRIX and Altix systems.
Table 8-2. IRIX and Linux Security Features
| IRIX | Linux |
|---|---|---|
Password length | yes | yes |
Password aging | yes | yes |
Password composition | yes | yes |
Logging Login/Logout | yes | yes |
Logging Failed Login | yes | yes |
Lockout of accounts after multiple failed logins | yes | yes |
Logging password changes | yes | requires audit trails |
Logging access to security relevant objects | yes | requires audit trails |
Logging security policy changes | yes | requires audit trails |
Audit trails | yes | Coming soon |
Displaying banners on login screens | yes | yes |
Proper permissions set on security relevant files | yes | yes |
Access Control Lists | yes | yes |
Common Criteria Security CAPP certification | EAL3 | Planning underway, please contact SGI |
Common Criteria Security LSPP certification | EAL3 for Trusted IRIX | Planning underway, please contact SGI |
NISPOM Chapter 8 | yes | Available in SGI ProPack 3.0 for Linux with patch |
DII-COE | yes | Planning underway, please contact SGI |