Lines Matching +full:blocking +full:- +full:io
2 * Copyright (c) 2000-2002, 2004-2006 Proofpoint, Inc. and its suppliers.
14 * $Id: local.h,v 1.59 2013-11-22 20:51:43 ca Exp $
42 /* std io functions */
52 /* stdio io functions */
61 /* string io functions */
70 /* syslog io functions */
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.
117 ** switch the mode of the file (blocking/non-blocking) to match
120 ** in blocking mode. If there is to be a finite timeout then the file
121 ** is best placed in non-blocking mode. Then, if not enough can be
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
147 if (((fd) = sm_io_getinfo(fp, SM_IO_WHAT_FD, NULL)) == -1) \
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) \
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) \
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
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
215 ** fd -- a file descriptor for doing select() with
216 ** timeout -- the original user set value.
232 (to) = (fp)->f_timeout; \
246 sm_io_to.tv_usec = ((to) - (sm_io_to.tv_sec * 1000)) * 1000; \
279 (to) -= (sm_io_to_diff.tv_sec * 1000); \
280 (to) -= (sm_io_to_diff.tv_usec / 1000); \