/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1985-2012 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* David Korn <dgk@research.att.com> *
* Phong Vo <kpv@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* Glenn Fowler
* AT&T Research
*
* generate POSIX fcntl.h
*/
#if _typ_off64_t
#ifdef __STDC__
#endif
#endif
#if _hdr_fcntl
#include <fcntl.h>
#endif
#if _hdr_unistd
#include <unistd.h>
#endif
#if _typ_off64_t
#endif
int
main()
{
int f_local = 0;
int f_lck = 0;
printf("#pragma prototyped\n");
printf("\n");
printf("#if _typ_off64_t\n");
printf("#undef off_t\n");
printf("#ifdef __STDC__\n");
printf("#define off_t off_t\n");
printf("#endif\n");
printf("#endif\n");
printf("\n");
printf("\n");
printf("#if _typ_off64_t\n");
printf("#undef off_t\n");
printf("#ifdef __STDC__\n");
printf("#define off_t off_t\n");
printf("#endif\n");
printf("#endif\n");
printf("\n");
#if _hdr_mman
#else
#if _sys_mman
#endif
#endif
printf("\n");
#ifndef FD_CLOEXEC
printf("#define FD_CLOEXEC 1\n");
printf("\n");
#endif
#ifndef F_DUPFD
#else
#endif
#ifndef F_GETFD
#else
#endif
#ifndef F_GETFL
#else
#endif
#ifndef F_GETLK
#else
#endif
#ifndef F_RDLCK
#else
#endif
#ifndef F_SETFD
#else
#endif
#ifndef F_SETFL
#else
#endif
#ifndef F_SETLK
#else
#endif
#ifndef F_SETLKW
#else
#endif
#ifndef F_UNLCK
#else
#endif
#ifndef F_WRLCK
#else
#endif
#if NEED_F
printf("#define fcntl _ast_fcntl\n");
#if _lib_fcntl
printf("#define _lib_fcntl 1\n");
#endif
#ifndef F_DUPFD
#endif
#ifndef F_GETFD
#endif
#ifndef F_GETFL
#endif
#ifndef F_GETLK
#endif
#ifndef F_SETFD
#endif
#ifndef F_SETFL
#endif
#ifndef F_SETLK
#endif
#ifndef F_SETLKW
#endif
#if NEED_LCK
printf("\n");
#ifndef F_RDLCK
#endif
#ifndef F_WRLCK
#endif
#ifndef F_UNLCK
#endif
#endif
printf("\n");
if (f_lck == 3)
{
printf("struct flock\n");
printf("{\n");
printf(" short l_type;\n");
printf(" short l_whence;\n");
printf(" off_t l_start;\n");
printf(" off_t l_len;\n");
printf(" short l_pid;\n");
printf("};\n");
printf("\n");
}
printf("\n");
#endif
#ifdef F_DUPFD_CLOEXEC
printf("#define F_dupfd_cloexec F_DUPFD_CLOEXEC\n");
#else
printf("#define F_dupfd_cloexec F_DUPFD\n");
#endif
#ifndef O_APPEND
#else
#endif
#ifndef O_CREAT
#else
#endif
#ifndef O_EXCL
#else
#endif
#ifndef O_NOCTTY
#ifdef TIOCNOTTY
#endif
#else
#endif
#ifndef O_NONBLOCK
#ifndef O_NDELAY
#endif
#else
#endif
#ifndef O_RDONLY
#endif
#ifndef O_RDWR
#endif
#ifndef O_TRUNC
#else
#endif
#ifndef O_WRONLY
#endif
#if NEED_O
printf("#define open _ast_open\n");
#ifndef O_RDONLY
printf("#define O_RDONLY 0\n");
#endif
#ifndef O_WRONLY
printf("#define O_WRONLY 1\n");
#endif
#ifndef O_RDWR
printf("#define O_RDWR 2\n");
#endif
#ifndef O_APPEND
#endif
#ifndef O_CREAT
#endif
#ifndef O_EXCL
#endif
#ifndef O_NOCTTY
#ifdef TIOCNOTTY
#endif
#endif
#ifndef O_NONBLOCK
#ifndef O_NDELAY
#endif
#endif
#ifndef O_TRUNC
#endif
#endif
#ifndef O_ACCMODE
printf("#define O_ACCMODE (O_RDONLY|O_WRONLY|O_RDWR)\n");
#endif
#ifndef O_NOCTTY
#ifndef TIOCNOTTY
printf("#define O_NOCTTY 0\n");
#endif
#endif
#ifndef O_NONBLOCK
#ifdef O_NDELAY
printf("#define O_NONBLOCK O_NDELAY\n");
#endif
#endif
#ifndef O_BINARY
printf("#define O_BINARY 0\n");
#endif
#ifdef O_CLOEXEC
printf("#define O_cloexec O_CLOEXEC\n");
#else
printf("#define O_cloexec 0\n");
#endif
#ifndef O_TEMPORARY
printf("#define O_TEMPORARY 0\n");
#endif
#ifndef O_TEXT
printf("#define O_TEXT 0\n");
#endif
printf("\n");
#if NEED_F
printf("extern int fcntl(int, int, ...);\n");
#endif
#if NEED_O
printf("extern int open(const char*, int, ...);\n");
#endif
#endif
printf("\n");
printf("#if _typ_off64_t\n");
printf("#undef off_t\n");
printf("#define off_t off64_t\n");
printf("#endif\n");
printf("#if _lib_fstat64\n");
printf("#define fstat fstat64\n");
printf("#endif\n");
printf("#if _lib_lstat64\n");
printf("#define lstat lstat64\n");
printf("#endif\n");
printf("#if _lib_stat64\n");
printf("#define stat stat64\n");
printf("#endif\n");
printf("#if _lib_creat64\n");
printf("#define creat creat64\n");
printf("#endif\n");
printf("#if _lib_mmap64\n");
printf("#define mmap mmap64\n");
printf("#endif\n");
printf("#if _lib_open64\n");
printf("#undef open\n");
printf("#define open open64\n");
printf("#endif\n");
return 0;
}