Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit
» 

DSPP Home

» HP STK home
Tru64 UNIX STK
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» FAQ
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
» DSPP
Content starts here

critical impact:

sysfs - different header file and GETNFSTYP semantics (CrCh26)

HDR Impacts KN Impacts

Problem description

The required header files for the sysfs function on Tru64 UNIX and HP-UX are different. The semantics of its GETNFSTYP operation code (opcode) are also slightly different.

The sysfs function returns information about configured file system types.

On Tru64 UNIX, macros for the names of the file system types are defined in <sys/fsid.h>. On HP-UX, similar macros are defined in <mntent.h>. You can use the macros with the GETFSIND operation code to map the name of a file system type to its index.

On Tru64 UNIX, the GETNFSTYP operation code returns the largest index of the configured file system types. On HP-UX, it returns the largest index plus one. On both platforms, the return value is not the actual number of file system types configured because the type numbers may not be contiguous. On Tru64 UNIX, the file system indexes start at 1; on HP-UX, they start at 0.

Identifiers

C/C++ Functionssysfs            

Old behavior

#include <sys/fstyp.h>
#include <sys/fsid.h>

int i, n;
char name[FSTYPSZ];

/* Map the name of a file system type to its index. */
i = sysfs(GETFSIND, CDFS);

/* Print all configured file system types. */
n = sysfs(GETNFSTYP);
for (i = 1; i <= n; i++)
        if (sysfs(GETFSTYP, i, name) == 0)
                printf("%d) %s\n", i, name);

See also

Solution description

Modify your code.

Replace the <sys/fsid.h> header file with <mntent.h>. Check uses of the GETFSIND and GETNFSTYP opcodes. Review the applicable manpages and code for more detail.

New behavior

#include <sys/fstyp.h>
#include <mntent.h>

int i, n;
char name[FSTYPSZ];

/* Map the name of a file system type to its index. */
i = sysfs(GETFSIND, MNTTYPE_CDFS);

/* Print all configured file system types. */
n = sysfs(GETNFSTYP);
for (i = 0; i < n; i++)
        if (sysfs(GETFSTYP, i, name) == 0)
                printf("%d) %s\n", i, name);

See also


Problem summary

classifications source types OS release severity type
HDR, KN C, C++ any HP-UX 11i version critical changed
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.