Introduction to OSS
Module 1 What Is OSS?
NonStop Kernel Open System Services API, command interpreter, and utilities HP NonStop system implementation of POSIX open standards Familiar interface and capabilities on top of NonStop system fundamentals
© 2002 hp (524907-001) 2 Characteristics of Open Systems
Compatibility — Applications running on the system will be able to run on future versions of the system. Portability — Applications running on the operating system on a given hardware platform will run on any vendor’s system that utilizes that same operating system. Scalability — Applications written for the system will run on the full range of computer architectures and sizes. Interoperability — Applications running on the system will be able to communicate with any other system using the same networking protocols.
© 2002 hp (524907-001) 3 POSIX.1 APIs
POSIX.1 (API examples) abort — Generate an abnormal process abort alarm — Schedule an alarm clock — Report processor time used cos — Cosine function execv — Execute a file Program exit — Terminate a process free — Free memory pause — Suspend process execution stat — Get file status time — Get system time
© 2002 hp (524907-001) 4 POSIX.2 Commands
POSIX.2 (command examples) cat — Concatenate and print files cp — Copy files date — Get the date and time grep — Search a file for a pattern ls — List directory contents man — Display manual pages rmdir — Remove a directory
© 2002 hp (524907-001) 5 X/OPEN XPG4
COBOL FORTRAN Pascal ADA Operating System and C (ISO and Common Usage) Languages Internationalized System Commands Calls and Libraries and Utilities (POSIX) (POSIX)
Base Profile
© 2002 hp (524907-001) 6 What OSS Is Not
UNIX Similar but different POSIX OSS is more than just this A development environment Facilities exist, but there are better ways
© 2002 hp (524907-001) 7 OSS Versus UNIX
Which UNIX? SVR4 versus BSD Whose UNIX? HP-UX Solaris AIX Like UNIX, but different No UNIX kernel No UNIX system administration Only Korn shell ...
© 2002 hp (524907-001) 8 Products that Use OSS
HP NonStop TUXEDO iTP WebServer HP Pathway/iTS HP NonStop SQL/MX HP NonStop CORBA All Java products HP NonStop SOAP Open Source Software ported to Open System Services (OSS): Apache Perl TCL and more ...
© 2002 hp (524907-001) 9 NonStop Kernel Environments
Application
Guardian Environment OSS Environment Database Management Database Management Systems Management Systems Management SNA,X25,TCP/IP DCE/TCP/IP Pathway TUXEDO Guardian Services Open System Svcs Guardian Utilities OSS Utilities Guardian APIs OSS APIs NonStop Kernel
© 2002 hp (524907-001) 10 OSS Product Features
Guardian Services Open System Services
TACL POSIX.2/XPG4 Tools Tools and Utilities and Utilities POSIX.1/XPG4 API Processes Guardian API 250+ Functions File system 250+ Functions 150+ C Functions I/O Pipes/FIFOs NonStop Kernel Signals l18N (L10N)
© 2002 hp (524907-001) 11 Interoperability with Guardian Environment
Guardian OSS Process Process 1. Access to Guardian services from OSS 1 2 processes Guardian API OSS API 2. Access to OSS services from Guardian processes
3 4 3. Accessing Guardian files 4. Accessing OSS files and Guardian OSS objects Objects Objects
© 2002 hp (524907-001) 12 OSS/Guardian Interoperability
Terminals/TELNET session Common user ID scheme TACL/shell bridge Access to /G objects Access to /E objects Process status display Print job spooling File attribute display
© 2002 hp (524907-001) 13 OSS Environment
Differences for Guardian users: File system Commands and utilities Access by means of TCP/IP, FTP, or NFS Aliasing of spooler locations Differences for UNIX users: System administration Not “vanilla” (plain) UNIX Use of OSS and Guardian sockets
© 2002 hp (524907-001) 14 OSS File System Basics
Module 2 Getting In and Out
Logged in directly With TELNET Available Services: OSS TACL EXIT Enter Choice> oss login: Initiated from TACL with OSH 1> osh
© 2002 hp (524907-001) 16 OSS Shell (Based on Korn Shell)
Shell environment /etc/profile, $HOME/.profile Aliases Functions Command line and history editing HP extensions DEFINE facilities Built-in run command -W flags
© 2002 hp (524907-001) 17 OSS File System
File system characteristics Hierarchical file system with path names Capability to span multiple disk volumes Single file limited to one disk volume OSS path names Case-sensitive (1023 character maximum) Access to Guardian files in the /G directory Access to remote files on other nodes by means of the /E directory
© 2002 hp (524907-001) 18 OSS Hierarchy
/
/E dev tmp users bin
/G etc usr var
Nodes tty,null vi Guardian profile bill ben
.profile fileA dirB
© 2002 hp (524907-001) 19 Guardian filenames and OSS files
OSS Pathname Guardian Filename /usr/tandem/test $VOL.ZYQ00000. Z0000D03
OSS Name Server Application Disk Process Disk volume
© 2002 hp (524907-001) 20 File System Terminology
Fileset — Subtree of files in the OSS filename space Pathname — A character string pointing to a file Absolute pathname — A pathname that begins with a slash (/) Relative pathname — A pathname that does not begin with a slash (/) File name — Guardian file name File descriptor — (fd) Guardian file number — (fnum) File system
© 2002 hp (524907-001) 21 OSS Pathname
Made up of one or more component directory names separated by slashes (/) Can be up to 1023 bytes in length; each component can be up to 255 bytes in length Component name can be any string of ASCII characters, except null (‘\0’) and slash (/) Can be absolute or relative; for example: /home/stu01/program.c program.c Tilde (~) is home directory Dot (.) is current directory Two dots (..) mean “one level up” The names of hidden files begin with a dot (.)
© 2002 hp (524907-001) 22 OSS Pathname to Guardian Files (1 of 2)
/G directory for local files Disk: /G/
© 2002 hp (524907-001) 23 OSS Pathname for Guardian Files (2 of 2)
/E directory for remote systems Remote passwords needed /E/
© 2002 hp (524907-001) 24 OSS File Types OSS pathname: /filename/filename/………./filename (dir) (dir) Regular disk file Text file Object file Data file Directory file FIFO (named pipe) file Special character file C Link (hard/symbolic) file Sockets file for an AF_UNIX socket
© 2002 hp (524907-001) 25 OSS Security Uses POSIX Security Model
Default permissions preset for any file type Directory file: U=rwx G=rwx O=rwx Other file types: U=rw- G=rw- O=rw- r=read, w=write, x=execute U=User (file owner access) G=Group (file Group association access) O=Other (file access for other than U and G)
© 2002 hp (524907-001) 26 Some Common Directories
/usr — Contains standard subdirectories: /usr/include — Header files for compilation /usr/lib — Library files for linking /usr/tandem — Optional products /bin — Standard utilities /bin/unsupported — Unsupported utilities /users — Contains subdirectories for individuals /dev — Two entries only: tty — The current terminal session null — Standard bit bucket /etc — System files
© 2002 hp (524907-001) 27 /dev Directory
The /dev directory (device directory) contains: tty — The current controlling terminal null — A data sink Other devices Do not appear in /dev Are added and configured in the Guardian environment
© 2002 hp (524907-001) 28 OSS File System
/
usr bin G E System RIDDLR Volume SYSTEM SPOOL DATA / Subvolume WORK TEST DUMP
File ID … … …
/G/data/test/foo $DATA.TEST.FOO /E/riddlr/G/data/test/foo \RIDDLR.$DATA.TEST.FOO
© 2002 hp (524907-001) 29 file and tty Commands
The file command displays the file type of OSS and Guardian files The file command displays: File type of OSS and Guardian Attributes such as: File type File code Target execution environment The tty command displays terminal session name
© 2002 hp (524907-001) 30 Basic Commands and Utilities
Module 3 Functionally Equivalent OSS Commands for Guardian Users
Navigating to directories cd versus VOLUME Displaying directories ls and ls -l versus FILES and FILEINFO Copying files cp versus FUP DUP Editing files vi (and ed) versus TEDIT and EDIT Printing files lp and lpstat versus FUP COPY and PERUSE
© 2002 hp (524907-001) 32 Commands and Utilities
alias cpio fold lp ps tr ar csplit gencat lpstat pwd true awk cut genxlt ls read tty basename date getconf make rm type bc dc getopts man rmdir umask bg diff grep mkcatdefs sed unalias c89 dirname head mkdir sh uname cancel echo iconv mkfifo sleep uncompress cat ed id more sort unexpand cd egrep ipcrm mv split uniq chgrp env ipcs nm strings uudecode chmod expand jobs nohup strip uuencode chown expr join od stty vi cksum false kill passwd tail wait cmp fc lex paste tar wc comm fg ln pathck tee who command fgrep locale pax test xargs compress file logger pr time yacc cp find logname printf touch zcat
© 2002 hp (524907-001) 33 cd and pwd Commands
cd command: Positions to different directory Uses absolute or relative pathname: $ cd /usr/tandem/webserver $ cd terry/test $ cd .. go up one level $ cd - go to previous directory Position to home directory: $ cd $ cd ~ pwd command displays current directory: $ pwd
© 2002 hp (524907-001) 34 ls Command
List OSS and Guardian files Lists names of OSS files Lists names of /G files -l flag for details -a flag for hidden files -r for reverse order -t for modified timestamp order Guardian extension -W flag added $ ls -Wguardian [/G[/volume[/subvol[/filename]]]] .. Displays name and file code testobj 100 testc 101
© 2002 hp (524907-001) 35 Online Documentation
man command displays online reference material $ man
© 2002 hp (524907-001) 36 Displaying the Contents of a Disk File
cat command displays all the contents: $ cat /users/terry/testfile more command displays a page at a time: $ more /users/terry/testfile spacebar next screen f next screen b previous screen
$ cp -options source destination Source and destination can be file or directory Destination file deleted without warning (except in /G/) Guardian option -Wclobber allows target Guardian file to be overwritten Guardian characteristics File attributes not preserved Guardian EDIT file copied into OSS disk file as unstructured OSS disk file copied to Guardian file as unstructured, code 180 Guardian special case Copy Guardian file to Guardian file (similar to FUP DUP) File attributes preserved Depth of Guardian directory Limits recursive copies
© 2002 hp (524907-001) 38 Renaming Files
mv command changes the name of a file or directory: $ mv old-name new-name Can rename to a new directory: $ mv existing-file new-directory Absolute and relative pathnames are allowed
© 2002 hp (524907-001) 39 Creating a Directory
Create using absolute or relative pathname: $ mkdir /usr/tandem/webserver/testapp $ mkdir stu99/newtest Note: The examples assume that higher level directories already exist. Uses default permissions Allowed on /G $ mkdir /G/volume/subvol Creates empty directory in OSS only
© 2002 hp (524907-001) 40 Deleting Directories and Files
rmdir command deletes directories Directories must be empty rm command deletes files -i flag means prompt for approval -r flag means delete subdirectories and files also Use with -i for safety $ rm -r -i stu99/newtest Allows deletion from /G
© 2002 hp (524907-001) 41 file Command
Displays file type Works on OSS and Guardian files File types determined include: Text files Files with “magic” values cpio or tar format files Object files Directory files FIFO files Special character files Needs vt100+ emulation
© 2002 hp (524907-001) 42 File and Directory Security Overview
Permissions are given to three user types: User (owner) Group Others Three access modes: Read, Write, Execute (rwx) Default security for new files and directories set by umask Permissions changed by chmod Ownership changed by chown command (super user only) Network (/E/
© 2002 hp (524907-001) 43 Permissions Mask
User Group Others r w x r w x r w x
400 200 100 40 20 10 4 2 1 • System default permissions are in code and are non-alterable • Set with umask command to specify what is subtracted from system default, thereby resulting in permission settings for new files/directories • May be used in chmod command to alter permissions on existing files and directories
© 2002 hp (524907-001) 44 Setting Default Security
umask sets default permissions for new files or directories Does not change security for existing files or directories System default permissions are: Owner Group Other Directory file: rwx rwx rwx (octal 777) Disk file: rw- rw- rw- (octal 666) umask in user’s profile overrides the umask in /etc/profile umask for user session overrides all default permissions Parameter value is subtracted from system default umask 066 — deny read and write permissions for group and others umask with no parameter displays current setting
© 2002 hp (524907-001) 45 Changing Permissions
chmod changes permissions on existing files/directories “Victor ugo” method: u for owner, g for group, o for others, a for all users + adds permission - removes permission = sets all permissions $ chmod u+x
© 2002 hp (524907-001) 46 Changing Ownership
chown changes the owner of an existing file or directory Permitted only by the super IDsz Not even owner can alter ownership chown
© 2002 hp (524907-001) 47 Spooling Operations
lp file1
lpstat
© 2002 hp (524907-001) 48 lp Command
Uses Guardian spooler to print files from OSS environment Consults /$HOME/printcap file or /etc/printcap file Aliases map to Guardian spooler locations hp4 $S.#LASER1 lineprint $S.#LP User’s own printcap destinations take precedence The user’s default is the first entry in the user’s printcap file lp command writes file to destination: Use one of the following methods to indicate destination: -d flag export LPDEST or PRINTER environment variables $ export LPDEST=hp4 $ lp -d hp4 myfile $ ls | lp $ cat myfile | lp
© 2002 hp (524907-001) 49 Controlling the Spooler
lpstat command displays status information Same information as PERUSE cancel command deletes a job $ cancel 123
© 2002 hp (524907-001) 50 Processes
TACL STATUS command shows Guardian and OSS processes ps command normally shows OSS processes only $ ps — Shows user’s processes $ ps –f — Gives more detail $ ps –e — Shows all OSS processes $ ps –l — Long listing These examples produce displays in “Guardian” format: $ ps -W all — Shows OSS and Guardian processes $ ps -W cpu=n — Shows all processes in a specified processor $ ps -W all,guser=
© 2002 hp (524907-001) 51 The run Command
Runs OSS processes with NonStop Kernel-specific attributes Command syntax: $ run [options] program [arguments] Examples: $ run -cpu=3 -gpri=50 -name=/G/myls ls -al $ run -debug -inspect=on /test/proga Options include: -defmode=on|off -jobid=nnn -lib=/G/vol/subvol/libname -mem=mmm -term=/G/termname
© 2002 hp (524907-001) 52 The kill Command
Sends a signal to one or more running processes Examples: Terminate OSS process(es) $ kill -s Kill
© 2002 hp (524907-001) 53 OSS File Editing
Module 4 Editing Source Files
EDIT files — Type 101, exist only in Guardian name space ASCII text files — Type 180, exist in OSS and Guardian name spaces Guardian programs can access only Guardian files — EDIT/TEDIT editors see only EDIT files OSS programs can access OSS and Guardian files — vi and ed editors see only ASCII text files
© 2002 hp (524907-001) 55 Moving Files Between OSS and Guardian Environments
Copying an EDIT file to an OSS file $ cp /G/data/reports/jan94 /home/stu01/report Reading a Guardian file into the ed buffer $ ed r /G/data/reports/jan94 Converting an OSS file to an EDIT file (two steps) 1. In the OSS environment: $ cp /home/stu01/report /G/data/reports/jan94 2. In the Guardian environment: TACL> CTOEDIT JAN94,EDIT94 Converting an EDIT file to an OSS file In the Guardian environment: TACL> EDITTOC EDIT94,JAN94
© 2002 hp (524907-001) 56 Editors Available on NonStop Systems
Guardian environment (for files with file code 101) EDIT [vs] TEDIT OSS environment (for text files) vi ed (unsupported utility)
© 2002 hp (524907-001) 57 Three vi Modes
: vi Command Last Line Mode Return Mode
ESC Insert, Append, Replace, Change
Input Mode
© 2002 hp (524907-001) 58 Common vi Editor Commands (1 of 3)
Starting vi $ vi
© 2002 hp (524907-001) 59 Common vi Editor Commands (2 of 3)
Insertion mode i — Begin insertion mode, in front of cursor a — Append after current position esc — Stop insertion or append mode Deletion dd — Deletes current line x — Deletes current character
© 2002 hp (524907-001) 60 Common vi Editor Commands (3 of 3)
Pattern matching /
© 2002 hp (524907-001) 61 vi Terminal Settings
The following must be specified: $ export TERM=vt100 OV32 must be set to vt320, vt220, or vt100 for session emulation type.
© 2002 hp (524907-001) 62 vi Session Options
Set by the command: :set
http://docs.hp.com/
•Open System Services Installation Guide •Open System Services Library Calls Reference Manual •Open System Services Management and Operations Guide •Open System Services Porting Guide •Open System Services Programmer’s Guide •Open System Services Shell and Utilities Reference Manual •Open System Services System Calls Reference Manual •Open System Services User’s Guide
© 2002 hp (524907-001) 64 © 2002 hp (524907-001) 65