server: Try to use /proc/pid/mem to read process memory since it should be faster.

This commit is contained in:
Alexandre Julliard 2010-07-21 10:50:12 +02:00
parent 2c35fccf4d
commit 1a79912a10
1 changed files with 20 additions and 0 deletions

View File

@ -19,9 +19,11 @@
*/
#include "config.h"
#include "wine/port.h"
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <signal.h>
#include <stdarg.h>
@ -377,6 +379,24 @@ int read_process_memory( struct process *process, client_ptr_t ptr, data_size_t
if (suspend_for_ptrace( thread ))
{
if (len > 3) /* /proc/pid/mem should be faster for large sizes */
{
char procmem[24];
int fd;
sprintf( procmem, "/proc/%u/mem", process->unix_pid );
if ((fd = open( procmem, O_RDONLY )) != -1)
{
ssize_t ret = pread( fd, dest, size, ptr );
close( fd );
if (ret == size)
{
len = 0;
goto done;
}
}
}
if (len > 1)
{
if (read_thread_long( thread, addr++, &data ) == -1) goto done;