Lines Matching +full:no +full:- +full:can +full:- +full:fd
2 * Copyright (c) 2000-2002, 2004-2006 Proofpoint, Inc. and its suppliers.
11 * forth in the LICENSE file which can be found at the top level of
14 * $Id: local.h,v 1.59 2013-11-22 20:51:43 ca Exp $
83 ((((fp)->f_flags & SMWR) == 0 || (fp)->f_bf.smb_base == NULL) && \
91 #define HASUB(fp) ((fp)->f_ub.smb_base != NULL)
94 if ((fp)->f_ub.smb_base != (fp)->f_ubuf) \
95 sm_free((char *)(fp)->f_ub.smb_base); \
96 (fp)->f_ub.smb_base = NULL; \
113 ** SM_CONVERT_TIME -- convert the API timeout flag for select() usage.
116 ** file descriptor (fd) if possible. The 'fd' is needed to possibly
117 ** switch the mode of the file (blocking/non-blocking) to match
121 ** is best placed in non-blocking mode. Then, if not enough can be
122 ** written, select() can be used to test when something can be written
125 ** Iff (yes "iff") the 'fd' is "-1" in value then the mode change
126 ** will not happen. This situation arises when a late-binding-to-disk
131 ** fp -- the file pointer the timeout is for
132 ** fd -- to become the file descriptor value from 'fp'
133 ** val -- the timeout value to be converted
134 ** time -- a struct timeval holding the converted value
137 ** nothing, this is flow-through code
146 # define SM_CONVERT_TIME(fp, fd, val, time) { \ argument
147 if (((fd) = sm_io_getinfo(fp, SM_IO_WHAT_FD, NULL)) == -1) \
149 /* can't get an fd, likely internal 'fake' fp */ \
153 (val) = (fp)->f_timeout; \
156 (time)->tv_sec = 0; \
157 (time)->tv_usec = 0; \
161 (time)->tv_sec = (val) / 1000; \
162 (time)->tv_usec = ((val) - ((time)->tv_sec * 1000)) * 1000; \
166 if ((fp)->f_timeoutstate == SM_TIME_NONBLOCK && (fd) != -1) \
169 ret = fcntl((fd), F_GETFL, 0); \
170 if (ret == -1 || fcntl((fd), F_SETFL, \
171 ret & ~O_NONBLOCK) == -1) \
176 (fp)->f_timeoutstate = SM_TIME_BLOCK; \
177 if ((fp)->f_modefp != NULL) \
178 (fp)->f_modefp->f_timeoutstate = SM_TIME_BLOCK; \
182 if ((fp)->f_timeoutstate == SM_TIME_BLOCK && (fd) != -1) \
185 ret = fcntl((fd), F_GETFL, 0); \
186 if (ret == -1 || fcntl((fd), F_SETFL, \
187 ret | O_NONBLOCK) == -1) \
192 (fp)->f_timeoutstate = SM_TIME_NONBLOCK; \
193 if ((fp)->f_modefp != NULL) \
194 (fp)->f_modefp->f_timeoutstate = SM_TIME_NONBLOCK; \
200 ** SM_IO_WR_TIMEOUT -- setup the timeout for the write
202 ** This #define uses a select() to wait for the 'fd' to become writable.
203 ** The select() can be active for up to 'to' time. The select may not
204 ** use all of the the 'to' time. Hence, the amount of "wall-clock" time is
206 ** BSD-based/like systems the timeout for a select is updated for the
209 ** since a BSD-like system will have updated it and we don't want to
211 ** Note: if a valid 'fd' doesn't exist yet, don't use this (e.g. the
215 ** fd -- a file descriptor for doing select() with
216 ** timeout -- the original user set value.
225 #define SM_IO_WR_TIMEOUT(fp, fd, to) { \ argument
232 (to) = (fp)->f_timeout; \
246 sm_io_to.tv_usec = ((to) - (sm_io_to.tv_sec * 1000)) * 1000; \
248 if (!SM_FD_OK_SELECT(fd)) \
254 FD_SET((fd), &sm_io_to_mask); \
256 FD_SET((fd), &sm_io_x_mask); \
261 sm_io_to_sel = select((fd) + 1, NULL, &sm_io_to_mask, \
279 (to) -= (sm_io_to_diff.tv_sec * 1000); \
280 (to) -= (sm_io_to_diff.tv_usec / 1000); \
286 ** If there is no 'fd' just error (we can't timeout). If the timeout
287 ** is SM_TIME_FOREVER then there is no need to do a timeout with
290 ** Specify the condition here as macro so it can be used in several places.
293 #define IS_IO_ERROR(fd, ret, to) \ argument
294 ((fd) < 0 || \