VirtualBox

Changeset 20821 in vbox for trunk


Ignore:
Timestamp:
Jun 23, 2009 12:42:19 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
48960
Message:

IPRT: alignment check hacking.

Location:
trunk/src/VBox/Runtime
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/init.cpp

    r19924 r20821  
    5959# include <iprt/file.h>
    6060# include <VBox/sup.h>
    61 # include <stdlib.h>
    62 #endif
    63 
     61#endif
     62#include <stdlib.h>
     63
     64#include "internal/alignmentchecks.h"
    6465#include "internal/path.h"
    6566#include "internal/process.h"
     
    112113RTPROCPRIORITY g_enmProcessPriority = RTPROCPRIORITY_DEFAULT;
    113114
     115#ifdef DEBUG
     116/**
     117 * Whether alignment checks are enabled.
     118 * This is set if the environment variable IPRT_ALIGNMENT_CHECKS is 1.
     119 */
     120RTDATADECL(bool) g_fRTAlignmentChecks = false;
     121#endif
     122
     123
    114124
    115125#ifndef RT_OS_WINDOWS
     
    195205    const char *pszDisableHostCache = getenv("VBOX_DISABLE_HOST_DISK_CACHE");
    196206    if (    pszDisableHostCache != NULL
    197         &&  strlen(pszDisableHostCache) > 0
     207        &&  *pszDisableHostCache
    198208        &&  strcmp(pszDisableHostCache, "0") != 0)
    199209    {
     
    263273#endif
    264274
     275#if defined(DEBUG)
     276    /*
     277     * Enable alignment checks.
     278     */
     279    const char *pszAlignmentChecks = getenv("IPRT_ALIGNMENT_CHECKS");
     280    g_fRTAlignmentChecks = pszAlignmentChecks != NULL
     281                        && pszAlignmentChecks[0] == '1'
     282                        && pszAlignmentChecks[1] == '\0';
     283    if (g_fRTAlignmentChecks)
     284        IPRT_ALIGNMENT_CHECKS_ENABLE();
     285#endif
     286
    265287    return VINF_SUCCESS;
    266288}
  • trunk/src/VBox/Runtime/r3/posix/env-posix.cpp

    r16526 r20821  
    4141#include <iprt/alloca.h>
    4242#include <iprt/assert.h>
     43#if defined(DEBUG) && defined(RT_OS_LINUX)
     44# include <iprt/asm.h>
     45#endif
    4346
    4447#include <stdlib.h>
    4548#include <errno.h>
    4649
     50#include "internal/alignmentchecks.h"
     51
    4752
    4853RTDECL(bool) RTEnvExist(const char *pszVar)
    4954{
    50     return getenv(pszVar) != NULL;
     55    return RTEnvGet(pszVar) != NULL;
    5156}
    5257
     
    5459RTDECL(const char *) RTEnvGet(const char *pszVar)
    5560{
    56     return getenv(pszVar);
     61    IPRT_ALIGNMENT_CHECKS_DISABLE(); /* glibc causes trouble */
     62    const char *pszValue = getenv(pszVar);
     63    IPRT_ALIGNMENT_CHECKS_ENABLE();
     64    return pszValue;
    5765}
    5866
     
    8694        return 0;
    8795    return RTErrConvertFromErrno(errno);
    88    
     96
    8997#else
    9098    if (!setenv(pszVar, pszValue, 1))
    9199        return VINF_SUCCESS;
    92100    return RTErrConvertFromErrno(errno);
    93 #endif 
     101#endif
    94102}
    95103
Note: See TracChangeset for help on using the changeset viewer.

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