Anip Patel
Anip Patel

Reputation: 65

Sending Ctrl+C to strace causing target process's write system call to fail with "interrupted system call"

I am doing strace using time strace -p 54545 -fy 2>&1 | grep "xyz". I am looking for all the system calls happening to file xyz.

I killed strace by continuously pressing Ctrl-C. I saw a write system call fail with errno 4 in process 54545.

I am not sending any signal to process 54545. Can strace cause this?

Upvotes: 4

Views: 471

Answers (1)

Sam Hartman
Sam Hartman

Reputation: 6509

In order to detach your process, the kernel is apparently waiting for a point at which it can get to a valid place in the process's in-kernel state to execute the detach. Write is one of the system calls that the kernel can choose to interrupt if it likes. That is, Unix processes are supposed to handle an EINTR from the write system call by retrying it. So, in order to get to a point in kernel execution where it can process the detach request, the kernel chooses to do this

Upvotes: 1

Related Questions