ioctl.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <html>
  2. <head>
  3. <title>ioctl</title>
  4. <body bgcolor=#ffffff>
  5. <h2 align=center>ioctl</h2>
  6. <h4 align=center>OS/161 Reference Manual</h4>
  7. <h3>Name</h3>
  8. ioctl - miscellaneous device I/O operations
  9. <h3>Library</h3>
  10. Standard C Library (libc, -lc)
  11. <h3>Synopsis</h3>
  12. #include &lt;sys/ioctl.h&gt;<br>
  13. <br>
  14. int<br>
  15. ioctl(int <em>fd</em>, int <em>code</em>, void *<em>data</em>);
  16. <h3>Description</h3>
  17. ioctl performs an object-specific operation <em>code</em> on the
  18. object referred to by the file handle <em>fd</em>. The <em>data</em>
  19. argument may point to supplemental data required or returned by the
  20. operation. The size of buffer required, if any, and other such matters
  21. are operation-specific.
  22. <p>
  23. Traditionally, ioctl is a catchall function for performing operations
  24. that don't fit neatly into any other model.
  25. <p>
  26. The ioctl codes are defined in &lt;kern/ioctl.h&gt;, which should be
  27. included via &lt;sys/ioctl.h&gt; by user-level code. As of this
  28. writing, the base OS/161 system defines no ioctls. However, it may
  29. prove useful to implement some, particularly in connection with some
  30. less conventional possible projects.
  31. <p>
  32. <h3>Return Values</h3>
  33. On success, ioctl returns 0. On error, -1 is returned, and
  34. <A HREF=errno.html>errno</A> is set according to the error
  35. encountered.
  36. <h3>Errors</h3>
  37. The following error codes should be returned under the conditions
  38. given. Other error codes may be returned for other errors not
  39. mentioned here.
  40. <blockquote><table width=90%>
  41. <td width=10%>&nbsp;</td><td>&nbsp;</td></tr>
  42. <tr><td>EBADF</td> <td><em>fd</em> was not a valid file handle.</td></tr>
  43. <tr><td>EIOCTL</td> <td><em>code</em> was an invalid ioctl for the
  44. object referenced.</td></tr>
  45. <tr><td>EFAULT</td> <td><em>data</em> was required by the operation
  46. requested, but was an invalid pointer.</td></tr>
  47. </table></blockquote>
  48. </body>
  49. </html>