Inline helpers need to be exported unmangled.

__open_2() is used by the fortify implementation of open(2) in
fcntl.h, and as such needs an unmangled C name. For some reason
(inlining?), this doesn't cause problems at the default optimization
level, but does for -O0.

The rest of these didn't cause build failures, but they look suspect
and probably will, we just haven't caught them yet.

(cherry-pick of 658727e111ed6dee7be5239494f0764f7b1b02f8 with conflicts
in stdio.h and string.h.)

Bug: 17784968
Change-Id: I7391a7a8999ee204eaf6abd14a3d5373ea419d5b
diff --git a/libc/include/sys/stat.h b/libc/include/sys/stat.h
index a6cc368..9c7373a 100644
--- a/libc/include/sys/stat.h
+++ b/libc/include/sys/stat.h
@@ -159,12 +159,12 @@
 extern int mknod(const char*, mode_t, dev_t);
 extern mode_t umask(mode_t);
 
-#if defined(__BIONIC_FORTIFY)
-
 extern mode_t __umask_chk(mode_t);
 extern mode_t __umask_real(mode_t) __RENAME(umask);
 __errordecl(__umask_invalid_mode, "umask called with invalid mode");
 
+#if defined(__BIONIC_FORTIFY)
+
 __BIONIC_FORTIFY_INLINE
 mode_t umask(mode_t mode) {
 #if !defined(__clang__)