An Oracle Technical White Paper July 2012 Red Hat Enterprise Linux to Oracle Solaris Porting Guide
Red Hat Enterprise Linux to Oracle Solaris Porting Guide What’s New in Oracle Solaris 11? ..................................................... 4 Oracle Portability and Compatibility Guarantee ............................. 5 Similarities and Differences Between Oracle Solaris and Linux ......... 5 Tools and Development Environment ............................................ 6 GNU Utilities and Popular Developer Tools ...................................
Red Hat Enterprise Linux to Oracle Solaris Porting Guide GNU Compiler Collection (GCC) Versus Oracle Solaris Studio Compiler Option Mapping ........................................................................... 31 Dynamic Linking Using Hardware-Specific Performance Libraries35 Open Source Software Libraries ...................................................... 36 Debugging Applications ................................................................... 47 Kernel Debuggers.............................
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Resource Limits on Oracle Solaris 11 .............................................. 72 Migrating Scripts.............................................................................. 72 Equivalent Commands, Options, and Alternatives on Oracle Solaris 11 72 Managing Services and Daemons on RHEL .................................... 78 RHEL Service Management ........................................................
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 1 Introduction The purpose of this document is to enable developers to resolve issues faced during the migration of Red Hat Enterprise Linux (RHEL) applications to Oracle Solaris 11. The document describes similarities and differences between the two environments in terms of architecture, system calls, tools, utilities, development environments, and operating system features.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Figure 1-1. Oracle Solaris is designed to meet the security, performance, and scalability requirements of cloud-based deployments. Oracle Portability and Compatibility Guarantee Oracle Solaris has maintained binary compatibility between operating system releases for nearly a decade, enabling existing Oracle Solaris applications to run unmodified on Oracle Solaris 11.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide RHEL conforms to the Linux Standard Base 4.0 (LSB 4.0) specification. The LSB is based on the POSIX specification, the SUS, and several other open standards, but it extends them in certain areas. Oracle Solaris supports IEEE Std 1003.1 and IEEE Std 1003.2, commonly known as POSIX.1 and POSIX.2, respectively. Specifically, Oracle Solaris 11 conforms to POSIX.1-2004 (POSIX.1-2001 update) and POSIX.1-2008 (POSIX.1-2004 update).
Red Hat Enterprise Linux to Oracle Solaris Porting Guide GNU Compiler Collection (GCC) and other GNU tools are also available on both RHEL and Oracle Solaris 11. Availability of Open Source Software on the Oracle Solaris Platform Most of the popular open source software is either already available on Oracle Solaris 11, or the ported binaries as well as source code are made available through various popular open source repositories, such as http://www.sunfreeware.com/, http://www.blastwave.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • Oracle's commitment for long-term investments • End-to-end 24 x 7 support from Oracle (a single vender) for hardware to applications 8
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 2 The Porting Process Recommended Strategy Due to both operating systems’ conformance to standards and the availability of tools to aid migration, many times the migration process can be straightforward and hassle-free. However, it is important to plan the migration systematically, so as to isolate the areas where more effort might be needed.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide packages on top of the default installation. Hence, you will have to carefully set the PATH environment in your development and deployment environments in order to invoke the correct utilities from the system. From the previously mentioned migration phases, you estimaet the time required for completing most of the tasks because the amount of effort required does not very much with the target platform.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Hence, for a large application, understanding which files within the source distribution are actually getting used to build the application for the given deployment scenario can help limit the scope of the porting activity. Classification of Code Before starting the actual porting process, it is good to segregate the code based on the amount of migration effort required for each unit.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide systems. Oracle Solaris Studio 12.x is available on both RHEL and Oracle Solaris (SPARC as well as x64). It is much easier to transition from RHEL to Oracle Solaris if you can maintain the same build tools and build environment on the two systems.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Data Portability Data Migration Considerations Data migration is one of the most challenging tasks in the porting process. Data migration activity is primarily divided into two parts: • Migration of raw data, which includes migration of application data, schema, tables, indexes, constraints, and so on. • Migration of associated infrastructure, which includes migration of stored procedures, database triggers, SQL queries, functions, and so on.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Applications storing data that is shared between platforms can handle the endianness issues in one of the following two ways: • Store data in an application-defined, endian-neutral format using text files and strings. • Choose either the big-endian or little-endian convention and do byte swapping (potentially using enabling technology such as XDR) when necessary.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide POPULAR PROPRIETARY DATABASES Oracle 11gR2 √ √ DB2 9.7.x √ √ Sybase 15.7.x √ √ Informix 11.7.x √ √ Though it is challenging to move data between proprietary databases, most of the database vendors ship tools to aid this type of data migration. For information about migrating from various proprietary databases to Oracle Database, please refer to http://www.oracle.com/technetwork/products/migration/index-084442.html.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide uncover a.out.uc A GUI will then appear for viewing coverage data. Memory Leak Detection One of the most powerful tools that is bundled with Oracle Solaris Studio is Discover, which is a memory error discovery tool for detecting memory access errors and leaks. To use Discoverer, the following steps must be performed: • As a prerequisite, the code must be compiled with Oracle Solaris Studio compiler optimization flags -xO[n]: cc -g -xO2 test.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 3 Operating System Considerations Supported Processor Architectures (Linux Versus Oracle Solaris) Many factors have resulted in increased use of Linux systems during last decade; in particular, significant popularity was observed in desktop systems and to some extent in the server systems market as well. One of the major reasons for this increase in deployments was the desire to decrease system costs.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide The processor will have to issue two different read instructions to read the complete integer. Thus, it takes twice as long to read a misaligned integer. In short, the addresses of memory chunks should be in multiples of their sizes. If an address satisfies this requirement, it is said to be properly aligned. The consequences of accessing data via an unaligned address can range from slower execution to program termination. Figure 3-2.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Figure 3-3. Visual representation of how struct mydata would be padded to align with 4-byte boundaries. Compiler Options and Portability of Code The pack pragma directive can be used to specify different packing alignment for structure, union, or class members.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide type—and even the size of the type itself—can differ. And this is exactly what happens if the data corresponding to mystruct is moved between an x86/x64 system and a SPARC system, even though the types used in the struct are of the same size. Byte Ordering Different microprocessor vendors use different byte-ordering schemes. For example, Intel processors have traditionally been little-endian. Motorola processors have always been big-endian.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide The story is little different for member data in a structure, union, or class objects. The struct member variables must be aligned to the highest bytes of the size of any member variables to prevent performance penalties. // 4-byte alignment struct mystruct { char a; // size = 1 byte // 3 bytes padding int i; // size = 4 bytes }; In the above example, the size of mystruct is 8 bytes.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide available on Oracle Solaris, either as system calls or library functions (APIs). There are some minor differences in system call implementation on the two platforms. Table 3-1 lists the implementation differences in terms of differences in the number of parameters, return values, or changes in the headers file names where the system call signatures are declared.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 AT_* constants */ #include #include . int fchmodat(int dirfd, const char Requires #include . *pathname, mode_t mode, gid_t group, int flags); fcntl #include Signature on Oracle Solaris is the same. #include Requires #include .
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 int ioctl(int d, int request, ...); Requires #include and #include . Does not require #include . lchown #include Signature on Oracle Solaris is the same. int lchown(const char *path, uid_t Requires #include .
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 #include /* Definition of Does not require #define _ATFILE_SOURCE and AT_* constants */ #include #include . int mknodat(int dirfd, const char *pathname, mode_t mode, dev_t dev); mount #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 profil #include void profil(unsigned short *buff, unsigned int profil(unsigned short *buf, size_t int bufsiz, unsigned int offset,unsigned bufsiz, size_t offset, unsigned, int int scale); scale); readlink #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 int shmctl(int shmid, int cmd, struct shmid_ds *buf); shmget #include Signature on Oracle Solaris is the same. #include Also requires #include . int shmget(key_t key, size_t size, int shmflg); sigaction #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 3-1. EQUIVALENT SYSTEM CALLS, ALTERNATIVE SYSTEM CALLS, AND WORKAROUNDS API SYNOPSIS ON LINUX FOR ORACLE SOLARIS 11 time #include Signature on Oracle Solaris is the same. time_t time(time_t *t); Requires #include . #include Signature on Oracle Solaris is the same. clock_t times(struct tms *buf); Requires #include . #define _ATFILE_SOURCE Signature on Oracle Solaris is the same.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 4 Application Development Environment Reducing Migration Costs Oracle Solaris 11 provides a very large set of native (Oracle proprietary) and open source commands, tools, libraries, and platform services similar to those available on RHEL. Therefore, the migration of an application development environment from Linux to Oracle Solaris can be very smooth.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • C, C++, and Fortran compilers for compiling code at the command line or through the IDE. The compilers are engineered to work well with the Oracle Solaris Studio debugger (dbx) and include the ability to optimize code by specifying compiler options. • Libraries to add advanced performance and multithreading capabilities to applications.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • Discover is a tool used by software developers to detect programming errors related to the allocation and use of program memory at runtime.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-1. EQUIVALENT COMPILER FLAGS AND WORKAROUNDS GCC 4.4.5 OPTIONS ORACLE SOLARIS STUDIO 12.3 DESCRIPTION OPTIONS (environment variable) -Yc specifies that the component c of the compiler can be found in directory dir. For GCC, the -B option specifies the directory but not the component. -B-Idir -YI, dir Changes the default directory that is searched for include files.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-1. EQUIVALENT COMPILER FLAGS AND WORKAROUNDS GCC 4.4.5 OPTIONS ORACLE SOLARIS STUDIO 12.3 DESCRIPTION OPTIONS -ffloat-store -[ no] fstore Forces conversion of floating-point expressions instead of leaving them in the register. -fargument- -xrestrict[ =f] Treats pointer-valued function parameters as restricted pointers.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-1. EQUIVALENT COMPILER FLAGS AND WORKAROUNDS GCC 4.4.5 OPTIONS ORACLE SOLARIS STUDIO 12.3 DESCRIPTION OPTIONS files. -nostdlib -xnolib Does not automatically link in any libraries. -Os -xspace Performs only optimizations that do not increase the code size. -pg -xpg Prepares the code to collect data for profiling with gprof. -pthread -mt Passes -D_REENTRANT to the preprocessor and adds the threads library to the link line.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-1. EQUIVALENT COMPILER FLAGS AND WORKAROUNDS GCC 4.4.5 OPTIONS ORACLE SOLARIS STUDIO 12.3 DESCRIPTION OPTIONS -ffast-math -xlibmopt Enables the compiler to use a library of optimized math routines. Dynamic Linking Using Hardware-Specific Performance Libraries Taking advantage of hardware properties specific to target platforms can result in a significant performance improvement.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide applications can have a dramatic impact on the overall performance of an application on Oracle Solaris. Open Source Software Libraries Most of the popular open source and GNU software is either already available on Oracle Solaris 11 as IPS packages, or the ported binaries as well as the source code are available through various popular open source repositories.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND cat VERSION ON RHEL GNU coreutils 8.4 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/gcat GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU diffutils 2.8.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND VERSION ON RHEL LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 dircolors GNU coreutils 8.4 /usr/bin/dircolors GNU coreutils 8.5 file/gnu-coreutils dirname GNU coreutils 8.4 /usr/bin/gdirname GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND VERSION ON RHEL LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 pgawk GNU Awk 3.1.7 /usr/bin/pgawk GNU Awk 3.1.5 text/gawk bash GNU bash, version /usr/bin/bash GNU bash version shell/bash 4.1.2(1)-release 4.1.9(1)-release (i386-pc- (x86_64-redhat-linux- solaris2.11) gnu) GNU c++filt version /usr/bin/gc++filt 2.20.51.0.2-5.19.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND rnano VERSION ON RHEL GNU mano version LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/rnano GNU mano version 2.0.9 editor/nano 2.0.10 nano GNU nano version 2.0.9 /usr/bin/nano GNU nano version 2.0.9 editor/nano nm GNU nm version /usr/bin/gnm GNU Binutils 2.19 developer/gnu-binutils 2.20.51.0.2-5.19.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND hostid VERSION ON RHEL GNU coreutils 8.4 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/ghostid GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 runtime/ruby-18 Links to /usr/gnu/bin/hostid id GNU coreutils 8.4 /usr/bin/gid Links to /usr/gnu/bin/id idn GNU Libidn 1.18 /usr/bin/idn (GNU Libidn) 1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND mkfifo VERSION ON RHEL GNU coreutils 8.4 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/gmkfifo GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils GNU coreutils 8.5 file/gnu-coreutils Links to /usr/gnu/bin/mkfifo mknod GNU coreutils 8.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND nohup VERSION ON RHEL GNU coreutils 8.4 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/gnohup GNU coreutils 8.5 file/gnu-coreutils GNU AutoGen - The developer/build/autogen Links to /usr/gnu/bin/nohup autogen - /usr/bin/autogen Automated Program Generator - Ver. 5.9 card - /usr/bin/card GNU a2ps 4.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND sdiff VERSION ON RHEL GNU diffutils 2.8.1 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/gsdiff GNU diffutils 2.8.7 text/gnu-diffutils Links to /usr/gnu/bin/sdiff seq GNU coreutils 8.4 /usr/bin/seq GNU coreutils 8.5 runtime/ruby-18 sha1sum GNU coreutils 8.4 /usr/bin/sha1sum GNU coreutils 8.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND tr VERSION ON RHEL GNU coreutils 8.4 LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/gtr GNU coreutils 8.5 file/gnu-coreutils Links to /usr/gnu/bin/tr truncate GNU coreutils 8.4 /usr/bin/truncate GNU coreutils 8.5 file/gnu-coreutils tty GNU coreutils 8.4 /usr/bin/gtty GNU coreutils 8.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 4-2. GNU COMMANDS MAPPING AND AVAILABILITY COMMAND clisp VERSION ON RHEL - LOCATION ON ORACLE VERSION ON ORACLE PACKAGE NAME ON ORACLE SOLARIS 11 SOLARIS 11 SOLARIS 11 /usr/bin/clisp GNU CLISP 2.47 (2008- runtime/clisp 10-23) (built on userland [10.134.73.164]) diffmk - /usr/bin/gdiffmk GNU gdiffmk (groff) Links to version 1.19.2 text/groff/groff-core /usr/gnu/bin/diffmk grolbp GNU grolbp /groff /usr/bin/grolbp version 1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Debugging Applications Many powerful tools are available on Oracle Solaris 11 for debugging software. These debugging tools can be broadly categorized as follows: • Kernel-land debuggers, for running in kernel mode − • User-land debuggers for running in user mode − • Kernel mode maps to the privilege mode of the CPU. Examples of kernel modules include file system kernel modules, device drivers, and so on.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide and recompile a native source file and continue executing without rebuilding the entire program. You can resume running from the code fix location. You do not need to relink or reload to continue debugging. In dbx, you can also navigate between threads, suspend, step a thread, and display the stack and locks.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • plockstat, which is a tool implemented using DTrace to print user-level lock statistics. This tool is very useful for analyzing and zeroing on lock contention issues in an application.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 5 Threads and Multiprocessing POSIX Compliance The standard POSIX.1c threads extensions (IEEE Std 1003.1c-1995) defines APIs for creating and manipulating threads. POSIX threads, usually referred to as Pthreads, is a POSIX standard for threads. POSIX.1 specifies a set of interfaces (functions and header files) for threaded programming. Oracle Solaris Studio as well as GNU compilers support the POSIX threads programming model.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide bash$ $( LD_ASSUME_KERNEL=2.12 ldd /bin/ls | grep libc.so |awk '{print $3}' ) | egrep -i 'threads|ntpl' Oracle Solaris Threading Model Before the POSIX standard was ratified, the Oracle Solaris multithreading API was implemented in the Oracle Solaris libthread library, which was developed by Sun and later became the basis for the UNIX International (UI) threads standard.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide take into account some minor differences in the interface, which are largely due to edge cases left unspecified by the standard or by permitted implementation dependences. Traditionally, both the platforms supported both POSIX and non-POSIX threads, but for new application development and porting efforts on the latest versions of both operating systems, the POSIX (Pthreads) model is recommended.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 5-1. IMPLEMENTATION-LEVEL DIFFERENCES FUNCTION RHEL ORACLE SOLARIS 11 int pthread_cancel(pthread_t On Linux, cancellation is A thread acting on a cancellation request runs thread); implemented using signals. Under with all signals blocked.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Signals in Threaded Applications The RHEL POSIX thread implementation is process-centric. On RHEL, as far as signals are concerned, each thread is viewed as an independent process (LWP). The RHEL kernel does not really differentiate between threads and processes. As a matter of fact, within a single process, the threads share many resources such as virtual memory, file descriptors, global variables, and so on.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide applications. The number of simultaneous threads that can be accommodated is quite large. Oracle Solaris 11 provides specific features that take advantage of chip multithreading technology. Systems based on Oracle’s CMT processors appear as a familiar SMP system to the operating system and the applications it supports. • The operating system is designed to take advantage of latest hardware trends.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide developer to specify how. Within legacy code, execution loops, in particular, often represent opportunities for optimization where previously repetitive serial operations can be divided into multiple, independent execution threads.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide % collect -r race app params % collect -r deadlock app params Finally, the results of the experiment are loaded into the Thread Analyzer to identify data race and deadlock conditions.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 6 Kernel Migrating the Device Drivers and Device driver software is tightly coupled to the operating system it is running on. In order to develop a device driver, you need to have a thorough knowledge of the operating system architecture and internals. While writing the device drivers, the operating system (kernel) interfaces that your driver will use to access the hardware must be well studied.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 6-2. ENTRY POINTS AND IMPLEMENTATION DIFFERENCES RHEL ORACLE SOLARIS 11 The kernel module daemon kmod execs modprobe. The kernel searches the linked list of modctl structures looking for a match to the module name (mod_modname). modprobe looks through the file If a match is found, return the address of the existing structure; /lib/modules/version/modules.dep to see if other otherwise, create a new one.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Device Driver Interface and Driver-Kernel Interface The following table lists the differences in data structures used by kernel modules on the two platforms. TABLE 6-3. DATA STRUCTURE AND FUNCTION CALLS RHEL ORACLE SOLARIS 11 query_module() in Linux is used to query the kernel for The _info() function returns information about a loadable various bits pertaining to modules. module. Within this function, the call mod_info() has to be made.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide init_module() in Linux initializes a loadable module entry. In Oracle Solaris, _init() initializes a loadable module. Within an _init() call, you need to call another function called mod_install() that takes the modlinkage struct as an argument. delete_module() in Linux deletes a loadable module. mod_remove() is used to remove module in Oracle Solaris. mod_remove() needs to be called from within _fini(). #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Best Practices for Porting Device Drivers and Kernel Modules The porting of device drivers from one platform to the other might not be an easy job, because of one or more of the following reasons: • To enhance functionality, in newer versions of an operating system, new members get added to the kernel data structures accessed by drivers, or the size of existing members gets redefined.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 7 Security Security Interfaces for Developers For data centers hosting enterprise applications, security is of utmost importance. In most enterprises, security is considered one of the prime factors for making platform decisions.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide The least privilege model includes nearly 50 fine-grained privileges as well as the basic privilege set. With the help of process privileges, system administrators now can delegate limited permission to users to override system security instead of giving users complete root access. On Oracle Solaris, a user does not have to become superuser to use a privileged application. In Oracle Solaris, privileges are enforced at the kernel level.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • A kernel cryptographic framework for kernel-level modules Note that consumers that are connected to the framework need not have any specific knowledge of the installed cryptographic mechanisms. Similarly, providers can be plugged into the framework and can support different types of consumers. You do not have to write consumer-specific code in the providers.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 7-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 7-1. API AND IMPLEMENTATION DIFFERENCES RHEL ORACLE SOLARIS 11 Blowfish Arcfour or RC4 Table 7-2 shows the differences in names and locations of header files. TABLE 7-2. DIFFERENCES IN HEADER FILES RHEL ORACLE SOLARIS 11 MD4 #include #include MD5 #include #include SHA1 #include #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • The hardware-assisted encryption can be used to enhance Oracle Database performance with Transparent Data Encryption (TDE) for column-level and table-space encryption. For more information on hardware-assisted encryption and how to benefit from it without making fundamental changes to application code, see the “Oracle Advanced Security Transparent Data Encryption Best Practices” white paper at http://www.oracle.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 8 Runtime Environment Though RHEL and Oracle Solaris are UNIX-based operating systems, there are some fundamental differences in their runtime environments. One such difference which might affect application is the privilege models on the two systems. Oracle Solaris uses the new least privilege model, which gives a specified process only a subset of superuser powers, not full access to all privileges.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide with the least privilege model to more securely run daemons such as httpd, which need to bind to privileged ports. Many such programs do not actually need root access for anything other than listening on a port below 1024, so granting the role to a user that runs the process net_privaddr would remove the need for ever running the process with EUID 0.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Resource Controls and Runtime Limits When moving from RHEL to Oracle Solaris 11, one reason an application might face problems is a difference in the resource limits on the two platforms. The following information can be used to determine if any changes are required on your system. Resource Limits on RHEL On typical RHEL, the ipcs -l command will show the following output.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide On RHEL, after reboot, the rc.sysinit initialization script reads the /etc/sysctl.conf file automatically. Resource Limits on Oracle Solaris 11 On Oracle Solaris 11, the default resource limits are set very high compared to previous Oracle Solaris releases. The /etc/system file provides a static mechanism for adjusting the values of kernel parameters. Values specified in this file are read at boot time and are applied.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 8-1.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide /etc/rcN.d/ directories. With this arrangement, now it is possible to have centralized commands such as chkconfig and /sbin/services manage all services from a single interface. RHEL Service Management In RHEL, the /sbin/service utility provides a consistent interface for executing the init scripts.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide #/sbin/chkconfig --list crond crond 0:off 1:off 2:on 3:on 4:on 5:on 6:off # /sbin/chkconfig crond --level 234 off # /sbin/chkconfig --list crond crond 0:off 1:off 2:off 3:off 4:off 5:on 6:off Now you can go to directories /etc/rc2.d/, /etc/rc3.d/, and /etc/rc4.d/ to confirm that the link to the crond startup script really got deleted.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide intervention is required, system administrators can quickly identify the root cause of the service's failure and significantly reduce system down time. By moving to SMF on Oracle Solaris 11, system administrators will be able to perform the following tasks through a single framework: • Observe and manage system-wide services. • Provide consistent configuration handling.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide You can disable a service with the following command, where service name is the name of the service that you want to disable: #svcadm disable service name Managing Service Dependencies in Oracle Solaris SMF provides a simple mechanism for defining the relationships among various services so that dependent services can be automatically restarted when necessary. Information necessary to manage each service is stored in the service repository.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Leveraging SMF Facilities in Oracle Solaris 11 The Oracle Solaris 11 SMF facility can be leveraged to do many new administrative tasks. For example, many manual configuration tasks can be moved to SMF. This includes the migration of several system, network, and naming service configurations to SMF. The following key changes are introduced in the latest Oracle Solaris 11 release: • The /etc/default/init file is now read-only on Oracle Solaris.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 9 Infrastructure Differences Most enterprise applications have a great deal in common—no matter what the application does or who uses it. Almost every enterprise application requires services such as authentication, logging, persistence, security, and so on.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide PAM Configuration and Differences The following table lists the PAM-related system administration command differences on the two platforms. TABLE 9-1. INFRASTRUCTURE DIFFERENCES RHEL ORACLE SOLARIS 11 The Linux-PAM configuration file is located in On Oracle Solaris 11, a configuration file named /etc/pam.conf. /etc/pam.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 9-2. SEQUENCE OF FUNCTION CALLS DURING PAM INVOCATION STEP-BY-STEP SEQUENCE ACTUAL SEQUENCE OF FUNCTION CALLS The application initializes the library with a call to The server calls pam_start(3) to initialize the PAM library, pam_start(). specify its service name and the target account, and register a suitable conversation function. #include
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 9-2. SEQUENCE OF FUNCTION CALLS DURING PAM INVOCATION STEP-BY-STEP SEQUENCE ACTUAL SEQUENCE OF FUNCTION CALLS Modules of account-management type can be used to restrict If the previous step returned PAM_NEW_AUTHTOK_REQD, the users from logging in at certain times of the day or week or for server now calls pam_chauthtok(3) to force the client to enforcing password expiration.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Differences in PAM Data Structures and Function Calls The following table lists the differences in data structures used by PAM on the two platforms. TABLE 9-3.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Necessary Compiler Option, Linker Options, and Linked Libraries TABLE 9-4. COMPILATION STEPS AND MAKEFILE CHANGES RHEL ORACLE SOLARIS 11 # gcc -fPIC -c pam_module.c # cc -o pam_module -lpam pam_module.c # gcc -shared -o pam_module.so pam_module.o –lpam pam_module_conv.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Chapter 10 Packaging and Distributing Applications With increasing trends towards consolidation using virtualization, system administrators are required to manage large volumes of software often with complex interdependencies on a varied set of hardware platforms. Keeping the systems running smoothly at data centers with complex software dependencies on varied hardware platforms is becoming a complex and challenging task every day.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide • Signature: The signature contains size, checksums, and other such package signatures. • Tagged data: Tags are grouped together at the top of the file in a section known as the preamble.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Packaging on Oracle Solaris 11 Oracle Solaris 11 takes a new approach to package management that greatly simplifies the process of managing patches and updates to help reduce the risk of operating system maintenance issues. Based on extensive customer feedback about patch and upgrade processes for Oracle Solaris 10, Oracle engineers completely redesigned the software packaging system in Oracle Solaris 11.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide installation in order to refresh the system configuration. They can also specify actions such as creating users and groups as part of the package installation process. The package manifest can be divided into three different parts: • Package metadata: This section is conceptually similar to “tagged data (header)” in RPM packages. Similar to RPM packages, this will have mandatory and optional elements.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Implementation Differences for Packaging The following table lists out the basic infrastructure-level differences for packaging on both the platforms. TABLE 10-1. INFRASTRUCTURE DIFFERENCES RHEL ORACLE SOLARIS 11 RPM packages are provided as compressed archive files that An IPS package is made of a series of actions.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 10-2. SYSTEM ADMINISTRATION RHEL ORACLE SOLARIS 11 To install or upgrade a package, use the -U command-line For installing package, use the following: option: #pkg install #rpm -U filename.rpm To preview an installation without actually doing it, use the The --test option tells the rpm command to test the following: installation or upgrade process but not to install the file: # pkg install -nv package_name #rpm -U --test filename.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 10-3. CREATING A PACKAGE RHEL ORACLE SOLARIS 11 On RHEL, consider that a tar file of the source is Let us look at steps to create a package for a sample application. created and put in the /path name/dir-name Step 1—In Oracle Solaris 11, first create a workspace and a prototype directory.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 10-3. CREATING A PACKAGE RHEL ORACLE SOLARIS 11 Step 4—Specify package contents Use the command pkgsend generate to parse through proto area recursively and specify what all constitutes the package oracle@solaris_11X:~/work $ pkgsend generate proto_install | pkgfmt > my_sample.p5m.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE 10-4. PUBLISHING A PACKAGE RHEL ORACLE SOLARIS 11 Once the package is ready, it can be published on Suppose we have a repository named example.com. a Web server so it can be downloaded by end To publish the package, ensure that it is read/write, not the default (read- users like any other download. only).
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Appendix A Security and Privileges The Oracle Solaris 11 security privileges are defined in Table A-1. TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_CONTRACT_EVENT Allow a process to request reliable delivery of events to an event endpoint. Allow a process to include events in the critical event set term of a template, which could be generated in volume by the user.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_FILE_DAC_SEARCH Allow a process to search a directory whose permission bits or ACL would not otherwise allow the process search permission. PRIV_FILE_DAC_WRITE Allow a process to write a file or directory whose permission bits or ACL do not allow the process write permission.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_IPC_DAC_READ Allow a process to read a System V IPC message queue, semaphore set, or shared memory segment whose permission bits would not otherwise allow the process read permission.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_PROC_CHROOT Allow a process to change its root directory. PRIV_PROC_CLOCK_HIGHRES Allow a process to use high-resolution timers. PRIV_PROC_EXEC Allow a process to call exec(2). PRIV_PROC_FORK Allow a process to call fork(2), fork1(2), or vfork(2). PRIV_PROC_INFO Allow a process to examine the status of processes other than those to which it can send signals.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_SYS_AUDIT Allow a process to start the (kernel) audit daemon. Allow a process to view and set audit state (audit user ID, audit terminal ID, audit sessions ID, audit pre-selection mask). Allow a process to turn off and on auditing. Allow a process to configure the audit parameters (cache and queue sizes, event-to-class mappings, and policy options).
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_SYS_RES_CONFIG Allow a process to create and delete processor sets, assign CPUs to processor sets and override the PSET_NOESCAPE property. Allow a process to change the operational status of CPUs in the system using p_online(2). Allow a process to configure file system quotas. Allow a process to configure resource pools and bind processes to pools.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_WIN_DAC_READ Allow a process to read from a window resource that it does not own (one that has a different user ID). This privilege is interpreted only if the system is configured with Trusted Extensions. PRIV_WIN_DAC_WRITE Allow a process to write to or create a window resource that it does not own (one that has a different user ID).
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE A-1. ORACLE SOLARIS 11 SECURITY PRIVILEGES PRIVILEGE NAME DESCRIPTION PRIV_WIN_MAC_WRITE Allow a process to create a window resource whose sensitivity label is not equal to the process sensitivity label. A newly created window property is created with the window's sensitivity label. This privilege is interpreted only if the system is configured with Trusted Extensions.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Appendix B GCC to Oracle Solaris Studio Compiler Flag Mapping The compiler flags shown in Table B-1 remain the same for both GCC and Oracle Solaris Studio. TABLE B-1. COMPILER FLAGS THAT REMAIN THE SAME GCC OPTION ORACLE SOLARIS STUDIO 12.3 OPTION DESCRIPTION -### -### Similar to -#, but the stages are not actually executed.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide TABLE B-1. COMPILER FLAGS THAT REMAIN THE SAME GCC OPTION ORACLE SOLARIS STUDIO 12.3 OPTION DESCRIPTION -O[ n] -xO[ n] Selects the optimization level.
Red Hat Enterprise Linux to Oracle Solaris Porting Guide Red Hat Enterprise Linux to Oracle Solaris Copyright © 2012, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only and the Porting Guide contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other July 2012, Version 1.