SlideShare une entreprise Scribd logo
1  sur  80
UNIT -3  UNIX FILE APIs ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],General file APIs
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Open ,[object Object],[object Object],#include <sys/types.h> #include <fcntl.h> int open (const char *pathname, int access  mode , mode_t permission);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Umask ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],Creat  #include <sys/types.h> #include <unistd.h> Int creat (const char* pathname,mode_t mode)
Read ,[object Object],#include <sys/types.h> #include <unistd.h> ssize_t read (int fdesc ,void* buf, size_t size);
Write   ,[object Object],#include <sys/types.h> #include <unistd.h> ssize_t read (int fdesc ,void* buf, size_t size);
Close  ,[object Object],[object Object],[object Object],#include <unistd.h> int close (int fdesc);
fcntl ,[object Object],[object Object],#include <fcntl.h> Int fcntl (int fdesc ,int cmd);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
lseek ,[object Object],[object Object],#include <sys/types.h> #include <unistd.h>  Off_t sleek (int fdesc , off_t pos, int whence)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
link ,[object Object],[object Object],#include <unistd.h> int link (const char* cur_link ,const char*  new_link)
unlink ,[object Object],[object Object],#include <unistd.h> int unlink (const char* cur_link );
Stat fstat ,[object Object],#include <sys/types.h> #include <unistd.h>  int stat (const char* path_name,struct  stat* statv) int fstat (const int fdesc,struct stat* statv)
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],int lstat (const char* path_name , struct stat*  statv);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Access   ,[object Object],#include <unistd.h> int access (const char* path_name, int flag);
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],Chmod fcmod #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int chmod (const char* path_name, mode_t flag); int fchmod (int fdsec, mode_t flag);
[object Object],[object Object]
Chown fchown lchown ,[object Object],[object Object],#include <unistd.h> #include <sys/types.h> int chown (const char* path_name,  uid_t uid, gid_t gid);  int fchown (int fdesc, uid_t uid, gid_t gid);  int lchown (const char* path_name,  uid_t uid, gid_t gid);
utime ,[object Object],[object Object],#include <unistd.h> #include <sys/types.h> #include <utime.h> int utime (const char* path_name,  struct utimbuf* times);
[object Object],[object Object],[object Object],[object Object],[object Object]
FILE AND RECORD LOCKING ,[object Object],[object Object],[object Object],[object Object],[object Object]
Shared and exclusive locks ,[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
Advisory locks ,[object Object],[object Object],[object Object]
FCNTL file locking ,[object Object],Use Sets a file lock. Do not block if this  cannot succeed immediately. Sets a file lock and blocks the  calling process until the lock is  acquired. Queries as to which process locked  a specified region of a file. Cmd_flag F_SETLK F_SETLKW F_GETLK
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
l_type and l_whence fields of flock ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Directory File APIs ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
Difference between mkdir and    mknod ,[object Object],[object Object],[object Object]
[object Object],[object Object]
FUNCTIONS ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Device file APIs ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
MAJOR AND MINOR NUMBERS ,[object Object],[object Object]
[object Object],[object Object],[object Object]
FIFO File APIs ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
How is synchronization provided? ,[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]
[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Symbolic Link File APIs ,[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
QUESTIONS ,[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object],[object Object]
[object Object],[object Object],[object Object]

Contenu connexe

Tendances (20)

Operating system critical section
Operating system   critical sectionOperating system   critical section
Operating system critical section
 
File System Hierarchy
File System HierarchyFile System Hierarchy
File System Hierarchy
 
Pig Latin, Data Model with Load and Store Functions
Pig Latin, Data Model with Load and Store FunctionsPig Latin, Data Model with Load and Store Functions
Pig Latin, Data Model with Load and Store Functions
 
Shell programming
Shell programmingShell programming
Shell programming
 
directory structure and file system mounting
directory structure and file system mountingdirectory structure and file system mounting
directory structure and file system mounting
 
10 File System
10 File System10 File System
10 File System
 
Semaphore
SemaphoreSemaphore
Semaphore
 
Process state in OS
Process state in OSProcess state in OS
Process state in OS
 
I/O Management
I/O ManagementI/O Management
I/O Management
 
Chomsky classification of Language
Chomsky classification of LanguageChomsky classification of Language
Chomsky classification of Language
 
Advance oops concepts
Advance oops conceptsAdvance oops concepts
Advance oops concepts
 
Dead Lock in operating system
Dead Lock in operating systemDead Lock in operating system
Dead Lock in operating system
 
Semaphores
SemaphoresSemaphores
Semaphores
 
Concurrency
ConcurrencyConcurrency
Concurrency
 
Static and dynamic scoping
Static and dynamic scopingStatic and dynamic scoping
Static and dynamic scoping
 
Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)Chapter2 Encapsulation (Java)
Chapter2 Encapsulation (Java)
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
File System in Operating System
File System in Operating SystemFile System in Operating System
File System in Operating System
 
Linux process management
Linux process managementLinux process management
Linux process management
 
Processes and threads
Processes and threadsProcesses and threads
Processes and threads
 

En vedette

Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communicationSushil Singh
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsAya Mahmoud
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess CommunicationDeepak H L
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed SystemsRupsee
 

En vedette (7)

Interprocess communication
Interprocess communicationInterprocess communication
Interprocess communication
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 
Inter-Process Communication in distributed systems
Inter-Process Communication in distributed systemsInter-Process Communication in distributed systems
Inter-Process Communication in distributed systems
 
Internet Protocols
Internet ProtocolsInternet Protocols
Internet Protocols
 
Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 
Distributed System
Distributed System Distributed System
Distributed System
 
Distributed Systems
Distributed SystemsDistributed Systems
Distributed Systems
 

Similaire à Unit 3

Unit 8
Unit 8Unit 8
Unit 8siddr
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelDivye Kapoor
 
File Management in C
File Management in CFile Management in C
File Management in CPaurav Shah
 
Programming in C
Programming in CProgramming in C
Programming in Csujathavvv
 
Chapter 3
Chapter 3Chapter 3
Chapter 3lopjuan
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSEelliando dias
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4Prerna Sharma
 
file handling1
file handling1file handling1
file handling1student
 
Data File Handiling File POINTERS IN C++
Data File Handiling File POINTERS IN C++Data File Handiling File POINTERS IN C++
Data File Handiling File POINTERS IN C++subham sahu
 
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdfAdvance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdfsangeeta borde
 
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdf
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdfEASY UNDERSTANDING OF FILES IN C LANGUAGE.pdf
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdfsudhakargeruganti
 
Introduction to Kernel Programming
Introduction to Kernel ProgrammingIntroduction to Kernel Programming
Introduction to Kernel ProgrammingAhmed Mekkawy
 

Similaire à Unit 3 (20)

Unix-module3.pptx
Unix-module3.pptxUnix-module3.pptx
Unix-module3.pptx
 
Unit 8
Unit 8Unit 8
Unit 8
 
Linux
LinuxLinux
Linux
 
Sysprog 16
Sysprog 16Sysprog 16
Sysprog 16
 
Unit5 C
Unit5 C Unit5 C
Unit5 C
 
The TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux KernelThe TCP/IP Stack in the Linux Kernel
The TCP/IP Stack in the Linux Kernel
 
File Management in C
File Management in CFile Management in C
File Management in C
 
File management
File managementFile management
File management
 
Programming in C
Programming in CProgramming in C
Programming in C
 
Programming in C
Programming in CProgramming in C
Programming in C
 
C Programming Project
C Programming ProjectC Programming Project
C Programming Project
 
Chapter 3
Chapter 3Chapter 3
Chapter 3
 
Building File Systems with FUSE
Building File Systems with FUSEBuilding File Systems with FUSE
Building File Systems with FUSE
 
Linux filesystemhierarchy
Linux filesystemhierarchyLinux filesystemhierarchy
Linux filesystemhierarchy
 
Programming in C Session 4
Programming in C Session 4Programming in C Session 4
Programming in C Session 4
 
file handling1
file handling1file handling1
file handling1
 
Data File Handiling File POINTERS IN C++
Data File Handiling File POINTERS IN C++Data File Handiling File POINTERS IN C++
Data File Handiling File POINTERS IN C++
 
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdfAdvance C Programming UNIT 4-FILE HANDLING IN C.pdf
Advance C Programming UNIT 4-FILE HANDLING IN C.pdf
 
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdf
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdfEASY UNDERSTANDING OF FILES IN C LANGUAGE.pdf
EASY UNDERSTANDING OF FILES IN C LANGUAGE.pdf
 
Introduction to Kernel Programming
Introduction to Kernel ProgrammingIntroduction to Kernel Programming
Introduction to Kernel Programming
 

Plus de siddr

Unit 7
Unit 7Unit 7
Unit 7siddr
 
Unit 6
Unit 6Unit 6
Unit 6siddr
 
Unit 5
Unit 5Unit 5
Unit 5siddr
 
Unit 4
Unit 4Unit 4
Unit 4siddr
 
Unit 2
Unit 2Unit 2
Unit 2siddr
 
Unit 1
Unit 1Unit 1
Unit 1siddr
 

Plus de siddr (6)

Unit 7
Unit 7Unit 7
Unit 7
 
Unit 6
Unit 6Unit 6
Unit 6
 
Unit 5
Unit 5Unit 5
Unit 5
 
Unit 4
Unit 4Unit 4
Unit 4
 
Unit 2
Unit 2Unit 2
Unit 2
 
Unit 1
Unit 1Unit 1
Unit 1
 

Unit 3

  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.