1*e93f7393Sniklas /* 2*e93f7393Sniklas * (c) Copyright 1990-1996 OPEN SOFTWARE FOUNDATION, INC. 3*e93f7393Sniklas * (c) Copyright 1990-1996 HEWLETT-PACKARD COMPANY 4*e93f7393Sniklas * (c) Copyright 1990-1996 DIGITAL EQUIPMENT CORPORATION 5*e93f7393Sniklas * (c) Copyright 1991, 1992 Siemens-Nixdorf Information Systems 6*e93f7393Sniklas * To anyone who acknowledges that this file is provided "AS IS" without 7*e93f7393Sniklas * any express or implied warranty: permission to use, copy, modify, and 8*e93f7393Sniklas * distribute this file for any purpose is hereby granted without fee, 9*e93f7393Sniklas * provided that the above copyright notices and this notice appears in 10*e93f7393Sniklas * all source code copies, and that none of the names listed above be used 11*e93f7393Sniklas * in advertising or publicity pertaining to distribution of the software 12*e93f7393Sniklas * without specific, written prior permission. None of these organizations 13*e93f7393Sniklas * makes any representations about the suitability of this software for 14*e93f7393Sniklas * any purpose. 15*e93f7393Sniklas */ 16*e93f7393Sniklas /* 17*e93f7393Sniklas * Header file for thread synchrounous I/O 18*e93f7393Sniklas */ 19*e93f7393Sniklas 20*e93f7393Sniklas #ifndef CMA_THREAD_IO 21*e93f7393Sniklas #define CMA_THREAD_IO 22*e93f7393Sniklas 23*e93f7393Sniklas /* 24*e93f7393Sniklas * INCLUDE FILES 25*e93f7393Sniklas */ 26*e93f7393Sniklas 27*e93f7393Sniklas #include <cma_config.h> 28*e93f7393Sniklas #include <sys/select.h> 29*e93f7393Sniklas #include <cma.h> 30*e93f7393Sniklas #include <sys/types.h> 31*e93f7393Sniklas #include <sys/time.h> 32*e93f7393Sniklas #include <cma_init.h> 33*e93f7393Sniklas #include <cma_errors.h> 34*e93f7393Sniklas 35*e93f7393Sniklas /* 36*e93f7393Sniklas * CONSTANTS 37*e93f7393Sniklas */ 38*e93f7393Sniklas 39*e93f7393Sniklas /* 40*e93f7393Sniklas * Maximum number of files (ie, max_fd+1) 41*e93f7393Sniklas */ 42*e93f7393Sniklas #define cma__c_mx_file FD_SETSIZE 43*e93f7393Sniklas 44*e93f7393Sniklas /* 45*e93f7393Sniklas * Number of bits per file descriptor bit mask (ie number of bytes * bits/byte) 46*e93f7393Sniklas */ 47*e93f7393Sniklas #define cma__c_nbpm NFDBITS 48*e93f7393Sniklas 49*e93f7393Sniklas /* 50*e93f7393Sniklas * TYPE DEFINITIONS 51*e93f7393Sniklas */ 52*e93f7393Sniklas 53*e93f7393Sniklas typedef enum CMA__T_IO_TYPE { 54*e93f7393Sniklas cma__c_io_read = 0, 55*e93f7393Sniklas cma__c_io_write = 1, 56*e93f7393Sniklas cma__c_io_except = 2 57*e93f7393Sniklas } cma__t_io_type; 58*e93f7393Sniklas #define cma__c_max_io_type 2 59*e93f7393Sniklas 60*e93f7393Sniklas /* 61*e93f7393Sniklas * From our local <sys/types.h>: 62*e93f7393Sniklas * 63*e93f7393Sniklas * typedef long fd_mask; 64*e93f7393Sniklas * 65*e93f7393Sniklas * typedef struct fd_set { 66*e93f7393Sniklas * fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; 67*e93f7393Sniklas * } fd_set; 68*e93f7393Sniklas * 69*e93f7393Sniklas */ 70*e93f7393Sniklas typedef fd_mask cma__t_mask; 71*e93f7393Sniklas typedef fd_set cma__t_file_mask; 72*e93f7393Sniklas 73*e93f7393Sniklas 74*e93f7393Sniklas 75*e93f7393Sniklas /* 76*e93f7393Sniklas * GLOBAL DATA 77*e93f7393Sniklas */ 78*e93f7393Sniklas 79*e93f7393Sniklas /* 80*e93f7393Sniklas * Maximum number of files (ie, max_fd+1) as determined by getdtablesize(). 81*e93f7393Sniklas */ 82*e93f7393Sniklas extern int cma__g_mx_file; 83*e93f7393Sniklas 84*e93f7393Sniklas /* 85*e93f7393Sniklas * Number of submasks (ie "int" sized chunks) per file descriptor mask as 86*e93f7393Sniklas * determined by getdtablesize(). 87*e93f7393Sniklas */ 88*e93f7393Sniklas extern int cma__g_nspm; 89*e93f7393Sniklas 90*e93f7393Sniklas /* 91*e93f7393Sniklas * MACROS 92*e93f7393Sniklas */ 93*e93f7393Sniklas 94*e93f7393Sniklas /* 95*e93f7393Sniklas * Define a constant for the errno value which indicates that the requested 96*e93f7393Sniklas * operation was not performed because it would block the process. 97*e93f7393Sniklas */ 98*e93f7393Sniklas # define cma__is_blocking(s) \ 99*e93f7393Sniklas ((s == EAGAIN) || (s == EWOULDBLOCK) || (s == EINPROGRESS) || \ 100*e93f7393Sniklas (s == EALREADY) || (s == EDEADLK)) 101*e93f7393Sniklas 102*e93f7393Sniklas /* 103*e93f7393Sniklas * It is necessary to issue an I/O function, before calling cma__io_wait() 104*e93f7393Sniklas * in the following cases: 105*e93f7393Sniklas * 106*e93f7393Sniklas * * This file descriptor has been set non-blocking by CMA 107*e93f7393Sniklas * * This file descriptor has been set non-blocking by the user. 108*e93f7393Sniklas */ 109*e93f7393Sniklas 110*e93f7393Sniklas #define cma__issue_io_call(fd) \ 111*e93f7393Sniklas ( (cma__g_file[fd]->non_blocking) || \ 112*e93f7393Sniklas (cma__g_file[fd]->user_fl.user_non_blocking) ) 113*e93f7393Sniklas 114*e93f7393Sniklas 115*e93f7393Sniklas #define cma__set_user_nonblocking(flags) \ 116*e93f7393Sniklas 117*e93f7393Sniklas /* 118*e93f7393Sniklas * Determine if the file is open 119*e93f7393Sniklas */ 120*e93f7393Sniklas /* 121*e93f7393Sniklas * If the file gets closed while waiting for the mutex cma__g_file[rfd] 122*e93f7393Sniklas * gets set to null. This results in a crash if NDEBUG is set to 0 123*e93f7393Sniklas * since cma__int_lock tries to dereference it to set the mutex ownership 124*e93f7393Sniklas * after it gets the mutex. The following will still set the ownership 125*e93f7393Sniklas * in cma__int_lock so we'll set it back to noone if cma__g_file is null 126*e93f7393Sniklas * when we come back just in case it matters. It shouldn't since its no 127*e93f7393Sniklas * longer in use but..... 128*e93f7393Sniklas * Callers of this should recheck cma__g_file after the reservation to 129*e93f7393Sniklas * make sure continueing makes sense. 130*e93f7393Sniklas */ 131*e93f7393Sniklas #define cma__fd_reserve(rfd) \ 132*e93f7393Sniklas { \ 133*e93f7393Sniklas cma__t_int_mutex *__mutex__; \ 134*e93f7393Sniklas __mutex__ = cma__g_file[rfd]->mutex; \ 135*e93f7393Sniklas cma__int_lock (__mutex__); \ 136*e93f7393Sniklas if(cma__g_file[rfd] == (cma__t_file_obj *)cma_c_null_ptr) \ 137*e93f7393Sniklas cma__int_unlock(__mutex__); \ 138*e93f7393Sniklas } 139*e93f7393Sniklas 140*e93f7393Sniklas 141*e93f7393Sniklas /* 142*e93f7393Sniklas * Unreserve a file descriptor 143*e93f7393Sniklas */ 144*e93f7393Sniklas #define cma__fd_unreserve(ufd) cma__int_unlock (cma__g_file[ufd]->mutex) 145*e93f7393Sniklas 146*e93f7393Sniklas /* 147*e93f7393Sniklas * AND together two select file descriptor masks 148*e93f7393Sniklas */ 149*e93f7393Sniklas #define cma__fdm_and(target,a,b) \ 150*e93f7393Sniklas { \ 151*e93f7393Sniklas int __i__ = cma__g_nspm; \ 152*e93f7393Sniklas while (__i__--) \ 153*e93f7393Sniklas (target)->fds_bits[__i__] = \ 154*e93f7393Sniklas (a)->fds_bits[__i__] & (b)->fds_bits[__i__]; \ 155*e93f7393Sniklas } 156*e93f7393Sniklas 157*e93f7393Sniklas /* 158*e93f7393Sniklas * Clear a bit in a select file descriptor mask 159*e93f7393Sniklas * 160*e93f7393Sniklas * FD_CLR(n, p) := ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) 161*e93f7393Sniklas */ 162*e93f7393Sniklas #define cma__fdm_clr_bit(n,p) FD_CLR (n, p) 163*e93f7393Sniklas 164*e93f7393Sniklas /* 165*e93f7393Sniklas * Copy the contents of one file descriptor mask into another. If the 166*e93f7393Sniklas * destination operand is null, do nothing; if the source operand is null, 167*e93f7393Sniklas * simply zero the destination. 168*e93f7393Sniklas */ 169*e93f7393Sniklas #define cma__fdm_copy(src,dst,nfds) { \ 170*e93f7393Sniklas if (dst) \ 171*e93f7393Sniklas if (src) { \ 172*e93f7393Sniklas cma__t_mask *__s__ = (cma__t_mask *)(src); \ 173*e93f7393Sniklas cma__t_mask *__d__ = (cma__t_mask *)(dst); \ 174*e93f7393Sniklas int __i__; \ 175*e93f7393Sniklas for (__i__ = 0; __i__ < (nfds); __i__ += cma__c_nbpm) \ 176*e93f7393Sniklas *__d__++ = *__s__++; \ 177*e93f7393Sniklas } \ 178*e93f7393Sniklas else \ 179*e93f7393Sniklas cma__fdm_zero (dst); \ 180*e93f7393Sniklas } 181*e93f7393Sniklas 182*e93f7393Sniklas /* 183*e93f7393Sniklas * To increment count for each bit set in fd - mask 184*e93f7393Sniklas */ 185*e93f7393Sniklas #define cma__fdm_count_bits(map,count) \ 186*e93f7393Sniklas { \ 187*e93f7393Sniklas int __i__ = cma__g_nspm; \ 188*e93f7393Sniklas while (__i__--) { \ 189*e93f7393Sniklas cma__t_mask __tm__; \ 190*e93f7393Sniklas __tm__ = (map)->fds_bits[__i__]; \ 191*e93f7393Sniklas while(__tm__) { \ 192*e93f7393Sniklas (count)++; \ 193*e93f7393Sniklas __tm__ &= ~(__tm__ & (-__tm__)); /* Assumes 2's comp */ \ 194*e93f7393Sniklas } \ 195*e93f7393Sniklas } \ 196*e93f7393Sniklas } 197*e93f7393Sniklas 198*e93f7393Sniklas /* 199*e93f7393Sniklas * Test if a bit is set in a select file descriptor mask 200*e93f7393Sniklas * 201*e93f7393Sniklas * FD_ISSET(n,p) := ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) 202*e93f7393Sniklas */ 203*e93f7393Sniklas #define cma__fdm_is_set(n,p) FD_ISSET (n, p) 204*e93f7393Sniklas 205*e93f7393Sniklas /* 206*e93f7393Sniklas * OR together two select file descriptor masks 207*e93f7393Sniklas */ 208*e93f7393Sniklas #define cma__fdm_or(target,a,b) \ 209*e93f7393Sniklas { \ 210*e93f7393Sniklas int __i__ = cma__g_nspm; \ 211*e93f7393Sniklas while (__i__--) \ 212*e93f7393Sniklas (target)->fds_bits[__i__] = \ 213*e93f7393Sniklas (a)->fds_bits[__i__] | (b)->fds_bits[__i__]; \ 214*e93f7393Sniklas } 215*e93f7393Sniklas 216*e93f7393Sniklas /* 217*e93f7393Sniklas * Set a bit in a select file descriptor mask 218*e93f7393Sniklas * 219*e93f7393Sniklas * FD_SET(n,p) := ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) 220*e93f7393Sniklas */ 221*e93f7393Sniklas #define cma__fdm_set_bit(n,p) FD_SET (n, p) 222*e93f7393Sniklas 223*e93f7393Sniklas /* 224*e93f7393Sniklas * Clear a select file descriptor mask. 225*e93f7393Sniklas */ 226*e93f7393Sniklas #define cma__fdm_zero(n) \ 227*e93f7393Sniklas cma__memset ((char *) n, 0, cma__g_nspm * sizeof(cma__t_mask)) 228*e93f7393Sniklas 229*e93f7393Sniklas 230*e93f7393Sniklas 231*e93f7393Sniklas 232*e93f7393Sniklas 233*e93f7393Sniklas /* 234*e93f7393Sniklas * CMA "thread-synchronous" I/O read/write operations 235*e93f7393Sniklas */ 236*e93f7393Sniklas 237*e93f7393Sniklas /* 238*e93f7393Sniklas * Since all CMA "thread-synchronous" I/O (read or write) operations on 239*e93f7393Sniklas * U*ix follow the exact same structure, the wrapper routines have been 240*e93f7393Sniklas * condensed into a macro. 241*e93f7393Sniklas * 242*e93f7393Sniklas * The steps performed are as follows: 243*e93f7393Sniklas * 1. Check that the file descriptor is a legitimate value. 244*e93f7393Sniklas * 2. Check that the entry in the CMA file "database" which corresponds to 245*e93f7393Sniklas * the file descriptor indicates that the "file" was "opened" by CMA. 246*e93f7393Sniklas * 3. Reserve the file, to serialized access to files. This not only 247*e93f7393Sniklas * simplifies things, but also defends against non-reentrancy. 248*e93f7393Sniklas * 4. If the "file" is "set" for non-blocking I/O, check if we 249*e93f7393Sniklas * have actually set the file non-blocking yet, and if not do so. 250*e93f7393Sniklas * Then, issue the I/O operantion. 251*e93f7393Sniklas * Success or failure is returned immediately, after unreserving the 252*e93f7393Sniklas * file. If the error indicates that the operation would have caused 253*e93f7393Sniklas * the process to block, continue to the next step. 254*e93f7393Sniklas * 5. The I/O prolog adds this "file" to the global bit mask, which 255*e93f7393Sniklas * represents all "files" which have threads waiting to perform I/O on 256*e93f7393Sniklas * them, and causes the thread to block on the condition variable for 257*e93f7393Sniklas * this "file". Periodically, a select is done on this global bit 258*e93f7393Sniklas * mask, and the condition variables corresponding to "files" which 259*e93f7393Sniklas * are ready for I/O are signaled, releasing those waiting threads to 260*e93f7393Sniklas * perform their I/O. 261*e93f7393Sniklas * 6. When the thread returns from the I/O prolog, it can (hopefully) 262*e93f7393Sniklas * perform its operation without blocking the process. 263*e93f7393Sniklas * 7. The I/O epilog clears the bit in the global mask and/or signals the 264*e93f7393Sniklas * the next thread waiting for this "file", as appropriate. 265*e93f7393Sniklas * 8. If the I/O failed, continue to loop. 266*e93f7393Sniklas * 9. Finally, the "file" is unreserved, as we're done with it, and the 267*e93f7393Sniklas * result of the operation is returned. 268*e93f7393Sniklas * 269*e93f7393Sniklas * 270*e93f7393Sniklas * Note: currently, we believe that timeslicing which is based on the 271*e93f7393Sniklas * virtual-time timer does not cause system calls to return EINTR. 272*e93f7393Sniklas * Threfore, any EINTR returns are relayed directly to the caller. 273*e93f7393Sniklas * On platforms which do not support a virtual-time timer, the code 274*e93f7393Sniklas * should probably catch EINTR returns and restart the system call. 275*e93f7393Sniklas */ 276*e93f7393Sniklas 277*e93f7393Sniklas /* 278*e93f7393Sniklas * This macro is used for both read-type and write-type functions. 279*e93f7393Sniklas * 280*e93f7393Sniklas * Note: the second call to "func" may require being bracketed in a 281*e93f7393Sniklas * cma__interrupt_disable/cma__interrupt_enable pair, but we'll 282*e93f7393Sniklas * wait and see if this is necessary. 283*e93f7393Sniklas */ 284*e93f7393Sniklas #define cma__ts_func(func,fd,arglist,type,post_process) { \ 285*e93f7393Sniklas cma_t_integer __res__; \ 286*e93f7393Sniklas cma_t_boolean __done__ = cma_c_false; \ 287*e93f7393Sniklas if ((fd < 0) || (fd >= cma__g_mx_file)) return (cma__set_errno (EBADF), -1); \ 288*e93f7393Sniklas if (!cma__is_open(fd)) return (cma__set_errno (EBADF), -1); \ 289*e93f7393Sniklas cma__fd_reserve (fd); \ 290*e93f7393Sniklas if (!cma__is_open(fd)) return (cma__set_errno (EBADF), -1); \ 291*e93f7393Sniklas if (cma__issue_io_call(fd)) {\ 292*e93f7393Sniklas if ((!cma__g_file[fd]->set_non_blocking) && \ 293*e93f7393Sniklas (cma__g_file[fd]->non_blocking == cma_c_true)) \ 294*e93f7393Sniklas cma__set_nonblocking(fd); \ 295*e93f7393Sniklas cma__interrupt_disable (0); \ 296*e93f7393Sniklas TRY { \ 297*e93f7393Sniklas __res__ = func arglist; \ 298*e93f7393Sniklas } \ 299*e93f7393Sniklas CATCH_ALL { \ 300*e93f7393Sniklas cma__interrupt_enable (0); \ 301*e93f7393Sniklas cma__fd_unreserve (fd); \ 302*e93f7393Sniklas RERAISE; \ 303*e93f7393Sniklas } \ 304*e93f7393Sniklas ENDTRY \ 305*e93f7393Sniklas cma__interrupt_enable (0); \ 306*e93f7393Sniklas if ((__res__ != -1) \ 307*e93f7393Sniklas || (!cma__is_blocking (errno)) \ 308*e93f7393Sniklas || (cma__g_file[fd]->user_fl.user_non_blocking)) \ 309*e93f7393Sniklas __done__ = cma_c_true; \ 310*e93f7393Sniklas } \ 311*e93f7393Sniklas if (__done__) { \ 312*e93f7393Sniklas cma__fd_unreserve (fd); \ 313*e93f7393Sniklas } \ 314*e93f7393Sniklas else { \ 315*e93f7393Sniklas TRY { \ 316*e93f7393Sniklas cma__io_prolog (type, fd); \ 317*e93f7393Sniklas while (!__done__) { \ 318*e93f7393Sniklas cma__io_wait (type, fd); \ 319*e93f7393Sniklas __res__ = func arglist; \ 320*e93f7393Sniklas if ((__res__ != -1) \ 321*e93f7393Sniklas || (!cma__is_blocking (errno)) \ 322*e93f7393Sniklas || (cma__g_file[fd]->user_fl.user_non_blocking)) \ 323*e93f7393Sniklas __done__ = cma_c_true; \ 324*e93f7393Sniklas } \ 325*e93f7393Sniklas } \ 326*e93f7393Sniklas FINALLY { \ 327*e93f7393Sniklas cma__io_epilog (type, fd); \ 328*e93f7393Sniklas cma__fd_unreserve (fd); \ 329*e93f7393Sniklas } \ 330*e93f7393Sniklas ENDTRY \ 331*e93f7393Sniklas } \ 332*e93f7393Sniklas if (__res__ != -1) post_process; \ 333*e93f7393Sniklas return __res__; \ 334*e93f7393Sniklas } 335*e93f7393Sniklas 336*e93f7393Sniklas /* 337*e93f7393Sniklas * Since most CMA "thread-synchronous" I/O ("open"-type) operations on 338*e93f7393Sniklas * U*ix follow the exact same structure, the wrapper routines have been 339*e93f7393Sniklas * condensed into a macro. 340*e93f7393Sniklas * 341*e93f7393Sniklas * The steps performed are as follows: 342*e93f7393Sniklas * 1. Issue the open function. 343*e93f7393Sniklas * 2. If the value returned indicates an error, return it to the caller. 344*e93f7393Sniklas * 3. If the file descriptor returned is larger than what we think is the 345*e93f7393Sniklas * maximum value (ie if it is too big for our database) then bugcheck. 346*e93f7393Sniklas * 4. "Open" the "file" in the CMA file database. 347*e93f7393Sniklas * 5. Return the file descriptor value to the caller. 348*e93f7393Sniklas * 349*e93f7393Sniklas * FIX-ME: for the time being, if the I/O operation returns EINTR, we 350*e93f7393Sniklas * simply return it to the caller; eventually, we should catch this 351*e93f7393Sniklas * and "do the right thing" (if we can figure out what that is). 352*e93f7393Sniklas */ 353*e93f7393Sniklas 354*e93f7393Sniklas /* 355*e93f7393Sniklas * This macro is used for all "open"-type functions which return a single file 356*e93f7393Sniklas * desciptor by immediate value. 357*e93f7393Sniklas */ 358*e93f7393Sniklas #define cma__ts_open(func,arglist,post_process) { \ 359*e93f7393Sniklas int __fd__; \ 360*e93f7393Sniklas TRY { \ 361*e93f7393Sniklas cma__int_init (); \ 362*e93f7393Sniklas cma__int_lock (cma__g_io_data_mutex); \ 363*e93f7393Sniklas __fd__ = func arglist; \ 364*e93f7393Sniklas cma__int_unlock (cma__g_io_data_mutex); \ 365*e93f7393Sniklas if (__fd__ >= 0 && __fd__ < cma__g_mx_file) \ 366*e93f7393Sniklas post_process; \ 367*e93f7393Sniklas } \ 368*e93f7393Sniklas CATCH_ALL \ 369*e93f7393Sniklas { \ 370*e93f7393Sniklas cma__set_errno (EBADF); \ 371*e93f7393Sniklas __fd__ = -1; \ 372*e93f7393Sniklas } \ 373*e93f7393Sniklas ENDTRY \ 374*e93f7393Sniklas if (__fd__ >= cma__g_mx_file) \ 375*e93f7393Sniklas cma__bugcheck ("cma__ts_open: fd is too large"); \ 376*e93f7393Sniklas return __fd__; \ 377*e93f7393Sniklas } 378*e93f7393Sniklas /* 379*e93f7393Sniklas * This macro is used for all "open"-type functions which return a pair of file 380*e93f7393Sniklas * desciptors by reference parameter. 381*e93f7393Sniklas */ 382*e93f7393Sniklas #define cma__ts_open2(func,fdpair,arglist,post_process) { \ 383*e93f7393Sniklas int __res__; \ 384*e93f7393Sniklas TRY { \ 385*e93f7393Sniklas cma__int_init (); \ 386*e93f7393Sniklas cma__int_lock (cma__g_io_data_mutex); \ 387*e93f7393Sniklas __res__ = func arglist; \ 388*e93f7393Sniklas cma__int_unlock (cma__g_io_data_mutex); \ 389*e93f7393Sniklas if (__res__ >= 0 && fdpair[0] < cma__g_mx_file \ 390*e93f7393Sniklas && fdpair[1] < cma__g_mx_file) \ 391*e93f7393Sniklas post_process; \ 392*e93f7393Sniklas } \ 393*e93f7393Sniklas CATCH_ALL \ 394*e93f7393Sniklas { \ 395*e93f7393Sniklas cma__set_errno (EBADF); \ 396*e93f7393Sniklas __res__ = -1; \ 397*e93f7393Sniklas } \ 398*e93f7393Sniklas ENDTRY \ 399*e93f7393Sniklas if ((fdpair[0] >= cma__g_mx_file) || (fdpair[1] >= cma__g_mx_file)) \ 400*e93f7393Sniklas cma__bugcheck ("cma__ts_open2: one of fd's is too large"); \ 401*e93f7393Sniklas return __res__; \ 402*e93f7393Sniklas } 403*e93f7393Sniklas 404*e93f7393Sniklas /* 405*e93f7393Sniklas * INTERNAL INTERFACES 406*e93f7393Sniklas */ 407*e93f7393Sniklas extern void cma__close_general (int); 408*e93f7393Sniklas 409*e93f7393Sniklas extern void 410*e93f7393Sniklas cma__init_thread_io (void); 411*e93f7393Sniklas 412*e93f7393Sniklas extern cma_t_boolean cma__io_available (cma__t_io_type,int,struct timeval *); 413*e93f7393Sniklas 414*e93f7393Sniklas extern void cma__io_epilog (cma__t_io_type,int); 415*e93f7393Sniklas 416*e93f7393Sniklas extern void cma__io_prolog (cma__t_io_type,int); 417*e93f7393Sniklas 418*e93f7393Sniklas extern void cma__io_wait (cma__t_io_type,int); 419*e93f7393Sniklas 420*e93f7393Sniklas extern void cma__open_general (int); 421*e93f7393Sniklas 422*e93f7393Sniklas extern void cma__reinit_thread_io (int); 423*e93f7393Sniklas 424*e93f7393Sniklas extern void cma__set_nonblocking (int); 425*e93f7393Sniklas 426*e93f7393Sniklas extern void cma__set_user_nonblock_flags (int,int); 427*e93f7393Sniklas 428*e93f7393Sniklas extern cma_t_boolean 429*e93f7393Sniklas cma__is_open (int fd); 430*e93f7393Sniklas 431*e93f7393Sniklas 432*e93f7393Sniklas #endif 433*e93f7393Sniklas 434*e93f7393Sniklas 435