Default style (Cherry Eve). Switch styles (Capricorn). XML Feed Calendar
All | General | Java | Music
20050614 Tuesday June 14, 2005

A bit about the implementation of standards conforming commands

A bit about the implementation of standards conforming commands

Welcome to the launch of OpenSolaris.

When I started back at Sun a couple of years ago, I helped with the changes required to make Solaris libraries and commands conform to XPG6, ie: SUSv3. The code has been compiled using the Sun[tm] ONE Studio 8 compiler, which defaults to C99 features.

When fixing a bug in a command, I check the SUSv3 and the Solaris man page. I do this because the commands that are specified in the SUSv3 must conform, yet we need to avoid breaking the backward compatibility of non-XPG code, which often conforms to SVID. Also we don't want to break scripts that count on the current behavior. A new, standards-conforming version of a command has been created when, for example, the new XPG6 functionality conflicts with the Solaris functionality. When a user wants to use standards-conforming commands, their path would contain something like:

/usr/xpg6/bin:/usr/xpg4/bin:/usr/bin

So for commands that are specified in SUSv3:
If a /usr/xpg6/bin version doesn't exist, you'll use the XPG6 compliant version in /usr/xpg4/bin, if one exists. If neither a /usr/xpg6/bin version nor /usr/xpg4/bin version exists, it means that the /usr/bin version complies with XPG6, ie: it wasn't necessary to create other versions in order to maintain backward compatibility.

In the OpenSolaris code, the various versions of the commands are built from the same source code using preprocessor directives. Depending upon their requirements, the commands use conditional compilation directives containing XPG4, XPG4ONLY, and XPG6.

For example, in usr/src/cmd/vi/port/ex.c :

#ifdef XPG4

        /* for /usr/xpg4/bin/ex and /usr/xpg6/bin/ex */

#else /* XPG4 */

        /* for /usr/bin/ex */

#endif /* XPG4 */

For example, in usr/src/cmd/vi/port/ex_cmds.c :

#ifdef XPG4ONLY

	/* for /usr/xpg4/bin/ex */

#else /* XPG6 and Solaris */

	/* for /usr/xpg6/bin/ex and /usr/bin/ex */

#endif /* XPG4ONLY */

So the code is built with -DXPG4 -DXPG4ONLY to create /usr/xpg4/bin/ex.

And the code is built with -DXPG4 to create /usr/xpg6/bin/ex.

And of course, each command is somewhat different.

Technorati Tag:

Technorati Tag:

Jun 14 2005, 08:31:43 AM PDT Permalink

20050530 Monday May 30, 2005

Introductions

It's time for an introduction. This is Carol Fields, and I've worked at Sun on Solaris commands and libraries for the last 2 years. In addition, I contracted at Sun several times during the 1990's, also working on Solaris Interfaces at that time. I've worked on bug fixing and enhancements for the releases in development. I made changes to the commands and libraries to have them conform to XPG4, and more recently, XPG6. I ported Solaris libraries to the UltraSPARC, allowing them to support 64-bit datatypes. And I modified Solaris file system utilities to work with large files.

Stay tuned for more about commands and libraries... May 30 2005, 05:15:40 AM PDT Permalink