diff options
Diffstat (limited to 'lib/open.c')
-rw-r--r-- | lib/open.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/open.c b/lib/open.c new file mode 100644 index 000000000..b69d2b548 --- /dev/null +++ b/lib/open.c @@ -0,0 +1,26 @@ +/* + * linux/lib/open.c + * + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#define __LIBRARY__ +#include <linux/unistd.h> +#include <stdarg.h> + +int open(const char * filename, int flag, ...) +{ + register int res; + va_list arg; + + va_start(arg,flag); + __asm__("movl %2,%%ebx\n\t" + "int $0x80" + :"=a" (res) + :"0" (__NR_open),"g" ((long)(filename)),"c" (flag), + "d" (va_arg(arg,int))); + if (res>=0) + return res; + errno = -res; + return -1; +} |