/*  DO NOT EDIT THIS FILE.

    It has been auto-edited by fixincludes from:

	"/usr/include/sys/types.h"

    This had to be done to correct non-standard usages in the
    original, manufacturer supplied header file.  */

/* $Header: types.h,v 1.41.98.15 98/06/02 15:56:15 aokuna Exp $ */

/*
* @(#) types.h  $Date: 98/06/02 15:56:15 $ $Revision: 1.41.98.15 $ PATCH_10.20 (PHKL_15247)
*/
              
#ifndef _SYS_TYPES_INCLUDED
#define _SYS_TYPES_INCLUDED

#ifdef _KERNEL_BUILD
#include "../h/_inttypes.h"
#include "../h/stdsyms.h"
#else  /* ! _KERNEL_BUILD */
#include <sys/_inttypes.h>
#include <sys/stdsyms.h>
#endif /* _KERNEL_BUILD */

#ifdef _INCLUDE_POSIX_SOURCE
#  ifndef _DEV_T
#    define _DEV_T
     typedef int32_t dev_t;		/* For device numbers */
#  endif /* _DEV_T */

#  ifndef _INO_T
#    define _INO_T
#    ifdef _KERNEL
       typedef uint32_t ino_t;           /* For file serial numbers */
#    else /* not _KERNEL */
#      ifdef __LP64__
         typedef uint64_t ino_t;         /* Just API goes wide for now... */
#      else  /* ! __LP64__ */
         typedef uint32_t ino_t;
#      endif /* __LP64__ */
#    endif /* not _KERNEL */
#  endif /* _INO_T */

#  ifndef _MODE_T
#    define _MODE_T
     typedef uint16_t mode_t;		/* For file types and modes */
#  endif /* _MODE_T */

#  ifndef _NLINK_T
#    define _NLINK_T
     typedef uint16_t nlink_t;		/* For link counts */
#  endif /* _NLINK_T */

#  ifndef _FPOS32_T
#   define _FPOS32_T
    typedef int32_t fpos32_t;		/* 32bit position inside a file */
#  endif /* _FPOS32_T */

#  ifndef _FPOS64_T
#    define _FPOS64_T
#    if !defined(__STDC_32_MODE__)
       typedef int64_t fpos64_t;	/* 64bit position inside a file */
#    endif
#  endif /* _FPOS64_T */

#  ifndef _FPOS_T
#    define _FPOS_T
#    ifdef _FILE64
       typedef int64_t fpos_t;		/* 64bit position inside a file */
#    else
       typedef int32_t fpos_t;		/* 32bit position inside a file */
#    endif
#  endif /* _FPOS_T */

#  ifndef _FSBLOCKS32_T
#    define _FSBLOCKS32_T
     typedef uint32_t fsblkcnt32_t;	/* blocks within a file system */
#  endif /* _FSBLOCKS32_T */

#  ifndef _FSBLOCKS64_T
#    define _FSBLOCKS64_T
#    if !defined(__STDC_32_MODE__)
       typedef uint64_t fsblkcnt64_t;	/* blocks within a file system */
#    endif
#  endif /* _FSBLOCKS64_T */

#  ifndef _FSBLOCKS_T
#    define _FSBLOCKS_T
#    ifdef _FILE64
       typedef uint64_t fsblkcnt_t;	/* 64-bit block count */
#    else
       typedef uint32_t fsblkcnt_t;	/* 32-bit block count */
#    endif
#  endif /* _FSBLOCKS_T */

#  ifndef _OFF32_T
#    define _OFF32_T
     typedef int32_t off32_t;	/* 32bit offsets and sizes */
#  endif /* _OFF32_T */

#  ifndef _OFF64_T
#    define _OFF64_T
#    if !defined(__STDC_32_MODE__)
        typedef int64_t off64_t;	/* 64bit offsets and sizes */
#    endif
#  endif /* _OFF64_T */

#  ifndef _OFF_T
#    define _OFF_T
#    ifdef _FILE64
        typedef int64_t off_t;		/* For 64-bit offsets and sizes */
#    else
        typedef int32_t off_t;		/* For 32-bit offsets and sizes */
#    endif /* _FILE64 */
#  endif /* _OFF_T */

