diff options
| author | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2010-02-14 09:47:37 +0000 |
|---|---|---|
| committer | vboxsync <vboxsync@cfe28804-0f27-0410-a406-dd0f0b0b656f> | 2010-02-14 09:47:37 +0000 |
| commit | 3c58ee31379375b708251466fd6a40ec0b2ce9e7 (patch) | |
| tree | 8ace7d6781cda72d4f240356d82914ef4d442330 /src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp | |
| parent | 16d9fe232831aaf4c7aa95dcba1a26f905bdd361 (diff) | |
| download | VirtualBox-svn-3c58ee31379375b708251466fd6a40ec0b2ce9e7.tar.gz | |
HostDrivers: tabs -> spaces.
git-svn-id: https://www.virtualbox.org/svn/vbox/trunk@26512 cfe28804-0f27-0410-a406-dd0f0b0b656f
Diffstat (limited to 'src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp')
| -rw-r--r-- | src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp index 300195d10d1..6129f113bc0 100644 --- a/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp +++ b/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp @@ -181,7 +181,7 @@ int suplibOsIOCtl(PSUPLIBDATA pThis, uintptr_t uFunction, void *pvReq, size_t cb * Issue device iocontrol. */ if (RT_LIKELY(ioctl(pThis->hDevice, uFunction, pvReq) >= 0)) - return VINF_SUCCESS; + return VINF_SUCCESS; /* This is the reverse operation of the one found in SUPDrv-linux.c */ switch (errno) @@ -216,30 +216,30 @@ int suplibOsPageAlloc(PSUPLIBDATA pThis, size_t cPages, void **ppvPages) size_t cbMmap = (pThis->fSysMadviseWorks ? cPages : cPages + 2) << PAGE_SHIFT; char *pvPages = (char *)mmap(NULL, cbMmap, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); if (pvPages == MAP_FAILED) - return VERR_NO_MEMORY; + return VERR_NO_MEMORY; if (pThis->fSysMadviseWorks) { - /* - * It is not fatal if we fail here but a forked child (e.g. the ALSA sound server) - * could crash. Linux < 2.6.16 does not implement madvise(MADV_DONTFORK) but the - * kernel seems to split bigger VMAs and that is all that we want -- later we set the - * VM_DONTCOPY attribute in supdrvOSLockMemOne(). - */ - if (madvise (pvPages, cbMmap, MADV_DONTFORK)) - LogRel(("SUPLib: madvise %p-%p failed\n", pvPages, cbMmap)); - *ppvPages = pvPages; + /* + * It is not fatal if we fail here but a forked child (e.g. the ALSA sound server) + * could crash. Linux < 2.6.16 does not implement madvise(MADV_DONTFORK) but the + * kernel seems to split bigger VMAs and that is all that we want -- later we set the + * VM_DONTCOPY attribute in supdrvOSLockMemOne(). + */ + if (madvise (pvPages, cbMmap, MADV_DONTFORK)) + LogRel(("SUPLib: madvise %p-%p failed\n", pvPages, cbMmap)); + *ppvPages = pvPages; } else { - /* - * madvise(MADV_DONTFORK) is not available (most probably Linux 2.4). Enclose any - * mmapped region by two unmapped pages to guarantee that there is exactly one VM - * area struct of the very same size as the mmap area. - */ - mprotect(pvPages, PAGE_SIZE, PROT_NONE); - mprotect(pvPages + cbMmap - PAGE_SIZE, PAGE_SIZE, PROT_NONE); - *ppvPages = pvPages + PAGE_SIZE; + /* + * madvise(MADV_DONTFORK) is not available (most probably Linux 2.4). Enclose any + * mmapped region by two unmapped pages to guarantee that there is exactly one VM + * area struct of the very same size as the mmap area. + */ + mprotect(pvPages, PAGE_SIZE, PROT_NONE); + mprotect(pvPages + cbMmap - PAGE_SIZE, PAGE_SIZE, PROT_NONE); + *ppvPages = pvPages + PAGE_SIZE; } memset(*ppvPages, 0, cPages << PAGE_SHIFT); return VINF_SUCCESS; |
