Index: base/mac/close_nocancel.cc |
diff --git a/base/mac/close_nocancel.cc b/base/mac/close_nocancel.cc |
index 134f7ac25cc0525d1ce62756451b2c18b084d05a..cd1e225af74e7b662a792abb76cfe410bb80f583 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 we receive that name |
Mark Mentovai
2015/03/27 12:12:50
Reword avoiding “we,” “our.”
pcc1
2015/03/27 17:46:56
Done.
|
+// by defining the close function. Our close 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,28 @@ |
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 |
+// When there's a choice between UNIX2003 and pre-UNIX2003 and UNIX2003 has been |
+// chosen, or when there's a choice between UNIX2003 and pre-UNIX2003 and |
Mark Mentovai
2015/03/27 12:12:51
This first sentence is kind of silly now.
pcc1
2015/03/27 17:46:56
Done.
|
+// 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 |
#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" |