2

I am trying atm to create a shared memory file for my process. The filename constists of several parts to identify the process the SHM belongs to and whats its content. An example would be: shm_pl_dev_system_25077

I create all the files in a directory I created in /tmp where I have full write and read permissions.

So the complete Path would be: /tmp/pl_dev/shm_pl_dev_system_25077

I create several files there, some fifo pipes and other stuff and also the shm. The only Problem I get is that shm_open will always return the errno 63 (ENAMETOOLONG).

Can you tell me what the issue here is?

Here is the code:

        handle_ = ::shm_open(shm_name.get(), O_RDWR, 0755);
        if (handle_ == -1 && errno == ENOENT)
        {
            // SHM does not yet exists, so create it!
            handle_ = ::shm_open(shm_name.get(), O_CREAT | O_RDWR, 0755);
            if (handle_ != -1) {
                created_ = true;
            }
            else
            {
                if (!silent_)
                {
                    log.error("Couldn't create the SHM (%d).", errno);
                }
                return false;
            }
        }

1 Answer 1

4

Okay. As it seems OSX is very limited in the filename of SHMs... The maximum length for a filename currently is 31 chars per section (see PSHMNAMELENGTH in /usr/include/sys/posix_shm.h)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.