file truncation on open with O_WRONLY

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello All !

   I was reading Linux Device Drivers , by 
A.Rubini and found the below lines on page 71
near the end . 

     " The only real operation performed on the 
device is truncating it to a length of zero when 
the device is opened for writing. This is 
performed because, by design, overwriting a pscull 
device with a shorter file results in a shorter 
device data area. This is similar to the way 
opening a regular file for writing truncates it to 
zero length. The operation does nothing if the 
device is opened for reading. "

  As said above in the last lines , I tried 
the open system call on a regular file ,with 
O_WRONLY option , without doing any further 
operations . I was expecting the regular file to 
truncate to zero after the open call as said above,
but I  found that the regular file is
intact .
 
  Can anybody please explain ? 
Or maybe I have not understood the above lines
properly .

   Thanks in advance .

Regards !
     


________________________________________________________________________
Missed your favourite TV serial last night? Try the new, Yahoo! TV.
       visit http://in.tv.yahoo.com
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux