VirtualBox

Changeset 537 in vbox for trunk/src/VBox/Runtime/r3/posix


Ignore:
Timestamp:
Feb 2, 2007 6:08:57 AM (18 years ago)
Author:
vboxsync
Message:

Make runtime build on FreeBSD.

Location:
trunk/src/VBox/Runtime/r3/posix
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/posix/path-posix.cpp

    r1 r537  
    332332         */
    333333/** @todo use RTProcGetExecutableName() */
    334 #ifdef __LINUX__
     334#if defined(__LINUX__) || defined(__FREEBSD__)
     335# ifdef __LINUX__
    335336        int cchLink = readlink("/proc/self/exe", &g_szrtProgramPath[0], sizeof(g_szrtProgramPath) - 1);
     337# else
     338        int cchLink = readlink("/proc/curproc/file", &g_szrtProgramPath[0], sizeof(g_szrtProgramPath) - 1);
     339# endif         
    336340        if (cchLink < 0 || cchLink == sizeof(g_szrtProgramPath) - 1)
    337341        {
  • trunk/src/VBox/Runtime/r3/posix/process-posix.cpp

    r1 r537  
    3131#include <sys/stat.h>
    3232#include <sys/wait.h>
     33#include <signal.h>
    3334#if defined(__LINUX__) || defined(__OS2__)
    3435# define HAVE_POSIX_SPAWN 1
     
    235236     * because I'm lazy I'm not creating OS specific code
    236237     * files and code for this.
    237     */
    238 #ifdef __LINUX__
     238     */
     239#if defined(__LINUX__) || defined(__FREEBSD__)
     240# ifdef __LINUX__
    239241    int cchLink = readlink("/proc/self/exe", pszExecName, cchExecName - 1);
     242# else   
     243    int cchLink = readlink("/proc/curproc/file", pszExecName, cchExecName - 1);
     244# endif   
    240245    if (cchLink > 0 && (size_t)cchLink <= cchExecName - 1)
    241246    {
  • trunk/src/VBox/Runtime/r3/posix/system-posix.cpp

    r1 r537  
    3838RTR3DECL(unsigned) RTSystemProcessorGetCount(void)
    3939{
     40    int cCpus; NOREF(cCpus);
     41   
    4042    /*
    4143     * The sysconf way (linux and others).
    4244     */
    4345#ifdef _SC_NPROCESSORS_ONLN
    44     int cCpus = sysconf(_SC_NPROCESSORS_ONLN);
     46    cCpus = sysconf(_SC_NPROCESSORS_ONLN);
    4547    if (cCpus >= 1)
    4648        return cCpus;
     
    5456    aiMib[0] = CTL_HW;
    5557    aiMib[1] = HW_NCPU;
    56     int cCpus = -1;
     58    cCpus = -1;
    5759    size_t cb = sizeof(cCpus);
    5860    int rc = sysctl(aiMib, ELEMENTS(aiMib), &cCpus, &cb, NULL, 0);
  • trunk/src/VBox/Runtime/r3/posix/thread-posix.cpp

    r248 r537  
    200200    if (!cMillies)
    201201    {
     202        /* pthread_yield() isn't part of SuS, thus this fun. */
    202203#ifdef __DARWIN__
    203204        pthread_yield_np();
     205#elif defined(__FREEBSD__) /* void pthread_yield */
     206        pthread_yield();
    204207#else
    205208        if (!pthread_yield())
  • trunk/src/VBox/Runtime/r3/posix/timer-posix.cpp

    r197 r537  
    3838#include <sys/ioctl.h>
    3939#ifdef __LINUX__
    40 #include <linux/rtc.h>
     40# include <linux/rtc.h>
    4141#endif
    4242#include <sys/time.h>
     
    4444#include <errno.h>
    4545#ifndef __OS2__
    46 #include <pthread.h>
     46# include <pthread.h>
    4747#endif
    4848
     
    224224     * Block SIGALRM from calling thread.
    225225     */
     226#if defined(__FREEBSD__) /* sighold is missing and I don't wish to break anything atm. */
     227    sigset_t SigSet;
     228    sigemptyset(&SigSet);
     229    sigaddset(&SigSet, SIGALRM);
     230    sigprocmask(SIG_BLOCK, &SigSet, NULL);
     231#else     
    226232    sighold(SIGALRM);
     233#endif   
    227234    static bool fDoneRTC;
    228235    if (!fDoneRTC)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette