Re: Silly warnings from python-SunOS-5.8-sun4d-fafner

Anders Qvist <[email protected]> Fri, 19 Jul 2002 19:23:06 +0200
Newsgroups gmane.comp.python.snake-farm.user
Message-ID <[email protected]>
At the moment, I'm a bit short on time, but here is some stuff to help
with the problem.

On Fri, Jul 19, 2002 at 12:17:34PM -0400, Guido van Rossum wrote:
> This version of Solaris (python-SunOS-5.8-sun4d-fafner) seems to have
> a problem, or perhaps it's GCC.  We get endless warnings (once per
> file compiled!):
> 
> In file included from ../python/dist/src/Include/stringobject.h:10,
>                  from ../python/dist/src/Include/Python.h:94,
>                  from ../python/dist/src/Modules/python.c:3:
> /sw/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.3/include/stdarg.h:170: warning: redefinition of `va_list'
> /usr/include/stdio.h:120: warning: `va_list' previously declared here
> 
> Again, it seems the standard headers contain an internal conflict.  is
> there any way we could silence this, so we'll be able to see more
> interesting warnings through the noise?

From /usr/include/stdio.h:

  /*
   * XPG4 requires that va_list be defined in <stdio.h> "as described in
   * <stdarg.h>".  ANSI-C and POSIX require that the namespace of <stdio.h>
   * not be polluted with this name.
   */
  #if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && !defined(_VA_LIST)
  #define _VA_LIST
  typedef __va_list va_list;
  #endif  /* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && ... */

... and further down:

#ifdef _STDARG_H
/* Define va_list, if desired, from __gnuc_va_list. */
/* We deliberately do not define va_list when called from
   stdio.h, because ANSI C says that stdio.h is not supposed to define
   va_list.  stdio.h needs to have access to that data type, 
   but must not use that name.  It should use the name __gnuc_va_list,
   which is safe because it is reserved for the implementation.  */

#ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
#undef _VA_LIST
#endif

#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif

#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
   so we must avoid testing it and setting it here.
   SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
   have no conflict with that.  */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */

/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
   But on BSD NET2 we must not test or define or undef it.
   (Note that the comments in NET 2's ansi.h
   are incorrect for _VA_LIST_--see stdio.h!)  */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2.  */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2  */
#ifndef _VA_LIST_T_H
typedef __gnuc_va_list va_list;
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif

#endif /* not _VA_LIST_, except on certain systems */

#endif /* not __svr4__ */

#endif /* _STDARG_H */

... it's a mess. Full files attached.

> Also, the AIX-2-000000042E00-hal builds fail (and have been failing
> for weeks) with an error in posixmodule.c:
> 
> ../python/dist/src/Modules/posixmodule.c: In function `posix_fdatasync':
> ../python/dist/src/Modules/posixmodule.c:902: `fdatasync' undeclared (first use 
> this function)
> ../python/dist/src/Modules/posixmodule.c:902: (Each undeclared identifier is rep
> orted only once
> ../python/dist/src/Modules/posixmodule.c:902: for each function it appears in.)
> 
> Any suggestion for how to fix this?  I'm guessing fdatasync() exists
> in the library (else configure wouldn't have defined HAVE_FDATASYNC),
> but it's not in the header files.  Can someone verify that it's really
> not in any header file?  Then we should extend the section
> 
> #ifdef __hpux
> extern int fdatasync(int); /* On HP-UX, in libc but not in unistd.h */
> #endif
> 
> with a similar test for __sun.
> 
> Or, if it's in some header file but there's a magical symbol needed to
> enable it, what's the symbol, and how can we get it defined?
> 
> Or perhaps configure should only #define HAVE_FDATASYNC if there's a
> declaration for it?
> 
> Or perhaps we should rewrite the code to inline posix_fildes(), and
> turn the problem into a warning?

sfarmer@hal [/usr/include]$ nm /usr/lib/libc.a | grep fdata
.fdatasync           T     619804
fdatasync            D     188972      12

This is in /usr/include/unistd.h:

        extern int      fdatasync(int);
        extern int      finfo(const char *, int, void *, int);
        extern int      ffinfo(int, int, void *, int);

  #endif /* ndef _KERNEL */

  #endif /* _NO_PROTO */

  #define _AES_OS_VERSION 1               /* OSF, AES version */

  #endif /* _ALL_SOURCE */

  #endif /* _H_UNISTD */

Included to the end of file as it shows the defs required/not allowed.
Full file attached.

Can I find out which unistd.h it looks in (there doesn't seem to be
any other on the machine, but one never knows)?
-- 
Anders "Quest" Qvist

"We've all heard that a million monkeys banging on a million typewriters
will eventually reproduce the entire works of Shakespeare. Now, thanks 
to the Internet, we know this is not true." -- Robert Wilensky
fafner_stdio.h (text/x-chdr, 10.8 KB)
/*	Copyright (c) 1988 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

/*
 * Copyright (c) 1993-1999, by Sun Microsystems, Inc.
 * All rights reserved.
 */

/*
 * User-visible pieces of the ANSI C standard I/O package.
 */

#ifndef _STDIO_H
#define	_STDIO_H

#pragma ident	"@(#)stdio.h	1.78	99/12/08 SMI"	/* SVr4.0 2.34.1.2 */

#include <iso/stdio_iso.h>

/*
 * If feature test macros are set that enable interfaces that use types
 * defined in <sys/types.h>, get those types by doing the include.
 *
 * Note that in asking for the interfaces associated with this feature test
 * macro one also asks for definitions of the POSIX types.
 */

/*
 * Allow global visibility for symbols defined in
 * C++ "std" namespace in <iso/stdio_iso.h>.
 */
#if __cplusplus >= 199711L
using std::FILE;
using std::size_t;
using std::fpos_t;
using std::remove;
using std::rename;
using std::tmpfile;
using std::tmpnam;
using std::fclose;
using std::fflush;
using std::fopen;
using std::freopen;
using std::setbuf;
using std::setvbuf;
using std::fprintf;
using std::fscanf;
using std::printf;
using std::scanf;
using std::sprintf;
using std::sscanf;
using std::vfprintf;
using std::vprintf;
using std::vsprintf;
using std::fgetc;
using std::fgets;
using std::fputc;
using std::fputs;
using std::getc;
using std::getchar;
using std::gets;
using std::putc;
using std::putchar;
using std::puts;
using std::ungetc;
using std::fread;
using std::fwrite;
using std::fgetpos;
using std::fseek;
using std::fsetpos;
using std::ftell;
using std::rewind;
using std::clearerr;
using std::feof;
using std::ferror;
using std::perror;
#endif

#ifdef	__cplusplus
extern "C" {
#endif

#if defined(_LARGEFILE_SOURCE) || defined(_XPG5)
#ifndef	_OFF_T
#define	_OFF_T
#if defined(_LP64) || _FILE_OFFSET_BITS == 32
typedef long		off_t;
#else
typedef __longlong_t	off_t;
#endif
#ifdef	_LARGEFILE64_SOURCE
#ifdef _LP64
typedef	off_t		off64_t;
#else
typedef __longlong_t	off64_t;
#endif
#endif /* _LARGEFILE64_SOURCE */
#endif /* _OFF_T */
#endif /* _LARGEFILE_SOURCE */

#ifdef _LARGEFILE64_SOURCE
#ifdef _LP64
typedef fpos_t		fpos64_t;
#else
typedef __longlong_t	fpos64_t;
#endif
#endif /* _LARGEFILE64_SOURCE */

/*
 * XPG4 requires that va_list be defined in <stdio.h> "as described in
 * <stdarg.h>".  ANSI-C and POSIX require that the namespace of <stdio.h>
 * not be polluted with this name.
 */
#if defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && !defined(_VA_LIST)
#define	_VA_LIST
typedef	__va_list va_list;
#endif	/* defined(_XOPEN_SOURCE) && (_XOPEN_VERSION - 0 >= 4) && ... */

#if defined(__EXTENSIONS__) || __STDC__ - 0 == 0 || \
		defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)

#define	L_ctermid	9
#define	L_cuserid	9
#endif

#if defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0 && \
		!defined(_POSIX_C_SOURCE))) || defined(_XOPEN_SOURCE)

#define	P_tmpdir	"/var/tmp/"
#endif /* defined(__EXTENSIONS__) || ((__STDC__ - 0 == 0 && ... */

#ifndef _STDIO_ALLOCATE
extern unsigned char	 _sibuf[], _sobuf[];
#endif

/* large file compilation environment setup */
#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname	fopen	fopen64
#pragma redefine_extname	freopen	freopen64
#pragma redefine_extname	tmpfile	tmpfile64
#pragma redefine_extname	fgetpos	fgetpos64
#pragma redefine_extname	fsetpos	fsetpos64
#ifdef	_LARGEFILE_SOURCE
#pragma redefine_extname	fseeko	fseeko64
#pragma redefine_extname	ftello	ftello64
#endif
#else	/* __PRAGMA_REDEFINE_EXTNAME */
#if defined(__STDC__)
extern FILE	*fopen64(const char *, const char *);
extern FILE	*freopen64(const char *, const char *, FILE *);
extern FILE	*tmpfile64(void);
extern int	fgetpos64(FILE *, fpos_t *);
extern int	fsetpos64(FILE *, const fpos_t *);
#else	/* defined(__STDC__) */
extern FILE	*fopen64();
extern FILE	*freopen64();
extern FILE	*tmpfile64();
extern int	fgetpos64();
extern int	fsetpos64();
#endif	/* defined(__STDC__) */
#define	fopen			fopen64
#define	freopen			freopen64
#define	tmpfile			tmpfile64
#define	fgetpos			fgetpos64
#define	fsetpos			fsetpos64
#ifdef	_LARGEFILE_SOURCE
#define	fseeko			fseeko64
#define	ftello			ftello64
#endif
#endif	/* __PRAGMA_REDEFINE_EXTNAME */
#endif	/* !_LP64 && _FILE_OFFSET_BITS == 64 */

#ifndef _LP64
extern unsigned char	*_bufendtab[];
extern FILE		*_lastbuf;
#endif

/* In the LP64 compilation environment, all APIs are already large file */
#if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma	redefine_extname	fopen64		fopen
#pragma	redefine_extname	freopen64	freopen
#pragma	redefine_extname	tmpfile64	tmpfile
#pragma	redefine_extname	fgetpos64	fgetpos
#pragma	redefine_extname	fsetpos64	fsetpos
#ifdef	_LARGEFILE_SOURCE
#pragma	redefine_extname	fseeko64	fseeko
#pragma	redefine_extname	ftello64	ftello
#endif
#else	/* __PRAGMA_REDEFINE_EXTNAME */
#define	fopen64		fopen
#define	freopen64	freopen
#define	tmpfile64	tmpfile
#define	fgetpos64	fgetpos
#define	fsetpos64	fsetpos
#ifdef	_LARGEFILE_SOURCE
#define	fseeko64	fseeko
#define	ftello64	ftello
#endif
#endif	/* __PRAGMA_REDEFINE_EXTNAME */
#endif	/* _LP64 && _LARGEFILE64_SOURCE */

#if defined(__STDC__)

#if	defined(__EXTENSIONS__) || defined(_REENTRANT)
extern char	*tmpnam_r(char *);
#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) */
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
	!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE))
extern void setbuffer(FILE *, char *, size_t);
extern int setlinebuf(FILE *);
#endif
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
	!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
	defined(_XPG5)
/* PRINTFLIKE3 */
extern int	snprintf(char *, size_t, const char *, ...);
#endif
#if defined(__EXTENSIONS__) || (__STDC__ == 0 && \
	!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE)) || \
	defined(_XPG5)
extern int	vsnprintf(char *, size_t, const char *, __va_list);
#endif	/* defined(__EXTENSIONS__) ||  __STDC__ == 0 ... */

/*
 * The following are known to POSIX and XOPEN, but not to ANSI-C.
 */
#if defined(__EXTENSIONS__) || __STDC__ == 0 || \
		defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)

extern FILE	*fdopen(int, const char *);
extern char	*ctermid(char *);
extern int	fileno(FILE *);

#endif	/* defined(__EXTENSIONS__) ||  __STDC__ == 0 ... */

/*
 * The following are known to POSIX.1c, but not to ANSI-C or XOPEN.
 */
#if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
	    (_POSIX_C_SOURCE - 0 >= 199506L)
extern void	flockfile(FILE *);
extern int	ftrylockfile(FILE *);
extern void	funlockfile(FILE *);
extern int	getc_unlocked(FILE *);
extern int	getchar_unlocked(void);
extern int	putc_unlocked(int, FILE *);
extern int	putchar_unlocked(int);

#endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT).. */

/*
 * The following are known to XOPEN, but not to ANSI-C or POSIX.
 */
#if defined(__EXTENSIONS__) || __STDC__ == 0 || defined(_XOPEN_SOURCE)

extern FILE	*popen(const char *, const char *);
extern char	*cuserid(char *);
extern char	*tempnam(const char *, const char *);
extern int	getopt(int, char *const *, const char *);
#if !defined(_XOPEN_SOURCE)
extern int	getsubopt(char **, char *const *, char **);
#endif /* !defined(_XOPEN_SOURCE) */
extern char	*optarg;
extern int	optind, opterr, optopt;
extern int	getw(FILE *);
extern int	putw(int, FILE *);
extern int	pclose(FILE *);

#endif	/* defined(__EXTENSIONS__) ||  __STDC__ == 0 ... */

/*
 * The following are defined as part of the Large File Summit interfaces.
 */
#if	defined(_LARGEFILE_SOURCE) || defined(_XPG5)
extern int	fseeko(FILE *, off_t, int);
extern off_t	ftello(FILE *);
#endif

/*
 * The following are defined as part of the transitional Large File Summit
 * interfaces.
 */
#if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
	    !defined(__PRAGMA_REDEFINE_EXTNAME))
extern FILE	*fopen64(const char *, const char *);
extern FILE	*freopen64(const char *, const char *, FILE *);
extern FILE	*tmpfile64(void);
extern int	fgetpos64(FILE *, fpos64_t *);
extern int	fsetpos64(FILE *, const fpos64_t *);
extern int	fseeko64(FILE *, off64_t, int);
extern off64_t	ftello64(FILE *);
#endif

#else	/* !defined __STDC__ */

#ifndef	_LP64
#define	_bufend(p)	((fileno(p) < _NFILE) ? _bufendtab[fileno(p)] : \
			(unsigned char *)_realbufend(p))
#define	_bufsiz(p)	(_bufend(p) - (p)->_base)
#endif	/*	_LP64	*/

#if	defined(__EXTENSIONS__) || defined(_REENTRANT)
extern char	*tmpnam_r();
#endif /* defined(__EXTENSIONS__) || defined(_REENTRANT) */
#if defined(__EXTENSIONS__) || \
	(!defined(_XOPEN_SOURCE) && !defined(_POSIX_C_SOURCE))
extern void setbuffer();
extern int setlinebuf();
#endif

#if defined(__EXTENSIONS__) || \
		defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)
extern FILE	*fdopen();
extern char	*ctermid();
extern int	fileno();
#endif	/* defined(__EXTENSIONS__) ||  defined(_POSIX_C_SOURCE... */

#if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
	    (_POSIX_C_SOURCE - 0 >= 199506L)
extern void	flockfile();
extern int	ftrylockfile();
extern void	funlockfile();
extern int	getc_unlocked();
extern int	getchar_unlocked();
extern int	putc_unlocked();
extern int	putchar_unlocked();
#endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT).. */

#if defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE)
extern FILE	*popen();
extern char	*cuserid();
extern char	*tempnam();
extern int	getopt();
#if !defined(_XOPEN_SOURCE)
extern int	getsubopt();
#endif /* !defined(_XOPEN_SOURCE) */
extern char	*optarg;
extern int	optind, opterr, optopt;
extern int	getw();
extern int	putw();
extern int	pclose();
#endif	/* defined(__EXTENSIONS__) || defined(_XOPEN_SOURCE) */

#if	defined(_LARGEFILE_SOURCE) || defined(_XPG5)
extern int	fseeko();
extern off_t	ftello();
#endif

#if	defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
	    !defined(__PRAGMA_REDEFINE_EXTNAME))
extern FILE	*fopen64();
extern FILE	*freopen64();
extern FILE	*tmpfile64();
extern int	fgetpos64();
extern int	fsetpos64();
extern int	fseeko64();
extern off64_t	ftello64();
#endif

#endif	/* __STDC__ */

#if !defined(__lint)

#if	defined(__EXTENSIONS__) || defined(_REENTRANT) || \
	    (_POSIX_C_SOURCE - 0 >= 199506L)
#ifndef	_LP64
#ifdef	__STDC__
#define	getc_unlocked(p)	(--(p)->_cnt < 0 \
					? __filbuf(p) \
					: (int)*(p)->_ptr++)
#define	putc_unlocked(x, p)	(--(p)->_cnt < 0 \
					? __flsbuf((x), (p)) \
					: (int)(*(p)->_ptr++ = \
					(unsigned char) (x)))
#else
#define	getc_unlocked(p)	(--(p)->_cnt < 0 \
					? _filbuf(p) \
					: (int)*(p)->_ptr++)
#define	putc_unlocked(x, p)	(--(p)->_cnt < 0 \
					? _flsbuf((x), (p)) \
					: (int)(*(p)->_ptr++ = \
					(unsigned char) (x)))
#endif	/* __STDC__ */
#endif	/* _LP64 */
#define	getchar_unlocked()	getc_unlocked(stdin)
#define	putchar_unlocked(x)	putc_unlocked((x), stdout)
#endif	/* defined(__EXTENSIONS__) || defined(_REENTRANT).. */

#endif	/* !defined(__lint) */

#ifdef	__cplusplus
}
#endif

#endif	/* _STDIO_H */
fafner_stdarg.h (text/x-chdr, 5.9 KB)
/* stdarg.h for GNU.
   Note that the type used in va_arg is supposed to match the
   actual type **after default promotions**.
   Thus, va_arg (..., short) is not valid.  */

#ifndef _STDARG_H
#ifndef _ANSI_STDARG_H_
#ifndef __need___va_list
#define _STDARG_H
#define _ANSI_STDARG_H_
#endif /* not __need___va_list */
#undef __need___va_list

#ifdef __clipper__
#include "va-clipper.h"
#else
#ifdef __m88k__
#include "va-m88k.h"
#else
#ifdef __i860__
#include "va-i860.h"
#else
#ifdef __hppa__
#include "va-pa.h"
#else
#ifdef __mips__
#include "va-mips.h"
#else
#ifdef __sparc__
#include "va-sparc.h"
#else
#ifdef __i960__
#include "va-i960.h"
#else
#ifdef __alpha__
#include "va-alpha.h"
#else
#if defined (__H8300__) || defined (__H8300H__) || defined (__H8300S__)
#include "va-h8300.h"
#else
#if defined (__PPC__) && (defined (_CALL_SYSV) || defined (_WIN32))
#include "va-ppc.h"
#else
#ifdef __arc__
#include "va-arc.h"
#else
#ifdef __M32R__
#include "va-m32r.h"
#else
#ifdef __sh__
#include "va-sh.h"
#else
#ifdef __mn10300__
#include "va-mn10300.h"
#else
#ifdef __mn10200__
#include "va-mn10200.h"
#else
#ifdef __v850__
#include "va-v850.h"
#else
#if defined (_TMS320C4x) || defined (_TMS320C3x)
#include <va-c4x.h>
#else

/* Define __gnuc_va_list.  */

#ifndef __GNUC_VA_LIST
#define __GNUC_VA_LIST
#if defined(__svr4__) || defined(_AIX) || defined(_M_UNIX) || defined(__NetBSD__)
typedef char *__gnuc_va_list;
#else
typedef void *__gnuc_va_list;
#endif
#endif

/* Define the standard macros for the user,
   if this invocation was from the user program.  */
#ifdef _STDARG_H

/* Amount of space required in an argument list for an arg of type TYPE.
   TYPE may alternatively be an expression whose type is used.  */

#if defined(sysV68)
#define __va_rounded_size(TYPE)  \
  (((sizeof (TYPE) + sizeof (short) - 1) / sizeof (short)) * sizeof (short))
#elif defined(_AIX)
#define __va_rounded_size(TYPE)  \
  (((sizeof (TYPE) + sizeof (long) - 1) / sizeof (long)) * sizeof (long))
#else
#define __va_rounded_size(TYPE)  \
  (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
#endif

#define va_start(AP, LASTARG) 						\
 (AP = ((__gnuc_va_list) __builtin_next_arg (LASTARG)))

#undef va_end
void va_end (__gnuc_va_list);		/* Defined in libgcc.a */
#define va_end(AP)	((void)0)

/* We cast to void * and then to TYPE * because this avoids
   a warning about increasing the alignment requirement.  */

#if (defined (__arm__) && ! defined (__ARMEB__)) || defined (__i386__) || defined (__i860__) || defined (__ns32000__) || defined (__vax__)
/* This is for little-endian machines; small args are padded upward.  */
#define va_arg(AP, TYPE)						\
 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),	\
  *((TYPE *) (void *) ((char *) (AP) - __va_rounded_size (TYPE))))
