diff --git a/0/linux/lib/open.c b/0/linux/lib/open.c new file mode 100644 index 0000000..8c3fc58 --- /dev/null +++ b/0/linux/lib/open.c @@ -0,0 +1,25 @@ +/* + * linux/lib/open.c + * + * (C) 1991 Linus Torvalds + */ + +#define __LIBRARY__ +#include +#include + +int open(const char * filename, int flag, ...) +{ + register int res; + va_list arg; + + va_start(arg,flag); + __asm__("int $0x80" + :"=a" (res) + :"0" (__NR_open),"b" (filename),"c" (flag), + "d" (va_arg(arg,int))); + if (res>=0) + return res; + errno = -res; + return -1; +}