Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello Everyone,
I am trying to understand how to implement sharing of objects in memory between various processes in apache. I have been using the routines defined in <sys/mman.h> to implement the shared memory mapping functionality. However, I am not seeing any actual sharing of the objects in my output.
I have attached the code segment of my module containing the request handler:
"counter: 1, thread: 0, process: 18194, request: POST /login?destination=login HTTP/1.1, time: Wed Nov 16 19:56:04 2011;"
"counter: 2, thread: 0, process: 18194, request: POST /login?destination=login HTTP/1.1, time: Wed Nov 16 19:56:04 2011;"
"counter: 3, thread: 0, process: 18194, request: GET /login HTTP/1.1, time: Wed Nov 16 19:56:05 2011;"
"counter: 4, thread: 0, process: 18194, request: GET /login HTTP/1.1, time: Wed Nov 16 19:56:05 2011;"
"counter: 5, thread: 0, process: 18194, request: GET /dashboard HTTP/1.1, time: Wed Nov 16 19:56:06 2011;"
"counter: 6, thread: 0, process: 18194, request: GET /dashboard HTTP/1.1, time: Wed Nov 16 19:56:06 2011;"
"counter: 7, thread: 0, process: 18194, request: GET /viewfeeds HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 8, thread: 0, process: 18194, request: GET /viewfeeds HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 9, thread: 0, process: 18194, request: GET /viewfeeds/dosort&sortby=none HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 10, thread: 0, process: 18194, request: GET /viewfeeds/dosort&sortby=none HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 1, thread: 0, process: 18201, request: GET /misc/viewfeeds/images/sidebar_05.png HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 2, thread: 0, process: 18201, request: GET /misc/viewfeeds/images/sidebar_05.png HTTP/1.1, time: Wed Nov 16 19:56:07 2011;"
"counter: 11, thread: 0, process: 18194, request: GET /recordings HTTP/1.1, time: Wed Nov 16 19:56:08 2011;"
"counter: 12, thread: 0, process: 18194, request: GET /recordings HTTP/1.1, time: Wed Nov 16 19:56:08 2011;"
"counter: 13, thread: 0, process: 18194, request: GET /cop HTTP/1.1, time: Wed Nov 16 19:56:09 2011;"
"counter: 14, thread: 0, process: 18194, request: GET /cop HTTP/1.1, time: Wed Nov 16 19:56:09 2011;"
"counter: 15, thread: 0, process: 18194, request: GET /logout HTTP/1.1, time: Wed Nov 16 19:56:10 2011;"
"counter: 16, thread: 0, process: 18194, request: GET /logout HTTP/1.1, time: Wed Nov 16 19:56:10 2011;"
"counter: 17, thread: 0, process: 18194, request: GET / HTTP/1.1, time: Wed Nov 16 19:56:11 2011;"
As you can see, the counter is incremented within the same process correctly, but is not shared among different processes. Sorry, for the overly verbose message, but can anybody tell me how to fix the sharing of my variable ctr so that it is shared among all process?
Respectfully,
Pranesh
Last edited by programlight; 11-16-2011 at 04:40 PM.
Fixed the problem. I needed to the signature of the set_shared_region function to :set_shared_region(int **shared_int) and then change the call to the function accordingly.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.