X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=_ldd.xml;h=4930ffc2bd075b56fd1180a5ef3180847cbae45a;hb=464a89f04248ac8385e14c2d581008a125c0a2a2;hp=47ebedfe7af0a854558475b0cfc586e5c2d13260;hpb=2cb687376e3a8daa8ac36295918d8747ef7c5bdd;p=cascardo%2Fkernel%2Fold_slides%2F.git
diff --git a/_ldd.xml b/_ldd.xml
index 47ebedf..4930ffc 100644
--- a/_ldd.xml
+++ b/_ldd.xml
@@ -56,7 +56,7 @@ write
close
-seek
+lseek
ioctl
@@ -144,4 +144,83 @@ c = write (fd, buffer, strlen (buffer));
+
+lseek
+
+The lseek system call changes the current position of the file, allowing
+to read or write in that position. Seeking on a device may have many
+different meanings.
+
+
+off\_t lseek (int fd, off\_t pos, int whence);
+
+
+The meaning of the position depends on the value of whence, which can be
+SEEK\_SET (the absolute position), SEEK\_CUR (relative to the current
+position), SEEK\_END (relative to the end of the file).
+
+
+Example:
+
+
+lseek (fd, 0, SEEK\_END);
+
+
+
+
+ioctl
+
+The ioctl system call is a catch-all operation. For those operations
+which doesn't fit in the read/write model, the ioctl allows the user to
+send a command with an optional argument to the device. This command may
+accept input or generate output.
+
+
+int ioctl (int fd, int request, char *arg);
+
+
+The last argument is optional and depends on the type of request. Every
+device or device class may have its different set of ioctl's.
+
+
+Example:
+
+
+struct ifreq req; ioctl (fd, SIOCGIFFLAGS, \&req);
+
+
+
+
+Linux Modules
+
+Linux is modularized. Drivers, filesystems, network protocols and others
+may be loaded at runtime. Every module has an init and an exit
+functions.
+
+
+Modules may have parameters. In load time, parameters, which may be
+boolean, integers or strings, are given by the user.
+
+
+
+
+Device types and numbers
+
+Linux devices may be of different types, including character devices,
+block devices or network devices. Both character and block devices have
+identifying numbers, a major and a minor number.
+
+
+In Linux, major and minor numbers have to be requested or allocated. The
+calls to do that are:
+
+
+int register\_chrdev\_region (dev\_t first, unsigned int count, char
+*name);
+int alloc\_chrdev\_region (dev\_t *dev, unsigned int firstminor,
+unsigned int count, char *name);
+void unregister\_chrdev\_region (dev\_t dev, unsigned int count);
+
+
+