X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=klibc%2Fklibc%2Fopen.c;h=cb1f5195dbe815b48f2b107db782b779c7a7ee66;hp=0d7db10c4a3d70daa0b19b4b835786c2311cacc5;hb=accff726856a0b3258a413d823a534f4f437e6b2;hpb=73028bc3322c9ec88e046c57e7b297fdd1c02b1a diff --git a/klibc/klibc/open.c b/klibc/klibc/open.c index 0d7db10c4..cb1f5195d 100644 --- a/klibc/klibc/open.c +++ b/klibc/klibc/open.c @@ -1,17 +1,22 @@ /* * open.c * - * The open syscall is weird, because it's defined as a varadic - * function, but implementing it as such generally sucks for - * performance. Thus we generate it as a 3-argument function, - * but with explicit __cdecl assuming the __cdecl convention is - * independent of being varadic. + * On 32-bit platforms we need to pass O_LARGEFILE to the open() + * system call, to indicate that we're 64-bit safe. */ -#define __IN_OPEN_C +#define _KLIBC_IN_OPEN_C #include #include -#include -#include +#include -__cdecl _syscall3(int,open,const char *,file,int,flags,mode_t,mode) +#if _BITSIZE == 32 && !defined(__i386__) + +extern int __open(const char *, int, mode_t); + +int open(const char *pathname, int flags, mode_t mode) +{ + return __open(pathname, flags|O_LARGEFILE, mode); +} + +#endif