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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [isoinfra/] [current/] [include/] [sys/] [select.h] - Blame information for rev 865

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

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

powered by: WebSVN 2.1.0

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