Changeset View
Changeset View
Standalone View
Standalone View
lib/libc/sys/openat.c
Show All 37 Lines | |||||
#include <stdarg.h> | #include <stdarg.h> | ||||
#include "libc_private.h" | #include "libc_private.h" | ||||
__weak_reference(__sys_openat, __openat); | __weak_reference(__sys_openat, __openat); | ||||
__sym_compat(openat, __impl_openat, FBSD_1.1); | __sym_compat(openat, __impl_openat, FBSD_1.1); | ||||
__weak_reference(openat, __impl_openat); | __weak_reference(openat, __impl_openat); | ||||
__sym_default(openat, openat, FBSD_1.2); | __sym_default(openat, openat, FBSD_1.2); | ||||
#pragma weak openat | |||||
int | int | ||||
openat(int fd, const char *path, int flags, ...) | openat(int fd, const char *path, int flags, ...) | ||||
{ | { | ||||
va_list ap; | va_list ap; | ||||
int mode; | int mode; | ||||
if ((flags & O_CREAT) != 0) { | if ((flags & O_CREAT) != 0) { | ||||
va_start(ap, flags); | va_start(ap, flags); | ||||
mode = va_arg(ap, int); | mode = va_arg(ap, int); | ||||
va_end(ap); | va_end(ap); | ||||
} else { | } else { | ||||
mode = 0; | mode = 0; | ||||
} | } | ||||
return (((int (*)(int, const char *, int, ...)) | return (((int (*)(int, const char *, int, ...)) | ||||
__libc_interposing[INTERPOS_openat])(fd, path, flags, mode)); | __libc_interposing[INTERPOS_openat])(fd, path, flags, mode)); | ||||
} | } |