Sponsored Content
Full Discussion: shmat() with fixed address
Top Forums Programming shmat() with fixed address Post 302477555 by sajjar on Sunday 5th of December 2010 08:23:49 PM
Old 12-05-2010
shmat() with fixed address

Hi,
I'm using Ubuntu 10.04 on a 64bit machine.

In my shmat() call, I want to assign fixed memory address to shmaddr variable. I have no idea which address value to give. Some where in the net I read we can make use of sysproc info to know the user space addresses, but could not figure out how to get that, please help on this.
void *shmat(int shmid, const void *shmaddr, int shmflg);

Note:
-----
the reason I want to use fixed address is to build linked list on the shmget() returned memory and my other process will map into fixed address and access the linked list.
 

10 More Discussions You Might Find Interesting

1. HP-UX

shmat() permission denied, what's this?

I have installed an application that runs correctly for root but not other users. The application generates an error that indicates users don't have permission to attach to shared memory. A daemon process creates the shared memory segment. I've checked every permission I can think of but nothing... (2 Replies)
Discussion started by: km4hr
2 Replies

2. Programming

shmat problem

The first shmat in my program cannot fetch the start address of the shared memory. #include <stdio.h> #include <unistd.h> #include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> int main(int argc,char *argv) { int pid; key_t mykey; int shmid; long *shm; long *shm2; ... (3 Replies)
Discussion started by: yong
3 Replies

3. Linux

shmat() Failure While Using a Large Amount of Shared Memory

Hi, I'm developing a data processing pipeline with multiple stages, with data being moved between the stages using shared memory segments. The size of the data is typically of the order of hundreds of megabytes, and there are typically a few tens of main shared memory segments each of size... (2 Replies)
Discussion started by: theicarusagenda
2 Replies

4. AIX

sharemem-f-shmat

Hi, I got this error from AIX 4.3.3/db2 7: * %SHAREMEM-F-SHMAT Error getting PUTPARM shared memory address , shmid=23029 * * 3630, errno=13 Anybody who know how to fix this? Thanks in advance, itik (1 Reply)
Discussion started by: itik
1 Replies

5. UNIX for Advanced & Expert Users

Problem shmat in HP-UX. EINVAL Error

I have a process that need two active connections to the same zone of shared memory. But when i do the second call to shmat it give me error 22 (EINVAL). Only works ok the second call to shmat if i disconnect the first connection (shmdt) In Sun,AIX and Digital, i donīt have this problem. ... (7 Replies)
Discussion started by: dairby
7 Replies

6. Programming

Problem shmat in HP-UX Titanium ia64. EINVAL Error

I have a process that needs two active connections to the same zone of shared memory simultaneously. The firs conection works ok, but when i do the second call to shmat it give me error 22 (EINVAL). Only works ok the second call to shmat if i disconnect the first connection (shmdt) Steps:... (3 Replies)
Discussion started by: dairby
3 Replies

7. Debian

Question on the dhcp-server configuration for a fixed IP address.

Hi , when i configure my server with a fixed ip address in dhcpd.conf as below subnet 172.21.151.0 netmask 255.255.255.0 { range 172.21.151.66 172.21.151.66; } host switch { hardware ethernet 00:05:30:02:DB:31; fixed-address 172.21.151.66; } when i start dhcpd server , it... (2 Replies)
Discussion started by: Gopi Krishna P
2 Replies

8. UNIX for Advanced & Expert Users

Doubt on fixed ip address assinged by dhcp server?

we can assign a dynamic and fixed ip address for a dhcp_client through dhcp server , if it is dynamic ip address , it would be having lease time and renews after half of the leasetime gets over. would the same funda applies for fixed ip address to .. i dont think so ... please confirm on the... (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies

9. SuSE

shmat failed due to Cannot allocate memory

Hi, My program was running for a whole night. after 12 hours i got an error message "Cannot allocate memory" during the shmat commmand. So can you please let me know what could be the reason? is there any solution? thanks in advance. Regards, Mano (5 Replies)
Discussion started by: ManoharanMani
5 Replies

10. UNIX for Advanced & Expert Users

C program to detect duplicate ip address if any after assigning ip address to ethernet interface

Hi , Could someone let me know how to detect duplicate ip address after assigning ip address to ethernet interface using c program (3 Replies)
Discussion started by: Gopi Krishna P
3 Replies
SHMAT(2)						      BSD System Calls Manual							  SHMAT(2)

NAME
shmat, shmdt -- map/unmap shared memory SYNOPSIS
#include <sys/shm.h> void * shmat(int shmid, const void *shmaddr, int shmflg); int shmdt(const void *shmaddr); DESCRIPTION
shmat() maps the shared memory segment associated with the shared memory identifier shmid into the address space of the calling process. The address at which the segment is mapped is determined by the shmaddr parameter. If it is equal to 0, the system will pick an address itself. Otherwise, an attempt is made to map the shared memory segment at the address shmaddr specifies. If SHM_RND is set in shmflg, the system will round the address down to a multiple of SHMLBA bytes (SHMLBA is defined in <sys/shm.h> ). A shared memory segment can be mapped read-only by specifying the SHM_RDONLY flag in shmflg. shmdt() unmaps the shared memory segment that is currently mapped at shmaddr from the calling process' address space. shmaddr must be a value returned by a prior shmat() call. A shared memory segment will remain existant until it is removed by a call to shmctl(2) with the IPC_RMID command. RETURN VALUES
shmat() returns the address at which the shared memory segment has been mapped into the calling process' address space when successful, shmdt() returns 0 on successful completion. Otherwise, a value of -1 is returned, and the global variable errno is set to indicate the error. ERRORS
The shmat() system call will fail if: [EACCES] The calling process has no permission to access this shared memory segment. [EINVAL] shmid is not a valid shared memory identifier. shmaddr specifies an illegal address. [EMFILE] The number of shared memory segments has reached the system-wide limit. [ENOMEM] There is not enough available data space for the calling process to map the shared memory segment. The shmdt() system call will fail if: [EINVAL] shmaddr is not the start address of a mapped shared memory segment. LEGACY SYNOPSIS
#include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h> The include files <sys/types.h> and <sys/ipc.h> are necessary for both functions. SEE ALSO
mmap(2), shmctl(2), shmget(2), compat(5) BSD
August 17, 1995 BSD
All times are GMT -4. The time now is 06:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy