File:  [DVB] / dietlibc / libstdio / fopen.c
Revision 1.8: download - view: text, annotated - select for diffs
Tue Nov 11 18:27:41 2003 UTC (20 years, 6 months ago) by sanjiyan
Branches: MAIN
CVS tags: HEAD
- some more stdio unlocked functions and cleanup with the cancel-points
- "new"-internal pthread_mutex_{un,}lock functions

#include <sys/types.h>
#include <dietstdio.h>
#include <unistd.h>

extern int __stdio_atexit;

/* this is needed so the libpthread wrapper can initialize the mutex,
 * not to lock it */

FILE *fopen_unlocked(const char *path, const char *mode) {
  int f=0;	/* O_RDONLY, O_WRONLY or O_RDWR */
  int fd;

  f=__stdio_parse_mode(mode);
  if ((fd=__libc_open(path,f,0666))<0)
    return 0;
  return __stdio_init_file(fd,1,f);
}

FILE *fopen(const char *path, const char *mode) __attribute__((weak,alias("fopen_unlocked")));

LinuxTV legacy CVS <linuxtv.org/cvs>