SASC-NG
DVBSoftCAM

scanwrap.c

Go to the documentation of this file.
00001 #define _GNU_SOURCE
00002 #include <dlfcn.h>
00003 #include <stdio.h>
00004 #include <stdlib.h>
00005 #include <sys/types.h>
00006 #include <sys/stat.h>
00007 #include <string.h>
00008 
00009 #define O_SYNC           010000
00010 #define O_ASYNC          020000
00011 
00012 static int (*realopen) (__const char *__file, int __oflag, ...);
00013 static int (*realopen64) (__const char *__file, int __oflag, ...);
00014 void _init(void) {
00015         realopen = dlsym(RTLD_NEXT, "open");
00016         realopen64 = dlsym(RTLD_NEXT, "open64");
00017 }
00018 
00019 int open(__const char *__file, int __oflag, mode_t __mode) {
00020   if(strncmp(__file, "/dev/dvb/adapter", 16) == 0)
00021     __oflag |= (O_SYNC | O_ASYNC);
00022   printf("flags: %04x",__oflag);
00023   return realopen(__file, __oflag, __mode);
00024 }
00025 
00026 int open64(__const char *__file, int __oflag, mode_t __mode) {
00027   if(strncmp(__file, "/dev/dvb/adapter", 16) == 0)
00028     __oflag |= (O_SYNC | O_ASYNC);
00029   return realopen64(__file, __oflag, __mode);
00030 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines