[Liboss-commit] CVS: liboss/lib esddsp.c,1.1,1.2
Brought to you by:
thesin
|
From: Alexander S. <mrv...@us...> - 2002-10-18 22:46:52
|
Update of /cvsroot/liboss/liboss/lib
In directory usw-pr-cvs1:/tmp/cvs-serv18094/lib
Modified Files:
esddsp.c
Log Message:
osscat almost works now. It calls write(), and esddsp doesn't override write(). We may need to implement this
Index: esddsp.c
===================================================================
RCS file: /cvsroot/liboss/liboss/lib/esddsp.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- esddsp.c 18 Oct 2002 22:11:41 -0000 1.1
+++ esddsp.c 18 Oct 2002 22:46:49 -0000 1.2
@@ -57,11 +57,7 @@
#include <esd.h>
/* BSDI has this functionality, but not define :() */
-#if defined(RTLD_NEXT)
-#define REAL_LIBC RTLD_NEXT
-#else
-#define REAL_LIBC ((void *) -1L)
-#endif
+#define REAL_LIBC libSystem_handle
#if defined(__FreeBSD__) || defined(__bsdi__)
typedef unsigned long request_t;
@@ -75,6 +71,9 @@
static char *ident = NULL, *mixer = NULL;
static int use_mixer = 0;
+static void *libSystem_handle = NULL;
+static int acquired_handle = 0;
+
#define OSS_VOLUME_BASE 50
#define ESD_VOL_TO_OSS(left, right) (short int) \
@@ -166,6 +165,14 @@
}
}
+static void liboss_init(void)
+{
+ if (!acquired_handle)
+ {
+ libSystem_handle = dlopen("/usr/lib/libSystem.dylib",RTLD_LAZY);
+ acquired_handle = 1;
+ }
+}
int
oss_open (const char *pathname, int flags, ...)
@@ -174,6 +181,8 @@
va_list args;
mode_t mode;
+ liboss_init ();
+
if (!func)
func = (int (*) (const char *, int, mode_t)) dlsym (REAL_LIBC, "open");
@@ -383,6 +392,8 @@
va_list args;
void *argp;
+ liboss_init ();
+
if (!func)
func = (int (*) (int, request_t, void *)) dlsym (REAL_LIBC, "ioctl");
va_start (args, request);
|