From: Thadeu Lima de Souza Cascardo Date: Wed, 7 May 2008 11:47:41 +0000 (-0300) Subject: Added close, read and write system calls. X-Git-Url: http://git.cascardo.eti.br/?p=cascardo%2Fkernel%2Fold_slides%2F.git;a=commitdiff_plain;h=2cb687376e3a8daa8ac36295918d8747ef7c5bdd Added close, read and write system calls. --- diff --git a/_ldd.xml b/_ldd.xml index 2b20507..47ebedf 100644 --- a/_ldd.xml +++ b/_ldd.xml @@ -86,4 +86,62 @@ fd = open ("/dev/ttyS0", O\_RDWR); + +close + +The close system call closes an open file. + + +int close (int fd); + + +Example: + + +close (fd); + + + + +read + +The read system call reads data from an open file into a buffer. For +devices, it reads from the device. + + +int read (int fd, char *buffer, int bsz); + + +Read returns the number of bytes written into the buffer, which may be +less than the number of bytes requested for any number of reasons. + + +Example: + + +c = read (fd, buffer, sizeof (buffer)); + + + + +write + +The write system call writes data to an open file from a buffer. For +devices, it writes to the device. + + +int write (int fd, char *buffer, int bsz); + + +Write returns the number of bytes written to the file, which may be +less than the number of bytes requested for any number of reasons. + + +Example: + + +c = write (fd, buffer, strlen (buffer)); + + +