Created a compatibility header for the USB Stack so that it can be compiled on BeOS too. How to do this correctly? I don't think that this stuff should go to HaikuBuildCompatibility.h as it's kernel stuff.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18538 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Michael Lotz
2006-08-19 13:18:03 +00:00
parent 27f1bc8217
commit c3157a2749
4 changed files with 56 additions and 0 deletions
@@ -0,0 +1,51 @@
#ifndef _USB_BEOS_COMPATIBILITY_H_
#define _USB_BEOS_COMPATIBILITY_H_
#ifndef HAIKU_TARGET_PLATFORM_HAIKU
#include <lock.h>
#include <stdarg.h>
#include <stdio.h>
inline status_t
benaphore_init(benaphore *ben, const char *name)
{
if (ben == NULL || name == NULL)
return B_BAD_VALUE;
ben->count = 1;
ben->sem = create_sem(0, name);
if (ben->sem >= B_OK)
return B_OK;
return ben->sem;
}
inline void
benaphore_destroy(benaphore *ben)
{
delete_sem(ben->sem);
ben->sem = -1;
}
inline void
load_driver_symbols(char *driver)
{
/* nothing */
}
inline int
snprintf(char *buffer, size_t bufferSize, const char *format, ...)
{
va_list args;
va_start(args, format);
int result = vsprintf(buffer, format, args);
va_end(args);
return result;
}
#endif // !HAIKU_TARGET_PLATFORM_HAIKU
#endif // !_USB_BEOS_COMPATIBILITY_H_
@@ -1,5 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel bus_managers usb ; SubDir HAIKU_TOP src add-ons kernel bus_managers usb ;
SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirC++Flags -fno-rtti ; SubDirC++Flags -fno-rtti ;
SubDirSysHdrs $(SUBDIR) ; SubDirSysHdrs $(SUBDIR) ;
@@ -12,6 +12,7 @@
#include <lock.h> #include <lock.h>
#include "usbspec_p.h" #include "usbspec_p.h"
#include "BeOSCompatibility.h"
class Hub; class Hub;
+2
View File
@@ -1,5 +1,7 @@
SubDir HAIKU_TOP src add-ons kernel busses usb ; SubDir HAIKU_TOP src add-ons kernel busses usb ;
SetSubDirSupportedPlatformsBeOSCompatible ;
SubDirC++Flags -fno-rtti ; SubDirC++Flags -fno-rtti ;
UsePrivateHeaders [ FDirName kernel ] ; UsePrivateHeaders [ FDirName kernel ] ;