Message-Id: <3.0.1.32.19970923144640.006b0534@yacker.xiotech.com> Date: Tue, 23 Sep 1997 14:46:40 -0500 To: djgpp-workers AT delorie DOT com From: Randy Maas Subject: Rev c. part 2: the diff for fsext.txh Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=====================_875062000==_" Precedence: bulk --=====================_875062000==_ Content-Type: text/plain; charset="us-ascii" This is the diff file for fsext.txh Randy Maas randym AT acm DOT org --=====================_875062000==_ Content-Type: text/plain; charset="us-ascii" Content-Disposition: attachment; filename="fsext-txh.dif" diff -c src\libc\fsext\fsext.txh fsext.txh *** \local\src\libc\fsext\fsext.txh Thu Sep 19 22:37:20 1996 --- \local\ginsu\diffs\fsext.txh Tue Sep 23 14:38:06 1997 *************** *** 23,29 @table @code @item __FSEXT_nop ! A no-op. This is currently unused by the library functions. @item __FSEXT_open --- 23,31 ----- @table @code @item __FSEXT_nop ! A no-op. This is currently unused by the library functions, except ! the function @code{_nop} (@pxref(_nop}). It may be used to provide ! execution time to the file system extension. @item __FSEXT_open *************** *** 43,49 A write handler. Called to write data to a ``file''. ! @item __FSEXT_read A ready handler. It is called by @code{select} library function (@pxref{select}) when it needs to know whether a handle used to --- 45,51 ----- A write handler. Called to write data to a ``file''. ! @item __FSEXT_ready A ready handler. It is called by @code{select} library function (@pxref{select}) when it needs to know whether a handle used to *************** *** 71,77 A close handler. Called when the ``file'' should be closed. ! @end table @var{rv} points to a temporary return value pointer. If the function is --- 73,81 ----- A close handler. Called when the ``file'' should be closed. ! @item __FSEXT_pread ! A file pread handler (@pxref{pread}). Called to read data from a ! specific location in a file. @item __FSEXT_pwrite A file pwrite handler (@pxref{pread}). Called to write data to a *************** *** 73,78 @end table @var{rv} points to a temporary return value pointer. If the function is emulated by the handler, the return value should be stored here, and the --- 77,85 ----- A file pread handler (@pxref{pread}). Called to read data from a specific location in a file. + @item __FSEXT_pwrite + A file pwrite handler (@pxref{pread}). Called to write data to a + specific location in a file. @item __FSEXT_fcntl A file fcntl handler. *************** *** 74,79 @end table @var{rv} points to a temporary return value pointer. If the function is emulated by the handler, the return value should be stored here, and the handler should return a nonzero value. If the handler returns zero, it is --- 81,114 ----- A file pwrite handler (@pxref{pread}). Called to write data to a specific location in a file. + @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_copy + + A file copy handler (@pxref{_copy}. This is called when you would + like to copy a file from one location to another (possibly local) + location. This is also called on your behalf if link() fails. This + is most relevant to file system extensions that emulate a directory + structure. + + @end table + @var{rv} points to a temporary return value pointer. If the function is emulated by the handler, the return value should be stored here, and the handler should return a nonzero value. If the handler returns zero, it is *************** *** 109,115 @end itemize - @c ---------------------------------------------------------------------- @node __FSEXT_alloc_fd, file system @subheading Syntax --- 144,149 ----- @end itemize @node __FSEXT_alloc_fd, file system @subheading Syntax *************** *** 116,122 @example #include ! int __FSEXT_alloc_fd(__FSEXT_Function *_function); @end example @subheading Description --- 150,156 ----- @example #include ! int __FSEXT_alloc_fd(__FSEXT_Function *_function, void* state) @end example @subheading Description *************** *** 123,131 This function is part of the @ref{File System Extensions}. It is used by extensions that fully emulate the I/O functions, and thus don't ! have a corresponding DOS file handle. This function opens DOS's ! @samp{NUL} device, so as to allocate a handle that DOS won't then reuse. ! It also assigns the handler function for that descriptor. The module is responsible for calling @code{_close} on the descriptor after setting the handler function to zero in the extended close --- 157,164 ----- This function is part of the @ref{File System Extensions}. It is used by extensions that fully emulate the I/O functions, and thus don't ! have a corresponding DOS file handle. It calls _DOS_alloc_fd ! (@ref{_DOS_alloc_fd}) to allocate a handle that DOS won't reuse. The module is responsible for calling @code{_close} on the descriptor after setting the handler function to zero in the extended close *************** *** 137,143 int socket() @{ ! int fd = __FSEXT_alloc_fd(socket_handler); init_socket(fd); return fd; @} --- 170,176 ----- int socket() @{ ! int fd = __FSEXT_alloc_fd(socket_handler, NULL); init_socket(fd); return fd; @} *************** *** 144,150 @end example - @c ---------------------------------------------------------------------- @node __FSEXT_set_function, file system @subheading Syntax --- 177,182 ----- @end example @node __FSEXT_set_function, file system @subheading Syntax *************** *** 151,157 @example #include ! int __FSEXT_set_function(int _fd, __FSEXT_Function *_function); @end example @subheading Description --- 183,189 ----- @example #include ! int __FSEXT_set_function(int _fd, __FSEXT_Function *_function, void* state) @end example @subheading Description *************** *** 160,166 to set the handler function for those extensions that use DOS files 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 --- 192,199 ----- to set the handler function for those extensions that use DOS files 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 optional pointer ! to the handlers specific data for the file descriptor. @subheading Return Value *************** *** 201,207 static void __attribute__((constructor)) install_screen_write_handler (void) @{ ! __FSEXT_set_function (fileno (stdout), my_screen_write); @} @end example --- 234,240 ----- static void __attribute__((constructor)) install_screen_write_handler (void) @{ ! __FSEXT_set_function (fileno (stdout), my_screen_write, NULL); @} @end example *************** *** 206,211 @end example @c ---------------------------------------------------------------------- @node __FSEXT_get_function, file system --- 239,246 ----- @end example + @subheading See Also + @xref{__FSEXT_get_function} __FSEXT_Function * __FSEXT_get_function(int _fd) *************** *** 207,215 @end example - @c ---------------------------------------------------------------------- - @node __FSEXT_get_function, file system - @subheading Syntax @example #include --- 242,247 ----- @subheading See Also @xref{__FSEXT_get_function} __FSEXT_Function * __FSEXT_get_function(int _fd) *************** *** 211,216 @node __FSEXT_get_function, file system @subheading Syntax @example #include --- 243,253 ----- @xref{__FSEXT_get_function} + __FSEXT_Function * __FSEXT_get_function(int _fd) + + int __FSEXT_get_handler(int _fd, __FSEXT_Function** func, void** state) + @node __FSEXT_close_all, file system + @subheading Syntax @example void __FSEXT_close_all (void) *************** *** 212,218 @subheading Syntax @example - #include __FSEXT_Function *__FSEXT_get_function(int _fd); @end example --- 249,254 ----- @node __FSEXT_close_all, file system @subheading Syntax @example void __FSEXT_close_all (void) @end example *************** *** 214,221 @example #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 --- 250,262 ----- @subheading Syntax @example ! void __FSEXT_close_all (void) ! @end example ! @subheading Description ! @code{__FSEXT_close_all} closes all of the currently open handles. ! This should be called during a programs exit phase, after libc has ! @code{fclose}'d all of the files it has opened. The reason for this ! is that not every operating system will close a handle (e.g. file ! descriptor or socket handle) after a program has exit. This can ! eventually cause the system to run out of handles until it reboots. *************** *** 217,238 __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 - - @example - _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 --- 260,262 ----- descriptor or socket handle) after a program has exit. This can eventually cause the system to run out of handles until it reboots. --=====================_875062000==_ Content-Type: text/plain; charset="us-ascii" --=====================_875062000==_--