#  ifndef _FSFILCNT32_T
#    define _FSFILCNT32_T
     typedef uint32_t fsfilcnt32_t;	/* free file nodes */
#  endif /* _FSFILCNT32_T */

#  ifndef _FSFILCNT64_T
#    define _FSFILCNT64_T
#    if !defined(__STDC_32_MODE__)
       typedef uint64_t fsfilcnt64_t;	/* free file nodes */
#    endif
#  endif /* _FSFILCNT64_T */

#  ifndef _FSFILCNT_T
#   define _FSFILCNT_T
#     ifdef _FILE64
        typedef uint64_t fsfilcnt_t;	/* 64-bit free file nodes */
#     else
        typedef uint32_t fsfilcnt_t;	/* 32-bit free file nodes */
#     endif
#  endif /* _FSFILCNT_T */

#  ifndef _BLKCNT32_T
#    define _BLKCNT32_T
     typedef int32_t blkcnt32_t;	/* 32-bit # of blocks */
#  endif /* _BLKCNT32_T */

#  ifndef _BLKCNT64_T
#    define _BLKCNT64_T
#    if !defined(__STDC_32_MODE__)
       typedef int64_t blkcnt64_t;	/* 64-bit # of blocks */
#    endif
#  endif /* _BLKCNT64_T */

#  ifndef _BLKCNT_T
#   define _BLKCNT_T
#     ifdef _FILE64
        typedef int64_t blkcnt_t;	/* 64-bit # of blocks */
#     else
        typedef int32_t blkcnt_t;	/* 32-bit # of blocks */
#     endif
#  endif /* _BLKCNT_T */

#  ifndef _PID_T
#    define _PID_T
     typedef int32_t pid_t;		/* For process and session IDs */
#  endif /* _PID_T */

#  ifndef _LWPID_T
#    define _LWPID_T
     typedef int32_t lwpid_t;              /* For process and session IDs */
#  endif /* _LWPID_T */

#  ifndef _GID_T
#    define _GID_T
     typedef int32_t gid_t;		/* For group IDs */
#  endif /* _GID_T */

#  ifndef _UID_T
#    define _UID_T
     typedef int32_t uid_t;		/* For user IDs */
#  endif /* _UID_T */

#  ifndef _TID_T
#    define _TID_T
     typedef int32_t tid_t;		/* For thread IDs */
#  endif /* _TID_T */

#  ifndef _SSIZE_T
#    define _SSIZE_T
#    ifdef __LP64__
        typedef int64_t ssize_t;	/* Signed version of size_t */
#    else
        typedef int32_t ssize_t;	/* Signed version of size_t */
#    endif /* __LP64__ */
#  endif /* _SSIZE_T */

#  ifndef _SITE_T
#    define _SITE_T
     typedef uint16_t __site_t;		/* see stat.h */
#  endif /* _SITE_T */

#  ifndef _CNODE_T
#    define _CNODE_T
     typedef uint16_t __cnode_t;	/* see stat.h */
#  endif /* _CNODE_T */
#endif /* _INCLUDE_POSIX_SOURCE */

#if defined(_INCLUDE_POSIX_SOURCE) || defined(_INCLUDE__STDC__)
#  ifndef _TIME_T
#    define _TIME_T
     typedef long time_t;		/* For times in seconds */
#  endif /* _TIME_T */
#endif /* _INCLUDE_POSIX_SOURCE || _INCLUDE__STDC__ */

#if defined(_INCLUDE_POSIX_SOURCE) || (defined(_INCLUDE__STDC__) && (!defined(_XPG4_EXTENDED) || defined(_INCLUDE_HPUX_SOURCE)))
#  ifndef _SIZE_T
#    define _SIZE_T
#    ifdef __LP64__
#if !defined(_GCC_SIZE_T)
#define _GCC_SIZE_T
typedef __SIZE_TYPE__ size_t;
#endif
	/* Type returned by sizeof() */
#    else
#if !defined(_GCC_SIZE_T)
#define _GCC_SIZE_T
typedef __SIZE_TYPE__ size_t;
#endif
	/* Type returned by sizeof() */
