You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
389 B
26 lines
389 B
/*
|
|
* 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__("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;
|
|
}
|