void *mmap_area;
} fd_t;
+static void initialize(void);
+static int initialized = 0;
+
static int oss_wrapper_debug = 0;
static int open_max;
static int poll_fds_add = 0;
va_list args;
long arg;
+ if (!initialized)
+ initialize();
+
va_start(args, cmd);
arg = va_arg(args, long);
va_end(args);
mode_t mode = 0;
int fd;
+ if (!initialized)
+ initialize();
+
if (oflag & O_CREAT) {
va_start(args, oflag);
mode = va_arg(args, mode_t);
int close(int fd)
{
+ if (!initialized)
+ initialize();
+
if (fd < 0 || fd >= open_max || fds[fd] == NULL) {
return _close(fd);
} else {
ssize_t write(int fd, const void *buf, size_t n)
{
+ if (!initialized)
+ initialize();
+
if (fd < 0 || fd >= open_max || fds[fd] == NULL)
return _write(fd, buf, n);
else
ssize_t read(int fd, void *buf, size_t n)
{
+ if (!initialized)
+ initialize();
+
if (fd < 0 || fd >= open_max || fds[fd] == NULL)
return _read(fd, buf, n);
else
va_list args;
void *arg;
+ if (!initialized)
+ initialize();
+
va_start(args, request);
arg = va_arg(args, void *);
va_end(args);
void *mmap(void *addr, size_t len, int prot, int flags, int fd, off_t offset)
{
void *result;
+
+ if (!initialized)
+ initialize();
+
if (fd < 0 || fd >= open_max || fds[fd] == NULL)
return _mmap(addr, len, prot, flags, fd, offset);
result = ops[fds[fd]->class].mmap(addr, len, prot, flags, fd, offset);
int munmap(void *addr, size_t len)
{
int fd;
+
+ if (!initialized)
+ initialize();
+
for (fd = 0; fd < open_max; ++fd) {
if (fds[fd] && fds[fd]->mmap_area == addr)
break;
int count, count1;
int direct = 1;
struct pollfd pfds1[nfds + poll_fds_add + 16];
+
+ if (!initialized)
+ initialize();
+
nfds1 = 0;
for (k = 0; k < nfds; ++k) {
int fd = pfds[k].fd;
int fd;
int direct = 1;
+ if (!initialized)
+ initialize();
+
if (rfds) {
_rfds1 = *rfds;
} else {
#include "stdioemu.c"
FILE *fopen(const char* path, const char *mode) {
+
+ if (!initialized)
+ initialize();
+
if(!is_dsp_device(path))
return _fopen (path, mode);
_select = dlsym(RTLD_NEXT, "select");
_poll = dlsym(RTLD_NEXT, "poll");
_fopen = dlsym(RTLD_NEXT, "fopen");
+ initialized = 1;
}