1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
13 * The Original Code is the Netscape Portable Runtime (NSPR).
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 1998-2000 Netscape Communications Corporation. All
22 * Alternatively, the contents of this file may be used under the
23 * terms of the GNU General Public License Version 2 or later (the
24 * "GPL"), in which case the provisions of the GPL are applicable
25 * instead of those above. If you wish to allow use of your
26 * version of this file only under the terms of the GPL and not to
27 * allow others to use your version of this file under the MPL,
28 * indicate your decision by deleting the provisions above and
29 * replace them with the notice and other provisions required by
30 * the GPL. If you do not delete the provisions above, a recipient
31 * may use your version of this file under either the MPL or the
36 ** A collection of things thought to be obsolete
39 #if defined(PROBSLET_H)
48 ** Yield the current thread. The proper function to use in place of
49 ** PR_Yield() is PR_Sleep() with an argument of PR_INTERVAL_NO_WAIT.
51 NSPR_API(PRStatus) PR_Yield(void);
53 /************************************************************************/
54 /************* The following definitions are for select *****************/
55 /************************************************************************/
58 ** The following is obsolete and will be deleted in the next release!
59 ** These are provided for compatibility, but are GUARANTEED to be slow.
61 ** Override PR_MAX_SELECT_DESC if you need more space in the select set.
63 #ifndef PR_MAX_SELECT_DESC
64 #define PR_MAX_SELECT_DESC 1024
66 typedef struct PR_fd_set {
68 PRFileDesc *harray[PR_MAX_SELECT_DESC];
70 PRInt32 narray[PR_MAX_SELECT_DESC];
74 *************************************************************************
75 ** FUNCTION: PR_Select
78 ** The call returns as soon as I/O is ready on one or more of the underlying
79 ** file/socket descriptors or an exceptional condition is pending. A count of the
80 ** number of ready descriptors is returned unless a timeout occurs in which case
81 ** zero is returned. On return, PR_Select replaces the given descriptor sets with
82 ** subsets consisting of those descriptors that are ready for the requested condition.
83 ** The total number of ready descriptors in all the sets is the return value.
87 ** This argument is unused but is provided for select(unix) interface
88 ** compatability. All input PR_fd_set arguments are self-describing
89 ** with its own maximum number of elements in the set.
92 ** A set describing the io descriptors for which ready for reading
93 ** condition is of interest.
95 ** PR_fd_set *writefds
96 ** A set describing the io descriptors for which ready for writing
97 ** condition is of interest.
99 ** PR_fd_set *exceptfds
100 ** A set describing the io descriptors for which exception pending
101 ** condition is of interest.
103 ** Any of the above readfds, writefds or exceptfds may be given as NULL
104 ** pointers if no descriptors are of interest for that particular condition.
106 ** PRIntervalTime timeout
107 ** Amount of time the call will block waiting for I/O to become ready.
108 ** If this time expires without any I/O becoming ready, the result will
112 ** PR_fd_set *readfds
113 ** A set describing the io descriptors which are ready for reading.
115 ** PR_fd_set *writefds
116 ** A set describing the io descriptors which are ready for writing.
118 ** PR_fd_set *exceptfds
119 ** A set describing the io descriptors which have pending exception.
122 ** Number of io descriptors with asked for conditions or zero if the function
123 ** timed out or -1 on failure. The reason for the failure is obtained by
124 ** calling PR_GetError().
125 ** XXX can we implement this on windoze and mac?
126 **************************************************************************
128 NSPR_API(PRInt32) PR_Select(
129 PRInt32 num, PR_fd_set *readfds, PR_fd_set *writefds,
130 PR_fd_set *exceptfds, PRIntervalTime timeout);
133 ** The following are not thread safe for two threads operating on them at the
136 ** The following routines are provided for manipulating io descriptor sets.
137 ** PR_FD_ZERO(&fdset) initializes a descriptor set fdset to the null set.
138 ** PR_FD_SET(fd, &fdset) includes a particular file descriptor fd in fdset.
139 ** PR_FD_CLR(fd, &fdset) removes a file descriptor fd from fdset.
140 ** PR_FD_ISSET(fd, &fdset) is nonzero if file descriptor fd is a member of
141 ** fdset, zero otherwise.
143 ** PR_FD_NSET(osfd, &fdset) includes a particular native file descriptor osfd
145 ** PR_FD_NCLR(osfd, &fdset) removes a native file descriptor osfd from fdset.
146 ** PR_FD_NISSET(osfd, &fdset) is nonzero if native file descriptor osfd is a member of
147 ** fdset, zero otherwise.
150 NSPR_API(void) PR_FD_ZERO(PR_fd_set *set);
151 NSPR_API(void) PR_FD_SET(PRFileDesc *fd, PR_fd_set *set);
152 NSPR_API(void) PR_FD_CLR(PRFileDesc *fd, PR_fd_set *set);
153 NSPR_API(PRInt32) PR_FD_ISSET(PRFileDesc *fd, PR_fd_set *set);
154 NSPR_API(void) PR_FD_NSET(PRInt32 osfd, PR_fd_set *set);
155 NSPR_API(void) PR_FD_NCLR(PRInt32 osfd, PR_fd_set *set);
156 NSPR_API(PRInt32) PR_FD_NISSET(PRInt32 osfd, PR_fd_set *set);
158 #ifndef NO_NSPR_10_SUPPORT
162 #include <sys/stat.h>
165 NSPR_API(PRInt32) PR_Stat(const char *path, struct stat *buf);
166 #endif /* NO_NSPR_10_SUPPORT */
170 #endif /* defined(PROBSLET_H) */