#    endif /* __LP64__ */
#  endif /* _SIZE_T */
#endif /* _INCLUDE_POSIX_SOURCE || (_INCLUDE__STDC__ && (!_XPG4_EXTENDED || _INCLUDE_HPUX_SOURCE)) */

#if defined(_INCLUDE_XOPEN_SOURCE) || (defined(_INCLUDE__STDC__) && (!defined(_XPG4_EXTENDED) || defined(_INCLUDE_HPUX_SOURCE)))
#  ifndef _CLOCK_T
#    define _CLOCK_T
     typedef uint32_t clock_t;		/* For clock ticks */
#  endif /* _CLOCK_T */
#endif /* _INCLUDE_XOPEN_SOURCE || (_INCLUDE__STDC__ && (!_XPG4_EXTENDED || _INCLUDE_HPUX_SOURCE)) */

#ifdef _INCLUDE_XOPEN_SOURCE
#  ifndef _KEY_T
#    define _KEY_T
      typedef int32_t key_t;		/* For interprocess communication ID */
#  endif /* _KEY_T */

   typedef unsigned short __ushort;	/* Try to avoid using this */

   typedef int32_t __daddr_t;		/* For disk block addresses */
   typedef char *__caddr_t;		/* For character addresses */
   typedef int32_t __swblk_t;
#endif /* _INCLUDE_XOPEN_SOURCE */


#ifdef _INCLUDE_AES_SOURCE
#  ifndef _CADDR_T
#    define _CADDR_T
     typedef __caddr_t		caddr_t;
#  endif /* _CADDR_T */
#endif /* _INCLUDE_AES_SOURCE */

#ifdef _INCLUDE_XOPEN_SOURCE_EXTENDED

#  ifndef _ID_T
#    define _ID_T
     typedef int32_t id_t;	/* For IDs that can be pid_t, uid_t, gid_t */
#  endif /* _ID_T */

#  ifndef _USECONDS_T
#    define _USECONDS_T
     typedef uint32_t useconds_t;	/*  Time in microseconds */
#  endif /* _USECONDS_T */

/* For getrlimit() */

#   ifndef _RLIM32_T
#     define _RLIM32_T
      typedef uint32_t rlim32_t;
#   endif /* _RLIM32_T */

#   ifndef _RLIM64_T
#     define _RLIM64_T
#    if !defined(__STDC_32_MODE__)
        typedef uint64_t rlim64_t;
#     endif
#   endif /* _RLIM64_T */

#  ifndef _RLIM_T
#    define _RLIM_T
#    ifdef _FILE64
       typedef uint64_t rlim_t;
#    else
       typedef uint32_t rlim_t;
#    endif
#  endif /* _RLIM_T */

/* For "struct statvfs" in statvfs.h */
   typedef __site_t		site_t;
#endif /* _INCLUDE_XOPEN_SOURCE_EXTENDED */

#ifdef _INCLUDE_HPUX_SOURCE
   typedef unsigned char	u_char;	   /* Try to avoid using these */
   typedef unsigned short	u_short;   /* Try to avoid using these */
   typedef unsigned int		u_int;     /* Try to avoid using these */
   typedef unsigned long	u_long;    /* Try to avoid using these */
   typedef unsigned int		uint;	   /* Try to avoid using these */
   typedef unsigned short	ushort;	   /* Try to avoid using these */
   typedef unsigned char  ubit8;
   typedef unsigned short ubit16;
   typedef uint32_t	  ubit32;
   typedef char           sbit8;
   typedef short          sbit16;
   typedef int32_t        sbit32;

   typedef __swblk_t		swblk_t;
   typedef __daddr_t		daddr_t;
   typedef __cnode_t		cnode_t;

   /* For physical memory addresses and/or offsets */
   typedef uintptr_t		physaddr_t;	
   typedef unsigned long	paddr_t; 	/* LGMEM- delete */

   /*
    * For page oriented variables.  
    * Note that this should remain a *signed* quantity because some
    * variables (e.g., mem_deficit) need to be signed.
    */
   typedef intptr_t		page_t;		

#  ifndef _ULONG_T
#  define _ULONG_T
   typedef unsigned long ulong_t;
#  endif

   typedef int16_t		cnt_t;
#ifdef __LP64__
   typedef uint64_t space_t;
#else
   typedef uint32_t space_t;
