Lines Matching +full:pre +full:- +full:set
9 <br> $Id: io.html,v 1.3 2001-03-17 03:22:50 gshapiro Exp $
24 library or a "programmer specified" set of functions set via
25 <i>sm_io_open()</i>. Whichever set of functions are specified <b>all</b>
26 open's, read's, write's, etc use the same set of functions. In contrast, with
27 <i>sm_io</i> a different set of functions can be specified with each
30 set can handle the actions directly, pass the action request to
31 another function set or do some work before passing it on to another function
32 set. The setting of a function set for a file type can be done for
73 Information about a particular file type or pointer can be obtained or set with
86 <pre>
89 </pre>
95 and set errno when appropriate. These (may?/will?) change to
98 <pre>
157 </pre>
162 pre-defined values:
165 SM_TIME_DEFAULT - timeout using the default setting for this file type
168 SM_TIME_FOREVER - timeout will take forever; blocks until task completed
171 SM_TIME_IMMEDIATE - timeout (virtually) now
177 A function will return with <i>errno</i> set to EINVAL if a bad value
180 set to <b>EAGAIN</b>. In the future this may change to an exception being
185 <!-- SM_IO_FOPEN -->
202 Otherwise, <tt>NULL</tt> is returned and <tt>errno</tt> is set.
203 <!-- SM_IO_OPEN -->
211 Opens a file by <i>type</i> directed by <i>info</i>. <i>Type</i> is a filled-in
250 For program specified types, to set the <i>type</i> argument easily and with minimal error the macro
256 <pre>
257 SM_IO_SET_TYPE(type, name, open, close, read, write, seek, get, set, timeout)
258 </pre>
261 <i>Timeout</i> is set as described in the <a href="#timeouts"><b>Timeouts</b></a>
269 set of sm_io flags that describes how the file is to be interacted with:
272 SM_IO_RDWR - read and write
275 SM_IO_RDONLY - read only
278 SM_IO_WRONLY - write only
281 SM_IO_APPEND - allow write to EOF only
284 SM_IO_APPENDRW - allow read-write from EOF only
287 SM_IO_RDWRTR - read and write with truncation of file first
299 On failure the NULL pointer is returned and errno is set.
301 <!-- SM_IO_SETINFO -->
309 For the open file <i>sfp</i> set the indicated information (<i>what</i>)
313 configured the same way (this is to prevent side-effect
315 The value of <i>what</i> will be file-type dependent since this function
319 vector set for open, close, etc. The new values are taken from <i>valp</i>
324 On success 0 (zero) is returned. On failure -1 is returned and errno is set.
326 <!-- SM_IO_GETINFO -->
346 On success 0 (zero) is returned. On failure -1 is returned and errno is set.
348 <!-- SM_IO_AUTOFLUSH -->
366 <!-- SM_IO_AUTOMODE -->
375 Associate the two file pointers for blocking/non-blocking mode changes.
377 a file between blocking and non-blocking. If the underlying file descriptor
383 <!-- SM_IO_CLOSE -->
394 <i>Timeout</i> is set as described in the <a href="#timeouts"><b>Timeouts</b></a>
404 errno is set.
433 functions that result in the file-type behaving as the system stdio
443 functions that result in the file-type behaving as the system stdio
487 <i>smiostdout</i> and <i>smiostderr</i> are layered on-top-of
516 Otherwise the setting will be rejected and <i>errno</i> set to EINVAL.
520 <pre>
529 </pre>
534 <pre>
535 SM_IO_SET_TYPE(type, name, open, close, read, write, seek, get, set, timeout)
536 </pre>
541 type - is the SM_FILE_T being filled-in
544 name - a human readable character string for human identification purposes
547 open - the vector to the open function
550 close - the vector to the close function
553 read - the vector to the read function
556 write - the vector to the write function
559 seek - the vector to the seek function
562 set - the vector to the set function
565 get - the vector to the get function
568 timeout - the default to be used for a timeout when SM_TIME_DEFAULT specified
574 file should only be set and observed with the "info" functions.
581 will not change or set these two structure members;
582 only specific file type will change or set these variables.
618 All of the "int" functions should return -1 (minus one) on failure
619 and 0 (zero) or greater on success. <i>Errno</i> should be set to
621 been set by another function the file type function used.
630 <pre>
638 return(-1);
639 </pre>
640 The above code open's a file of type "my_type". The <i>info</i> is set
647 We have also specified read-only access (SM_IO_RDONLY) and that no <i>rpool</i>
648 will be used. The <i>timeout</i> has been set to 1000 milliseconds which
651 <pre>
667 sm_io_snprintf(path, PATH_MAX, "%s/%s", pw->pw_dir, info);
670 ** Okay. Now the path pass-in has been prefixed with the
674 fp->cookie = sm_io_open(SmFtStdio, path, flags, rpools);
675 if (fp->cookie == NULL)
676 return(-1) /* errno set by sm_io_open call */
680 </pre>
684 <pre>
706 return(sm_io_write(fp->cookie, buf, size));
708 </pre>
709 As a thought-exercise for the fair reader: how would you modify the