Discussion
The link system call in UNIX is called link (sfname tfname) :
Which of the following statements are true ?
(1) sfname and tfname have the same inode after the call.
(2) sfname and tfname have the same directory entry after the call.
(3) sfname is an existing file before the call.
(4) tfname is an existing file before the call.
Answer: A
The true statements are (1) and (3).
link(sfname, tfname) creates a new directory entry, tfname, pointing to the same inode as the existing file sfname, and increments the inode's link count. So after the call both names refer to the same inode (1), and sfname must already exist before the call (3).
Statement (2) is false: the call creates a second, separate directory entry, so the two names have different directory entries that share one inode. Statement (4) is false too: if tfname already exists the call fails, so any option containing (2) or (4) is wrong.
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development