The Linux Programming Interface
File Systems 277 z Many native UNIX and Linux file systems support the notion of reserving a certain portion of the blocks of a ...
278 Chapter 14 various information about the file, including its type, size, link count, ownership, permissions, timestamps, and ...
Chapter 15: File Attributes In this chapter, we investigate various attributes of files (file metadata). We begin with a descrip ...
280 Chapter 15 These three system calls differ only in the way that the file is specified: z stat() returns information about a ...
File Attributes 281 Device IDs and i-node number The st_dev field identifies the device on which the file resides. The st_ino fi ...
282 Chapter 15 The full set of file-type macros (defined in <sys/stat.h>) is shown in Table 15-1. All of the file-type mac ...
File Attributes 283 The st_blocks field records the number of disk blocks actually allocated. If the file con- tains holes (Sect ...
284 Chapter 15 Listing 15-1: Retrieving and interpreting file stat information ––––––––––––––––––––––––––––––––––––––––––––––––– ...
File Attributes 285 printf("Last file access: %s", ctime(&sb->st_atime)); printf("Last file modification: %s", ctime(& ...
286 Chapter 15 In Sections 14.8.1 and 15.5, we describe mount(2) options and per-file flags that pre- vent updates to the last a ...
File Attributes 287 Nanosecond timestamps With version 2.6, Linux supports nanosecond resolution for the three timestamp fields ...
288 Chapter 15 (To be accurate, on Linux, it is the process’s file-system user ID, rather than its effective user ID, that is ch ...
File Attributes 289 With futimes(), the file is specified via an open file descriptor, fd. With lutimes(), the file is specified ...
290 Chapter 15 If times is specified as NULL, then both file timestamps are updated to the current time. If times is not NULL, t ...
File Attributes 291 15.3 File Ownership Each file has an associated user ID (UID) and group ID (GID). These IDs determine which ...
292 Chapter 15 The distinction between these three system calls is similar to the stat() family of sys- tem calls: z chown() cha ...
File Attributes 293 When changing the owner or group of a file, the set-group-ID permission bit is not turned off if the group-e ...
294 Chapter 15 } else { /* Turn group name into GID */ gid = groupIdFromName(argv[2]); if (gid == -1) fatal("No group user (%s)" ...
File Attributes 295 z Execute: The file may be executed (i.e., it is a program or a script). In order to execute a script file ( ...
296 Chapter 15 Listing 15-3: Header file for file_perms.c ––––––––––––––––––––––––––––––––––––––––––––––––––––––––files/file_per ...
«
12
13
14
15
16
17
18
19
20
21
»
Free download pdf