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

Unified Diff: base/mac/close_nocancel.cc

Issue 1036123003: Add #include of <unistd.h> to close_nocancel.cc. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reword comments Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/mac/close_nocancel.cc
diff --git a/base/mac/close_nocancel.cc b/base/mac/close_nocancel.cc
index 134f7ac25cc0525d1ce62756451b2c18b084d05a..8971e731c98d43f243ce1d376c32d1c0f7369e54 100644
--- a/base/mac/close_nocancel.cc
+++ b/base/mac/close_nocancel.cc
@@ -28,12 +28,14 @@
//
// This file operates by providing a close function with the non-$NOCANCEL
// symbol name expected for the compilation environment as set by <unistd.h>
-// and <sys/cdefs.h> (the DARWIN_ALIAS_C macro). That function calls the
-// $NOCANCEL variant, which is resolved from libsyscall. By linking with this
-// version of close prior to the libsyscall version, close's implementation is
-// overridden.
+// and <sys/cdefs.h> (the DARWIN_ALIAS_C macro). That name is set by an asm
+// label on the declaration of the close function, so the definition of that
+// function receives that name. The function calls the $NOCANCEL variant, which
+// is resolved from libsyscall. By linking with this version of close prior to
+// the libsyscall version, close's implementation is overridden.
#include <sys/cdefs.h>
+#include <unistd.h>
// If the non-cancelable variants of all system calls have already been
// chosen, do nothing.
@@ -41,37 +43,26 @@
extern "C" {
-#if __DARWIN_UNIX03 && !__DARWIN_ONLY_UNIX_CONFORMANCE
+#if !__DARWIN_ONLY_UNIX_CONFORMANCE
-// When there's a choice between UNIX2003 and pre-UNIX2003 and UNIX2003 has
-// been chosen:
-#define close_interface close$UNIX2003
-#define close_implementation close$NOCANCEL$UNIX2003
-
-#elif !__DARWIN_UNIX03 && !__DARWIN_ONLY_UNIX_CONFORMANCE
-
-// When there's a choice between UNIX2003 and pre-UNIX2003 and pre-UNIX2003
-// has been chosen. There's no close$NOCANCEL symbol in this case, so use
-// close$NOCANCEL$UNIX2003 as the implementation. It does the same thing
-// that close$NOCANCEL would do.
-#define close_interface close
+// When there's a choice between UNIX2003 and pre-UNIX2003. There's no
+// close$NOCANCEL symbol in this case, so use close$NOCANCEL$UNIX2003 as the
+// implementation. It does the same thing that close$NOCANCEL would do.
#define close_implementation close$NOCANCEL$UNIX2003
#else // __DARWIN_ONLY_UNIX_CONFORMANCE
// When only UNIX2003 is supported:
-#define close_interface close
#define close_implementation close$NOCANCEL
#endif
int close_implementation(int fd);
-int close_interface(int fd) {
+int close(int fd) {
return close_implementation(fd);
}
-#undef close_interface
#undef close_implementation
} // extern "C"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698