#endif
   typedef uint32_t		prot_t;
   typedef uint32_t             cdno_t;
   typedef uint16_t		use_t;

   typedef struct _physadr { intptr_t r[1]; } *physadr;
   typedef struct _quad { long val[2]; } quad;

   typedef int spu_t;


#  define MAXSUSE	65535	/* maximum share count on swap device */


     typedef short cpu_t;

     typedef struct label_t {
#ifdef __LP64__
	int64_t     lbl_rp;
	int64_t     lbl_sp;
	int64_t     lbl_s[17];	
	int64_t     lbl_ss[1];
 	int64_t     lbl_sf[4];
#else
	int32_t     lbl_rp;
	int32_t     lbl_sp;
	int32_t     lbl_s[17];	
	int32_t     lbl_ss[1];
 	double      lbl_sf[4];
#endif
    } label_t;

#  ifndef _KERNEL
   typedef char *dm_message;
#  endif /* not _KERNEL */

#  ifndef _AID_T
#     define _AID_T
      typedef int32_t	aid_t;
#  endif /* _AID_T */


/* These probably should be moved to some other header */

#  define UID_NO_CHANGE  ((uid_t) -1)  /* for chown(2) and setresuid(2) */
#  define GID_NO_CHANGE  ((gid_t) -1)  /* for chown(2) and setresgid(2) */

   typedef pid_t		sid_t;	   /* For session IDs */

#  define PGID_NOT_SET   ((pid_t) -1)  /* for no pgrp */
#  define SID_NOT_SET	 ((sid_t) -1)  /* for no session */
#  define PGID_USE_PID   ((pid_t) -2)  /* set pgrp to pid */
#  define SID_USE_PID	 ((sid_t) -2)  /* set session to pid*/


#  if !defined(_XPG4_EXTENDED) || defined(_INCLUDE_HPUX_SOURCE) || defined(_KERNEL)
/* Types, macros, etc. for select() */

#  ifndef MAXFUPLIM
/*
 * MAXFUPLIM is the absolute limit of open files per process.  No process, 
 * even super-user processes may increase u.u_maxof beyond MAXFUPLIM.
 * MAXFUPLIM means maximum files upper limit.
 * Important Note:  This definition should actually go into h/param.h, but 
 * since it is needed by the select() macros which follow, it had to go here.
 * I did not put it in both files since h/param.h includes this file and that
 * would be error prone anyway.  
 *
 * Users wishing to use 60000 open files per process should first consult the
 * HP-UX 10.10 Release Notes, since this feature is not supported for all
 * configurations.
 */
#if defined(_KERNEL) || defined(_USE_BIG_FDS)
#    define MAXFUPLIM       60000	/* please see comment above */
#else
#    define MAXFUPLIM       2048
#endif

/*
 * These macros are used for select().  select() uses bit masks of file
 * descriptors in 32-bit ints.  These macros manipulate such bit fields (the
 * file system macros uses chars).  FD_SETSIZE may be defined by the user,
 * but must be >= u.u_highestfd + 1.  Since we know the absolute limit on 
 * number of per process open files is MAXFUPLIM, we need to define FD_SETSIZE 
 * to be large enough to accomodate this many file descriptors.  Unless the 
 * user has this many files opened, he should redefine FD_SETSIZE to a 
 * smaller number.
 */
#    ifndef _KERNEL
#      ifndef FD_SETSIZE
#        define FD_SETSIZE MAXFUPLIM
#      endif
#    else /* not _KERNEL */
#      define FD_SETSIZE MAXFUPLIM
#    endif /* _KERNEL */

     typedef int32_t fd_mask;

#    define NFDBITS (sizeof(fd_mask) * 8)     /* 8 bits per byte */

#    ifndef howmany
#      define howmany(x,y)  (((x)+((y)-1))/(y))
#    endif

#    ifndef _FD_SET
#      define _FD_SET
       typedef struct fd_set {
         fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
       } fd_set;
#    endif /** _FD_SET **/


#    ifndef __FD_SET
#    define __FD_SET
#    define FD_SET(n,p)  ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#    endif /* __FD_SET */
#    ifndef __FD_CLR
#    define __FD_CLR
#    define FD_CLR(n,p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#    endif /* __FD_CLR */
#    ifndef __FD_ISSET
#    define __FD_ISSET
#    define FD_ISSET(n,p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#    endif /* __FD_ISSET */

