summaryrefslogtreecommitdiffstats
path: root/loader/ldt_keeper.c
diff options
context:
space:
mode:
authornplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-25 01:22:20 +0000
committernplourde <nplourde@b3059339-0415-0410-9bf9-f77b7e298cf2>2006-11-25 01:22:20 +0000
commitac04dcd62588703bf03abf3a4c177af54a2475d0 (patch)
tree404310a1ea5cb27f488d016c792498f5b84de27b /loader/ldt_keeper.c
parentb30a399c528917d620f153bfe478114c6d9f284b (diff)
downloadmpv-ac04dcd62588703bf03abf3a4c177af54a2475d0.tar.bz2
mpv-ac04dcd62588703bf03abf3a4c177af54a2475d0.tar.xz
added mmap_anon to osdep lib. Used in loader for now
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21203 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader/ldt_keeper.c')
-rw-r--r--loader/ldt_keeper.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/loader/ldt_keeper.c b/loader/ldt_keeper.c
index 6b28776501..bf61f617cf 100644
--- a/loader/ldt_keeper.c
+++ b/loader/ldt_keeper.c
@@ -28,6 +28,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <unistd.h>
+#include "osdep/mmap_anon.h"
#ifdef __linux__
#include <asm/unistd.h>
#include <asm/ldt.h>
@@ -200,8 +201,8 @@ ldt_fs_t* Setup_LDT_Keeper(void)
return NULL;
}
fs_seg=
- ldt_fs->fs_seg = mmap(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE,
- ldt_fs->fd, 0);
+ ldt_fs->fs_seg = mmap_anon(NULL, getpagesize(), PROT_READ | PROT_WRITE, MAP_PRIVATE, &ldt_fs->fd,
+ 0);
if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
@@ -286,6 +287,7 @@ void Restore_LDT_Keeper(ldt_fs_t* ldt_fs)
free(ldt_fs->prev_struct);
munmap((char*)ldt_fs->fs_seg, getpagesize());
ldt_fs->fs_seg = 0;
+ if (ldt_fs->fd != -1)
close(ldt_fs->fd);
free(ldt_fs);
}