Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game. |
| 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
08-25-2010, 10:50 PM
|
#1
|
|
LQ Newbie
Registered: Aug 2010
Posts: 10
Rep:
|
Total amount of allocated SHM memory?
Is there an easy way in C to get the total amount of allocated SHM memory on a machine?
|
|
|
|
08-26-2010, 03:57 PM
|
#2
|
|
Senior Member
Registered: Feb 2010
Location: /usa/ca/orange_county/lake_forest
Distribution: ArchBang, Google Android 2.1 + Motoblur (on Motortola Flipside), Google Chrome OS (on Cr-48)
Posts: 1,791
Rep:
|
It would probably be C's equivalent to the following shell command:
|
|
|
|
08-26-2010, 05:03 PM
|
#3
|
|
Senior Member
Registered: May 2005
Posts: 4,386
|
Quote:
Originally Posted by Kenny_Strawn
It would probably be C's equivalent to the following shell command:
|
?????
Code:
file /dev/shm
/dev/shm: sticky directory
|
|
|
|
08-26-2010, 05:11 PM
|
#4
|
|
Senior Member
Registered: May 2005
Posts: 4,386
|
man 2 shmctl
|
|
|
|
08-27-2010, 07:05 AM
|
#5
|
|
LQ Newbie
Registered: Aug 2010
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by Sergei Steshenko
man 2 shmctl
|
This is what I was looking for. Thanks!
|
|
|
|
08-27-2010, 05:33 PM
|
#6
|
|
LQ Newbie
Registered: Aug 2010
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by Sergei Steshenko
man 2 shmctl
|
Sorry this does not work. shmctl recognizes only System V shared memory and I am working with POSIX shm... Is there anything equivalent for POSIX shm?
|
|
|
|
08-27-2010, 06:02 PM
|
#7
|
|
Senior Member
Registered: May 2005
Posts: 4,386
|
Quote:
Originally Posted by kresyzig
Sorry this does not work. shmctl recognizes only System V shared memory and I am working with POSIX shm... Is there anything equivalent for POSIX shm?
|
Maybe
http://www.cs.cf.ac.uk/Dave/C/node27...00000000000000 .
|
|
|
|
08-28-2010, 02:34 AM
|
#8
|
|
LQ Newbie
Registered: Aug 2010
Posts: 10
Original Poster
Rep:
|
Quote:
Originally Posted by Sergei Steshenko
|
Finally I have used opendir("/dev/shm") combined with readdir_r to get the size of the pseudo-files in /dev/shm/ /. This is the only way I have found to compute the total amount of shared memory. That works fine, I just don't know if there is a more optimal method...
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 05:26 PM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|