summaryrefslogtreecommitdiffstats
path: root/usr/klibc/arch/i386/openat.S
diff options
context:
space:
mode:
Diffstat (limited to 'usr/klibc/arch/i386/openat.S')
-rw-r--r--usr/klibc/arch/i386/openat.S26
1 files changed, 26 insertions, 0 deletions
diff --git a/usr/klibc/arch/i386/openat.S b/usr/klibc/arch/i386/openat.S
new file mode 100644
index 0000000..2dfdfe2
--- /dev/null
+++ b/usr/klibc/arch/i386/openat.S
@@ -0,0 +1,26 @@
+/*
+ * arch/i386/openat.S
+ *
+ * Handle the openat() system call - oddball due to the varadic
+ * prototype, which forces the use of the cdecl calling convention,
+ * and the need for O_LARGEFILE.
+ */
+
+#include <asm/unistd.h>
+
+/* <asm/fcntl.h>, despite the name, isn't assembly-safe */
+#define O_LARGEFILE 0100000
+
+#ifdef __NR_openat /* Don't build if kernel headers too old */
+
+ .globl openat
+ .type openat,@function
+
+openat:
+ orl $O_LARGEFILE,12(%esp)
+ pushl $__NR_openat
+ jmp __syscall_varadic
+
+ .size openat,.-openat
+
+#endif