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
Migrating Guardian Applications to the OSS
Environment
Open System Services Porting Guide—520573-006
8-21
Using OSH From TACL
•
Using PROCESS_SPAWN_ in a Guardian Program on page 8-22
•
Using the Guardian LISTNER Program on page 8-23
Using OSH From TACL
The OSH command can be used to run a process in the OSS environment from the
Guardian environment. The OSH command is a Guardian program that spawns an
OSS process within the same node, allowing you to specify the environment and initial
process attributes of the child process. Using the -c option, you can submit a
command to the OSS child process, as follows:
osh -c command_string
where the command string can be any valid OSS shell command, OSS utility name, or
script file pathname. Parameters to be processed by the named command, utility, or
script can also be included. Standard I/O streams can be redirected from or to OSS
files. Input and output can be redirected to Guardian processes and EDIT files by using
the OSSTTY facility. (OSSTTY can be invoked on the OSH command line. See the
Open System Services Programmer’s Guide for more information about OSSTTY). A
specific OSS program can be run by using the -p option, for example:
osh -p pathname arg1 arg2 ... argn
In this case, the specified program is run as a child process from the TACL prompt. By
default, the OSH command without arguments creates a child process running the
login shell. The Guardian DEFINEs are inherited by OSH and resulting child
processes. All Guardian PARAMs are converted into OSS environment variables for
the child process. More details on starting up an OSS program using the OSH
command from TACL are available in the osh(1) reference page either online or in
the Open System Services Shell and Utilities Reference Manual.
Using system() in a Guardian Program
OSS programs can be started from the Guardian environment in a programmatic way
by using the system() Guardian C run-time routine to run the OSH command, which
in turn can run an OSS command. When the OSH command is run programmatically,
the TACL RUN options IN and OUT must be specified. More details on starting up an
OSS program using the system() function is available in the system(3) reference
page either online or in the Open System Services Library Calls Reference Manual.
Example 8-1 provides sample code: the command string passed to the Guardian
program can be any valid OSS shell command.
The OSS command line must be given to the Guardian RUNOSSP command within
double quotes (" ") to make sure there is no interpretation of special characters within
the command string. An example follows:
run runossp "ls -l /home/stu01 > listfile"
Here the output file listfile is produced in the OSS file system. An OSS script can
also be run using the RUNOSSP utility from the TACL command interpreter.