summaryrefslogtreecommitdiffstats
path: root/src/lib/open.c
diff options
context:
space:
mode:
authorWe-unite <3205135446@qq.com>2025-01-23 10:41:10 +0800
committerWe-unite <3205135446@qq.com>2025-01-23 10:41:10 +0800
commite6f77b7ea3e38c9853bee60b275f3f89d252a5b3 (patch)
tree80bfbabed9d4cbcf9fa62677f78b34279d7e2f87 /src/lib/open.c
downloadlinux-0.11-master.tar.gz
linux-0.11-master.zip
Initial commit, makee it usable on newest linuxHEADmaster
Diffstat (limited to 'src/lib/open.c')
-rw-r--r--src/lib/open.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/open.c b/src/lib/open.c
new file mode 100644
index 0000000..8c3fc58
--- /dev/null
+++ b/src/lib/open.c
@@ -0,0 +1,25 @@
1/*
2 * linux/lib/open.c
3 *
4 * (C) 1991 Linus Torvalds
5 */
6
7#define __LIBRARY__
8#include <unistd.h>
9#include <stdarg.h>
10
11int open(const char * filename, int flag, ...)
12{
13 register int res;
14 va_list arg;
15
16 va_start(arg,flag);
17 __asm__("int $0x80"
18 :"=a" (res)
19 :"0" (__NR_open),"b" (filename),"c" (flag),
20 "d" (va_arg(arg,int)));
21 if (res>=0)
22 return res;
23 errno = -res;
24 return -1;
25}