#else /* big-endian */
/* This is for big-endian machines; small args are padded downward.  */
#define va_arg(AP, TYPE)						\
 (AP = (__gnuc_va_list) ((char *) (AP) + __va_rounded_size (TYPE)),	\
  *((TYPE *) (void *) ((char *) (AP)					\
		       - ((sizeof (TYPE) < __va_rounded_size (char)	\
			   ? sizeof (TYPE) : __va_rounded_size (TYPE))))))
#endif /* big-endian */

/* Copy __gnuc_va_list into another variable of this type.  */
#define __va_copy(dest, src) (dest) = (src)

#endif /* _STDARG_H */

#endif /* not TMS320C3x or TMS320C4x */
#endif /* not v850 */
#endif /* not mn10200 */
#endif /* not mn10300 */
#endif /* not sh */
#endif /* not m32r */
#endif /* not arc */
#endif /* not powerpc with V.4 calling sequence */
#endif /* not h8300 */
#endif /* not alpha */
#endif /* not i960 */
#endif /* not sparc */
#endif /* not mips */
#endif /* not hppa */
#endif /* not i860 */
#endif /* not m88k */
#endif /* not clipper */

#ifdef _STDARG_H
/* Define va_list, if desired, from __gnuc_va_list. */
/* We deliberately do not define va_list when called from
   stdio.h, because ANSI C says that stdio.h is not supposed to define
   va_list.  stdio.h needs to have access to that data type, 
   but must not use that name.  It should use the name __gnuc_va_list,
   which is safe because it is reserved for the implementation.  */

#ifdef _HIDDEN_VA_LIST  /* On OSF1, this means varargs.h is "half-loaded".  */
#undef _VA_LIST
#endif

#ifdef _BSD_VA_LIST
#undef _BSD_VA_LIST
#endif

#if defined(__svr4__) || (defined(_SCO_DS) && !defined(__VA_LIST))
/* SVR4.2 uses _VA_LIST for an internal alias for va_list,
   so we must avoid testing it and setting it here.
   SVR4 uses _VA_LIST as a flag in stdarg.h, but we should
   have no conflict with that.  */
#ifndef _VA_LIST_
#define _VA_LIST_
#ifdef __i860__
#ifndef _VA_LIST
#define _VA_LIST va_list
#endif
#endif /* __i860__ */
typedef __gnuc_va_list va_list;
#ifdef _SCO_DS
#define __VA_LIST
#endif
#endif /* _VA_LIST_ */
#else /* not __svr4__ || _SCO_DS */

/* The macro _VA_LIST_ is the same thing used by this file in Ultrix.
   But on BSD NET2 we must not test or define or undef it.
   (Note that the comments in NET 2's ansi.h
   are incorrect for _VA_LIST_--see stdio.h!)  */
#if !defined (_VA_LIST_) || defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__) || defined(WINNT)
/* The macro _VA_LIST_DEFINED is used in Windows NT 3.5  */
#ifndef _VA_LIST_DEFINED
/* The macro _VA_LIST is used in SCO Unix 3.2.  */
#ifndef _VA_LIST
/* The macro _VA_LIST_T_H is used in the Bull dpx2  */
#ifndef _VA_LIST_T_H
typedef __gnuc_va_list va_list;
#endif /* not _VA_LIST_T_H */
#endif /* not _VA_LIST */
#endif /* not _VA_LIST_DEFINED */
#if !(defined (__BSD_NET2__) || defined (____386BSD____) || defined (__bsdi__) || defined (__sequent__) || defined (__FreeBSD__))
#define _VA_LIST_
#endif
#ifndef _VA_LIST
#define _VA_LIST
#endif
#ifndef _VA_LIST_DEFINED
#define _VA_LIST_DEFINED
#endif
#ifndef _VA_LIST_T_H
#define _VA_LIST_T_H
#endif

#endif /* not _VA_LIST_, except on certain systems */

#endif /* not __svr4__ */

#endif /* _STDARG_H */

#endif /* not _ANSI_STDARG_H_ */
#endif /* not _STDARG_H */
hal_unistd.h (text/x-chdr, 13.2 KB)
/* IBM_PROLOG_BEGIN_TAG                                                   */
/* This is an automatically generated prolog.                             */
/*                                                                        */
/* bos42G src/bos/usr/include/unistd.h                                    */
/*                                                                        */
/* Licensed Materials - Property of IBM                                   */
/*                                                                        */
/* (C) COPYRIGHT International Business Machines Corp. 1985,1995          */
/* All Rights Reserved                                                    */
/*                                                                        */
/* US Government Users Restricted Rights - Use, duplication or            */
/* disclosure restricted by GSA ADP Schedule Contract with IBM Corp.      */
/*                                                                        */
/* IBM_PROLOG_END_TAG                                                     */
/* @(#)82	1.38.1.17  src/bos/usr/include/unistd.h, incstd, bos42G, g9644b 10/28/96 17:46:36 */
/*
 * COMPONENT_NAME: (INCSTD) Standard Include Files
 *
 * FUNCTIONS:
 *
 * ORIGINS: 3 27
 *
 * (C) COPYRIGHT International Business Machines Corp. 1985, 1996
 * All Rights Reserved
 * Licensed Materials - Property of IBM
 *
 * US Government Users Restricted Rights - Use, duplication or
 * disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 * Copyright (c) 1984 AT&T	
 * All Rights Reserved  
 *
 * THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	
 * The copyright notice above does not evidence any   
 * actual or intended publication of such source code.
 */

