ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
i want to copy the RAM as is on the hard disk..
i want to write a simple C program..
i don't know which pointer do i have to use.
please give me some sort of help.
your RAM can be found at /dev/mem. Using cat /dev/mem > filename works I think. Is that what you want?
by issuing command cat /dev/mem > RAM.DAT will copy whole RAM to disk...
i would also like to know what to do if i want to copy from an address to another address... i mean copying memory range
...to dump 5000 bytes starting at offset 10000. I'm not 100% sure what the effect of reading the /dev/mem like this will be. One thing to watch is that dumping the memory will no doubt affect the memory... so you won't get an instantaneous snapshot. You might do better to dump from a virtual machine, or use a hardware debugger.
Yes, the ability to copy the entirety of your memory to a file a normal user could read sounds very .. unsafe .. isn't that basically the same as reading from any random memory address, which could be beyond your process' space? I get SIGSEGVs when I try to do that in C.
Yes, the ability to copy the entirety of your memory to a file a normal user could read sounds very .. unsafe .. isn't that basically the same as reading from any random memory address, which could be beyond your process' space? I get SIGSEGVs when I try to do that in C.
It's not possible as a normal user - you have to be root. On Ubuntu (and I'm sure some other distros) there is a group, kmem which is also able to read this, but normal users are not added to this group.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.