/* $Id$ */
/** @file
* IPRT - Include all necessary headers for the Haiku kernel.
*/
/*
* Copyright (C) 2012 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*
* The contents of this file may alternatively be used under the terms
* of the Common Development and Distribution License Version 1.0
* (CDDL) only, as it comes in the "COPYING.CDDL" file of the
* VirtualBox OSE distribution, in which case the provisions of the
* CDDL are applicable instead of those of the GPL.
*
* You may elect to license modified versions of this file under the
* terms and conditions of either the GPL or the CDDL or both.
*/
#ifndef ___the_haiku_kernel_h
#define ___the_haiku_kernel_h
#include <stdlib.h>
#include <OS.h>
#include <KernelExport.h>
extern int32 smp_get_num_cpus(void);
extern int32 smp_get_current_cpu(void);
extern status_t vm_reserve_address_range(team_id team, void **_address, uint32 addressSpec, addr_t size, uint32 flags);
extern area_id vm_clone_area(team_id team, const char *name, void **address, uint32 addressSpec, uint32 protection,
/* headers/private/kernel/thread_type.h */
extern spinlock gThreadSpinlock;
typedef struct
{
enabled, etc.) */
#if 0
char name[B_OS_NAME_LENGTH];
#endif
// and a lot more...
} Thread;
extern void thread_yield(bool force);
/**
* Convert from Haiku kernel return code to IPRT status code.
* Or as generic call since it's not r0 specific.
*/
{
switch (rc)
{
case B_OK: return VINF_SUCCESS;
case B_BAD_SEM_ID: return VERR_SEM_ERROR;
case B_NO_MORE_SEMS: return VERR_TOO_MANY_SEMAPHORES;
case B_BAD_THREAD_ID: return VERR_INVALID_PARAMETER;
case B_NO_MORE_THREADS: return VERR_MAX_THRDS_REACHED;
case B_BAD_TEAM_ID: return VERR_INVALID_PARAMETER;
case B_NO_MORE_TEAMS: return VERR_MAX_PROCS_REACHED;
//default: return VERR_GENERAL_FAILURE;
/** POSIX Errors are defined as a subset of system errors. */
default: return RTErrConvertFromErrno(rc);
}
}
#endif /* ___the_haiku_kernel_h */