Files and Directories E. Im
|
|
- Brent Bryant
- 6 years ago
- Views:
Transcription
1 Files and Directories 2009 E. Im 1
2 How to write the ls program?
3 Is this a directory?
4 Permissions for the owner
5 Permissions for the members of the owner group group
6 Symbolic links ($ln -s RigidBodyWin.h RR) group
7 Contents File attributes handling stat Unix file system structure and symbolic links Directory operations
8 stat, fstat, and lstat #include <sys/stat.h> int stat(const char *pathname, struct stat *buf); int fstat(int filedes, struct stat *buf); int lstat(const char *pathname, struct stat *buf); stat/fstat returns a structure of information about the named file. lstat returns information about the symbolic link, not th e file referenced by the symbolic link.
9 stat, fstat, and lstat struct stat { mode_t st_mode; /* file type & mode (permission) */ ino_t st_ino; /* i-node number (serial number) */ dev_t st_dev; /* device number (file system) */ dev_t st_rdev; /* device number for special files */ nlink_t st_nlink; /* number of links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ off_t st_size; /* size in bytes, for regular files */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last file status change */ long st_blksize;/* best I/O block size */ long st_blocks; /* no. of disk blocks allocated */ };
10 File Size st_size of the stat structure: file size in bytes Regular file Directory a multiple of a number such as 16 or 512 Symbolic link the actual number of bytes in the filename For example, lrwxrwxrwx 1 root 7 Sep 25 07:14 lib -> usr/lib st_blksize: the preferred block size for I/O st_blocks: the actual number of 512-byte blocks that are allocated
11 File Truncation #include <unistd.h> int truncate(const char *pathname, off_t length); int ftruncate(int filedes, off_t length); They truncate an existing file to length bytes.
12 File Types Encoded in the st_mode member of the stat structure Regular file Directory file pairs of (file name, pointer to information on the file) Character special file, e.g. tty Block special file, e.g. disk devices FIFO named pipe Socket used for network communication between processes Symbolic link A type of file pointing to another file Figure 4.3
13 Sample output from Figure 4.3 $./a.out /etc/passwd /etc /dev/initctl /dev/log /dev/tty /dev/scsi/host0/bus0/target0/lun0/cd /dev/cdrom /etc/passwd: regular /etc: directory /dev/initctl: fifo /dev/log: socket /dev/tty: character special /dev/scsi/host0/bus0/target0/lun0/cd: block special /dev/cdrom: symbolic link
14 #include "apue.h int main(int argc, char *argv[]) { int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[i]); if (lstat(argv[i], &buf) < 0) { err_ret("lstat error"); continue; } if (S_ISREG(buf.st_mode)) ptr = "regular"; else if (S_ISDIR(buf.st_mode)) ptr = "directory"; else if (S_ISCHR(buf.st_mode)) ptr = "character special"; else if (S_ISBLK(buf.st_mode)) ptr = "block special"; else if (S_ISFIFO(buf.st_mode)) ptr = "fifo"; else if (S_ISLNK(buf.st_mode)) ptr = "symbolic link"; else if (S_ISSOCK(buf.st_mode)) ptr = "socket"; else ptr = "** unknown mode **"; printf("%s\n", ptr); } Figure 4.3 exit(0); }
15 #include "apue.h int main(int argc, char *argv[]) { int i; struct stat buf; char *ptr; for (i = 1; i < argc; i++) { printf("%s: ", argv[i]); if (lstat(argv[i], &buf) < 0) { err_ret("lstat error"); continue; } if (S_ISREG(buf.st_mode)) ptr = "regular"; else if (S_ISDIR(buf.st_mode)) ptr = "directory"; else if (S_ISCHR(buf.st_mode)) ptr = "character special"; else if (S_ISBLK(buf.st_mode)) ptr = "block special"; else if (S_ISFIFO(buf.st_mode)) ptr = "fifo"; else if (S_ISLNK(buf.st_mode)) ptr = "symbolic link"; else if (S_ISSOCK(buf.st_mode)) ptr = "socket"; else ptr = "** unknown mode **"; printf("%s\n", ptr); } Figure 4.3 exit(0); }
16 File Access Permissions The nine file access permission bits from <sys/stat.h> st_mode mask S_IRUSR S_IWUSR S_IXUSR S_IRGRP S_IWGRP S_IXGRP S_IROTH S_IWOTH S_IXOTH Meaning $ ls l foo bar -rwxr-xr-x 1 stevens 0 Nov 16 16:23 bar -rw-r--r-- 1 stevens 0 Nov 16 16:23 foo chmod(1), e.g. chmod g+w bar User-read User-write User-execute Group-read Group-write Group-execute Other-read Other-write Other-execute
17 File Access Permissions Directory File R to obtain a list of all the file names in the dir. W to create/delete a file in the directory, both X and W are necessary. X - to pass through the directory comprising a pathname (e.g., execute permission in /, /usr, and /usr/include to op en /usr/include/stdio.h), also called search bit. R O_RDONLY and O_RDWR for the open function W O_WRONLY, O_RDWR, O_TRUNC X exec functions Q: To create a new file in a directory, which permission(s) do we need to have? Q: To delete an existing file in a dir, which permission(s)?
18 User IDs of a process User IDs and group IDs associated with each process real user ID, real group ID (st_uid & st_gid) Owner of the cat program is root Real user ID of the cat process is taesoo who cannot access /etc/shadow
19 Set-User-ID and Set-Group-ID User IDs and group IDs associated with each process real user ID, real group ID (st_uid & st_gid) effective user ID, effective group ID, supplementary group IDs saved set-user-id, saved set-group-id set-user-id bit and set-group-id bit in st_mode When this file is executed, set the effective user/group ID of the process to be the owner/group of the file. As an example, passwd(1) is a set-user-id program. passwd command is for changing my password
20 File Access Permissions user ID and group ID of the file effective user ID, effective group ID, and supplementary group IDs of the process 1. if the effective user ID is 0, 2. if the effective user ID equals the user ID of the file, 3. if the effective group ID equals the group ID of the file, 4. if the appropriate other access permission bit is set,. Q: what if permissions of a.out are as follows?: -rw-rwx-r-x a.out Hint: OR condition
21 Ownership of New Files and Directories The user ID of a new file is set to the effective user ID of the process. The group ID of a new file is set to one of the followings The effective group ID of the process The group ID of the containing directory FreeBSD, Mac OS X 10.3 set-group-id bit (Linux, Solaris)
22 access Function #include <unistd.h> int access(const char *pathname, int mode); mode: R_OK, W_OK, X_OK, and F_OK Accessibility test based on the real user ID/group ID to verify that the real user can access the given file. not the effective user ID of a process Figure 4.8
23 Figure 4.8 #include "apue.h #include <fcntl.h> int main(int argc, char *argv[]) { if (argc!= 2) err_quit("usage: a.out <pathname>"); if (access(argv[1], R_OK) < 0) err_ret("access error for %s", argv[1]); else printf("read access OK\n"); if (open(argv[1], O_RDONLY) < 0) err_ret("open error for %s", argv[1]); else printf("open for reading OK\n"); } exit(0);
24 access Function $ ls l a.out -rwxrwxr-w 1 sar Nov 30 12:10 a.out $./a.out a.out read access OK open for reading OK $ ls l /etc/shadow -r root 1315 Jul /etc/shadow $./a.out /etc/shadow access error for /etc/shadow: Permission denied open error for /etc/shadow: Permission denied $ su become superuser Passwd: enter superuser password $ chown root a.out change file s user ID to root $ chmod u+s a.out and turn on set-user-id bit $ ls l a.out check owner and SUID bit -rwsrwxr-x 1 root Nov 30 12:10 a.out $ exit go back to normal user $./a.out /etc/shadow access error for /etc/shadow: Permission denied open for reading OK
25 Changing file permissions Using umask at creation time Using chmod after the file is created
26 umask command 000 = 00 ( ) 001 = 01 ( X) 010 = 02 ( W ) 011 = 03 ( WX) 100 = 04 (R ) 101 = 05 (R X) 110 = 06 (RW ) 111 = 07 (RWX) Touch command ignores x flag
27 umask Function #include <sys/stat.h> mode_t umask(mode_t cmask); It sets the file mode creation mask for the process an d returns the previous value. Any bits that are on in the file mode creation mask ar e turned off in the file s mode. Figure 4.9 $ umask first print the current file mode creation mask 002 $ a.out $ ls l foo bar -rw sar 0 Nov 16 16:23 bar -rw-rw-rw- 1 sar 0 Nov 16 16:23 foo $ umask see if the file mode creation mask changed 002
28 Figure 4.9 #include "apue.h #include <fcntl.h> #define RWRWRW (S_IRUSR S_IWUSR S_IRGRP S_IWGRP S_IROTH S_IWOT H) int main(void) { umask(0); if (creat("foo", RWRWRW) < 0) err_sys("creat error for foo"); umask(s_irgrp S_IWGRP S_IROTH S_IWOTH); if (creat("bar", RWRWRW) < 0) err_sys("creat error for bar"); } exit(0);
29 chmod and fchmod Functions #include <sys/stat.h> int chmod(const char *pathname, mode_t mode); int fchmod(int filedes, mode_t mode); Figure 4.12 $ ls l foo bar -rw sar bar -rw-rw-rw- 1 sar foo $ a.out $ ls l foo bar??? mode S_ISUID S_ISGID S_ISVTX S_IRWXU S_IRUSR S_IWUSR S_IXUSR S_IRWXG S_IRGRP S_IWGRP S_IXGRP S_IRWXO S_IROTH S_IWOTH S_IXOTH Description set-user-id on execution set-group-id on execution saved-text (sticky bit) read, write, and execute by user (owner) read by user (owner) write by user (owner) execute by user (owner) read, write, and execute by group read by group write by group execute by group read, write, and execute by other (world) read by other (world) write by other (world) execute by other (world)
30 chmod command 000 = 00 ( ) 001 = 01 ( X) 010 = 02 ( W ) 011 = 03 ( WX) 100 = 04 (R ) 101 = 05 (R X) 110 = 06 (RW ) 111 = 07 (RWX)
31 Figure 4.12 #include "apue.h int main(void) { struct stat statbuf; /* turn on set-group-id and turn off group-execut e */ if (stat("foo", &statbuf) < 0) err_sys("stat error for foo"); if (chmod("foo", (statbuf.st_mode & ~S_IXGRP) S_ISGID) < 0) err_sys("chmod error for foo"); if (chmod("bar", S_IRUSR S_IWUSR S_IRGRP S_IROTH) < 0) err_sys("chmod error for bar"); } exit(0);
32 Figure 4.12 #include "apue.h int main(void) { struct stat statbuf; /* turn on set-group-id and turn off group-execut e */ if (stat("foo", &statbuf) < 0) err_sys("stat error for foo"); if (chmod("foo", (statbuf.st_mode & ~S_IXGRP) S_ISGID) < 0) err_sys("chmod error for foo"); if (chmod("bar", 0644) < 0) err_sys("chmod error for bar"); } exit(0);
33 Sticky Bit S_ISVTX: sticky bit = saved text bit File is used to save the program s text in the swap area to spe ed up memory loading the next time set only by the superuser (in FreeBSD, Mac OS X, Solaris. but not in Linux) Directory e.g. /tmp and /var/spool/uucppublic A file in the directory can be removed or renamed only if t he user has write permission for the directory, AND either owns the file, owns the directory, or is the superuser
34 Changing file ownership using chown, fchown, and lchown #include <unistd.h> int chown(const char *pathname, uid_t owner, gid_t group); int fchown(int filedes, uid_t owner, gid_t group); int lchown(const char *pathname, uid_t owner, gid_t group); To change the user/group ID of a file. lchwon changes the owners of the symbolic link its elf.
35 chown, fchown, and lchown If _POSIX_CHOWN_RESTRICTED is in effect, Only a superuser process can change the user ID of the fil e; A nonsuperuser process can change the group ID of the fi le if the process owns the file (the owner equals to the user ID of the file), and the group equals either the effective group ID of the proc ess or one of the process s supplementary group IDs. You can t change the user ID of other users files You can change the group ID of files that you own, but o nly to groups that you belong to.
36 File Systems Various implementations of the UNIX file system UFS disk drive partition partition partition file system cylinder group 0 cylinder group 1 cylinder group n boot block(s) super block super block copy cg info i-node map block bitmap i-nodes data blocks i-nodei-node i-node
37 File Systems i-node contains info about the file, including file type, access permission, ref-count, size, ptrs to data blocks, and so on. Only two items (filename and i-node no.) are stored in the dir entry. i-node array data block second data block data block first data block third data block directory blocks and data blocks directory block data block directory block i-nodei-node i-node i-node i-node number filename i-node number filename
38 File Systems A link count in an i-node = the number of directory entries that point to the i- node st_nlink in the stat structure Hard links vs. soft links Symbolic links (soft links) The actual content of the file (the data blocks) contains the filename that the symbolic link points to. lrwxrwxrwx 1 root 7 Sep 25 07:14 lib->usr/lib No directory entry pointing to an i-node in a different file system. After $ mkdir testdir i-list array directory blocks and data blocks data block directory block data block directory block i-node 0 i-node 1267 i-node i-node number testdir
39 Link count of directory ~/test
40 Link count of file ~/test/a (hard links)
41 link, unlink, remove, and rename F unctions #include <unistd.h> int link(const char *existingpath, const char *newpath); Creates a new dir entry that references the existing path (, w hich increments the link count.) Both pathnames must be on the same file system (although P OSIX.1 supports linking across file systems.) Only a superuser can create a link to a directory. #include <unistd.h> int unlink(const char *pathname); Removes the dir entry and decrements the link count (the file is deleted, when it reaches 0). If a symbolic link, unlink references the symbolic link itself.
42 link, unlink, remove, and rename F unctions #include <stdio.h> int remove(const char *pathname); For a file, identical to unlink and, for a directory, to rmdir #include <stdio.h> int rename(const char *oldname, const char *newname);
43 Program 4.16 #include "apue.h #include <fcntl.h> int main(void) { if (open("tempfile", O_RDWR) < 0) err_sys("open error"); if (unlink("tempfile") < 0) err_sys("unlink error"); printf("file unlinked\n"); sleep(15); printf("done\n"); } exit(0);
44 link, unlink, remove, and rename F unctions Program 4.16 $ ls l tempfile -rw-r sar Jan 21 07:14 tempfile $ df /home Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda % /home $./a.out & 1364 $ file unlinked ls l tempfile ls: tempfile: No such file or directory $ df /home Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda % /home $ done df /home Filesystem 1K-blocks Used Available Use% Mounted on /dev/hda % /home
45 Symbolic links ($ln -s RigidBodyWin.h RR) group
46 Symbolic Links To get around the limitation of hard links Linking across file systems A hard link to a directory (only by superuser) foo $ mkdir foo $ touch foo/a $ ln s../foo foo/testdir $ ls l foo total 0 a testdir -rw-rw-r-- 1 sar 0 Dec 6 06:06 a lrwxrwxrwx 1 sar 6 Dec 6 06:06 testdir->../foo
47 symlink and readlink Functions #include <unistd.h> int symlink(const char *actualpath, const char *sympath); A new dir entry, sympath, is created that points to a ctual path. #include <unistd.h> ssize_t readlink(const char *pathname, char *buf, size_ t bufsize); open follows a symbolic link, while readlink ope ns the link itself and reads the name in the link. Equivalent to the actions of open, read, and cl ose.
48 File times group
49 File Times Field Description Example ls(1) option st_atime st_mtime st_ctime Last access time of file data Last modification time of file data Last change time of i-node status read write chmod, chown -u default -c The modification time is when the file contents were last modified. The changed-status time indicates when the i-node was last modified, e.g., changing the file access permission, the user ID, the number of links, etc. The three times for a file/directory and its parent directory For example, creating a new file affects the containing dir, and it af fects the i-node for the new file. (Figure 4.20)
50 utime Function #include <sys/types.h> #include <utime.h> int utime(const char *pathname, const struct utimbuf *times); struct utimbuf { time_t actime; /* access time */ time_t modtime; /* modification time */ } The utime changes the access/modification time of a file. If times is NULL, set to current time. Effective UID must equal the real ID of the file, or write permissio n for the file. Otherwise, set to values pointed by times. Effective UID must equal the real ID of the file, or superuser privil ege Program 4.21
51 #include "apue.h #include <fcntl.h> #include <utime.h> int main(int argc, char *argv[]) { int i, fd; struct stat statbuf; struct utimbuf timebuf; Program 4.21 } for (i = 1; i < argc; i++) { if (stat(argv[i], &statbuf) < 0) { /* fetch current times */ err_ret("%s: stat error", argv[i]); continue; } if ((fd = open(argv[i], O_RDWR O_TRUNC)) < 0) { /* truncate */ err_ret("%s: open error", argv[i]); continue; } close(fd); timebuf.actime = statbuf.st_atime; timebuf.modtime = statbuf.st_mtime; if (utime(argv[i], &timebuf) < 0) {/* reset times */ err_ret("%s: utime error", argv[i]); continue; } } exit(0);
52 mkdir and rmdir Functions #include <sys/stat.h> int mkdir(const char *pathname, mode_t mode); The mode is modified by the umask of the proce ss. The user ID and group ID of the new directory. #include <unistd.h> int rmdir(const char *pathname); If the link count of the dir becomes 0, and no other process has the dir open, then the space occupied by the dir is freed.
53 Reading directories group
54 Reading Directories #include <dirent.h> DIR *opendir(const char *pathname); struct dirent *readdir(dir *dp); void rewinddir(dir *dp); int closedir(dir *dp); long telldir(dir *dp); void seekdir(dir *dp, long loc); dp = opendir(fullpath); while ((dirp = readdir(dp))!= NULL) printf( %s\n,dirp->d_name); closedir(dp); struct dirent { ino_t d_ino; /* i-node number */ char d_name[name_max + 1]; /* null-terminated fname */ } Only the kernel can write to a directory. Write and execute permission to create/delete f iles Program 4.22
55 #include "apue.h #include <dirent.h> #include <limits.h>/* function type that is called for each filename */ typedefint Myfunc(const char *, const struct stat *, int); static Myfunc myfunc; static int myftw(char *, Myfunc *); static int dopath(myfunc *); static long nreg, ndir, nblk, nchr, nfifo, nslink, nsock, ntot; int main(int argc, char *argv[]) { int ret; if (argc!= 2) err_quit("usage: ftw <starting-pathname>"); ret = myftw(argv[1], myfunc); /* does it all */ ntot = nreg + ndir + nblk + nchr + nfifo + nslink + nsock; if (ntot == 0) ntot = 1; /* avoid divide by 0; print 0 for all counts */ printf("regular files = %7ld, %5.2f %%\n", nreg, nreg*100.0/ntot); printf("directories = %7ld, %5.2f %%\n", ndir, ndir*100.0/ntot); printf("block special = %7ld, %5.2f %%\n", nblk, nblk*100.0/ntot); printf("char special = %7ld, %5.2f %%\n", nchr, nchr*100.0/ntot); printf("fifos = %7ld, %5.2f %%\n", nfifo, nfifo*100.0/ntot); printf("symbolic links = %7ld, %5.2f %%\n", nslink, nslink*100.0/ntot); printf("sockets = %7ld, %5.2f %%\n", nsock, nsock*100.0/ntot); exit(ret); } Program 4.22
56 Program 4.22 /* * Descend through the hierarchy, starting at "pathname". * The caller's func() is called for every file. */ #define FTW_F 1 /* file other than directory */ #define FTW_D 2 /* directory */ #define FTW_DNR 3 /* directory that can't be read */ #define FTW_NS4 /* file that we can't stat */ static char *fullpath; /* contains full pathname for every file */ static int /* we return whatever func() returns */ myftw(char *pathname, Myfunc *func) { int len; fullpath = path_alloc(&len); /* malloc's for PATH_MAX+1 bytes */ /* ({Prog pathalloc}) */ strncpy(fullpath, pathname, len);/* protect against */ fullpath[len-1] = 0; /* buffer overrun */ } return(dopath(func));
57 Program 4.22 /* * Descend through the hierarchy, starting at "fullpath". If "fullpath" is anything other than a directory, we lstat() i t, * call func(), and return. For a directory, we call ourself recursively for each name in the directory. */ static int /* we return whatever func() returns */ dopath(myfunc* func) { struct stat statbuf; struct dirent *dirp; DIR *dp; int ret; char *ptr; if (lstat(fullpath, &statbuf) < 0) /* stat error */ return(func(fullpath, &statbuf, FTW_NS)); if (S_ISDIR(statbuf.st_mode) == 0) /* not a directory */ return(func(fullpath, &statbuf, FTW_F)); /* It's a directory. First call func() for the directory, * then process each filename in the directory. */ if ((ret = func(fullpath, &statbuf, FTW_D))!= 0) return(ret); ptr = fullpath + strlen(fullpath); /* point to end of fullpath */ *ptr++ = '/ ; *ptr = 0; if ((dp = opendir(fullpath)) == NULL) /* can't read directory */ return(func(fullpath, &statbuf, FTW_DNR)); while ((dirp = readdir(dp))!= NULL) { if (strcmp(dirp->d_name, ".") == 0 strcmp(dirp->d_name, "..") == 0) continue; /* ignore dot and dot-dot */ strcpy(ptr, dirp->d_name); /* append name after slash */ if ((ret = dopath(func))!= 0) /* recursive */ break; /* time to leave */ } ptr[-1] = 0; /* erase everything from slash onwards */ if (closedir(dp) < 0) err_ret("can't close directory %s", fullpath); return(ret); }
58 Program 4.22 static int myfunc(const char *pathname, const struct stat *statptr, int type) { switch (type) { case FTW_F: switch (statptr->st_mode & S_IFMT) { case S_IFREG: nreg++; break; case S_IFBLK: nblk++; break; case S_IFCHR: nchr++; break; case S_IFIFO: nfifo++; break; case S_IFLNK: nslink++; break; case S_IFSOCK: nsock++; break; case S_IFDIR: err_dump("for S_IFDIR for %s", pathname); /* directories should have type = FTW_D */ } break; case FTW_D: ndir++; break; case FTW_DNR: err_ret("can't read directory %s", pathname); break; case FTW_NS: err_ret("stat error for %s", pathname); break; default: err_dump("unknown type %d for pathname %s", type, pathname); } return(0); }
59 chdir, fchdir, and getcwd #include <unistd.h> int chdir(const char *pathname); int fchdir(int filedes); char *getcwd(char *buf, size_t size); Correspond to cd and pwd
60 Special Device Files Every file system is known by its major/minor devic e numbers stored in a dev_t object. major and minor macros to access 8/8, 8/24, 14/ 18, or 32/32 major/minor bits. The st_dev is the dev no. of the file system conta ining the file. The st_rdev contains the dev no. of the characte r/block special files. Program 4.25
61 Program 4.25 #include "apue.h #ifdef SOLARIS #include <sys/mkdev.h> #endif int main(int argc, char *argv[]) { int i; struct stat buf; for (i = 1; i < argc; i++) { printf("%s: ", argv[i]); if (stat(argv[i], &buf) < 0) { err_ret("stat error"); continue; } printf("dev = %d/%d", major(buf.st_dev), minor(buf.st_dev)); if (S_ISCHR(buf.st_mode) S_ISBLK(buf.st_mode)) { printf(" (%s) rdev = %d/%d, (S_ISCHR(buf.st_mode))? "character" : "block", major(buf.st_rdev), minor(buf.st_rdev)); } printf("\n"); } exit(0); }
File and Directories. Advanced Programming in the UNIX Environment
File and Directories Advanced Programming in the UNIX Environment stat Function #include int stat(const char *restrict pathname, struct stat *restrict buf ); int fstat(int fd, struct stat
More informationFiles and Directories
Contents 1. Preface/Introduction 2. Standardization and Implementation 3. File I/O 4. Standard I/O Library 5. Files and Directories 6. System Data Files and Information 7. Environment of a Unix Process
More informationFiles and Directories Objectives Additional Features of the File System Properties of a File. Three major functions that return file information:
Files and Directories Objectives Additional Features of the File System Properties of a File. Three major functions that return file information: #include #include int stat(const
More informationFiles and directories. Updated by: Dr. Safwan Qasem Spring 2010 Original version created by: Dr. Mohamed El Bachir Menai
Files and directories Updated by: Dr. Safwan Qasem Spring 2010 Original version created by: Dr. Mohamed El Bachir Menai 1 Files and Directories Objectives Additional Features of the File System Properties
More informationFile Types in Unix. Regular files which include text files (formatted) and binary (unformatted)
File Management Files can be viewed as either: a sequence of bytes with no structure imposed by the operating system. or a structured collection of information with some structure imposed by the operating
More informationChapter 4 - Files and Directories. Information about files and directories Management of files and directories
Chapter 4 - Files and Directories Information about files and directories Management of files and directories File Systems Unix File Systems UFS - original FS FFS - Berkeley ext/ext2/ext3/ext4 - Linux
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and
More informationOperating System Labs. Yuanbin Wu
Operating System Labs Yuanbin Wu CS@ECNU Operating System Labs Project 3 Oral test Handin your slides Time Project 4 Due: 6 Dec Code Experiment report Operating System Labs Overview of file system File
More informationFiles and Directories Filesystems from a user s perspective
Files and Directories Filesystems from a user s perspective Unix Filesystems Seminar Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of
More informationThe link() System Call. Preview. The link() System Call. The link() System Call. The unlink() System Call 9/25/2017
Preview The link() System Call link(), unlink() System Call remove(), rename() System Call Symbolic link to directory Symbolic link to a executable file symlink() System Call File Times utime() System
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationCS631 - Advanced Programming in the UNIX Environment
CS631 - Advanced Programming in the UNIX Environment Slide 1 CS631 - Advanced Programming in the UNIX Environment Files and Directories Department of Computer Science Stevens Institute of Technology Jan
More informationI/O OPERATIONS. UNIX Programming 2014 Fall by Euiseong Seo
I/O OPERATIONS UNIX Programming 2014 Fall by Euiseong Seo Files Files that contain a stream of bytes are called regular files Regular files can be any of followings ASCII text Data Executable code Shell
More informationHyo-bong Son Computer Systems Laboratory Sungkyunkwan University
File I/O Hyo-bong Son (proshb@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Unix Files A Unix file is a sequence of m bytes: B 0, B 1,..., B k,..., B m-1 All I/O
More informationCSI 402 Lecture 11 (Unix Discussion on Files continued) 11 1 / 19
CSI 402 Lecture 11 (Unix Discussion on Files continued) 11 1 / 19 User and Group IDs Ref: Chapter 3 of [HGS]. Each user is given an ID (integer) called uid. (Most system programs use uid instead of the
More informationSystem Calls. Library Functions Vs. System Calls. Library Functions Vs. System Calls
System Calls Library Functions Vs. System Calls A library function: Ordinary function that resides in a library external to the calling program. A call to a library function is just like any other function
More informationFiles and Directories
Files and Directories Stat functions Given pathname, stat function returns structure of information about file fstat function obtains information about the file that is already open lstat same as stat
More informationOperating System Labs. Yuanbin Wu
Operating System Labs Yuanbin Wu CS@ECNU Operating System Labs Project 4 (multi-thread & lock): Due: 10 Dec Code & experiment report 18 Dec. Oral test of project 4, 9:30am Lectures: Q&A Project 5: Due:
More informationPreview. lseek System Calls. A File Copy 9/18/2017. An opened file offset can be explicitly positioned by calling lseek system call.
Preview lseek System Calls lseek() System call File copy dup() and dup2() System Cal Command Line Argument sat, fsat, lsat system Call ID s for a process File Access permission access System Call umask
More informationINTRODUCTION TO THE UNIX FILE SYSTEM 1)
INTRODUCTION TO THE UNIX FILE SYSTEM 1) 1 FILE SHARING Unix supports the sharing of open files between different processes. We'll examine the data structures used by the kernel for all I/0. Three data
More informationFiles and Directories Filesystems from a user s perspective
Files and Directories Filesystems from a user s perspective Unix Filesystems Seminar Alexander Holupirek Database and Information Systems Group Department of Computer & Information Science University of
More informationLecture 21 Systems Programming in C
Lecture 21 Systems Programming in C A C program can invoke UNIX system calls directly. A system call can be defined as a request to the operating system to do something on behalf of the program. During
More informationLinux C C man mkdir( ) mkdir Linux man mkdir mkdir( ) mkdir mkdir( )
D Linux Linux E-D.1 Linux C C man mkdir( ) mkdir Linux man mkdir mkdir( ) mkdir mkdir( ) jhchen@aho:~$ man -S 2 mkdir Reformatting mkdir(2), please wait... MKDIR(2) Linux Programmer's Manual MKDIR(2) NAME
More informationLast Week: ! Efficiency read/write. ! The File. ! File pointer. ! File control/access. This Week: ! How to program with directories
Overview Unix System Programming Directories and File System Last Week:! Efficiency read/write! The File! File pointer! File control/access This Week:! How to program with directories! Brief introduction
More informationCS , Spring Sample Exam 3
Andrew login ID: Full Name: CS 15-123, Spring 2010 Sample Exam 3 Mon. April 6, 2009 Instructions: Make sure that your exam is not missing any sheets, then write your full name and Andrew login ID on the
More informationOverview. Unix System Programming. Outline. Directory Implementation. Directory Implementation. Directory Structure. Directories & Continuation
Overview Unix System Programming Directories & Continuation Maria Hybinette, UGA 1 Last Week: Efficiency read/write The File File pointer File control/access Permissions, Meta Data, Ownership, umask, holes
More informationUNIX System Calls. Sys Calls versus Library Func
UNIX System Calls Entry points to the kernel Provide services to the processes One feature that cannot be changed Definitions are in C For most system calls a function with the same name exists in the
More informationCSC 271 Software I: Utilities and Internals
CSC 271 Software I: Utilities and Internals Lecture 13 : An Introduction to File I/O in Linux File Descriptors All system calls for I/O operations refer to open files using a file descriptor (a nonnegative
More informationCptS 360 (System Programming) Unit 6: Files and Directories
CptS 360 (System Programming) Bob Lewis School of Engineering and Applied Sciences Washington State University Spring, 2019 Motivation Need to know your way around a filesystem. A properly organized filesystem
More informationOPERATING SYSTEMS: Lesson 2: Operating System Services
OPERATING SYSTEMS: Lesson 2: Operating System Services Jesús Carretero Pérez David Expósito Singh José Daniel García Sánchez Francisco Javier García Blas Florin Isaila 1 Goals To understand what an operating
More informationOPERATING SYSTEMS: Lesson 12: Directories
OPERATING SYSTEMS: Lesson 12: Directories Jesús Carretero Pérez David Expósito Singh José Daniel García Sánchez Francisco Javier García Blas Florin Isaila 1 Goals To know the concepts of file and directory
More informationCSci 4061 Introduction to Operating Systems. File Systems: Basics
CSci 4061 Introduction to Operating Systems File Systems: Basics File as Abstraction Naming a File creat/open ( path/name, ); Links: files with multiple names Each name is an alias #include
More informationFile Systems. Today. Next. Files and directories File & directory implementation Sharing and protection. File system management & examples
File Systems Today Files and directories File & directory implementation Sharing and protection Next File system management & examples Files and file systems Most computer applications need to: Store large
More informationFile Systems. q Files and directories q Sharing and protection q File & directory implementation
File Systems q Files and directories q Sharing and protection q File & directory implementation Files and file systems Most computer applications need to Store large amounts of data; larger than their
More informationFall 2017 :: CSE 306. File Systems Basics. Nima Honarmand
File Systems Basics Nima Honarmand File and inode File: user-level abstraction of storage (and other) devices Sequence of bytes inode: internal OS data structure representing a file inode stands for index
More informationThesis, antithesis, synthesis
Identity Page 1 Thesis, antithesis, synthesis Thursday, December 01, 2011 4:00 PM Thesis, antithesis, synthesis We began the course by considering the system programmer's point of view. Mid-course, we
More informationstructs as arguments
Structs A collection of related data items struct record { char name[maxname]; int count; ; /* The semicolon is important! It terminates the declaration. */ struct record rec1; /*allocates space for the
More informationwhich maintain a name to inode mapping which is convenient for people to use. All le objects are
UNIX Directory Organization UNIX directories are simple (generally ASCII) les which maain a name to inode mapping which is convenient for people to use. All le objects are represented by one or more names
More informationLecture 23: System-Level I/O
CSCI-UA.0201-001/2 Computer Systems Organization Lecture 23: System-Level I/O Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark Barrett
More informationSystem- Level I/O. Andrew Case. Slides adapted from Jinyang Li, Randy Bryant and Dave O Hallaron
System- Level I/O Andrew Case Slides adapted from Jinyang Li, Randy Bryant and Dave O Hallaron 1 Unix I/O and Files UNIX abstracts many things into files (just a series of bytes) All I/O devices are represented
More informationFile I/O. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University
File I/O Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Unix Files A Unix file is a sequence of m bytes: B 0, B 1,..., B k,..., B m-1 All I/O devices
More informationCS 201. Files and I/O. Gerson Robboy Portland State University
CS 201 Files and I/O Gerson Robboy Portland State University A Typical Hardware System CPU chip register file ALU system bus memory bus bus interface I/O bridge main memory USB controller graphics adapter
More informationOriginal ACL related man pages
Original ACL related man pages NAME getfacl - get file access control lists SYNOPSIS getfacl [-drlpvh] file... getfacl [-drlpvh] - DESCRIPTION For each file, getfacl displays the file name, owner, the
More informationFile I/O. Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University Embedded Software Lab.
1 File I/O Dong-kun Shin Embedded Software Laboratory Sungkyunkwan University http://nyx.skku.ac.kr Unix files 2 A Unix file is a sequence of m bytes: B 0, B 1,..., B k,..., B m-1 All I/O devices are represented
More informationImportant Dates. October 27 th Homework 2 Due. October 29 th Midterm
CSE333 SECTION 5 Important Dates October 27 th Homework 2 Due October 29 th Midterm String API vs. Byte API Recall: Strings are character arrays terminated by \0 The String API (functions that start with
More informationADVANCED OPERATING SYSTEMS UNIT 2 FILE AND DIRECTORY I/O BY MR.PRASAD SAWANT
ADVANCED OPERATING SYSTEMS UNIT 2 FILE AND DIRECTORY I/O BY MR.PRASAD SAWANT OUT LINE OF SESSION 1. Buffer headers 2. structure of the buffer pool 3. scenarios for retrieval of a buffer 4. reading and
More informationThe course that gives CMU its Zip! I/O Nov 15, 2001
15-213 The course that gives CMU its Zip! I/O Nov 15, 2001 Topics Files Unix I/O Standard I/O A typical hardware system CPU chip register file ALU system bus memory bus bus interface I/O bridge main memory
More informationSystems Programming/ C and UNIX
Systems Programming/ C and UNIX Alice E. Fischer September 9, 2015 Alice E. Fischer Systems Programming Lecture 3... 1/39 September 9, 2015 1 / 39 Outline 1 Compile and Run 2 Unix Topics System Calls The
More informationf90 unix file: Unix File Operations Module March 9, 2009
f90 unix file: Unix File Operations Module March 9, 2009 1 Name f90 unix file Module of Unix file operations 2 Usage USE F90 UNIX FILE This module contains part of a Fortran API to functions detailed in
More informationFile System (FS) Highlights
CSCI 503: Operating Systems File System (Chapters 16 and 17) Fengguang Song Department of Computer & Information Science IUPUI File System (FS) Highlights File system is the most visible part of OS From
More informationContents. NOTICE & Programming Assignment #1. QnA about last exercise. File IO exercise
File I/O Examples Prof. Jin-Soo Kim(jinsookim@skku.edu) TA - Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents NOTICE & Programming Assignment
More informationContents. Programming Assignment 0 review & NOTICE. File IO & File IO exercise. What will be next project?
File I/O Prof. Jin-Soo Kim(jinsookim@skku.edu) TA - Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents Programming Assignment 0 review & NOTICE
More informationOutline. File Systems. File System Structure. CSCI 4061 Introduction to Operating Systems
Outline CSCI 4061 Introduction to Operating Systems Instructor: Abhishek Chandra File Systems Directories File and directory operations Inodes and metadata Links 2 File Systems An organized collection
More informationCSC209F Midterm (L0101) Fall 1999 University of Toronto Department of Computer Science
CSC209F Midterm (L0101) Fall 1999 University of Toronto Department of Computer Science Date: October 26, 1999 Time: 1:10 pm Duration: 50 minutes Notes: 1. This is a closed book test, no aids are allowed.
More informationSystem Calls and I/O Appendix. Copyright : University of Illinois CS 241 Staff 1
System Calls and I/O Appendix Copyright : University of Illinois CS 241 Staff 1 More System Calls Directory and File System Management s = mkdir(name, mode) Create a new directory s = rmdir(name) s = link(name,
More informationUNIX FILESYSTEM STRUCTURE BASICS By Mark E. Donaldson
THE UNIX FILE SYSTEM Under UNIX we can think of the file system as everything being a file. Thus directories are really nothing more than files containing the names of other files and so on. In addition,
More informationRicardo Rocha. Department of Computer Science Faculty of Sciences University of Porto
Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and
More informationCSE 333 SECTION 3. POSIX I/O Functions
CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight Exercise 7 due Monday (out later today) POSIX Portable Operating System Interface Family of standards specified by the
More informationCSCI-E28 Lecture 3 Outline. Directories, File Attributes, Bits, File Operations. Write our own versions of Unix programs
CSCI-E28 Lecture 3 Outline Topics: Approach: Directories, File Attributes, Bits, File Operations Write our own versions of Unix programs Featured Commands: ls, ls -l Main Ideas: Adirectory is a list of
More informationHomework 5. Due Date: Friday, June 7, 2002, at 11:59PM; no late assignments accepted Points: 100
Homework 5 Due Date: Friday, June 7, 2002, at 11:59PM; no late assignments accepted Points: 100 UNIX System 1. (10 points) I want to make the file libprog.a in my home directory available to everyone so
More informationContents. NOTICE & Programming Assignment 0 review. What will be next project? File IO & File IO exercise
File I/O Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Dong-Yun Lee(dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Contents NOTICE & Programming Assignment 0 review
More informationThe UNIX File System. File Systems and Directories UNIX inodes Accessing directories Understanding links in directories.
The UNIX File System File Systems and Directories UNIX s Accessing directories Understanding links in directories Reading: R&R, Ch 5 Directories Large amounts of data: Partition and structure for easier
More informationAll the scoring jobs will be done by script
File I/O Prof. Jin-Soo Kim( jinsookim@skku.edu) TA Sanghoon Han(sanghoon.han@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Announcement (1) All the scoring jobs
More informationIntroduction. Files. 3. UNIX provides a simple and consistent interface to operating system services and to devices. Directories
Working With Files Introduction Files 1. In UNIX system or UNIX-like system, all input and output are done by reading or writing files, because all peripheral devices, even keyboard and screen are files
More informationFILE SYSTEMS. Tanzir Ahmed CSCE 313 Fall 2018
FILE SYSTEMS Tanzir Ahmed CSCE 313 Fall 2018 References Previous offerings of the same course by Prof Tyagi and Bettati Textbook: Operating System Principles and Practice 2 The UNIX File System File Systems
More informationCSCE 313 Introduction to Computer Systems
CSCE 313 Introduction to Computer Systems Instructor: Dr. Guofei Gu http://courses.cse.tamu.edu/guofei/csce313 The UNIX File System File Systems and Directories Accessing directories UNIX s Understanding
More informationFILE SYSTEMS. Jo, Heeseung
FILE SYSTEMS Jo, Heeseung TODAY'S TOPICS File system basics Directory structure File system mounting File sharing Protection 2 BASIC CONCEPTS Requirements for long-term information storage Store a very
More informationUnix File and I/O. Outline. Storing Information. File Systems. (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu
Outline Unix File and I/O (USP Chapters 4 and 5) Instructor: Dr. Tongping Liu Basics of File Systems Directory and Unix File System: inode UNIX I/O System Calls: open, close, read, write, ioctl File Representations:
More informationAll the scoring jobs will be done by script
File I/O Prof. Jinkyu Jeong( jinkyu@skku.edu) TA-Seokha Shin(seokha.shin@csl.skku.edu) TA-Jinhong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu
More information17: Filesystem Examples: CD-ROM, MS-DOS, Unix
17: Filesystem Examples: CD-ROM, MS-DOS, Unix Mark Handley CD Filesystems ISO 9660 Rock Ridge Extensions Joliet Extensions 1 ISO 9660: CD-ROM Filesystem CD is divided into logical blocks of 2352 bytes.
More informationMaster Calcul Scientifique - Mise à niveau en Informatique Written exam : 3 hours
Université de Lille 1 Année Universitaire 2015-2016 Master Calcul Scientifique - Mise à niveau en Informatique Written exam : 3 hours Write your code nicely (indentation, use of explicit names... ), and
More informationCS 33. Files Part 2. CS33 Intro to Computer Systems XXI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved.
CS 33 Files Part 2 CS33 Intro to Computer Systems XXI 1 Copyright 2018 Thomas W. Doeppner. All rights reserved. Directories unix etc home pro dev passwd motd twd unix... slide1 slide2 CS33 Intro to Computer
More informationLecture files in /home/hwang/cs375/lecture05 on csserver.
Lecture 5 Lecture files in /home/hwang/cs375/lecture05 on csserver. cp -r /home/hwang/cs375/lecture05. scp -r user@csserver.evansville.edu:/home/hwang/cs375/lecture05. Project 1 posted, due next Thursday
More informationMemory Mapped I/O. Michael Jantz. Prasad Kulkarni. EECS 678 Memory Mapped I/O Lab 1
Memory Mapped I/O Michael Jantz Prasad Kulkarni EECS 678 Memory Mapped I/O Lab 1 Introduction This lab discusses various techniques user level programmers can use to control how their process' logical
More informationAutomated Test Generation in System-Level
Automated Test Generation in System-Level Pros + Can be easy to generate system TCs due to clear interface specification + No false alarm (i.e., no assert violation caused by infeasible execution scenario)
More informationOperating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst
Operating Systems CMPSCI 377 Spring 2017 Mark Corner University of Massachusetts Amherst Clicker Question #1 For a sequential workload, the limiting factor for a disk system is likely: (A) The speed of
More informationLecture 3. Introduction to Unix Systems Programming: Unix File I/O System Calls
Lecture 3 Introduction to Unix Systems Programming: Unix File I/O System Calls 1 Unix File I/O 2 Unix System Calls System calls are low level functions the operating system makes available to applications
More information0UNIT-III UNIX FILE SYSTEM
1 0UNIT-III UNIX FILE SYSTEM UNIX System Overview UNIX Architecture Login Name Shells Files and Directories 1. File System 2. Filename 3. Pathname 4. Working Directory, Home Directory File Structures Files
More informationOperating Systems Lab
Operating Systems Lab Islamic University Gaza Engineering Faculty Department of Computer Engineering Fall 2012 ECOM 4010: Operating Systems Lab Eng: Ahmed M. Ayash Lab # 4 Paths, Links & File Permissions
More informationFile Systems Overview. Jin-Soo Kim ( Computer Systems Laboratory Sungkyunkwan University
File Systems Overview Jin-Soo Kim ( jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Today s Topics File system basics Directory structure File system mounting
More informationPreview. System Call. System Call. System Call. System Call. Library Functions 9/20/2018. System Call
Preview File Descriptors for a Process for Managing Files write read open close lseek A system call is a request for the operating system to do something on behalf of the user's program. The system calls
More informationCMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O
CMSC 216 Introduction to Computer Systems Lecture 17 Process Control and System-Level I/O Sections 8.2-8.5, Bryant and O'Hallaron PROCESS CONTROL (CONT.) CMSC 216 - Wood, Sussman, Herman, Plane 2 Signals
More information39. File and Directories
39. File and Directories Oerating System: Three Easy Pieces AOS@UC 1 Persistent Storage Kee a data intact even if there is a ower loss. w Hard disk drive w Solid-state storage device Two key abstractions
More informationAdvanced Systems Security: Ordinary Operating Systems
Systems and Internet Infrastructure Security Network and Security Research Center Department of Computer Science and Engineering Pennsylvania State University, University Park PA Advanced Systems Security:
More informationUNIT I INTRODUCTION TO UNIX & FILE SYSTEM
INTRODUCTION TO UNIX & FILE SYSTEM Part A 1. What is UNIX? UNIX(Uniplexed Information Computing System) it is an operating system was developed in Early 1970 at Bell Labs. It was initially a character
More informationCSE 333 SECTION 3. POSIX I/O Functions
CSE 333 SECTION 3 POSIX I/O Functions Administrivia Questions (?) HW1 Due Tonight HW2 Due Thursday, July 19 th Midterm on Monday, July 23 th 10:50-11:50 in TBD (And regular exercises in between) POSIX
More informationFile Input and Output (I/O)
File Input and Output (I/O) Brad Karp UCL Computer Science CS 3007 15 th March 2018 (lecture notes derived from material from Phil Gibbons, Dave O Hallaron, and Randy Bryant) 1 Today UNIX I/O Metadata,
More informationThe bigger picture. File systems. User space operations. What s a file. A file system is the user space implementation of persistent storage.
The bigger picture File systems Johan Montelius KTH 2017 A file system is the user space implementation of persistent storage. a file is persistent i.e. it survives the termination of a process a file
More informationProgramiranje za UNIX. Datoteke i direktoriji
Programiranje za UNIX Datoteke i direktoriji Sadržaj Svojstva UNIX datoteka Korisnici i prava Operacije sa linkovima Rad s direktorijima Sistemske datoteke Sistemske informacije 2 Svojstva datoteke Svojstva
More informationCMPSC 311- Introduction to Systems Programming Module: Input/Output
CMPSC 311- Introduction to Systems Programming Module: Input/Output Professor Patrick McDaniel Fall 2014 Input/Out Input/output is the process of moving bytes into and out of the process space. terminal/keyboard
More informationSystem Programming. Introduction to Unix
Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Introduction
More informationLinux Forensics. Newbug Tseng Oct
Linux Forensics Newbug Tseng Oct. 2004. Contents Are u ready Go Real World Exploit Attack Detect Are u ready Linux File Permission OWNER 4 2 1 GROUP 4 2 1 OTHER 4 2 1 R R R W SUID on exection 4000 X W
More informationELEC-C7310 Sovellusohjelmointi Lecture 3: Filesystem
ELEC-C7310 Sovellusohjelmointi Lecture 3: Filesystem Risto Järvinen September 21, 2015 Lecture contents Filesystem concept. System call API. Buffered I/O API. Filesystem conventions. Additional stuff.
More informationDesign Choices 2 / 29
File Systems One of the most visible pieces of the OS Contributes significantly to usability (or the lack thereof) 1 / 29 Design Choices 2 / 29 Files and File Systems What s a file? You all know what a
More informationSystem-Level I/O. Topics Unix I/O Robust reading and writing Reading file metadata Sharing files I/O redirection Standard I/O
System-Level I/O Topics Unix I/O Robust reading and writing Reading file metadata Sharing files I/O redirection Standard I/O A Typical Hardware System CPU chip register file ALU system bus memory bus bus
More informationFiles. Eric McCreath
Files Eric McCreath 2 What is a file? Information used by a computer system may be stored on a variety of storage mediums (magnetic disks, magnetic tapes, optical disks, flash disks etc). However, as a
More informationHow do we define pointers? Memory allocation. Syntax. Notes. Pointers to variables. Pointers to structures. Pointers to functions. Notes.
, 1 / 33, Summer 2010 Department of Computer Science and Engineering York University Toronto June 15, 2010 Table of contents, 2 / 33 1 2 3 Exam, 4 / 33 You did well Standard input processing Testing Debugging
More informationPOSIX Shared Memory. Linux/UNIX IPC Programming. Outline. Michael Kerrisk, man7.org c 2017 November 2017
Linux/UNIX IPC Programming POSIX Shared Memory Michael Kerrisk, man7.org c 2017 mtk@man7.org November 2017 Outline 10 POSIX Shared Memory 10-1 10.1 Overview 10-3 10.2 Creating and opening shared memory
More informationCSCI 4500/8506 Operating Systems Some UNIX System Calls, Library, and PThreads Functions
CSCI 4500/8506 Operating Systems Some UNIX System Calls, Library, and PThreads Functions Described below is a subset of UNIX system calls, library functions, and Pthreads (that is, POSIX Threads) functions.
More information3/26/2014. Contents. Concepts (1) Disk: Device that stores information (files) Many files x many users: OS management
2013-2014 Contents 1. Concepts about the file system 2. The The disk user structure view 3. 2. Files The disk in disk structure The ext2 FS 4. 3. The Files Virtual in disk File The System ext2 FS 4. The
More information