Find the answer to your Linux question:
Results 1 to 4 of 4
hello, please i wanna attach a process to a specific adress in shared memory but i couldn't (invalid argument), could u please give me the general form of an adress, ...
  1. #1
    Just Joined!
    Join Date
    Dec 2007
    Location
    Algeria
    Posts
    26

    [SOLVED] shmat() function

    hello, please i wanna attach a process to a specific adress in shared memory but i couldn't (invalid argument), could u please give me the general form of an adress,
    i use shmat()
    thank u

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    That parameter is not intended to attach to a particular address in shared memory. That parameter is intended to attach the beginning of the shared memory block to a specified address in physical memory. It is not usually supported (and probably not in Linux), which is a good thing, because most applications using shared memory don't care where in physical memory that shared memory resides.

    Unless you have specific needs to the contrary, make this parameter zero. If you do have specific needs, please tell us about them.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Dec 2007
    Location
    Algeria
    Posts
    26

    shmat()

    thanks,
    the program that im making is : 6 processes, 1 manager and 5 normal processes,
    when a normal process need a resource, it has to ask the manager for it, by using a shared memory called TREQUEST;
    so i need to specify an adress for each process in the same shared memory TREQUEST;
    if u have a solution or another design with one shared memory please tell me;

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Ouch! All that bold print hurt my eyes! :)

    If you haven't done so already, do this at the command line:
    Code:
    man shmat
    man shmctl
    man shmget
    If you were specifying a particular address to shmat(), that would have been the second parameter. Don't do that; use NULL there. Use the address which comes back from the function call as the location (in user space) of the shared memory.

    To make sure that all processes share the same memory (though possibly at different places in their user address space), pass in the same first paramter to shmat() for each.

    If man pages are not installed on your system, google each of these sets of words:
    Code:
    man shmat Linux
    man shmctl Linux
    man shmget Linux
    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...