VirtualBox

Changeset 385

Show
Ignore:
Timestamp:
01/27/07 21:05:44 (2 years ago)
Author:
vboxsync
Message:

RTProcSelf, RTR0ProcHandleSelf, RTR0PROCESS.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/iprt/process.h

    r204 r385  
    2424#include <iprt/cdefs.h> 
    2525#include <iprt/types.h> 
    26  
    27 #ifndef IN_RING3 
    28 # error "The RTProc APIs are Ring-3 only!" 
    29 #endif 
    30  
    3126 
    3227__BEGIN_DECLS 
     
    8580 
    8681 
     82/** 
     83 * Get the current process identifier. 
     84 * 
     85 * @returns Process identifier. 
     86 */ 
     87RTDECL(RTPROCESS) RTProcSelf(void); 
     88 
     89 
     90#ifdef IN_RING0 
     91/** 
     92 * Get the current process handle. 
     93 * 
     94 * @returns Ring-0 process handle. 
     95 */ 
     96RTR0DECL(RTR0PROCESS) RTR0ProcHandleSelf(void); 
     97#endif 
     98 
    8799 
    88100#ifdef IN_RING3 
     
    102114 */ 
    103115RTR3DECL(RTPROCPRIORITY) RTProcGetPriority(void); 
    104  
    105 /** 
    106  * Get the identifier for the current process. 
    107  * 
    108  * @returns Process identifier. 
    109  */ 
    110 RTR3DECL(RTPROCESS) RTProcSelf(void); 
    111116 
    112117/** 
     
    215220RTR3DECL(char *) RTProcGetExecutableName(char *pszExecName, size_t cchExecName); 
    216221 
     222#endif /* IN_RING3 */ 
     223 
     224/** @} */ 
     225 
     226__END_DECLS 
     227 
    217228#endif 
    218229 
    219 /** @} */ 
    220  
    221 __END_DECLS 
    222  
    223 #endif 
    224  
  • trunk/include/iprt/types.h

    r331 r385  
    4040 
    4141# if defined(__LINUX__) && defined(__KERNEL__) 
    42     /*  
     42    /* 
    4343     * Kludge for the linux kernel: 
    4444     *   1. sys/types.h doesn't mix with the kernel. 
    45      *   2. Starting with 2.6.19 linux/types.h typedefs bool and linux/stddef.h  
     45     *   2. Starting with 2.6.19 linux/types.h typedefs bool and linux/stddef.h 
    4646     *      declares false and true as enum values. 
    4747     * We work around these issues here and nowhere else. 
     
    119119# else 
    120120typedef unsigned char bool; 
    121 # endif  
     121# endif 
    122122# ifndef true 
    123123#  define true  (1) 
     
    905905#define NIL_RTNATIVETHREAD                          (~(RTNATIVETHREAD)0) 
    906906 
    907 /** Process handle. */ 
     907/** Process identifier. */ 
    908908typedef RTHCUINTPTR                                 RTPROCESS; 
    909 /** Pointer to a process handle. */ 
     909/** Pointer to a process identifier. */ 
    910910typedef RTPROCESS                                  *PRTPROCESS; 
    911 /** Nil process handle. */ 
     911/** Nil process identifier. */ 
    912912#define NIL_RTPROCESS                               (~(RTPROCESS)0) 
     913 
     914/** Process ring-0 handle. */ 
     915typedef RTR0UINTPTR                                 RTR0PROCESS; 
     916/** Pointer to a ring-0 process handle. */ 
     917typedef RTR0PROCESS                                *PRTR0PROCESS; 
     918/** Nil ring-0 process handle. */ 
     919#define NIL_RTR0PROCESS                             (~(RTR0PROCESS)0) 
    913920 
    914921/** @typedef RTSEMEVENT 
  • trunk/src/VBox/Runtime/Makefile

    r331 r385  
    393393VBoxRT_LIBS.darwin             = \ 
    394394        iconv 
     395VBoxRT_LDFLAGS.darwin          = -framework IOKit 
    395396ifdef VBOX_USE_VCC80 
    396397VBoxRT_LDFLAGS.win             = /MANIFEST 
     
    545546        r0drv/linux/alloc-r0drv-linux.c \ 
    546547        r0drv/linux/initterm-r0drv-linux.c \ 
     548        r0drv/linux/process-r0drv-linux.cpp \ 
    547549        r0drv/linux/RTLogWriteDebugger-r0drv-linux.c \ 
    548550        r0drv/linux/semaphore-r0drv-linux.c \ 
     
    554556        r0drv/nt/alloc-r0drv-nt.cpp \ 
    555557        r0drv/nt/initterm-r0drv-nt.cpp \ 
     558        r0drv/nt/process-r0drv-nt.cpp \ 
    556559        r0drv/nt/RTLogWriteDebugger-r0drv-nt.cpp \ 
    557560        r0drv/nt/semaphore-r0drv-nt.cpp \ 
     
    571574        r0drv/darwin/memobj-r0drv-darwin.cpp \ 
    572575        r0drv/darwin/initterm-r0drv-darwin.cpp \ 
     576        r0drv/darwin/process-r0drv-darwin.cpp \ 
    573577        r0drv/darwin/RTLogWriteDebugger-r0drv-darwin.cpp \ 
    574578        r0drv/darwin/semaphore-r0drv-darwin.cpp \ 
  • trunk/src/VBox/Runtime/include/internal/memobj.h

    r217 r385  
    156156        { 
    157157            /** The process that owns the locked memory. 
    158              * This is NIL_RTPROCESS if it's kernel memory. */ 
    159             RTPROCESS   Process; 
     158             * This is NIL_RTR0PROCESS if it's kernel memory. */ 
     159            RTR0PROCESS R0Process; 
    160160        } Lock; 
    161161 
     
    173173        { 
    174174            /** The process that owns the reserved memory. 
    175              * This is NIL_RTPROCESS if it's kernel memory. */ 
    176             RTPROCESS   Process; 
     175             * This is NIL_RTR0PROCESS if it's kernel memory. */ 
     176            RTR0PROCESS R0Process; 
    177177        } ResVirt; 
    178178 
     
    181181        { 
    182182            /** The process that owns the reserved memory. 
    183              * This is NIL_RTPROCESS if it's kernel memory. */ 
    184             RTPROCESS   Process; 
     183             * This is NIL_RTR0PROCESS if it's kernel memory. */ 
     184            RTR0PROCESS R0Process; 
    185185        } Mapping; 
    186186    } u; 
  • trunk/src/VBox/Runtime/r0drv/darwin/memobj-r0drv-darwin.cpp

    r377 r385  
    3232#include <iprt/param.h> 
    3333#include <iprt/string.h> 
     34#include <iprt/process.h> 
    3435#include "internal/memobj.h" 
    3536 
     
    9495        { 
    9596#ifdef USE_VM_MAP_WIRE 
    96             vm_map_t Map = pMemDarwin->Core.u.Lock.Process != NIL_RTPROCESS 
    97                          ? get_task_map((task_t)pMemDarwin->Core.u.Lock.Process) 
     97            vm_map_t Map = pMemDarwin->Core.u.Lock.R0Process != NIL_RTR0PROCESS 
     98                         ? get_task_map((task_t)pMemDarwin->Core.u.Lock.R0Process) 
    9899                         : kernel_map; 
    99100            kern_return_t kr = vm_map_unwire(Map, 
     
    377378        if (pMemDarwin) 
    378379        { 
    379             pMemDarwin->Core.u.Lock.Process = (RTPROCESS)Task; 
     380            pMemDarwin->Core.u.Lock.R0Process = (RTR0PROCESS)Task; 
    380381            *ppMem = &pMemDarwin->Core; 
    381382            return VINF_SUCCESS; 
     
    404405            if (pMemDarwin) 
    405406            { 
    406                 pMemDarwin->Core.u.Lock.Process = (RTPROCESS)Task; 
     407                pMemDarwin->Core.u.Lock.R0Process = (RTR0PROCESS)Task; 
    407408                pMemDarwin->pMemDesc = pMemDesc; 
    408409                *ppMem = &pMemDarwin->Core; 
     
    470471                if (pMemDarwin) 
    471472                { 
    472                     pMemDarwin->Core.u.Mapping.Process = NIL_RTPROCESS; 
     473                    pMemDarwin->Core.u.Mapping.R0Process = NIL_RTR0PROCESS; 
    473474                    pMemDarwin->pMemMap = pMemMap; 
    474475                    *ppMem = &pMemDarwin->Core; 
     
    514515                if (pMemDarwin) 
    515516                { 
    516                     pMemDarwin->Core.u.Mapping.Process = /*RTProcSelf()*/(RTPROCESS)current_task(); 
     517                    pMemDarwin->Core.u.Mapping.R0Process = RTR0ProcHandleSelf(); 
    517518                    pMemDarwin->pMemMap = pMemMap; 
    518519                    *ppMem = &pMemDarwin->Core; 
     
    546547    { 
    547548        ppnum_t PgNo; 
    548         if (pMemDarwin->Core.u.Lock.Process == NIL_RTPROCESS) 
     549        if (pMemDarwin->Core.u.Lock.R0Process == NIL_RTR0PROCESS) 
    549550            PgNo = pmap_find_phys(kernel_pmap, (uintptr_t)pMemDarwin->Core.pv + iPage * PAGE_SIZE); 
    550551        else 
     
    575576                AssertReturn(s_offPmap >= 0, NIL_RTHCPHYS); 
    576577            } 
    577             pmap_t Pmap = *(pmap_t *)((uintptr_t)get_task_map((task_t)pMemDarwin->Core.u.Lock.Process) + s_offPmap); 
     578            pmap_t Pmap = *(pmap_t *)((uintptr_t)get_task_map((task_t)pMemDarwin->Core.u.Lock.R0Process) + s_offPmap); 
    578579            PgNo = pmap_find_phys(Pmap, (uintptr_t)pMemDarwin->Core.pv + iPage * PAGE_SIZE); 
    579580        } 
  • trunk/src/VBox/Runtime/r0drv/linux/process-r0drv-linux.cpp

    r384 r385  
    11/* $Id$ */ 
    22/** @file 
    3  * InnoTek Portable Runtime - Process, Ring-0 Driver, Darwin
     3 * InnoTek Portable Runtime - Process, Ring-0 Driver, Linux
    44 */ 
    55 
     
    2323*   Header Files                                                               * 
    2424*******************************************************************************/ 
    25 #include "the-darwin-kernel.h" 
     25#include "the-linux-kernel.h" 
    2626#include <iprt/process.h> 
    2727 
     
    2929RTDECL(RTPROCESS) RTProcSelf(void) 
    3030{ 
    31     return proc_selfpid()
     31    return (RTPROCESS)current->tgid
    3232} 
    3333 
     
    3535RTR0DECL(RTR0PROCESS) RTR0ProcHandleSelf(void) 
    3636{ 
    37     return (RTR0PROCESS)current_task()
     37    return (RTR0PROCESS)current->tgid
    3838} 
    3939 
  • trunk/src/VBox/Runtime/r0drv/nt/process-r0drv-nt.cpp

    r384 r385  
    11/* $Id$ */ 
    22/** @file 
    3  * InnoTek Portable Runtime - Process, Ring-0 Driver, Darwin
     3 * InnoTek Portable Runtime - Process, Ring-0 Driver, NT
    44 */ 
    55 
     
    2323*   Header Files                                                               * 
    2424*******************************************************************************/ 
    25 #include "the-darwin-kernel.h" 
     25#include "the-nt-kernel.h" 
    2626#include <iprt/process.h> 
    2727 
     
    2929RTDECL(RTPROCESS) RTProcSelf(void) 
    3030{ 
    31     return proc_selfpid(); 
     31    return (RTPROCESS)PsGetCurrentProcessId(); 
    3232} 
    3333 
     
    3535RTR0DECL(RTR0PROCESS) RTR0ProcHandleSelf(void) 
    3636{ 
    37     return (RTR0PROCESS)current_task(); 
     37    return (RTR0PROCESS)PsGetCurrentProcess(); 
    3838} 
    3939 
  • trunk/src/VBox/Runtime/r3/process.cpp

    r1 r385  
    4343 * @returns Process identifier. 
    4444 */ 
    45 RTR3DECL(RTPROCESS) RTProcSelf(void) 
     45RTDECL(RTPROCESS) RTProcSelf(void) 
    4646{ 
    4747    RTPROCESS Self = g_ProcessSelf; 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy