Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Issue 100225: POSIX: Add a macro for handling EINTR. (Closed)

Created:
11 years, 7 months ago by agl
Modified:
9 years, 7 months ago
Reviewers:
Mark Mentovai, tony
CC:
chromium-reviews_googlegroups.com
Visibility:
Public.

Description

POSIX: Add a macro for handling EINTR. Previously, our handling of EINTR was a little sloppy. If I happened to review a bit of code, I probably made sure that EINTR was handled in a do loop. Otherwise, it would just be ignored. This patch adds "base/eintr_wrappers.h" which, currenly, defines a single macro: HANDLE_EINTR. This macro can be wrapped around any system call and will restart the call if it returns -1 and errno == EINTR.

Patch Set 1 #

Patch Set 2 : ... #

Patch Set 3 : ... #

Patch Set 4 : ... #

Total comments: 7

Patch Set 5 : ... #

Unified diffs Side-by-side diffs Delta from patch set Stats (+221 lines, -212 lines) Patch
M base/debug_util_posix.cc View 2 chunks +3 lines, -2 lines 0 comments Download
M base/directory_watcher_inotify.cc View 1 5 chunks +9 lines, -15 lines 0 comments Download
A base/eintr_wrappers.h View 1 2 3 4 1 chunk +33 lines, -0 lines 0 comments Download
M base/file_descriptor_shuffle.cc View 2 chunks +4 lines, -16 lines 0 comments Download
M base/file_util_linux.cc View 4 chunks +6 lines, -5 lines 0 comments Download
M base/file_util_posix.cc View 4 chunks +12 lines, -11 lines 0 comments Download
M base/message_pump_glib.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M base/message_pump_libevent.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M base/process_util_linux.cc View 2 chunks +2 lines, -1 line 0 comments Download
M base/process_util_mac.mm View 2 chunks +2 lines, -1 line 0 comments Download
M base/process_util_posix.cc View 1 10 chunks +15 lines, -25 lines 0 comments Download
M base/process_util_unittest.cc View 5 chunks +12 lines, -10 lines 0 comments Download
M chrome/browser/debugger/devtools_remote_listen_socket.cc View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/debugger/devtools_remote_listen_socket_unittest.cc View 1 6 chunks +8 lines, -13 lines 0 comments Download
M chrome/browser/process_singleton_linux.cc View 2 chunks +3 lines, -1 line 0 comments Download
M chrome/browser/renderer_host/render_widget_helper.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/common/file_descriptor_set_posix.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/common/file_descriptor_set_unittest.cc View 3 chunks +4 lines, -3 lines 0 comments Download
M chrome/common/ipc_channel_posix.cc View 1 15 chunks +51 lines, -58 lines 0 comments Download
M chrome/common/ipc_send_fds_test.cc View 3 chunks +3 lines, -2 lines 0 comments Download
M chrome/common/process_watcher_posix.cc View 1 2 chunks +3 lines, -5 lines 0 comments Download
M chrome/common/transport_dib_mac.cc View 2 chunks +3 lines, -1 line 0 comments Download
M net/base/file_stream_posix.cc View 2 chunks +9 lines, -18 lines 0 comments Download
M net/base/listen_socket.cc View 4 chunks +5 lines, -3 lines 0 comments Download
M net/base/listen_socket_unittest.cc View 5 chunks +7 lines, -5 lines 0 comments Download
M net/base/tcp_client_socket_libevent.cc View 2 3 8 chunks +11 lines, -7 lines 0 comments Download
M net/base/telnet_server.cc View 2 chunks +2 lines, -1 line 0 comments Download

Messages

Total messages: 4 (0 generated)
agl
11 years, 7 months ago (2009-04-30 22:19:08 UTC) #1
tony
LGTM, just a small nit. http://codereview.chromium.org/100225/diff/31/34 File base/eintr_wrappers.h (right): http://codereview.chromium.org/100225/diff/31/34#newcode1 Line 1: #ifndef BASE_EINTR_WRAPPERS_H_ Nit: ...
11 years, 7 months ago (2009-04-30 22:25:30 UTC) #2
Mark Mentovai
http://codereview.chromium.org/100225/diff/31/34 File base/eintr_wrappers.h (right): http://codereview.chromium.org/100225/diff/31/34#newcode1 Line 1: #ifndef BASE_EINTR_WRAPPERS_H_ Needs a boilerplate. http://codereview.chromium.org/100225/diff/31/34#newcode2 Line 2: ...
11 years, 7 months ago (2009-04-30 22:27:20 UTC) #3
agl
11 years, 7 months ago (2009-04-30 22:39:01 UTC) #4
http://codereview.chromium.org/100225/diff/31/34
File base/eintr_wrappers.h (right):

http://codereview.chromium.org/100225/diff/31/34#newcode2
Line 2: #define BASE_EINTR_WRAPPERS_H_
On 2009/04/30 22:27:20, Mark Mentovai wrote:
> Are you gonna add more macros or something here?  wrappers (plural) seems
weird
> with just this one wrapper.

I suspected that there would be more, but it seems we're doing ok with just the
one. If it gets past the try bots and everything looks good then I'll probably
rename it to remove the s.

http://codereview.chromium.org/100225/diff/31/34#newcode14
Line 14: } while (x == -1 && errno == EINTR); \
On 2009/04/30 22:27:20, Mark Mentovai wrote:
> Don't you mean ret and not x?

Good point! Thanks!

Powered by Google App Engine
This is Rietveld 408576698