#ifndef _H_UNISTD
#define _H_UNISTD

#ifndef _H_STANDARDS
#include <standards.h>
#endif

#ifndef _H_TYPES
#include <sys/types.h>  /* for time_t */
#endif

#ifndef _H_ACCESS
#include <sys/access.h>	/* for the "access" function */
#endif

/*
 * POSIX requires that certain values be included in unistd.h.  It also
 * requires that when _POSIX_SOURCE is defined only those standard
 * specific values are present.  This header includes all the POSIX
 * required entries.
 */

#ifdef _POSIX_SOURCE
#ifdef _LARGE_FILES
#define lseek lseek64
#endif


/* Symbolic constants for the "lseek" function: */
#ifndef SEEK_SET
#define SEEK_SET 0	/* Set file pointer to "offset" */
#define SEEK_CUR 1	/* Set file pointer to current plus "offset" */
#define SEEK_END 2	/* Set file pointer to EOF plus "offset" */
#endif /* SEEK_SET */

#ifdef _NO_PROTO

#ifndef _KERNEL
extern int access();
extern unsigned int alarm();
extern int chdir();
extern int chown();
extern int close();
extern char *ctermid();
extern char *cuserid();
extern int dup();
extern int dup2();
extern int execl();
extern int execv();
extern int execle(); 
extern int execve();
extern int execlp();
extern int execvp();
extern void _exit();
extern pid_t fork();
extern long fpathconf();
extern char *getcwd();
extern gid_t getegid();
extern uid_t geteuid();
extern gid_t getgid();
extern int getgroups();
extern char *getlogin();
extern pid_t getpgrp();
extern pid_t getpid();
extern pid_t getppid();
extern uid_t getuid();
extern int isatty();
extern int link();
extern off_t lseek();
extern long pathconf();
extern int pause();
extern int pipe();
extern int read();
extern int rmdir();
extern int setgid();
extern int setpgid();
extern int setsid(); 
extern int setuid();
extern unsigned int sleep();
extern long sysconf();
extern pid_t tcgetpgrp();
extern int tcsetpgrp();
extern char *ttyname();
extern int unlink();
extern int write(); 
#endif		/* !_KERNEL	*/

#else		/* POSIX required prototypes */

#ifndef _KERNEL
extern int access(const char *, int);
extern unsigned int alarm(unsigned int);
extern int chdir(const char *);
extern int chown(const char *, uid_t, gid_t);
extern int close(int);
extern char *ctermid(char *);
extern char *cuserid(char *);
extern int dup(int);
extern int dup2(int, int);
extern int execl(const char *, const char *, ...);
extern int execv(const char *, char *const []);
extern int execle(const char *, const char *, ...); 
extern int execve(const char *, char *const [], char *const []);
extern int execlp(const char *, const char *, ...); 
extern int execvp(const char *, char *const []);
extern void _exit(int);
extern pid_t fork(void);
extern long fpathconf(int, int);
extern char *getcwd(char *, size_t);
extern gid_t getegid(void);
extern uid_t geteuid(void);
extern gid_t getgid(void);
extern int getgroups(int, gid_t []);
extern char *getlogin(void);
#ifndef _BSD
extern pid_t getpgrp(void);
#endif /* _BSD */
extern pid_t getpid(void);
extern pid_t getppid(void);
extern uid_t getuid(void);
extern int isatty(int);
extern int link(const char *, const char *);
extern off_t lseek(int, off_t, int);
#ifdef _LARGE_FILE_API
extern off64_t	lseek64(int, off64_t, int);
#endif
extern long pathconf(const char *, int);
extern int pause(void);
extern int pipe(int []);
extern ssize_t read(int, void *, size_t);
extern int rmdir(const char *);
extern int setgid(gid_t);
extern int setpgid(pid_t, pid_t);
extern pid_t setsid(void);
extern int setuid(uid_t);
extern unsigned int sleep(unsigned int);
extern long sysconf(int);
extern pid_t tcgetpgrp(int);
extern int tcsetpgrp(int, pid_t);
extern char *ttyname(int);
extern int unlink(const char *);
extern ssize_t write(int, const void *, size_t); 
#endif		/* !_KERNEL	*/
#endif		/* !_NO_PROTO	*/

#define STDIN_FILENO	0
#define STDOUT_FILENO	1
#define STDERR_FILENO	2

#define _POSIX_JOB_CONTROL	1
#define _POSIX_SAVED_IDS	1
#define _POSIX_VERSION		199009L
#define _POSIX2_VERSION		199209L
#define _POSIX2_C_VERSION	199209L

#define _POSIX_REENTRANT_FUNCTIONS		1
#define _POSIX_THREADS				1
#undef  _POSIX_THREAD_ATTR_STACKADDR
#define _POSIX_THREAD_ATTR_STACKSIZE		1
#undef  _POSIX_THREAD_FORKALL
#define _POSIX_THREAD_PRIORITY_SCHEDULING	1
#undef  _POSIX_THREAD_PRIO_INHERIT
#undef  _POSIX_THREAD_PRIO_PROTECT
#undef  _POSIX_THREAD_PROCESS_SHARED

