Cirrus Logic CS485 Manual de usuario Pagina 54

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 67
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 53
CS485G Spring 2015 54
closedir(). readdir() returns a struct dirent pointer, which
includes the name of the file.
5. Directories associate file names with inode numbers, which uniquely
index the on-disk metadata for each file.
(a) Multiple directories can point to the same inode, in which case
a single file might have multiple path names.
(b) The on-disk inode includes a count of how many directories
point to it.
(c) The ln command introduces such a link between two files.
(d) To remove a name from a directory, use the unlink() system
call.
(e) When the last reference to a file is removed, the kernel can re-
claim the file’s allocated space on the disk.
6. Each open file includes a file position indicator for each open file; it
is advanced by read() and write() and a program can modify it
with lseek().
7. Lecture 30, 4/15/2015
8. Multiple processes may have the same file open.
(a) If they opened the file independently, each has its own file po-
sition.
(b) If they received the file descriptor by inheritance, they share the
file position.
9. The standard I/O library (#include <stdio.h>) provides buffered
versions of input and output.
(a) Instead of file descriptors (small integers), it uses pointers to a
FILE structure.
(b) It predefines stdin, stdout, stderr.
(c) It only submits a system call when a buffer is full (output) or
empty (input) or if there is an explicit request to fflush().
10. Choosing which calls to use in the program (low-level, stdio, or Rio):
(a) low-level: most general, lowest overhead per call, can access
file metadata, async-signal-safe (so they can be used in signal
handlers). But dealing with short counts is tricky, and I/O is
unbuffered, leading to multiple system calls.
Vista de pagina 53
1 2 ... 49 50 51 52 53 54 55 56 57 58 59 ... 66 67

Comentarios a estos manuales

Sin comentarios