473,466 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create 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_BITS=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="Linux", 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_IFDIR|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_IFDIR|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_IFDIR|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_IFDIR|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_IFDIR|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_IFREG|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_IFREG|0755, st_size=1512400, ...}) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7f75000
old_mmap(0x359000, 1207532, PROT_READ|PROT_EXEC,
MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x359000
old_mmap(0x47a000, 16384, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x120000) = 0x47a000
old_mmap(0x47e000, 7404, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x47e000
close(3) = 0
old_mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS,
-1, 0) = 0xb7f74000
mprotect(0x47a000, 8192, PROT_READ) = 0
mprotect(0x355000, 4096, PROT_READ) = 0
set_thread_area({entry_number:-1 -6, base_addr:0xb7f746c0,
limit:1048575, seg_32bit:1, contents:0, read_exec_only:0,
limit_in_pages:1, seg_not_present:0, useable:1}) = 0
munmap(0xb7f76000, 98896) = 0
brk(0) = 0x804a000
brk(0x806c000) = 0x806c000
getpid() = 17545
open("/proc/17545/mem", O_RDONLY|O_LARGEFILE) = 3
pread(3, 0x804a008, 52, 4294959104) = -1 EIO (Input/output error)
fstat64(1, {st_mode=S_IFCHR|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(0xb7f8e000, 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 2042
ne****@gmail.com 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.development.apps or
comp.unix.programmer 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
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...
1
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...
0
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...
0
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
1
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.