@node The Ctrl-C message
@subsection The Ctrl-C message
@cindex ctrl-c message, in file-i/o protocol
A special case is, if the @var{Ctrl-C flag} is set in the @value{GDBN}
reply packet. In this case the target should behave, as if it had
gotten a break message. The meaning for the target is ``system call
interupted by @code{SIGINT}''. Consequentially, the target should actually stop
(as with a break message) and return to @value{GDBN} with a @code{T02}
packet. In this case, it's important for the target to know, in which
state the system call was interrupted. Since this action is by design
not an atomic operation, we have to differ between two cases:
@itemize @bullet
@item
The system call hasn't been performed on the host yet.
@item
The system call on the host has been finished.
@end itemize
These two states can be distinguished by the target by the value of the
returned @code{errno}. If it's the protocol representation of @code{EINTR}, the
system
call hasn't been performed. This is equivalent to the @code{EINTR} handling
on POSIX systems. In any other case, the target may presume that the
system call has been finished --- successful or not --- and should behave
as if the break message arrived right after the system call.
@value{GDBN} must behave reliable. If the system call has not been called
yet, @value{GDBN} may send the @code{F} reply immediately, setting @code{EINTR}
as
@code{errno} in the packet. If the system call on the host has been finished
before the user requests a break, the full action must be finshed by
@value{GDBN}. This requires sending @code{M} or @code{X} packets as they fit.
The @code{F} packet may only be send when either nothing has happened
or the full action has been completed.