OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [isoinfra/] [v2_0/] [include/] [sys/] [select.h] - Blame information for rev 595

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
/*========================================================================
2
//
3
//      sys/select.h
4
//
5
//      POSIX definitions for select()
6
//
7
//========================================================================
8
//####ECOSGPLCOPYRIGHTBEGIN####
9
// -------------------------------------------
10
// This file is part of eCos, the Embedded Configurable Operating System.
11
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
12
// Copyright (C) 2002 Nick Garnett
13
//
14
// eCos is free software; you can redistribute it and/or modify it under
15
// the terms of the GNU General Public License as published by the Free
16
// Software Foundation; either version 2 or (at your option) any later version.
17
//
18
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
20
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
21
// for more details.
22
//
23
// You should have received a copy of the GNU General Public License along
24
// with eCos; if not, write to the Free Software Foundation, Inc.,
25
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
26
//
27
// As a special exception, if other files instantiate templates or use macros
28
// or inline functions from this file, or you compile this file and link it
29
// with other works to produce a work based on this file, this file does not
30
// by itself cause the resulting work to be covered by the GNU General Public
31
// License. However the source code for this file must still be made available
32
// in accordance with section (3) of the GNU General Public License.
33
//
34
// This exception does not invalidate any other reasons why a work based on
35
// this file might be covered by the GNU General Public License.
36
//
37
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38
// at http://sources.redhat.com/ecos/ecos-license/
39
// -------------------------------------------
40
//####ECOSGPLCOPYRIGHTEND####
41
//========================================================================
42
//#####DESCRIPTIONBEGIN####
43
//
44
// Author(s):     jlarmour
45
// Contributors:
46
// Date:          2001-07-26
47
// Purpose:       This file provides the macros, types and functions
48
//                required by POSIX 1003.1.
49
// Description:   Much of the real contents of this file get set from the
50
//                configuration (set by the implementation)
51
// Usage:         #include <sys/select.h>
52
//
53
//####DESCRIPTIONEND####
54
//
55
//======================================================================
56
*/
57
 
58
/* CONFIGURATION */
59
 
60
#include <pkgconf/isoinfra.h>          /* Configuration header */
61
 
62
/* ------------------------------------------------------------------- */
63
 
64
#if !defined(_POSIX_SOURCE)
65
 
66
#ifdef CYGINT_ISO_SELECT
67
# ifdef CYGBLD_ISO_SELECT_HEADER
68
#  include CYGBLD_ISO_SELECT_HEADER
69
# else
70
 
71
#   ifndef CYGONCE_ISO_SYS_SELECT_FD_SETS
72
#   define CYGONCE_ISO_SYS_SELECT_FD_SETS
73
 
74
#define NBBY    8               /* number of bits in a byte */
75
 
76
/*
77
 * Select uses bit masks of file descriptors in longs.  These macros
78
 * manipulate such bit fields (the filesystem macros use chars).
79
 * FD_SETSIZE may be defined by the user, but the default here should
80
 * be enough for most uses.
81
 */
82
#ifndef FD_SETSIZE
83
#define FD_SETSIZE      256
84
#endif
85
 
86
typedef unsigned int    fd_mask;
87
#define __NFDBITS       (sizeof(fd_mask) * NBBY)        /* bits per mask */
88
 
89
#ifndef __howmany
90
#define __howmany(__x, __y)     (((__x) + ((__y) - 1)) / (__y))
91
#endif
92
 
93
typedef struct fd_set {
94
        fd_mask fds_bits[__howmany(FD_SETSIZE, __NFDBITS)];
95
} fd_set;
96
 
97
#define FD_SET(__n, __p)   ((__p)->fds_bits[(__n)/__NFDBITS] |= (1 << ((__n) % __NFDBITS)))
98
#define FD_CLR(__n, __p)   ((__p)->fds_bits[(__n)/__NFDBITS] &= ~(1 << ((__n) % __NFDBITS)))
99
#define FD_ISSET(__n, __p) ((__p)->fds_bits[(__n)/__NFDBITS] & (1 << ((__n) % __NFDBITS)))
100
 
101
#define FD_COPY(__f, __t)                                       \
102
{                                                               \
103
    unsigned int _i;                                            \
104
    for( _i = 0; _i < __howmany(FD_SETSIZE, __NFDBITS) ; _i++ ) \
105
        (__t)->fds_bits[_i] = (__f)->fds_bits[_i];              \
106
}
107
 
108
#define FD_ZERO(__p)                                            \
109
{                                                               \
110
    unsigned int _i;                                            \
111
    for( _i = 0; _i < __howmany(FD_SETSIZE, __NFDBITS) ; _i++ ) \
112
        (__p)->fds_bits[_i] = 0;                                \
113
}
114
 
115
#   endif /* CYGONCE_ISO_SYS_SELECT_FD_SETS */
116
 
117
#  ifndef __NEED_FD_SETS_ONLY
118
 
119
#   ifndef CYGONCE_ISO_SYS_SELECT_H
120
#   define CYGONCE_ISO_SYS_SELECT_H
121
 
122
#include <signal.h>
123
 
124
#   ifdef __cplusplus
125
extern "C" {
126
#   endif
127
 
128
struct timeval;
129
extern int
130
select( int /* nfd */, fd_set * /* in */, fd_set * /* out */,
131
        fd_set * /* ex */, struct timeval * /* tv */ );
132
 
133
#ifdef CYGPKG_POSIX
134
struct timespec;
135
extern int
136
pselect( int /* nfd */, fd_set * /* in */, fd_set * /* out */,
137
        fd_set * /* ex */, const struct timespec * /* ts */,
138
        const sigset_t * /* mask */);
139
#endif
140
 
141
#   ifdef __cplusplus
142
}   /* extern "C" */
143
#   endif
144
 
145
#   endif /* CYGONCE_ISO_SYS_SELECT_H multiple inclusion protection */
146
 
147
#  endif /* __NEED_FD_SETS_ONLY */
148
 
149
# endif
150
#endif
151
 
152
 
153
#endif /* if !defined(_POSIX_SOURCE) */
154
/* ------------------------------------------------------------------- */
155
 
156
/* EOF sys/select.h */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.