Open System Services Porting Guide (G06.24+, H06.03+)
Table Of Contents
- What’s New in This Manual
- About This Manual
- 1 Introduction to Porting
- 2 The Development Environment
- 3 Useful Porting Tools
- 4 Interoperating Between User Environments
- Purpose of Interoperability
- The OSS User Environment
- OSS Commands for the Guardian User
- Guardian Commands for the UNIX User
- OSS Pathname and Guardian Filename Conversions
- Running the OSS Shell and Commands From TACL
- Running Guardian Commands From the OSS Shell
- Running OSS Processes With Guardian Attributes
- Using OSS Commands to Manage Guardian Objects
- 5 Interoperating Between Programming Environments
- 6 OSS Porting Considerations
- 7 Porting UNIX Applications to the OSS Environment
- 8 Migrating Guardian Applications to the OSS Environment
- General Migration Guidelines
- C Compiler Issues for Guardian Programs
- Using New and Extended Guardian Procedures
- Using OSS Functions in a Guardian Program
- Interoperating With OSS Programs
- Starting an OSS Program From the Guardian Environment
- C Compiler Considerations for OSS Programs
- Porting a Guardian Program to the OSS Environment
- How Arguments Are Passed to the C or C++ Program
- Differences in the Two Run-Time Environments
- Which Run-Time Routines Are Available
- Use of Common Run-Time Environment (CRE) Functions
- Replacing Guardian Procedure Calls With Equivalent OSS Functions
- Which IPC Mechanisms Can Be Used
- Interactions Between Guardian and OSS Functions
- 9 Porting From Specific UNIX Systems
- 10 Native Migration Overview
- 11 Porting or Migrating Sockets Applications
- 12 Porting Threaded Applications
- A Equivalent OSS and UNIX Commands for Guardian Users
- B Equivalent Guardian Commands for OSS and UNIX Users
- C Equivalent Inspect Debugging Commands for dbx Commands
- D Equivalent Native Inspect Debugging Commands for dbx Commands
- E Standard POSIX Threads Functions: Differences Between the Previous and Current Standards
- Glossary
- Index
OSS Porting Considerations
Open System Services Porting Guide—520573-006
6-18
Performing File Operations
into a zombie process. This may not be the case in other implementations of UNIX. For
example, in SVR4 UNIX, zombies are not created if SIGCHLD is ignored. To avoid
wasting system resources when terminating child processes and ignoring SIGCHLD,
you should take specific action to avoid the creation of zombie processes.
The POSIX.1 standard recommends that portable applications that create child
processes include signal-catching routines that call the wait() or waitpid()
function to receive notification of the termination of child processes. This avoids the
creation of a zombie process when a child process terminates.
Section 3 of the Open System Services Programmer’s Guide contains an example of a
programming technique for preventing zombie processes when child processes
terminate. In the example program, the child process uses the fork() function to
create a duplicate of itself as a grandchild process and immediately terminates. Then,
when the grandchild process terminates, it cannot become a zombie process because
its parent has already terminated. This technique is recommended for portable
programs, since it will work for any implementation of SIGCHLD.
Performing File Operations
This subsection discusses file operations such as opening and creating files and
directories and enabling file caching. Like process operations, there is associated
system overhead involved with these operations. If the code you are porting performs a
great deal of opening and closing of small files as a common manner of execution, you
may want to modify some of your code, in line with some of the performance
considerations discussed in this section.
The OSS name server is key to all pathname-oriented functions: for example, using the
OSS open(), creat(), readdir(), and stat() function calls. The OSS name
server creates and finds inodes (identification nodes), and it translates a name to a file
system ID. It keeps the names and the directory hierarchy in a database and shares
management of regular disk files with Disk Process 2 (DP2).
In addition, the OSS name server shares the management of /dev/tty with Telserv,
shares the management of /dev/null with the OSS file system, and shares the
management of FIFOs with the OSS pipe server.
For a detailed comparison of the Guardian and OSS file systems, including topics such
as file management, file system functions, and interfacing with Guardian and OSS
APIs, refer to the discussion on managing files in the Open System Services
Programmer’s Guide.