c - Cygwin/Cygserver Shared memory -


i trying migrate shared memory code centos(3.5) cygwin(2.8.1, win10). shared memory work this:

  1. spawn shared memory @ process shmget.

  2. map shared memory on process shmat , record location, fill information memory.

  3. map shared memory on process "shmat", pass location of last process recorded, because expect both processes mapping shared memory @ same address.

here code explain:

// 1 process size_t size = 1024 * 1024;//1m int id = shmget(ipc_private, size, 0660); char *madr = 0; char *location = shmat(id, madr, 0);  // process char *location1 = shmat(id, location , 0); // !!!we hope location1 , location should same!!! 

on centos works well.

on cygwin 1 process mapped shared memory @ 0xffd90000, process not same mapped @ oxffdb0000. check memory 0xffd90000 available on process.

wrong expectation on linux, see
https://linux.die.net/man/2/shmat

be aware shared memory segment attached in way may attached @ different addresses in different processes. therefore, pointers maintained within shared memory must made relative (typically starting address of segment), rather absolute.


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -