From 52f86ea0075c66e18e4796ad88f45541da8b4de5 Mon Sep 17 00:00:00 2001 From: Miguel Date: Thu, 7 Mar 2019 23:26:17 +0100 Subject: some cleanup and such --- 080_blog/00035_Programming/00010_IPC/.index.md.swp | Bin 0 -> 12288 bytes 080_blog/00035_Programming/00010_IPC/index.md | 24 +++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 080_blog/00035_Programming/00010_IPC/.index.md.swp create mode 100644 080_blog/00035_Programming/00010_IPC/index.md (limited to '080_blog/00035_Programming/00010_IPC') diff --git a/080_blog/00035_Programming/00010_IPC/.index.md.swp b/080_blog/00035_Programming/00010_IPC/.index.md.swp new file mode 100644 index 0000000..87e0eaa Binary files /dev/null and b/080_blog/00035_Programming/00010_IPC/.index.md.swp differ diff --git a/080_blog/00035_Programming/00010_IPC/index.md b/080_blog/00035_Programming/00010_IPC/index.md new file mode 100644 index 0000000..e42e38f --- /dev/null +++ b/080_blog/00035_Programming/00010_IPC/index.md @@ -0,0 +1,24 @@ +# Inter Process Communication + March 14, 2018 + +We can attach nicely to same memory segment from 2 different processes: + +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ {.c .numberLines} +// ipc via shared mem +// attach to shared memory; +key_t my_ftok = ftok("~/surf-webext-dom-shared-mem",'a'); + +int mem_seg=shmget(my_ftok,1024*1024,IPC_CREAT|0660); +if(mem_seg==-1) +{ +g_print("shmget failed: %s\n",strerror(errno)); +} + +shared_buf=shmat(mem_seg,NULL,0); +if(shared_buf==(void*)-1) +{ +g_print("shmat failed: %s\n",strerror(errno)); +} +g_print("attached to shared memory.\n"); +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + -- cgit v1.2.3