1
Developing for SCO Platforms including Single Certification between UW7 and OSR6Jonathan Schilling and John Wolfe, SCO Engineering
2
Intended Audience
Existing SCO OpenServer 5 developers looking to build and possibly modernize apps for SCO OpenServer 6
ISVs looking to have a single application binary run on both SCO OpenServer 6 and UnixWare 7
New developers who haven’t built apps for SCO platforms before
3
Topics
The structure of SCO OpenServer 6 and its Devsys
How to single certify applications for itHow to modernize OpenServer 5 applications
for itHow to build open source applications for itHow to build “New to SCO” applications for itFeatures of the OpenServer 6 (and UW7) DevsysResources for developers
4
Goals of OpenServer 6
A modernization release of SCO OpenServer 5adds kernel threadsadds user-space POSIX threads libraryadds asynchronous I/Oadds LFS large file systems for files > 2 GB better performance, reliability, scalabilityadds Java 1.4.x and beyondenables threads-dependent apps
Apache 2, MySQL, KDE desktop, etc.
user interfaces still the same as SCO OpenServer!install, desktop, sys admin, commands, etc.
5
How OpenServer 6 is Structured
One OpenServer 6 User Experience
Install, desktop, sys admin, commands
One OpenServer 6 User Experience
Install, desktop, sys admin, commands
OSR System Libs
/osr5/usr/lib/
OSR System Libs
/osr5/usr/lib/
SVR5/UDK System Libs
/usr/lib/
SVR5/UDK System Libs
/usr/lib/
One OpenServer 6 KernelOne OpenServer 6 Kernel
OSR5 sys callsOSR5 sys calls SVR5 sys callsSVR5 sys calls
Legacy AppsLegacy Apps Modern AppsModern Apps
OpenServer 6 dev tools
/osr5/usr/ccs/bin/
OpenServer 6 dev tools
/usr/ccs/bin/
OSRABIOSRABI
SVR5/UDKABI
SVR5/UDKABI
6
Development Tools Options on OpenServer 6
OpenServer 6 Dev Sys for SVR5/UDK ABIOpenServer 6 dev sys using -K udk optionuse for single certification on UnixWare 7 and
OpenServer 6use for modernizing existing OSR5 appsuse for device driver development (IHVs)
OpenServer 6 Dev Sys for OSR ABIOpenServer 6 dev sys using -K osr optionuse for binary compatibility to legacy OSR5
apps
7
Single Certification
8
Single Certification for UW7 and OSR6
Major advantages for ISVsone build environmentone binary distributionone platform for full test cycletwo platforms it can run ontwo markets it can sell to
UDK is the vehicle
What are the Do’s and Don’ts?
9
Single Certification Platforms
Supported nowDevelop on UnixWare 7.1.x, run on OpenServer 6
Supported in Nov 2005Develop on OpenServer 6, run on UnixWare 7.1.4
mp3Might work now on UnixWare 7.1.4 …… depends on library usage of your app
10
Single Certification Testing Guidance
Really only need to test once?Do full certification testing on one platformDo sanity checks/touch testing on the other
platformtreat similarly to re-testing product on a new minor point
release of an OSwe expect it to work
if it doesn’t, it’s a bug and we’ll fix it!
First time you do this, do some extra testing on the second platform
11
Single certification guidance
General ruleslink apps dynamically not staticallyuse threads, LFS, networking, graphics, audio,
almost all other APIs!avoid certain auditing/security/admin/job control APIs
use C, C++, Java, or assembly use APIs to get system information
don’t read and parse /etc and /var files directly
use pkgadd format use shells and commands that behave same
or use “non-native” shell/commands on one platform
12
Single certification guidance
APIs all “useful” APIs from normal applications, work
Thousands!Authentication APIs are the one known outage:
UW7 libiaf is present but does not work on OSR6OSR5 libprot works in OSR modedifferent APIs, models, accounting databaseswill reconcile in “Fusion” releaseworkaround is to do authentication is separate
module
13
Single certification guidance
Commandsshells are somewhat different across the ABIs
e.g. OSR5 sh doesn’t support symbolic signal names
Use /u95/bin/sh instead of /bin/shnow will get consistent behavior across UW7, OSR6
Use uname to determine which platform onUse /udk/bin and /u95/bin on OSR6 to find
commands with same behavior as UW7
14
Single certification guidance
System directory structure and file differencesApps should not read and parse /etc and /vars
configuration files directlyApps should use APIs instead
example: reading /etc/inet/hosts works on UW7 but not on OSR6 where that file doesn’t exist
call gethostent() etc., works on both UW7 and OSR6
This is good portability practice anyway!Device names should be configurable
don’t hard-code inside applicationmany UW7 ones are present in OSR6 anyway
e.g. /dev/tty00s, tty01s, etc. for serial lines
15
Single certification guidance
PackagingPackages should install into /opt or /var
with two-ABI world, installing into /usr is ill-advised
Use pkgadd technologyavailable on both UW7 and OSR6custom is only on OSR6
Some ISVs have their own install technologyGUI-driven install wizardssimple tarballs
16
Single Certification for Drivers
UnixWare 7 device drivers work on OpenServer 6
It’s the same SVR5 kernel technologyIHV Single Certification between UnixWare 7
and OpenServer 6 (either direction) is easy and problem-free
17
Modernizing OpenServer 5 Applications
18
Guidance on modernizing existing apps: C++
Existing OSR5 DevSys C++ compiler is old!AT&T Cfront-based, c. 1992, buggypredates 1998 ISO language, library standardslarge-scale changes in language since then
If your sources were developed with it …expect they will not compile cleanly nowsource fix-ups are usually straightforward
you’re doing your code a favor!
For bad cases try the CC -Xo optionold library classes will all still be there
19
Guidance on modernizing existing apps: Threads
Must modify to use threadspthreads API more standard than SVR4/UI threadsuse -Kudk to recompile applicationuse -Kpthread when compiling threaded code
fixes some things like global errno automatically
Existing OSR5 source may not be thread-safe!May use non-reentrant functions such as strtok()
use strtok_r() replacements when availableMay store application data globallyMay return pointers to static dataMust study your code
20
Guidance on modernizing existing apps:
Large files
Go forward with Large File Summit (LFS) APIsuse -Kudk to recompile applicationcreate files up to one terabyte in sizecan use size-specific interfaces
fopen64, lseek64, etc.or, can use regular fopen, lseek, etc.
cc -D_FILE_OFFSET_BITS=64
must use vxfs filesystem and create filesystem with largefiles flag
ulimit must be set to unlimited
21
Guidance on modernizing existing apps: Fundamental system types
Be careful with expanded fundamental system types (EFT)Size change between OSR5 and OSR6 in UDK mode:
mode_t, dev_t, uid_t, gid_t, nlink_t, pid_t, ino_t, sigset_ttypically size goes from 16 bits to 32 bits system or app struct’s containing them also change size
e.g. struct stat contains both dev_t and ino_tdev_t also changes how major, minor numbers packedall consequences of SVR5 infusion into OpenServer 6 kernel
Change should be transparent unless your code has assumptions about size
22
Building Legacy OpenServer Applications
When is OSR ABI needed?when linking with existing OSR5 .o/.a/.so objects
Use OSR ABI compilerssame as UDK but with -K osr for OSR ABImodern, reliable, standard, optimizing64-bit “long long” integer availableLFS, threads, asynch I/O, EFT not availablecan accept OSR5 COFF objects as input to linker
but cannot generate COFF
can link with existing OSR5 C .o/.a/.so objectsbut cannot link with existing OSR5 C++ objects
use CC -Xo to compile very old OSR5 C++ sources
23
So exactly what is an ABI?
What an app looks like at the binary levelContent and layout of information that it presents to
system loaders and linkers (object file format)How different modules of an app communicate
Function call conventionsSize and layout of basic data typesSize and layout of compound data types - structures,
unions, bit-fields
How an app communicates with the systemPathnames, sys call numbers, errno’s, ioctlsSize and layout of basic and aggregate system data
types
Mixing OSR and UDK ABI Object Files ... No!
No safe way to link OSR5 ABI and SVR5/UDK ABI relocatable or shared objects (.o/.a/.so)
No way to intercept different system data types
No way to intercept different bit-field layouts and function calling conventions
No way to intercept system calls from objects
Linker will reject mixture of objects, by defaultForce link mode provided - “I know what I’m doing”
But you probably don’tNot recommended
25
Want new features but need compatibility with old OSR5 library?
If your own, recompileIf from another ISV, get vendor to provide new, UDK-ABI-built librariesIf neither possible ...
make app into 2 processesone process calls old lib
compile -Kosr
one process uses new features
compile -Kudk
use socket, pipe, IPC, etc. to communicate between
26
Building “New to SCO” Applications
27
“New to SCO” Applications
“I don’t care about single certification with UW7 and I don’t have legacy OSR5 objects … which OpenServer 6 ABI should I use?” The UDK one!The SRV5/UDK ABI is SCO’s one forward-going ABI.
28
Porting “New to SCO” Applications
It’s not hard!Can use either UDK or GCCCan use gmake even with UDKGood preprocessor starting points
-DSVR4, -DSOLARIS, -DSOLARIS2 If UDK, certain command option choices
http://www.sco.com/developers/migration/osr5-uw7_whitepaper.html
29
Building Open Source Applications
30
Open Source Applications
Open source app characteristicsuse “configure” style build process
depend on other open source packages
depend on using GCC compilersmakefile command optionslanguage dialectfamiliarity
single certification may be less of an issue
Some proprietary apps use these techniques as well
GCC may be a familiar choice
31
Status of GCC on OpenServer 6
OpenServer 6 FCS does not have GCCCannot just install OSR5 GCC 2.95.3 packages
Wrong pathnames for headers, etc.
GCC 3.4.4 now available for web downloadAlpha-level preview release
Only for SVR5/UDK mode, not for OSR5 mode
Major jump from previous SCO 2.95.3Final version in 3.x.x series
Better C++ standards conformanceBetter IA-32 generated code
FCS coming, then will come to UW 7.1.4OSR 5.0.7 will stay at GCC 2.95.3
32
Building Open Source with UDK Compilers
Do not have to use GCC to build open sourceCan use SCO UDK compiler instead
We do it all the time internally
./configure will do most of the workFor building in UDK/SVR5 mode
Set CC, CXX, if gcc and g++ would be found in PATHif config.guess not recent, force to i586-*-sysv5.0*
For building in OSR mode
Must use since GCC doesn’t do –Kosr modeSet CC, CXX, --host, --target, --buildif config.guess not recent, force to i586-*-sco3.2*
33
Building Open Source in general
Use pre-built GNU GCC toolsgawk, flex, bison, gmake, autoconf, automake, etc
/usr/gnu/bin
Use pre-built open source librarieslarge package GWXLIBS
I18N, compression, images, graphics, db, XML
crypt, security, regex, much more …
34
Features of the OpenServer 6 and UnixWare 7 Development Systems
35
Features of the OpenServer 6 Dev Sys
C Compilation SystemC++ Compilation SystemC/C++ DebuggermemtoolfurJava 2 Standard Edition v. 1.4.2Except where noted, features apply to Dev Sys used for
both SVR5/UDK and OSR ABIs and to UDK on UW7A major upgrade compared to existing (and outdated)
OSR5 Development System product!!
36
The OpenServer 6 -K mode switch
Compilers/usr/ccs/bin/cc defaults to -Kudk /osr5/usr/ccs/bin/cc defaults to -Kosr“cross-ABI” compiles are allowed
/usr/ccs/bin/cc -Kosr .../osr5/usr/ccs/bin/cc -Kudk …
ditto CC for C++ compilesas, ld have -K osr | udk options as well
Other Dev Sys commandshave -K osr | udk option if necessary (e.g. lint)don’t have option if irrelevant (e.g. lex and yacc)
37
OpenServer 6 C Compiler
Robust compiler, excellent IA-32 code generationStandards-conforming libraries and headers Profiled versions of libraries
prof, lprof in both ABIsfprof SRV5/UDK ABI
onlyStandard set of command line tools, fully internationalizedConformance checking (-Xc) is against C 90 standardSupport for Java native methods [SVR5/UDK ABI only]
Almost all of C 99 - ISO/IEC 9899:1999
inline, restrict, variable argument macro functions, & 60 other features Only things missing:
variable-length arrayscomplex and imaginary numbersminor variances in snprintf(3S)
[some new C99 library functions and headers may be SVR5/UDK ABI only]Option –Xb will disable inline and restrict keywords
38
OpenServer 6 C++ Compiler
Accurate, robust implementationAlmost all of the C++ standard - ISO/IEC 14882:1998
except rarely-used: export keyword, placement delete, function-try-blocks, two-phase template name binding, multi-byte characters in source code, partial specialization of a class member template
Complete C++ Std Library STL, iostreams, string, locale, numerics, etc.fast and thread-safe
Excellent IA-32 code generationException Handling - high performance Device driver supportThread safety [SVR5/UDK ABI only]
Support for Java native methods [SVR5/UDK ABI only]
39
OpenServer 6 Debugger
Graphical user interfaceCommand line interface
powerful, shell-like command languagecommand history, command aliases
Strong C and C++ symbolic debuggingStep through inline functions, header code,
exceptions
Controls multi-process, multi-threaded appsfollow forks in both parent and children processes
Understands ELF/COFF, DWARF I/II executables
40
memtool - Catching Dynamic Memory Errors
[SVR5/UDK ABI only]Diagnose dynamic memory allocation errors
writing beyond a block of memory
using deallocated blocks
memory “leaks”
bad arguments passed to C malloc or C++ new
Does not catch general pointer misuses or writing outside local or global arrays
Runs the application under the hidden control of the debugger and the dynamic C library malloc runtime checking
41
memtool (cont’d)
Diagnostic includes one to three stack traceswhen detected
when (de)allocated
previous use (for realloc or free)
Erroneously modified block diagnostics include an annotated memory dump snapshot for the block
Each diagnostic comes with an explanation – short, medium, or long (user settable)
Application need not be rebuilt or relinkeddebugging (-g flag) provides much better info
42
fur - FUnction Relocation
Instruments and reorders code in relocatable objects - at code block levelchanges function order - locality of referencereorder code blocks - improves branch predictionmove “low-usage” code to pseudo functions
Profile guided optimization without recompilationActual uses
Has been used to optimize SCO kernels and librariesOEMs used fur to gain 15% improvement in Oracle
DB server - TPCC benchmarksMay be used for Java virtual machine, Mozilla
browser
43
Other OpenServer 6 Dev Sys components
C++ Standard Components [SVR5/UDK ABI only]
X11R6 Development KitMotif Development KitCDE Development Kit
[UW7 UDK only]
Network Management Development Kit
TCL Development Kit
Software Installation ToolsDocumentation
DocView, man pagesavailable at http://www.sco.com/support/docs
44
Java 2 Standard Edition - version 1.4.2
a/k/aJava Software Development Kit (SDK, JDK)Java Runtime Environment (JRE)
Single binary package built with UDK for use on both UnixWare 7 and OpenServer 6Example of SCO-internal “single certification”!Makes for ISV Java app single certificationMust use UDK ABI for any C/C++ native
methods
45
What’s in J2SE 1.4.2?
Runtime piecesHotSpot Java Virtual Machine
real native threads on both UW7 and OpenServer 6
HotSpot dynamic compilers
clientserver
appletviewer basic API libraries
lang, util, math, ioapplet, AWT, image, audio, medianet, zip, security
RMI, Java Beans, XML, much more
Development piecesjavac compilerjdb command-line debuggerjavah, javap, javadoc, jar utilities
DocumentationSCO Release NotesSun doc references
Demosincluding C/C++ JNI
46
Resources for Developers
SCO Developer NetworkProduct discountsSCO Partner NewsDeveloper supportTraining/EducationThird-Party Solutions DirectoryPartnership Opportunities
SCO Marketplace Contract for work to improve SCO products!
47
Summary
OpenServer 6 has two ABI worldsModern apps and single certification use
OpenServer 6 Dev Sys with SVR5/UDK ABILegacy apps use OpenServer 6 Dev Sys
with OSR ABIOpenServer 6 development tools are
modern, full-featured, optimizing, strong on debugging and memory checkinga major upgrade from existing OSR5 DevSys!
48
Questions & Answers
Top Related