Files and Directories

Introduction

  • stat functions,describe each of these
  • look more details of the structure of the Unix file system and symbolic links
  • operate on directories adn some others.

stat,fstat,fstatat,lstat functions

  • given a pathname,the stat function returns a structure of information about the named file.
  • the fstat function obtains information about the file that has opened on the descriptor fd.
  • lstat function returns information about the symbolic link,not the file it referenced.
  • the fstatat function provides a way to return the file statistics for a pathname relative to an open directory represented by the fd argument.,when the AT_SYMLINK_NOFOLLOW flag is set,fstatat will not follow symbolic links,returning information about the file to which the symbolic link points

file types

  • most files on Unix system ae regular files or directories,but there are also some other types:
    – regular file:the most common type of file,which contains data of some form.
    – directory file:a file that contains the names of other files and pointers to information on these files,only the kernel can write directly to a directory file.Process must use the functions to make changes to a directory
    – block special file:a type of file providing buffered I/O access in fixed-size units to devices such as disk drives.
    – character special file:a type of file providing unbuffered I/O access in variable-sized units to devices.All devices on a system are either block special files or character special files.
    – FIFO:a type of file used for communication between processes,it also called named pipo.
    –socket:a type of file for network communication between processes,and a socket can also be used for non-network communication between processes on a single host
    – symbolic link:a type file that points to another file.

to be continued…

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值