#define _POSIX_CHOWN_RESTRICTED	 0
#define _POSIX_VDISABLE 	 0xFF
#define _POSIX_NO_TRUNC	    	 0

#ifndef NULL 
#define NULL	0
#endif

/* arguments for the confstr() function */

#define _CS_PATH	1
#define _CSPATH		"/usr/bin"

/* arguments for the pathconf() function */

#define _PC_CHOWN_RESTRICTED	10
#define _PC_LINK_MAX		11
#define _PC_MAX_CANON		12
#define _PC_MAX_INPUT		13
#define _PC_NAME_MAX		14
#define _PC_NO_TRUNC		15
#define _PC_PATH_MAX		16
#define _PC_PIPE_BUF		17
#define _PC_VDISABLE 		18

/* arguments for the sysconf() function, the defined numbers are used as 
 * array index in sysconf().
 *
 * POSIX.1(1990), Table 4-2 
 */
#define _SC_ARG_MAX			0
#define _SC_CHILD_MAX			1
#define _SC_CLK_TCK			2
#define _SC_NGROUPS_MAX			3
#define _SC_OPEN_MAX			4
#define _SC_STREAM_MAX			5
#define _SC_TZNAME_MAX			6
#define _SC_JOB_CONTROL			7
#define _SC_SAVED_IDS			8
#define _SC_VERSION			9

/* POSIX.1(1990), Table 2-3, required by command getconf */
	
#define _SC_POSIX_ARG_MAX		10
#define _SC_POSIX_CHILD_MAX		11	
#define _SC_POSIX_LINK_MAX		12
#define _SC_POSIX_MAX_CANON		13
#define _SC_POSIX_MAX_INPUT		14
#define _SC_POSIX_NAME_MAX		15
#define _SC_POSIX_NGROUPS_MAX		16
#define _SC_POSIX_OPEN_MAX		17
#define _SC_POSIX_PATH_MAX		18
#define _SC_POSIX_PIPE_BUF		19
#define _SC_POSIX_SSIZE_MAX		20
#define _SC_POSIX_STREAM_MAX		21
#define _SC_POSIX_TZNAME_MAX		22

/* POSIX.2 (Draft 10), Table 41)	*/

#define _SC_BC_BASE_MAX			23
#define _SC_BC_DIM_MAX			24
#define _SC_BC_SCALE_MAX		25
#define _SC_BC_STRING_MAX		26
#define _SC_EQUIV_CLASS_MAX		27
#define _SC_EXPR_NEST_MAX		28
#define _SC_LINE_MAX			29
#define _SC_RE_DUP_MAX			30
#define _SC_2_VERSION			31
#define _SC_2_C_DEV			32
#define _SC_2_FORT_DEV			33
#define _SC_2_FORT_RUN			34
#define _SC_2_LOCALEDEF			35
#define _SC_2_SW_DEV			36

/* POSIX.2 (Draft 10), Table 13)	*/

#define _SC_POSIX2_BC_BASE_MAX		37
#define _SC_POSIX2_BC_DIM_MAX		38
#define _SC_POSIX2_BC_SCALE_MAX		39
#define _SC_POSIX2_BC_STRING_MAX	40
#define _SC_POSIX2_EQUIV_CLASS_MAX	41
#define _SC_POSIX2_EXPR_NEST_MAX	42
#define _SC_POSIX2_LINE_MAX		43
#define _SC_POSIX2_RE_DUP_MAX		44
#define _SC_PASS_MAX			45
#define _SC_XOPEN_VERSION		46
#define _SC_ATEXIT_MAX			47
#if _XOPEN_SOURCE_EXTENDED==1
#define _SC_PAGE_SIZE			48
#endif /* _XOPEN_SOURCE_EXTENDED */
#define _SC_AES_OS_VERSION		49
#define _SC_COLL_WEIGHTS_MAX		50
#define _SC_2_C_BIND			51
#define _SC_2_C_VERSION			52
#define _SC_2_UPE			53
#define _SC_2_CHAR_TERM			54
#define _SC_XOPEN_SHM			55
#define _SC_XOPEN_CRYPT			56
#define _SC_XOPEN_ENH_I18N		57
#if _XOPEN_SOURCE_EXTENDED==1
#define _SC_PAGESIZE                    _SC_PAGE_SIZE
#define _SC_IOV_MAX                     58
#endif /* _XOPEN_SOURCE_EXTENDED */
#define _SC_REENTRANT_FUNCTIONS		59
#define _SC_THREADS			60
#define _SC_THREAD_ATTR_STACKADDR	61
#define _SC_THREAD_ATTR_STACKSIZE	62
#define _SC_THREAD_FORKALL		63
#define _SC_THREAD_PRIORITY_SCHEDULING	64
#define _SC_THREAD_PRIO_INHERIT		65
#define _SC_THREAD_PRIO_PROTECT		66
#define _SC_THREAD_PROCESS_SHARED	67
#define _SC_THREAD_DATAKEYS_MAX		68
#define _SC_THREAD_STACK_MIN		69
#define _SC_THREAD_THREADS_MAX		70
#define _SC_NPROCESSORS_CONF		71
#define _SC_NPROCESSORS_ONLN		72
#if _XOPEN_SOURCE_EXTENDED==1
#define _SC_XOPEN_UNIX			73
#endif /* _XOPEN_SOURCE_EXTENDED */

