[MPlayer-cvslog] r21264 - in trunk: loader/ext.c loader/ldt_keeper.c loader/ldt_keeper.h osdep/mmap_anon.c osdep/mmap_anon.h
reimar
subversion at mplayerhq.hu
Sun Nov 26 14:09:47 CET 2006
Author: reimar
Date: Sun Nov 26 14:09:46 2006
New Revision: 21264
Modified:
trunk/loader/ext.c
trunk/loader/ldt_keeper.c
trunk/loader/ldt_keeper.h
trunk/osdep/mmap_anon.c
trunk/osdep/mmap_anon.h
Log:
Remove useless fd parameter for mmap_anon
Modified: trunk/loader/ext.c
==============================================================================
--- trunk/loader/ext.c (original)
+++ trunk/loader/ext.c Sun Nov 26 14:09:46 2006
@@ -248,7 +248,7 @@
if (unix_handle == -1)
{
- ret = mmap_anon( start, size_low, prot, flags, &fd, offset_low );
+ ret = mmap_anon( start, size_low, prot, flags, offset_low );
}
else
{
@@ -365,12 +365,10 @@
mmap_access |=PROT_READ|PROT_WRITE;
if(anon)
- answer=mmap_anon(NULL, len, mmap_access, MAP_PRIVATE, &hFile, 0);
+ answer=mmap_anon(NULL, len, mmap_access, MAP_PRIVATE, 0);
else
answer=mmap(NULL, len, mmap_access, MAP_PRIVATE, hFile, 0);
- if(anon && hFile != -1)
- close(hFile);
if(answer!=(LPVOID)-1)
{
if(fm==0)
@@ -395,8 +393,6 @@
fm->name=NULL;
fm->mapping_size=len;
- if(anon && hFile != -1)
- close(hFile);
return (HANDLE)answer;
}
return (HANDLE)0;
@@ -495,11 +491,9 @@
}
answer=mmap_anon(address, size, PROT_READ | PROT_WRITE | PROT_EXEC,
- MAP_PRIVATE, &fd, 0);
+ MAP_PRIVATE, 0);
// answer=FILE_dommap(-1, address, 0, size, 0, 0,
// PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
- if (fd != -1)
- close(fd);
if (answer != (void *)-1 && address && answer != address) {
/* It is dangerous to try mmap() with MAP_FIXED since it does not
Modified: trunk/loader/ldt_keeper.c
==============================================================================
--- trunk/loader/ldt_keeper.c (original)
+++ trunk/loader/ldt_keeper.c Sun Nov 26 14:09:46 2006
@@ -196,12 +196,10 @@
return NULL;
fs_seg=
- ldt_fs->fs_seg = mmap_anon(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, 0);
if (ldt_fs->fs_seg == (void*)-1)
{
perror("ERROR: Couldn't allocate memory for fs segment");
- close(ldt_fs->fd);
free(ldt_fs);
return NULL;
}
@@ -282,7 +280,5 @@
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);
}
Modified: trunk/loader/ldt_keeper.h
==============================================================================
--- trunk/loader/ldt_keeper.h (original)
+++ trunk/loader/ldt_keeper.h Sun Nov 26 14:09:46 2006
@@ -9,7 +9,6 @@
typedef struct {
void* fs_seg;
char* prev_struct;
- int fd;
} ldt_fs_t;
void Setup_FS_Segment(void);
Modified: trunk/osdep/mmap_anon.c
==============================================================================
--- trunk/osdep/mmap_anon.c (original)
+++ trunk/osdep/mmap_anon.c Sun Nov 26 14:09:46 2006
@@ -31,7 +31,7 @@
* \param zerofd
* \return a pointer to the mapped region upon successful completion, -1 otherwise.
*/
-void *mmap_anon(void *addr, size_t len, int prot, int flags, int *zerofd, off_t offset)
+void *mmap_anon(void *addr, size_t len, int prot, int flags, off_t offset)
{
int fd;
void *result;
@@ -46,7 +46,6 @@
#ifdef MAP_ANONYMOUS
/* BSD-style anonymous mapping */
- fd = -1;
result = mmap(addr, len, prot, flags | MAP_ANONYMOUS, -1, offset);
#else
/* SysV-style anonymous mapping */
@@ -57,11 +56,9 @@
}
result = mmap(addr, len, prot, flags, fd, offset);
+ close(fd);
#endif /* MAP_ANONYMOUS */
- if (zerofd)
- *zerofd = fd;
-
return result;
}
Modified: trunk/osdep/mmap_anon.h
==============================================================================
--- trunk/osdep/mmap_anon.h (original)
+++ trunk/osdep/mmap_anon.h Sun Nov 26 14:09:46 2006
@@ -3,6 +3,6 @@
#include <sys/types.h>
-void *mmap_anon(void *, size_t, int, int, int *, off_t);
+void *mmap_anon(void *, size_t, int, int, off_t);
#endif /* _OSDEP_MMAP_ANON_H_ */
More information about the MPlayer-cvslog
mailing list