problems with shared memory area

Discussion in 'C++' started by Ron Eggler, Mar 4, 2008.

  1. Ron Eggler

    Ron Eggler Guest

    Hi,

    I'm running an application on an embedded PC 104 platform on a Linux OS.
    I need some shared memory and I'm trying to create it with:
    int prg_shm = ::shmget(0x1999,sizeof(struct configuration),0666);
    if (prg_shm == -1)
    {
    prg_shm = ::shmget(0x1999,sizeof(struct configuration),IPC_CREAT|0666);
    if (prg_shm == -1)
    {
    std::cerr << "Failed to create shared memory area!\n";
    ::exit(EXIT_FAILURE);
    }
    }

    But I always get ""Failed to create shared memory area!" and I'm not seeing
    what's wrong. Any suggestions?

    Thanks!
    Ron
    --
    chEErs roN
     
    Ron Eggler, Mar 4, 2008
    #1
    1. Advertising

  2. Ron Eggler wrote:
    > I'm running an application on an embedded PC 104 platform on a Linux
    > OS.
    > I need some shared memory and I'm trying to create it with:
    > int prg_shm = ::shmget(0x1999,sizeof(struct
    > configuration),0666); if (prg_shm == -1)
    > {
    > prg_shm = ::shmget(0x1999,sizeof(struct
    > configuration),IPC_CREAT|0666); if (prg_shm == -1)
    > {
    > std::cerr << "Failed to create shared memory
    > area!\n"; ::exit(EXIT_FAILURE);
    > }
    > }
    >
    > But I always get ""Failed to create shared memory area!" and I'm not
    > seeing
    > what's wrong. Any suggestions?


    Post to a Linux newsgroup, where this would be on topic.

    V
    --
    Please remove capital 'A's when replying by e-mail
    I do not respond to top-posted replies, please don't ask
     
    Victor Bazarov, Mar 4, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark
    Replies:
    1
    Views:
    609
    Larry Barowski
    Jun 27, 2005
  2. sam
    Replies:
    2
    Views:
    2,251
    Dhruv
    Jun 27, 2003
  3. hotadvice
    Replies:
    14
    Views:
    709
    hotadvice
    Oct 2, 2007
  4. Andy B.
    Replies:
    0
    Views:
    812
    Andy B.
    Apr 30, 2010
  5. Jim
    Replies:
    0
    Views:
    192
Loading...

Share This Page