LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-17-2018, 05:03 AM   #1
Shivanshu
LQ Newbie
 
Registered: Aug 2018
Posts: 1

Rep: Reputation: Disabled
Post Offset returned using lseek command after write operation is wrong on unix System


Hello,

Depending on the incoming data stream, the data is written to a file using basic unix commands such as open,write and lseek. One in a hundred time the offset returned by lseek is incorrect after the data has been written into the file. Like example below the offset after write operation should have been 507160. Due to which the data at the end of the file has been lost. Are there limitations in using write and lseek functions(as this is happening at random not for all files).

Following are the prints:
dataLogging : Received Data Size = 34408
getCorrespondingFd : Currently Open FD is 6 For File Type 1
Printing data to Offset 472752
dataLogging : Write Call is successfull
CurrentOffset 502024
dataLogging : Write Call is successfull
 
Old 08-17-2018, 11:22 AM   #2
rknichols
Senior Member
 
Registered: Aug 2009
Distribution: Rocky Linux
Posts: 4,783

Rep: Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214Reputation: 2214
Assuming there is no issue with stdio buffering occurring, I suggest running that process under strace until you get a trace that captures the error.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do you know the answers for questions in Design of unix operation system book ???? neo3matrix Linux - Newbie 2 07-08-2015 09:33 AM
Serial: Write timeout for write operation in Linux bharathi.onchip Linux - Embedded & Single-board computer 1 12-13-2011 11:08 AM
How to write cron job in unix system ykumarreddy Linux - Software 2 06-26-2009 10:29 AM
Returned mail: Can't create output: Operation not permitted turbo_acura Linux - General 0 10-19-2004 06:56 AM
How to Write Own Shell in Unix using System Calls? indian Programming 2 08-05-2004 04:06 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 06:13 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration