lkml.org 
[lkml]   [1996]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectWhat mmap does here ..
Date

Hi all,

I have a very trivial piece of code which swaps two nummbers.
When I do a strace a.out I get the following -

I am puzzled by the unusually large value for the file desc in first
mmap call. Additionally why do we need a mmap here? Thanks in advance and
Yeah, sorry if I am a little away from the main objectives of this
mailing list.

Thanks

pkd@wipro.wipsys.soft.net

------------------------------------------------------------------------
mmap(0, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|0x20, 4294967295, 0) = 0x40006000
---------------------------------------------------------------------
mprotect(0x8048000, 1463, PROT_READ|PROT_WRITE|PROT_EXEC) = 0
stat("/etc/ld.so.cache", {st_mode=S_IFREG|0644, st_size=1721, ...}) = 0
open("/etc/ld.so.cache", O_RDONLY) = 3
mmap(0, 1721, PROT_READ, MAP_SHARED, 3, 0) = 0x40007000
close(3) = 0
open("/lib/libc.so.5.2.18", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3"..., 4096) = 4096
mmap(0, 708608, PROT_NONE, MAP_PRIVATE|0x20, 4294967295, 0) = 0x40008000
mmap(0x40008000, 479678, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED, 3, 0) = 0x40008000
mmap(0x4007e000, 18776, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED, 3, 0x75000) = 0x4007e000
mmap(0x40083000, 203456, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|0x20, 4294967295, 0) = 0x40083000
close(3) = 0
munmap(0x40007000, 1721) = 0
mprotect(0x8048000, 1463, PROT_READ|PROT_EXEC) = 0
SYS_136(0, 0x1, 0x4, 0x40001fb0, 0x80483b8) = 0
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 192), ...}) = 0
brk(0x804c67c) = 0x804c67c
brk(0x804d000) = 0x804d000
brk(0x804e000) = 0x804e000
ioctl(1, TCGETS, {B9600 opost isig icanon echo ...}) = 0
fstat(0, {st_mode=S_IFCHR|0620, st_rdev=makedev(4, 192), ...}) = 0
brk(0x804f000) = 0x804f000
ioctl(0, TCGETS, {B9600 opost isig icanon echo ...}) = 0
write(1, " enter a and b \t", 16) = 16
read(0, "2 3\n", 4096) = 4
write(1, " before swap a = 2.000000, b = 3"..., 40) = 40
write(1, " after swap a = 3.000000, b = 2."..., 39) = 39
_exit(39) = ?


\
 
 \ /
  Last update: 2005-03-22 13:37    [W:0.019 / U:0.572 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site