The UNIX File System

Last time: Users and Files: who, cp

Prof. Brian D. Davison

Computer Science & Engineering, Lehigh University

Additional Credits

Announcements

Copy: does the size of the buffer matter?

Control flow in copying a file

alt text

I/O Efficiency

Can't the kernel do our buffering?

Consequences of buffering

Another example: tail

Reading arbitrary bytes from a file

Reading arbitrary bytes from a file

Directories, File Info, etc.

Writing ls (Using same approach)

Writing ls (Using same approach)

Writing ls (Using same approach)

Directories

Reading Directories

Reading Directories

Using Directory Functions

Writing first version of ls.c

main()
    opendir()
    while ( readdir() )
       print d_name

    closedir()
    return 0