revert between 56095 -> 55830 in arch
[AROS.git] / arch / all-unix / libs / oss / oss_init.c
blob1282f4545bb07f128b5d7f8df824e24b09aad946
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <stddef.h>
7 #include <exec/types.h>
8 #include <exec/libraries.h>
9 #include <dos/dosextens.h>
10 #include <aros/libcall.h>
11 #include <aros/debug.h>
12 #include <hidd/unixio.h>
14 #include <proto/exec.h>
15 #include <proto/oop.h>
16 #include <proto/alib.h>
18 #include <aros/symbolsets.h>
19 #include LC_LIBDEFS_FILE
21 OOP_Object *unixio = NULL;
22 int audio_fd;
24 static int InitData(LIBBASETYPEPTR LIBBASE)
26 struct TagItem tags[] = {
27 {0 , (IPTR)"oss.library" },
28 {0 , (IPTR)AROS_ARCHITECTURE},
29 {TAG_DONE, 0 }
32 LIBBASE->UnixIOAttrBase = OOP_ObtainAttrBase(IID_Hidd_UnixIO);
33 if (!LIBBASE->UnixIOAttrBase)
34 return FALSE;
36 /* Initialise tag IDs only after getting UnixIOAttrBase */
37 tags[0].ti_Tag = aHidd_UnixIO_Opener;
38 tags[1].ti_Tag = aHidd_UnixIO_Architecture;
40 unixio = OOP_NewObject(NULL, CLID_Hidd_UnixIO, tags);
41 if (!unixio) return FALSE;
43 return TRUE;
46 static int OpenLib(LIBBASETYPEPTR LIBBASE)
48 /* Allow only one opener */
50 return ((struct Library *)LIBBASE)->lib_OpenCnt ? FALSE : TRUE;
53 static int CleanUp(LIBBASETYPEPTR LIBBASE)
55 if (LIBBASE->UnixIOAttrBase)
56 OOP_ReleaseAttrBase(IID_Hidd_UnixIO);
58 /* UnixIO is a singletone, there's no need to dispose it */
60 return TRUE;
63 ADD2INITLIB(InitData, 0);
64 ADD2OPENLIB(OpenLib, 0);
65 ADD2EXPUNGELIB(CleanUp, 0);
66 ADD2LIBS("unixio.hidd", 0, static struct Library *, unixioBase);