Message-Id: <3.0.1.32.19971126103254.007ec100@yacker.xiotech.com> Date: Wed, 26 Nov 1997 10:32:54 -0600 To: djgpp-workers AT delorie DOT com From: Randy Maas Subject: patch for fsext.txh Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_880583574==_" Precedence: bulk --=====================_880583574==_ Content-Type: text/plain; charset="us-ascii" --=====================_880583574==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="fsext-t.dif" *** src/libc/fsext/fsext.txh~1 Sun Aug 31 16:39:52 1997 --- src/libc/fsext/fsext.txh Wed Nov 26 09:53:48 1997 *************** *** 15,19 **** @example ! int function(__FSEXT_Fnumber func_number, int *rv, va_list args); @end example --- 15,19 ---- @example ! int function(__FSEXT_Fnumber func_number, int *rv, va_list args, void* state); @end example *************** *** 73,76 **** --- 73,103 ---- A close handler. Called when the ``file'' should be closed. + @item __FSEXT_fcntl + + A file fcntl handler. + + @item __FSEXT_ioctl + + A file ioctl handler. + + @item __FSEXT_lseek + + A file lseek handler (@pxref{lseek}). + + @item __FSEXT_link + + A file link handler (@pxref{link}). This is most relevant to + file system extensions that emulate a directory structure. + + @item __FSEXT_unlink + + A file unlink handler (@pxref{unlink}). This is most relevant to + file system extensions that emulate a directory structure. + + @item __FSEXT_dup2 + + A file dup2 handler (@pxref{dup2}). This is called when two different + file descriptors are used to refer to the same open file. + @end table *************** *** 153,156 **** --- 180,184 ---- #include + int __FSEXT_set_function(__FSEXT_Function *_function, void* state) int __FSEXT_set_function(int _fd, __FSEXT_Function *_function); @end example *************** *** 162,166 **** for I/O. One situation where you might need this is when you must catch output to the terminal and play some tricks with it, like colorize it or ! redirect it to another device. @subheading Return Value --- 190,195 ---- for I/O. One situation where you might need this is when you must catch output to the terminal and play some tricks with it, like colorize it or ! redirect it to another device. The @var{state} is an additional pointer to ! the handlers' specific data for the file descriptor. @subheading Return Value *************** *** 208,212 **** @end example - @c ---------------------------------------------------------------------- @node __FSEXT_get_function, file system --- 237,240 ---- *************** *** 216,226 **** #include ! __FSEXT_Function *__FSEXT_get_function(int _fd); @end example This function is part of the @ref{File System Extensions}. It is used internal to libc.a to redirect I/O requests to the appropriate extensions. @subheading Example --- 244,259 ---- #include ! int __FSEXT_get_function(int _fd, __FSEXT_Function** func, void** state) @end example + @subheading Description + This function is part of the @ref{File System Extensions}. It is used internal to libc.a to redirect I/O requests to the appropriate extensions. + @subheading Return Value + 1 if the file descriptor has a handler associated with it, 0 otherwise. + @subheading Example *************** *** 228,239 **** _read(int fd, void *buf, int len) @{ ! __FSEXT_Function *func = __FSEXT_get_function(fd); ! if (func) ! @{ ! int rv; ! if (func(__FSEXT_read, &rv, &fd)) ! return rv; ! @} ! /* rest of read() */ @} @end example --- 261,273 ---- _read(int fd, void *buf, int len) @{ ! void* state; ! __FSEXT_Function *func; ! ! if (__FSEXT_get_function(fd, &func, &state) && func) ! @{ ! int rv; ! if (func(__FSEXT_read, &rv, &fd, state)) return rv; ! @} ! /@* rest of read() *@/ @} @end example --=====================_880583574==_ Content-Type: text/plain; charset="us-ascii" --=====================_880583574==_--