LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   write() syscall hangs up (https://www.linuxquestions.org/questions/linux-software-2/write-syscall-hangs-up-813019/)

jim.yefeng 06-08-2010 11:40 PM

write() syscall hangs up
 
I had a problem that my write() syscall hangs up.
The write is writing data to a file descriptor which is a slave pty.

The write executed inside a loop.
After writing some times. Then it hangs up.

jim.yefeng 06-08-2010 11:42 PM

The codes looks like,
102 for(countBytes = 0; countBytes < readBytes; countBytes +=
wroteBytes)
103 {
104 wroteBytes = write(writeFd, readBuffer+countBytes, readBytes -
countBytes);
105
106 // If the other side closed, don't bother trying to finish

The writeFd is a descriptor which is associated with a slave pty.
It can runs ok several times. but then hangs up.

Could someone help me? thx anyway!


All times are GMT -5. The time now is 12:27 PM.