473,569 Members | 2,790 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to get the suppport of pread64 from a 32bit machine?

hi,

I am not sure if this is the proper list to ask this question. If not,
I would appreciate if you can point me to the right place.

I am going to use pread64 open file as /proc/(pid)/mem, but failed with
EIO error. The following is my code:

#define _GNU_SOURCE

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
#include < string.h>
int main(void)
{
char *buf;
char filename[64];
int fd, len;

buf = (char *)malloc(4096);

sprintf (filename, "/proc/%d/mem", getpid());

fd = open64 (filename, O_RDONLY | O_LARGEFILE);

len = pread64(fd, buf, 52, 0xFFFFE000);

printf("len=%d\ n", len);

}

The code is compiled with -D_FILE_OFFSET_B ITS=64. But I still cannot
get the pread64 from strace message. The following is the strace
message I got.
strace ./bar
execve("./bar", ["./bar"], [/* 55 vars */]) = 0
uname({sys="Lin ux", node="neocenter .unl.edu", ...}) = 0
brk(0) = 0x804a000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or
directory)
open("tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("libc.so.6 ", O_RDONLY) = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT
(No such file or directory)
stat64("/usr/local/lib/tls/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such
file or directory)
open("/usr/local/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/usr/local/lib/tls/i686", 0xbfac9c18) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/usr/local/lib/tls/sse2", 0xbfac9c18) = -1 ENOENT (No such file
or directory)
open("/usr/local/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/local/lib/tls", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/usr/local/lib/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such
file or directory)
open("/usr/local/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/local/lib/i686", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/local/lib/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/local/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/local/lib", {st_mode=S_IFDI R|0755, st_size=28672, ...}) =
0
open("/usr/lib/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib/tls/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such file
or directory)
open("/usr/lib/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/usr/lib/tls/i686", {st_mode=S_IFDI R|0755, st_size=4096, ...})
= 0
open("/usr/lib/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/usr/lib/tls/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib/tls", {st_mode=S_IFDI R|0755, st_size=4096, ...}) = 0
open("/usr/lib/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib/i686", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib/sse2", {st_mode=S_IFDI R|0755, st_size=4096, ...}) = 0
open("/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib", {st_mode=S_IFDI R|0755, st_size=98304, ...}) = 0
open("/usr/lib64/tls/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No
such file or directory)
stat64("/usr/lib64/tls/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such
file or directory)
open("/usr/lib64/tls/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib64/tls/i686", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/tls/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib64/tls/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib64/tls", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/i686/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such
file or directory)
stat64("/usr/lib64/i686/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/i686/libc.so.6", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/usr/lib64/i686", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/sse2/libc.so.6", O_RDONLY) = -1 ENOENT (No such file
or directory)
stat64("/usr/lib64/sse2", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/usr/lib64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or
directory)
stat64("/usr/lib64", 0xbfac9c18) = -1 ENOENT (No such file or
directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFRE G|0644, st_size=98896, ...}) = 0
old_mmap(NULL, 98896, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb7f76000
close(3) = 0
open("/lib/tls/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\ 0\0\0\0\0\0\0\0 \0\3\0\3\0\1\0\ 0\0 \3376\000"...,
512) = 512
fstat64(3, {st_mode=S_IFRE G|0755, st_size=1512400 , ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_ WRITE, MAP_PRIVATE|MAP _ANONYMOUS,
-1, 0) = 0xb7f75000
old_mmap(0x3590 00, 1207532, PROT_READ|PROT_ EXEC,
MAP_PRIVATE|MAP _DENYWRITE, 3, 0) = 0x359000
old_mmap(0x47a0 00, 16384, PROT_READ|PROT_ WRITE,
MAP_PRIVATE|MAP _FIXED|MAP_DENY WRITE, 3, 0x120000) = 0x47a000
old_mmap(0x47e0 00, 7404, PROT_READ|PROT_ WRITE,
MAP_PRIVATE|MAP _FIXED|MAP_ANON YMOUS, -1, 0) = 0x47e000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_ WRITE, MAP_PRIVATE|MAP _ANONYMOUS,
-1, 0) = 0xb7f74000
mprotect(0x47a0 00, 8192, PROT_READ) = 0
mprotect(0x3550 00, 4096, PROT_READ) = 0
set_thread_area ({entry_number:-1 -6, base_addr:0xb7f 746c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only: 0,
limit_in_pages: 1, seg_not_present :0, useable:1}) = 0
munmap(0xb7f760 00, 98896) = 0
brk(0) = 0x804a000
brk(0x806c000) = 0x806c000
getpid() = 17545
open("/proc/17545/mem", O_RDONLY|O_LARG EFILE) = 3
pread(3, 0x804a008, 52, 4294959104) = -1 EIO (Input/output error)
fstat64(1, {st_mode=S_IFCH R|0620, st_rdev=makedev (136, 7), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_ WRITE, MAP_PRIVATE|MAP _ANONYMOUS, -1,
0) = 0xb7f8e000
write(1, "len=-1\n", 7len=-1
) = 7
munmap(0xb7f8e0 00, 4096) = 0
exit_group(7) = ?

My system information: (2.6.20-rc6) the latest kernel on Intel i386
32bit machine
/lib/libc.so.6
GNU C Library stable release version 2.3.3, by Roland McGrath et al.
Copyright (C) 2004 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.
Compiled by GNU CC version 3.4.2 20041017 (Red Hat 3.4.2-6.fc3).
Compiled on a Linux 2.4.20 system on 2004-10-27.
Available extensions:
GNU libio by Per Bothner
crypt add-on version 2.1 by Michael Glad and others
linuxthreads-0.10 by Xavier Leroy
The C stubs add-on version 2.1.2.
BIND-8.2.3-T5B
NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk
Glibc-2.0 compatibility add-on by Cristian Gafton
GNU Libidn by Simon Josefsson
libthread_db work sponsored by Alpha Processor Inc
Thread-local storage support included.
For bug reporting instructions, please see:
<http://www.gnu.org/software/libc/bugs.html>.

Thanks,
Neo
--
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!

Jan 27 '07 #1
1 2047
ne****@gmail.co m wrote:
hi,

I am not sure if this is the proper list to ask this question. If not,
I would appreciate if you can point me to the right place.

I am going to use pread64 open file as /proc/(pid)/mem, but failed with
EIO error. The following is my code:

#define _GNU_SOURCE
<snip>

I suggest posting this in comp.os.linux.d evelopment.apps or
comp.unix.progr ammer or some other Linux/GNU specific newsgroup. This
group tries to restrict itself to the standard C language.

Jan 27 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1449
by: SamG | last post by:
If anyone has a x86_64 machine and is running a 32bit OS on top of that.... could you tell me what output would you get for the following program #====================== import platform print platform.processor() print platform.architecture() #======================
1
3467
by: Morfys | last post by:
Hi, I would like to copy glibc/libgcc (in particular, libc.so. 6,libgcc_s.so.1) for a 32bit machine onto a 64bit machine. Would using the 32bit glibc/libgcc on the 64bit machine work? The reason I ask is that I've been getting the following error: Bin/libc.so.6: symbol _dl_out_of_memory, version GLIBC_PRIVATE not defined in file...
0
879
by: gigs | last post by:
I need to write 32bit wrapper for application to run in 32bit. I have 64 bit os and i need 32 bit wrapper for ironpython to run at 32 bit. IronPython is a neutral EXE so it'll run at 64-bit on a 64-bit machine and 32-bit on a 32-bit machine. I never did something like that so i ask you to give me some tricks/clues where to start? ...
0
1336
by: Paul McNett | last post by:
Gary Josack wrote: I just tried it: WindowsXP in Parallels Desktop: ('32bit', 'WindowsPE') Ubuntu 7.10 in Parallels Desktop: ('32bit', '')
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7666
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3636
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2107
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1208
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.