add directory kernel
This commit is contained in:
26
kernel/0.95/linux-0.95/lib/open.c
Normal file
26
kernel/0.95/linux-0.95/lib/open.c
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* linux/lib/open.c
|
||||
*
|
||||
* (C) 1991 Linus Torvalds
|
||||
*/
|
||||
|
||||
#define __LIBRARY__
|
||||
#include <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;
|
||||
}
|
||||
Reference in New Issue
Block a user