source: trunk/sys/dietlibc/fopen.c @ 302

Last change on this file since 302 was 1, checked in by alain, 8 years ago

First import

File size: 545 bytes
RevLine 
[1]1#include <unistd.h>
2#include "dietstdio.h"
3#include <fcntl.h>
4
5extern int __stdio_atexit;
6
7/* this is needed so the libpthread wrapper can initialize the mutex,
8 * not to lock it */
9
10FILE *fopen_unlocked(const char *path, const char *mode) {
11  int f=0;      /* O_RDONLY, O_WRONLY or O_RDWR */
12  int fd;
13
14  f=__stdio_parse_mode(mode);
15  log_msg("fopen: flags %x\n", f);
16  if ((fd= open(path,f,0666))<0)
17    return 0;
18  return __stdio_init_file(fd,1,f);
19}
20
21FILE *fopen(const char *path, const char *mode) __attribute__((weak,alias("fopen_unlocked")));
Note: See TracBrowser for help on using the repository browser.