Paste: Ignoring EINTR in Clay
Author: | kssreeram |
Mode: | text |
Date: | Fri, 21 Jan 2011 08:14:06 |
Plain Text |
//
// shadow system calls to handle EINTR
//
callIgnoringEINTR(f, ...args) {
alias ResultType = Type(f(...args));
var result = ResultType();
while (true) {
result = f(...args);
if (result != -1) break;
if (errno() != EINTR) break;
}
return result;
}
open(...args) = callIgnoringEINTR(generated.open, ...args);
read(...args) = callIgnoringEINTR(generated.read, ...args);
write(...args) = callIgnoringEINTR(generated.write, ...args);
close(...args) = callIgnoringEINTR(generated.close, ...args);
connect(...args) = callIgnoringEINTR(generated.connect, ...args);
accept(...args) = callIgnoringEINTR(generated.accept, ...args);
send(...args) = callIgnoringEINTR(generated.send, ...args);
sendto(...args) = callIgnoringEINTR(generated.sendto, ...args);
sendmsg(...args) = callIgnoringEINTR(generated.sendmsg, ...args);
recv(...args) = callIgnoringEINTR(generated.recv, ...args);
recvfrom(...args) = callIgnoringEINTR(generated.recvfrom, ...args);
recvmsg(...args) = callIgnoringEINTR(generated.recvmsg, ...args);
select(...args) = callIgnoringEINTR(generated.select, ...args);
New Annotation