04-09-2010
Quote:
Originally Posted by
jimmyuk
Hi all,
I have been working on shared memory. I have created the shared memory and a linked list of 5 nodes. Now I want to attach the linked list to shared memory. When we attach a shared memory it returns a void pointer, but here I am in a fix , how to relate this void pointer to linked list. So please help me out.
What do you mean by "attach the linked list to shared memory"? Do you want some region of shared memory to be in the linked list somehow, or do you want to create a linked list that resides
in the shared memory so that other processes can use it?
If it's the latter, you need to "manage" the shared memory yourself and create the various data structures your linked list needs, moving them into shared memory where appropriate.
However, that seems like a fairly large undertaking - why do you want to do this?
John G
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
I am running HP-UX B.11.11.
I'm increasing a parameter for a database engine so that it uses more memory to buffer the disk drive (to speed up performance). I have over 5GB of memory not being used.
But when I try to start the DB with the increased buffer parameter I get told.
"Not... (1 Reply)
Discussion started by: cjcamaro
1 Replies
2. Programming
I need to create a shared library to access an in memory DB. The DB is not huge, but big enough to make it cumbersome to carry around in every single process using the shared library. Luckily, it is pretty static information, so I don't need to worry much about synchronizing the data between... (12 Replies)
Discussion started by: DreamWarrior
12 Replies
3. Programming
I am writing a shared library in Linux (but compatible with other UNIXes) and I want to allow multiple instances to share a piece of memory -- 1 byte is enough. What's the "best" way to do this? I want to optimize for speed and portability.
Obviously, I'll have to worry about mutual exclusion. (0 Replies)
Discussion started by: otheus
0 Replies
4. HP-UX
I'm not an HP-UX Admin professional, but rather a Lawson ERP installer. I'm looking for clues on how to troubleshoot this issue. I have WAS 6.1 ND running on HP-UX 11.23 PA-RISC with the Lawson ERP application . When I start the Lawson application, no errors arise. When I start WAS app server, an... (4 Replies)
Discussion started by: mrvitas
4 Replies
5. UNIX for Dummies Questions & Answers
hi,
For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process.
And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to change... (0 Replies)
Discussion started by: zerocool_08
0 Replies
6. Linux
hi,
For some special reason , I'd like to control the memory address for the shared libraries in my dynamically linked process.
And it is the "ld" which interpret the dynamically linked library, and in my system, the "ld-linux.so.2" is put at 0x00812000. Then I use "prelink -r" command to... (3 Replies)
Discussion started by: zerocool_08
3 Replies
7. UNIX for Dummies Questions & Answers
Hi all,
I have been working on shared memory. I have created the shared memory and a linked list of 5 nodes. Now I want to attach the linked list to shared memory. When we attach a shared memory it returns a void pointer, but here I am in a fix , how to relate this void pointer to linked list.... (1 Reply)
Discussion started by: jimmyuk
1 Replies
8. Programming
is this possible, if so plz please share with me..
Correct English please, not Cyber-/Leetspeak (11 Replies)
Discussion started by: vijay_manpage
11 Replies
9. Programming
Hello.
I am new to this forum and I would like to ask for advice about low level POSIX programming.
I have to implement a POSIX compliant C shared library.
A file will have some variables and the shared library will have some functions which need those variables.
There is one special... (5 Replies)
Discussion started by: iamjag
5 Replies
10. AIX
I want to create a shared lib with certain libs statically linked to it. I can generate a fully shared lib as follows:
gcc -maix64 -DHAVE_CONFIG_H -I. -I./src -DHAVE_OPENSSL -I/usr/include/openssl -I/usr/include -I/usr/include/apr-1 -D_LARGEFILE64_SOURCE -I/usr/java8_64/include -shared -o... (0 Replies)
Discussion started by: amandeepgautam
0 Replies
LEARN ABOUT OPENDARWIN
shmget
SHMGET(2) BSD System Calls Manual SHMGET(2)
NAME
shmget -- get shared memory area identifier
SYNOPSIS
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
int
shmget(key_t key, int size, int shmflg);
DESCRIPTION
shmget() returns the shared memory identifier associated with the key key.
A shared memory segment is created if either key is equal to IPC_PRIVATE, or key does not have a shared memory segment identifier associated
with it, and the IPC_CREAT bit is set in shmflg.
If a new shared memory segment is created, the data structure associated with it (the shmid_ds structure, see shmctl(2)) is initialized as
follows:
o shm_perm.cuid and shm_perm.uid are set to the effective uid of the calling process.
o shm_perm.gid and shm_perm.cgid are set to the effective gid of the calling process.
o shm_perm.mode is set to the lower 9 bits of shmflg.
o shm_lpid, shm_nattch, shm_atime, and shm_dtime are set to 0
o shm_ctime is set to the current time.
o shm_segsz is set to the value of size.
RETURN VALUES
Upon successful completion a positive shared memory segment identifier is returned. Otherwise, -1 is returned and the global variable errno
is set to indicate the error.
ERRORS
[EACESS] A shared memory segment is already associated with key and the caller has no permission to access it.
[EEXIST] Both IPC_CREAT and IPC_EXCL are set in shmflg, and a shared memory segment is already associated with key.
[ENOSPC] A new shared memory indentifier could not be created because the system limit for the number of shared memory identifiers
has been reached.
[ENOENT] IPC_CREAT was not set in shmflg and no shared memory segment associated with key was found.
[ENOMEM] There is not enough memory left to created a shared memory segment of the requested size.
SEE ALSO
shmctl(2), shmat(2), shmdt(2)
BSD
August 17, 1995 BSD