1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
/* $Id: replace.h 8000 2009-07-12 10:53:35Z gbiggs $
*
* replacement function prototypes
*/
#ifndef _REPLACE_H
#define _REPLACE_H
#include <playerconfig.h>
/* Compatibility definitions for System V `poll' interface.
Copyright (C) 1994,96,97,98,99,2000 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with the GNU C Library; see the file COPYING.LIB. If not,
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
#ifdef __cplusplus
extern "C" {
#endif
#if defined (WIN32)
#if defined (PLAYER_STATIC)
#define PLAYERREPLACE_EXPORT
#elif defined (playerreplace_EXPORTS)
#define PLAYERREPLACE_EXPORT __declspec (dllexport)
#else
#define PLAYERREPLACE_EXPORT __declspec (dllimport)
#endif
#else
#define PLAYERREPLACE_EXPORT
#endif
#if !defined (PATH_MAX)
// Windows limits the maximum path length to 260
#define PATH_MAX 260
#endif
#if !HAVE_POLLIN
/* Event types that can be polled for. These bits may be set in `events'
to indicate the interesting event types; they will appear in `revents'
to indicate the status of the file descriptor. */
#define POLLIN 01 /* There is data to read. */
#define POLLPRI 02 /* There is urgent data to read. */
#define POLLOUT 04 /* Writing now will not block. */
/* Some aliases. */
#define POLLWRNORM POLLOUT
#define POLLRDNORM POLLIN
#define POLLRDBAND POLLPRI
/* Event types always implicitly polled for. These bits need not be set in
`events', but they will appear in `revents' to indicate the status of
the file descriptor. */
#define POLLERR 010 /* Error condition. */
#define POLLHUP 020 /* Hung up. */
#define POLLNVAL 040 /* Invalid polling request. */
/* Canonical number of polling requests to read in at a time in poll. */
#define NPOLLFILE 30
#endif // !HAVE_POLLIN
#if !HAVE_POLLFD
/* Data structure describing a polling request. */
struct pollfd
{
int fd; /* File descriptor to poll. */
short int events; /* Types of events poller cares about. */
short int revents; /* Types of events that actually occurred. */
};
#endif // !HAVE_POLLFD
#if !HAVE_POLL
/* Poll the file descriptors described by the NFDS structures starting at
FDS. If TIMEOUT is nonzero and not -1, allow TIMEOUT milliseconds for
an event to occur; if TIMEOUT is -1, block until an event occurs.
Returns the number of file descriptors with events, zero if timed out,
or -1 for errors. */
PLAYERREPLACE_EXPORT int poll (struct pollfd *fds, unsigned long int nfds, int timeout);
#else
#include <sys/poll.h> /* for poll(2) */
#endif // !HAVE_POLL
#if !HAVE_DIRNAME
PLAYERREPLACE_EXPORT char * dirname (char *path);
#else
#include <libgen.h> // for dirname(3)
#endif // !HAVE_DIRNAME
#if !HAVE_CFMAKERAW && !WIN32
#include <termios.h>
void cfmakeraw (struct termios *t);
#endif // !HAVE_CFMAKERAW && !WIN32
#if !HAVE_ROUND
PLAYERREPLACE_EXPORT double round (double x);
#endif // !HAVE_ROUND
#if !HAVE_RINT
PLAYERREPLACE_EXPORT double rint (double x);
#endif
#if !HAVE_COMPRESSBOUND
PLAYERREPLACE_EXPORT unsigned long compressBound (unsigned long sourceLen);
#endif // HAVE_COMPRESSBOUND
#if !HAVE_CLOCK_GETTIME
#include <time.h>
#define CLOCK_REALTIME 0
PLAYERREPLACE_EXPORT int clock_gettime(int clk_id, struct timespec *tp);
#endif // !HAVE_CLOCK_GETTIME
#if !HAVE_STRUCT_TIMESPEC
struct timespec
{
long tv_sec;
long tv_nsec;
};
// Must define it here to stop Win32 pthreads from complaining, since that defines it as well
#define HAVE_STRUCT_TIMESPEC 1
#endif
#if !HAVE_USLEEP
PLAYERREPLACE_EXPORT int usleep (int usec);
#endif
#if !HAVE_NANOSLEEP
PLAYERREPLACE_EXPORT int nanosleep (const struct timespec *req, struct timespec *rem);
#endif
#if !HAVE_GETTIMEOFDAY && WIN32
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
};
PLAYERREPLACE_EXPORT int gettimeofday (struct timeval *tv, void *tzp);
#endif
#if !HAVE_GETOPT
PLAYERREPLACE_EXPORT int getopt (int argc, char * const argv[], const char *optstring);
PLAYERREPLACE_EXPORT extern char *optarg;
PLAYERREPLACE_EXPORT extern int optind, opterr, optopt;
#endif
#ifdef __cplusplus
}
#endif
#endif
|