Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
Location of /dev/shm on Mac OS X

I am working on a shared memory assignment on Mac OS X

    #define SHARED_OBJECT_PATH    "/my_shared_memory"

    fd = shm_open(SHARED_OBJECT_PATH, O_CREAT | O_EXCL | O_RDWR, S_IRWXU | S_IRWXG);
    if (fd < 0) {                                                         
        perror("In shm_open()");                                          
        exit(1);                                                          
    }

One of the small snippets in the program is the above.

When I compile and run the program a second time, I would get the error:

In shm_open(): File exists

I am assuming because I need to manually delete using rm [path_to]/my_shared_memory. I know on Linux, the default location is dev/shm, however, this path does not exist on Mac OS X.

Where is the location of my_shared_memory so I can delete it?

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The simplest solution to your problem is not using

O_EXCL

if you don't want that behaviour.

Generally, shared memory objects do have a name, but it's not really a file name -- you can't generally delete them. It's good POSIX style to display them under /dev/shm, but this depends on your OS:

My best guess would be that you should read what man shm_open says on your machine.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda