[m-rev.] for post-commit review: retry interrupted system calls
Peter Wang
novalazy at gmail.com
Tue Oct 30 11:49:30 AEDT 2007
This would be more likely in multithreaded programs where a system call
in one thread can be interrupted by another thread initiating GC.
Estimated hours taken: 1.5
Branches: main
Retry interrupted system calls which return an error code and set `errno' to
EINTR.
compiler/prog_event.m:
library/io.m:
runtime/mercury_context.c:
runtime/mercury_memory_handlers.c:
runtime/mercury_trace_base.c:
runtime/mercury_wrapper.c:
As above.
extras/posix/posix.dup.m:
extras/posix/posix.exec.m:
extras/posix/posix.lseek.m:
extras/posix/posix.open.m:
extras/posix/posix.readdir.m:
extras/posix/posix.select.m:
extras/posix/posix.socket.m:
extras/posix/posix.stat.m:
extras/posix/posix.wait.m:
extras/posix/posix.write.m:
As above.
Use `pragma foreign_enum' in some places.
extras/posix/posix.read.m:
Use `pragma foreign_proc' instead of `pragma c_code' in a spot.
Index: compiler/prog_event.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/compiler/prog_event.m,v
retrieving revision 1.13
diff -u -r1.13 prog_event.m
--- compiler/prog_event.m 7 Sep 2007 15:08:18 -0000 1.13
+++ compiler/prog_event.m 29 Oct 2007 13:08:10 -0000
@@ -237,7 +237,10 @@
size_t num_bytes_read;
MR_String problem;
- num_bytes_read = read(spec_fd, spec_buf, size);
+ /* XXX we don't handle successful but partial reads */
+ do {
+ num_bytes_read = read(spec_fd, spec_buf, size);
+ } while (num_bytes_read == -1 && MR_is_eintr(errno));
if (num_bytes_read != size) {
problem = MR_make_string(proc_label, ""could not read in %s"",
specs_file_name);
Index: extras/posix/posix.dup.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.dup.m,v
retrieving revision 1.3
diff -u -r1.3 posix.dup.m
--- extras/posix/posix.dup.m 23 Apr 2007 04:32:38 -0000 1.3
+++ extras/posix/posix.dup.m 29 Oct 2007 23:23:18 -0000
@@ -45,7 +45,9 @@
dup0(OldFd::in, NewFd::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
- NewFd = dup(OldFd);
+ do {
+ NewFd = dup(OldFd);
+ } while (NewFd == -1 && MR_is_eintr(errno));
IO = IO0;
").
@@ -66,7 +68,9 @@
dup2_2(OldFd::in, NewFd::in, Ret::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
- Ret = dup2(OldFd, NewFd);
+ do {
+ Ret = dup2(OldFd, NewFd);
+ } while (Ret == -1 && MR_is_eintr(errno));
IO = IO0;
").
Index: extras/posix/posix.exec.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.exec.m,v
retrieving revision 1.3
diff -u -r1.3 posix.exec.m
--- extras/posix/posix.exec.m 23 Apr 2007 09:08:14 -0000 1.3
+++ extras/posix/posix.exec.m 29 Oct 2007 23:24:04 -0000
@@ -67,9 +67,13 @@
exec0(Command::in, Args::array_ui, Env::array_ui, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, tabled_for_io],
"
- execve(Command,
- ((MR_ArrayType *)Args)->elements,
- ((MR_ArrayType *)Env)->elements);
+ int ret;
+
+ do {
+ ret = execve(Command,
+ ((MR_ArrayType *)Args)->elements,
+ ((MR_ArrayType *)Env)->elements);
+ } while (ret == -1 && MR_is_eintr(errno));
IO = IO0;
").
Index: extras/posix/posix.lseek.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.lseek.m,v
retrieving revision 1.4
diff -u -r1.4 posix.lseek.m
--- extras/posix/posix.lseek.m 23 Apr 2007 09:08:14 -0000 1.4
+++ extras/posix/posix.lseek.m 30 Oct 2007 00:13:39 -0000
@@ -37,7 +37,7 @@
%-----------------------------------------------------------------------------%
lseek(Fd, Offset, Whence, Result, !IO) :-
- lseek0(Fd, Offset, whence(Whence), Res, !IO),
+ lseek0(Fd, Offset, Whence, Res, !IO),
( Res < 0 ->
errno(Err, !IO),
Result = error(Err)
@@ -45,7 +45,8 @@
Result = ok(Res)
).
-:- pred lseek0(fd::in, int::in, int::in, int::out, io::di, io::uo) is det.
+:- pred lseek0(fd::in, int::in, lseek.whence::in, int::out, io::di, io::uo)
+ is det.
:- pragma foreign_proc("C",
lseek0(Fd::in, Offset::in, Whence::in, Res::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
@@ -54,15 +55,11 @@
IO = IO0;
").
-:- pragma no_inline(whence/1).
-:- func whence(lseek.whence) = int.
-:- pragma foreign_proc("C",
- whence(W::in) = (V::out),
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- static const int whence_flags[] = { SEEK_SET, SEEK_CUR, SEEK_END } ;
- V = whence_flags[W];
-").
+:- pragma foreign_enum("C", lseek.whence/0, [
+ set - "SEEK_SET",
+ cur - "SEEK_CUR",
+ end - "SEEK_END"
+]).
%-----------------------------------------------------------------------------%
:- end_module posix.lseek.
Index: extras/posix/posix.open.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.open.m,v
retrieving revision 1.4
diff -u -r1.4 posix.open.m
--- extras/posix/posix.open.m 23 Apr 2007 09:08:14 -0000 1.4
+++ extras/posix/posix.open.m 30 Oct 2007 00:14:43 -0000
@@ -132,7 +132,9 @@
close0(Fd::in, Res::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
- Res = close(Fd);
+ do {
+ Res = close(Fd);
+ } while (Res == -1 && MR_is_eintr(errno));
IO = IO0;
").
@@ -150,20 +152,28 @@
!:Or = !.Or \/ oflagval(F),
orflags(Fs, !Or).
-:- pragma no_inline(oflagval/1).
:- func oflagval(oflag) = int.
-:- pragma foreign_proc("C",
- oflagval(F::in) = (V::out),
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- static const int oflag_values[] = {
- O_RDONLY, O_WRONLY, O_RDWR, O_CREAT, O_EXCL, O_NOCTTY,
- O_TRUNC, O_APPEND, O_NDELAY, O_SYNC
- };
- V = oflag_values[F];
+:- pragma foreign_proc("C",
+ oflagval(F::in) = (I::out),
+ [will_not_call_mercury, promise_pure, thread_safe],
+"
+ I = F;
").
+:- pragma foreign_enum("C", oflag/0, [
+ rdonly - "O_RDONLY",
+ wronly - "O_WRONLY",
+ rdwr - "O_RDWR",
+ creat - "O_CREAT",
+ excl - "O_EXCL",
+ noctty - "O_NOCTTY",
+ trunc - "O_TRUNC",
+ append - "O_APPEND",
+ ndelay - "O_NDELAY",
+ sync - "O_SYNC"
+]).
+
%-----------------------------------------------------------------------------%
:- end_module posix.open.
%-----------------------------------------------------------------------------%
Index: extras/posix/posix.read.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.read.m,v
retrieving revision 1.3
diff -u -r1.3 posix.read.m
--- extras/posix/posix.read.m 23 Apr 2007 09:08:15 -0000 1.3
+++ extras/posix/posix.read.m 30 Oct 2007 00:19:32 -0000
@@ -52,7 +52,9 @@
txtptr = (ME_Text *) Text0;
- Read = read(Fd, txtptr->data, ToRead);
+ do {
+ Read = read(Fd, txtptr->data, ToRead);
+ } while (Read == -1 && MR_is_eintr(errno));
Text = Text0;
IO = IO0;
Index: extras/posix/posix.readdir.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.readdir.m,v
retrieving revision 1.1
diff -u -r1.1 posix.readdir.m
--- extras/posix/posix.readdir.m 16 Jul 2001 03:08:19 -0000 1.1
+++ extras/posix/posix.readdir.m 30 Oct 2007 00:01:32 -0000
@@ -35,12 +35,13 @@
{ Result = error(Err) }
).
-:- pred readdir0(dir, string, int, io__state, io__state).
-:- mode readdir0(in, out, out, di, uo) is det.
+:- pred readdir0(dir::in, string::out, int::out, io::di, io::uo) is det.
-:- pragma c_code(readdir0(Dir::in, Entry::out, Result::out, IO0::di, IO::uo),
- [will_not_call_mercury, thread_safe], "
- struct dirent *ent = readdir((DIR *)Dir);
+:- pragma foreign_proc("C",
+ readdir0(Dir::in, Entry::out, Result::out, IO0::di, IO::uo),
+ [will_not_call_mercury, promise_pure, thread_safe, tabled_for_io],
+"
+ struct dirent *ent = readdir(Dir);
if (ent != NULL) {
MR_make_aligned_string_copy(Entry, ent->d_name);
Result = 0;
Index: extras/posix/posix.select.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.select.m,v
retrieving revision 1.5
diff -u -r1.5 posix.select.m
--- extras/posix/posix.select.m 23 Apr 2007 09:08:15 -0000 1.5
+++ extras/posix/posix.select.m 30 Oct 2007 00:02:35 -0000
@@ -70,9 +70,11 @@
"
struct timeval tv;
- tv.tv_sec = TS;
- tv.tv_usec = TM;
- Res = select(N, R, W, E, &tv);
+ do {
+ tv.tv_sec = TS;
+ tv.tv_usec = TM;
+ Res = select(N, R, W, E, &tv);
+ } while (Res == -1 && MR_is_eintr(errno));
IO = IO0;
").
Index: extras/posix/posix.socket.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.socket.m,v
retrieving revision 1.7
diff -u -r1.7 posix.socket.m
--- extras/posix/posix.socket.m 23 Apr 2007 09:21:00 -0000 1.7
+++ extras/posix/posix.socket.m 30 Oct 2007 00:16:40 -0000
@@ -75,7 +75,7 @@
%-----------------------------------------------------------------------------%
socket(Dom, Typ, protocol(Prot), Result, !IO) :-
- socket0(domain(Dom), socket_type(Typ), Prot, FdNo, !IO),
+ socket0(Dom, Typ, Prot, FdNo, !IO),
( FdNo < 0 ->
errno(Err, !IO),
Result = error(Err)
@@ -83,7 +83,8 @@
Result = ok(fd(FdNo))
).
-:- pred socket0(int::in, int::in, int::in, int::out, io::di, io::uo) is det.
+:- pred socket0(domain::in, socket_type::in, int::in, int::out, io::di, io::uo)
+ is det.
:- pragma foreign_proc("C",
socket0(Dom::in, Typ::in, Prot::in, Fd::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
@@ -92,36 +93,18 @@
IO = IO0;
").
-:- pragma no_inline(domain/1).
-:- func domain(domain) = int.
-:- pragma foreign_proc("C",
- domain(D::in) = (V::out),
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- static const int domain_values[] = {
- AF_UNIX,
- AF_INET
- };
-
- V = domain_values[D];
-").
-
-:- pragma no_inline(socket_type/1).
-:- func socket_type(socket_type) = int.
-:- pragma foreign_proc("C",
- socket_type(T::in) = (V::out),
- [promise_pure, will_not_call_mercury, thread_safe],
-"
- static const int type_values[] = {
- SOCK_STREAM,
- SOCK_DGRAM,
- SOCK_RAW,
- SOCK_SEQPACKET,
- SOCK_RDM
- };
-
- V = type_values[T];
-").
+:- pragma foreign_enum("C", domain/0, [
+ unix - "AF_UNIX",
+ inet - "AF_INET"
+]).
+
+:- pragma foreign_enum("C", socket_type/0, [
+ stream - "SOCK_STREAM",
+ dgram - "SOCK_DGRAM",
+ raw - "SOCK_RAW",
+ seqpacket - "SOCK_SEQPACKET",
+ rdm - "SOCK_RDM"
+]).
%-----------------------------------------------------------------------------%
@@ -194,7 +177,9 @@
connect0(Fd::in, Addr::in, Len::in, Res::out, IO0::di, IO::uo),
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
- Res = connect(Fd, Addr, Len);
+ do {
+ Res = connect(Fd, Addr, Len);
+ } while (Res == -1 && MR_is_eintr(errno));
IO = IO0;
").
@@ -245,7 +230,9 @@
MR_incr_hp(Ptr0, (1 + sizeof(struct sockaddr_in)/sizeof(MR_Word)));
Ptr = (struct sockaddr *) Ptr0;
ptr = (struct sockaddr_in *) Ptr;
- NewFd = accept(Fd, ptr, &len);
+ do {
+ NewFd = accept(Fd, ptr, &len);
+ } while (NewFd == -1 && MR_is_eintr(errno));
IO = IO0;
").
@@ -265,6 +252,8 @@
} else {
MR_fatal_error(""cons_sockaddr: unknown type"");
}
+
+ Sok = ptr;
").
%-----------------------------------------------------------------------------%
Index: extras/posix/posix.stat.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.stat.m,v
retrieving revision 1.4
diff -u -r1.4 posix.stat.m
--- extras/posix/posix.stat.m 23 Apr 2007 09:08:15 -0000 1.4
+++ extras/posix/posix.stat.m 30 Oct 2007 00:06:56 -0000
@@ -85,7 +85,9 @@
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
Stat = MR_GC_NEW(struct stat);
- Res = stat(Path, Stat);
+ do {
+ Res = stat(Path, Stat);
+ } while (Res == -1 && MR_is_eintr(errno));
IO = IO0;
").
Index: extras/posix/posix.wait.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.wait.m,v
retrieving revision 1.4
diff -u -r1.4 posix.wait.m
--- extras/posix/posix.wait.m 23 Apr 2007 09:08:15 -0000 1.4
+++ extras/posix/posix.wait.m 30 Oct 2007 00:07:34 -0000
@@ -64,7 +64,9 @@
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
int status;
- Pid = wait(&status);
+ do {
+ Pid = wait(&status);
+ } while (Pid == -1 && MR_is_eintr(errno));
Status = status;
IO = IO0;
").
@@ -102,7 +104,9 @@
[promise_pure, will_not_call_mercury, thread_safe, tabled_for_io],
"
int status;
- Pid = waitpid(Pid0, &status, 0);
+ do {
+ Pid = waitpid(Pid0, &status, 0);
+ } while (Pid == -1 && MR_is_eintr(errno));
Status = status;
IO = IO0;
").
Index: extras/posix/posix.write.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/extras/posix/posix.write.m,v
retrieving revision 1.3
diff -u -r1.3 posix.write.m
--- extras/posix/posix.write.m 23 Apr 2007 09:08:15 -0000 1.3
+++ extras/posix/posix.write.m 30 Oct 2007 00:20:10 -0000
@@ -51,7 +51,9 @@
ME_Text *txtptr;
txtptr = (ME_Text *) Text;
- Res = write(Fd, txtptr->data, ToWrite);
+ do {
+ Res = write(Fd, txtptr->data, ToWrite);
+ } while (Res == -1 && MR_is_eintr(errno));
IO = IO0;
").
Index: library/io.m
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/library/io.m,v
retrieving revision 1.404
diff -u -r1.404 io.m
--- library/io.m 1 Oct 2007 05:40:42 -0000 1.404
+++ library/io.m 29 Oct 2007 10:50:56 -0000
@@ -9344,7 +9344,9 @@
""error invoking system command: "", MR_PROC_LABEL, MR_TRUE, Msg);
} else {
/* Wait for the spawned process to exit. */
- err = waitpid(pid, &st, 0);
+ do {
+ err = waitpid(pid, &st, 0);
+ } while (err == -1 && MR_is_eintr(errno));
if (err == -1) {
Status = 127;
ML_maybe_make_err_msg(MR_TRUE, errno,
@@ -9886,7 +9888,9 @@
strncat(FileName, countstr, 3);
strcat(FileName, ""."");
strncat(FileName, countstr + 3, 3);
- fd = open(FileName, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ do {
+ fd = open(FileName, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ } while (fd == -1 && MR_is_eintr(errno));
num_tries++;
ML_io_tempnam_counter += (1 << num_tries);
} while (fd == -1 && errno == EEXIST &&
@@ -9897,7 +9901,9 @@
ErrorMessage);
Error = -1;
} else {
- err = close(fd);
+ do {
+ err = close(fd);
+ } while (err == -1 && MR_is_eintr(errno));
ML_maybe_make_err_msg(err, errno,
""error closing temporary file: "", MR_PROC_LABEL, MR_TRUE,
ErrorMessage);
Index: runtime/mercury_context.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_context.c,v
retrieving revision 1.58
diff -u -r1.58 mercury_context.c
--- runtime/mercury_context.c 11 Oct 2007 11:45:21 -0000 1.58
+++ runtime/mercury_context.c 30 Oct 2007 00:31:22 -0000
@@ -400,6 +400,9 @@
int err;
int max_id;
int n_ids;
+ fd_set rd_set0;
+ fd_set wr_set0;
+ fd_set ex_set0;
fd_set rd_set;
fd_set wr_set;
fd_set ex_set;
@@ -410,26 +413,28 @@
return 0;
}
- MR_fd_zero(&rd_set); MR_fd_zero(&wr_set); MR_fd_zero(&ex_set);
+ MR_fd_zero(&rd_set0);
+ MR_fd_zero(&wr_set0);
+ MR_fd_zero(&ex_set0);
max_id = -1;
for (pctxt = MR_pending_contexts ; pctxt ; pctxt = pctxt -> next) {
if (pctxt->waiting_mode & MR_PENDING_READ) {
if (max_id > pctxt->fd) {
max_id = pctxt->fd;
}
- FD_SET(pctxt->fd, &rd_set);
+ FD_SET(pctxt->fd, &rd_set0);
}
if (pctxt->waiting_mode & MR_PENDING_WRITE) {
if (max_id > pctxt->fd) {
max_id = pctxt->fd;
}
- FD_SET(pctxt->fd, &wr_set);
+ FD_SET(pctxt->fd, &wr_set0);
}
if (pctxt->waiting_mode & MR_PENDING_EXEC) {
if (max_id > pctxt->fd) {
max_id = pctxt->fd;
}
- FD_SET(pctxt->fd, &ex_set);
+ FD_SET(pctxt->fd, &ex_set0);
}
}
max_id++;
@@ -439,11 +444,21 @@
}
if (block) {
- err = select(max_id, &rd_set, &wr_set, &ex_set, NULL);
+ do {
+ rd_set = rd_set0;
+ wr_set = wr_set0;
+ ex_set = ex_set0;
+ err = select(max_id, &rd_set, &wr_set, &ex_set, NULL);
+ } while (err == -1 && MR_is_eintr(errno));
} else {
- timeout.tv_sec = 0;
- timeout.tv_usec = 0;
- err = select(max_id, &rd_set, &wr_set, &ex_set, &timeout);
+ do {
+ rd_set = rd_set0;
+ wr_set = wr_set0;
+ ex_set = ex_set0;
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 0;
+ err = select(max_id, &rd_set, &wr_set, &ex_set, &timeout);
+ } while (err == -1 && MR_is_eintr(errno));
}
if (err < 0) {
Index: runtime/mercury_memory_handlers.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_memory_handlers.c,v
retrieving revision 1.31
diff -u -r1.31 mercury_memory_handlers.c
--- runtime/mercury_memory_handlers.c 18 Mar 2006 15:57:58 -0000 1.31
+++ runtime/mercury_memory_handlers.c 30 Oct 2007 00:32:15 -0000
@@ -183,10 +183,15 @@
MR_fatal_abort(void *context, const char *main_msg, int dump)
{
char *context_msg;
+ int ret;
context_msg = MR_explain_context(context);
- write(STDERR, main_msg, strlen(main_msg));
- write(STDERR, context_msg, strlen(context_msg));
+ do {
+ ret = write(STDERR, main_msg, strlen(main_msg));
+ } while (ret == -1 && MR_is_eintr(errno));
+ do {
+ ret = write(STDERR, context_msg, strlen(context_msg));
+ } while (ret == -1 && MR_is_eintr(errno));
MR_trace_report_raw(STDERR);
if (dump) {
@@ -1004,5 +1009,9 @@
{
const char *msg =
"This may have been caused by a stack overflow, due to unbounded recursion.\n";
- write(STDERR, msg, strlen(msg));
+ int ret;
+
+ do {
+ ret = write(STDERR, msg, strlen(msg));
+ } while (ret == -1 && MR_is_eintr(errno));
}
Index: runtime/mercury_trace_base.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_trace_base.c,v
retrieving revision 1.85
diff -u -r1.85 mercury_trace_base.c
--- runtime/mercury_trace_base.c 2 Oct 2007 03:37:26 -0000 1.85
+++ runtime/mercury_trace_base.c 30 Oct 2007 00:32:44 -0000
@@ -958,6 +958,7 @@
MR_trace_report_raw(int fd)
{
char buf[80]; /* that ought to be more than long enough */
+ int ret;
if (MR_trace_event_number > 0) {
/*
@@ -966,7 +967,11 @@
*/
if (MR_trace_report_msg != NULL) {
- write(fd, MR_trace_report_msg, strlen(MR_trace_report_msg));
+ do {
+ /* XXX we don't handle successful but partial writes */
+ ret = write(fd, MR_trace_report_msg,
+ strlen(MR_trace_report_msg));
+ } while (ret == -1 && MR_is_eintr(errno));
}
if (MR_standardize_event_details) {
@@ -976,7 +981,10 @@
sprintf(buf, "Last trace event was event #%ld.\n",
(long) MR_trace_event_number);
}
- write(fd, buf, strlen(buf));
+ do {
+ /* XXX we don't handle successful but partial writes */
+ ret = write(fd, buf, strlen(buf));
+ } while (ret == -1 && MR_is_eintr(errno));
}
}
Index: runtime/mercury_wrapper.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/runtime/mercury_wrapper.c,v
retrieving revision 1.184
diff -u -r1.184 mercury_wrapper.c
--- runtime/mercury_wrapper.c 11 Oct 2007 11:45:22 -0000 1.184
+++ runtime/mercury_wrapper.c 29 Oct 2007 10:51:51 -0000
@@ -2663,7 +2663,9 @@
for (i = 1; i < MAX_MEM_USAGE_REPORT_ATTEMPTS; i++) {
sprintf(buf, ".mem_usage_report%02d", i);
- fd = open(buf, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ do {
+ fd = open(buf, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ } while (fd == -1 && MR_is_eintr(errno));
if (fd >= 0) {
fp = fdopen(fd, "w");
break;
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to: mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions: mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------
More information about the reviews
mailing list