#endif /* _POSIX_SOURCE */

#ifdef _XOPEN_SOURCE

#define _XOPEN_VERSION		4
#define _XOPEN_XCU_VERSION	4
#define _XOPEN_XPG3		1
#define _XOPEN_XPG4		1

#define _POSIX2_C_BIND		1
#define _POSIX2_C_DEV		1
#define _POSIX2_CHAR_TERM	1
#define _POSIX2_LOCALEDEF	1
#define _POSIX2_UPE		1
#define _POSIX2_FORT_DEV	(-1)
#define _POSIX2_FORT_RUN	(-1)
#define _POSIX2_SW_DEV		1	

#define _XOPEN_CRYPT		1
#define _XOPEN_SHM		1	
#define _XOPEN_ENH_I18N		1	

extern  char    *optarg;
extern  int     optind, opterr, optopt;

#ifdef _NO_PROTO
	extern  int     chroot();
	extern	size_t	confstr();
	extern  char    *crypt();
	extern  void    encrypt();
	extern  int     fsync();
	extern	int	getopt();
	extern  char    *getpass();
	extern	int	nice();
	extern  void    swab();

#else
	extern  int     chroot(const char *);
	extern	size_t	confstr(int, char*, size_t);
	extern  char    *crypt(const char *, const char *);
	extern  void    encrypt(char *, int);
	extern  int     fsync(int);
	extern	int	getopt(int, char* const*, const char*);
	extern  char    *getpass(const char *);
	extern	int	nice(int);
	extern  void    swab(const void *, void *, ssize_t);

#endif

#endif /* _XOPEN _SOURCE */

#if _XOPEN_SOURCE_EXTENDED==1
#ifdef _LARGE_FILES
#define	ftruncate	ftruncate64
#define	truncate	truncate64
#endif

#ifndef _H_LOCKF
#include <sys/lockf.h>		/* lockf definitions for portability	*/
#endif

#define _XOPEN_UNIX		1

#ifdef _NO_PROTO
	extern int		brk();
	extern int		fchdir();
	extern int		fchown();
	extern int		ftruncate();
	extern int		getdtablesize();
	extern long		gethostid();
	extern int		gethostname();
	extern int		getpagesize();
	extern pid_t		getpgid();
	extern pid_t		getsid();
	extern char		*getwd();
	extern int		lchown();
	extern int		readlink();
	extern void		*sbrk();
	extern pid_t		setpgrp();
	extern int		setregid();
	extern int		setreuid();
	extern int		symlink();
	extern void		sync();
	extern int		truncate();
	extern useconds_t	ualarm();
	extern int		usleep();
	extern pid_t		vfork();
#else
	extern int		brk(void *);
	extern int		fchdir(int);
	extern int		fchown(int, uid_t, gid_t);
	extern int		ftruncate(int, off_t);
#ifdef _LARGE_FILE_API
	extern int		ftruncate64(int, off64_t);
#endif
	extern int		getdtablesize(void);
	extern int		gethostname(char *, size_t);
	extern long		gethostid(void);
	extern int		getpagesize(void);
	extern pid_t		getpgid(pid_t);
	extern pid_t		getsid(pid_t);
	extern char		*getwd(char *);
	extern int		lchown(const char *, uid_t, gid_t);
	extern int		readlink(const char *, char *, size_t);
	extern void		*sbrk(int);
#ifndef _BSD
	extern pid_t		setpgrp(void);
#endif /* _BSD */
	extern int		setregid(gid_t, gid_t);
	extern int		setreuid(uid_t, uid_t);
	extern int		symlink(const char *, const char *);
	extern void		sync(void);
	extern int		truncate(const char *, off_t);
#ifdef _LARGE_FILE_API
	extern int		truncate64(const char *, off64_t);
#endif
	extern useconds_t	ualarm(useconds_t, useconds_t);
	extern int		usleep(useconds_t);
	extern pid_t		vfork(void);

#endif /* _NO_PROTO */

#endif /* _XOPEN_SOURCE_EXTENDED */

#ifdef _ALL_SOURCE

extern char **environ;

#ifdef _NO_PROTO
	extern int		ioctl();
	extern int 		readx();
	extern int 		setgroups();
	extern int 		writex();
	extern offset_t llseek();
#else
#ifndef _BSD
	extern int		ioctl(int, int, ...);
#endif /* _BSD */
	extern int 		setgroups(int, gid_t []);
#ifndef _KERNEL
	extern int 	readx(int, char*, unsigned, long);
	extern int 	writex(int, char*, unsigned, long);

#ifdef _LARGE_FILES
#define fclear fclear64
#define	fsync_range	fsync_range64
#endif
	extern off_t	fclear(int, off_t);
	extern int	fsync_range(int, int, off_t, off_t);
#ifdef _LARGE_FILE_API
	extern off64_t	fclear64(int, off64_t);
	extern int	fsync_range64(int, int, off64_t, off64_t);
#endif
	extern offset_t llseek(int, offset_t, int);
	extern int	fdatasync(int);
	extern int	finfo(const char *, int, void *, int);
	extern int	ffinfo(int, int, void *, int);

#endif /* ndef _KERNEL */

#endif /* _NO_PROTO */

#define _AES_OS_VERSION 1               /* OSF, AES version */

#endif /* _ALL_SOURCE */

#endif /* _H_UNISTD */