#    ifndef _KERNEL
#        ifndef __FD_ZERO
#        define __FD_ZERO
#        define FD_ZERO(p)     memset((void *)(p), (int) 0, sizeof(*(p)))
#        endif /* __FD_ZERO */
#    endif /* not _KERNEL */
#   endif /* not MAXFUPLIM */
#  else /* _XPG4_EXTENDED && !_INCLUDE_HPUX_SOURCE && !_KERNEL */
	/*
	 * For CASPEC, look in <sys/time.h> for the _XPG4_EXTENDED definition
	 * But for _INCLUDE_HPUX_SOURCE without _XPG4_EXTENDED (or for the
         * kernel build , maintain definition(s) here
	 */
#  endif /* _XPG4_EXTENDED && !_INCLUDE_HPUX_SOURCE && !_KERNEL */

#  ifndef _KERNEL
#    ifdef __cplusplus
	extern "C" {
#    endif /* __cplusplus */

#    ifdef _CLASSIC_ID_TYPES
#      ifdef _SVID3
	  extern int setpgrp();
#      endif /* _SVID3 */
#    else /* not _CLASSIC_ID_TYPES */
#      ifdef _PROTOTYPES
#        ifdef _SVID3
	   extern pid_t setpgrp(void);
#        endif /* _SVID3 */
#      else /* not _PROTOTYPES */
#        ifdef _SVID3
	   extern pid_t setpgrp();
#        endif /* _SVID3 */
#      endif /* not _PROTOTYPES */
#    endif /* not _CLASSIC_ID_TYPES */

#    ifdef _PROTOTYPES
#      ifdef _SVID3
	  extern int ptrace(int, pid_t, int, int, int);
	  extern int ioctl(int, int, ...);
	  extern int acct(const char *);
#      endif /* _SVID3 */
#    else /* not _PROTOTYPES */
#      ifdef _SVID3
	  extern int ptrace();
	  extern int ioctl();
	  extern int acct();
#      endif /* _SVID3 */
#    endif /* not _PROTOTYPES */

#    ifdef __cplusplus
	}
#    endif /* __cplusplus */
#  endif /* not _KERNEL */

#endif /* _INCLUDE_HPUX_SOURCE */

#if !defined(__STDC_32_MODE__)

/* Make these kernel types available as some commands need 
 * these types (via vnode.h). They will be available in 
 * ANSI-EXT mode, K&R or LP64 mode.
 */

#  ifndef _K_OFF_T
#    define _K_OFF_T
	typedef int64_t  k_off_t;
#  endif
#  ifndef _K_RLIM_T
#    define _K_RLIM_T
  	typedef uint64_t k_rlim_t;
#  endif
#  ifndef _K_BLKCNT_T
#    define _K_BLKCNT_T
  	typedef int64_t k_blkcnt_t;
#  endif
#  ifndef _K_FSFILCNT_T
#    define _K_FSFILCNT_T
  	typedef uint32_t k_fsfilcnt_t;
#  endif
#  ifndef _K_FSBLKCNT_T
#    define _K_FSBLKCNT_T
  	typedef uint32_t k_fsblkcnt_t;
#  endif
#  ifndef _DIR_OFF_T
#    define _DIR_OFF_T
	typedef int32_t dir_off_t;
#  endif
#endif /* ! __STDC_32_MODE */

#ifdef _UNSUPPORTED

	/* 
	 * NOTE: The following header file contains information specific
	 * to the internals of the HP-UX implementation. The contents of 
	 * this header file are subject to change without notice. Such
	 * changes may affect source code, object code, or binary
	 * compatibility between releases of HP-UX. Code which uses 
	 * the symbols contained within this header file is inherently
	 * non-portable (even between HP-UX implementations).
	*/
#ifdef _KERNEL_BUILD
#include "../h/_types.h"
#else  /* ! _KERNEL_BUILD */
#include <.unsupp/sys/_types.h>
#endif /* _KERNEL_BUILD */
#endif /* _UNSUPPORTED */

#endif /* _SYS_TYPES_INCLUDED */


