Document system calls and the open call.
authorThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Tue, 6 May 2008 21:08:10 +0000 (18:08 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@minaslivre.org>
Tue, 6 May 2008 21:08:10 +0000 (18:08 -0300)
_ldd.xml

index 2dd4fa6..3d7a928 100644 (file)
--- a/_ldd.xml
+++ b/_ldd.xml
 
 <foil>
 <title>Introduction</title>
-<para>Devices are files in /dev</para>
+<para>
+Devices in POSIX Systems are files in /dev directory. As with any files
+in POSIX, they may be opened, closed, read from, written to, seeked,
+ioctl'd, and others.
+</para>
+
+<para>
+Examples of device files:
+</para>
 
 <itemizedlist>
 <listitem>
-<para>/dev/sda</para>
+<para>
+/dev/sda - A SCSI block device
+</para>
 </listitem>
 <listitem>
-<para>/dev/ttyS0</para>
+<para>
+/dev/ttyS0 - A Serial terminal device
+</para>
 </listitem>
 </itemizedlist>
 
 </foil>
 
+<foil>
+<title>POSIX I/O calls</title>
+<para>
+POSIX systems have some standard calls for I/O. Since devices are files,
+these same system calls are used to work with devices. We are gonna work
+with the following calls:
+</para>
+<itemizedlist>
+<listitem><para>
+open
+</para></listitem>
+<listitem><para>
+read
+</para></listitem>
+<listitem><para>
+write
+</para></listitem>
+<listitem><para>
+close
+</para></listitem>
+<listitem><para>
+seek
+</para></listitem>
+<listitem><para>
+ioctl
+</para></listitem>
+</itemizedlist>
+</foil>
+
+<foil>
+<title>open</title>
+<para>
+The open system call opens a file. When working with devices, that's
+when some initialization should be done. Some devices may be opened only
+once at a time.
+</para>
+<para>
+int open (char * filename, int flags);
+</para>
+<para>
+flags may be O_RDONLY, O_WRONLY, O_RDWR and many others, some not
+important for devices.
+</para>
+<para>
+Example:
+</para>
+<para>
+fd = open ("/dev/ttyS0", O_RDWR);
+</para>
+</foil>
+
 </slides>