Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

return the address of a shared memory location

Posted on 1998-04-17
2
251 Views
Last Modified: 2010-04-21
I need the address of a shared memory location.  All I have is the key_t - is there anyway to get the shmid from this information?
0
Comment
Question by:ethornsb
2 Comments
 

Author Comment

by:ethornsb
ID: 2006257
Adjusted points to 300
0
 
LVL 6

Accepted Solution

by:
jpk041897 earned 300 total points
ID: 2006258
Use:

void *shmat(int shmid, void*shmaddr, int shmflag);

smid is obtained via a call to

int shmget(key_t key, int size, int shmflag);

and shmaddr should be (void *)0 for your purposes.

shmat will return a pointer to the shared memory segment.

See shmop(2) and shmget(2) in the Programmers Reference manual for more info.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question