Sponsored Content
Top Forums Programming Problem shmat in HP-UX Titanium ia64. EINVAL Error Post 302340263 by dairby on Monday 3rd of August 2009 06:07:19 AM
Old 08-03-2009
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: Iīm going to shared a integer.
1š.- Create shared memory OK:
iIdentificador = shmget(5000,sizeof(int),IPC_CREAT | 0777); //In the original source the key is not hardcode...

2š.-Connection 1 and view the integer shared. Works OK:
piIntegerShared_1=(int *)shmat(iIdentificador,NULL,0))
printf("\n\t =>Dato compartido [%ld]\n",*piIntegerShared_1);

3š.-Connection 2: ERROR !!!:
if((piIntegerShared_2=(int *)shmat(iIdentificador,NULL,0))==(void*)-1)
printf("\n\n\t ERROR shmat memoria2 [%d] [%s]",errno,strerror(errno));

Output: ERROR shmat memoria2 [22] [Invalid argument]

The connection 2 only works ok, if i before delete the connection 1 with:
shmdt(piIntegerShared_1);

Which is the problem in the step 3?
In Sun,AIX and Digital, i donīt have this problem all connection works ok. Only in HP-UX (Itanium - ia64) 11i Version 2: August 2003

Thanks,
David

Last edited by dairby; 08-03-2009 at 10:59 AM..
 

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. UNIX for Dummies Questions & Answers

HP-UX 11.23 ia64 and Glance

I've been searching and cannot seem to find anywhere online a link to a manual for Glance. Does anyone have a link to this? I searched in here already and the links I found on a post from 2002 were dead. And more to the point, do you know if you can use Glance to see Disk I/O per logical... (2 Replies)
Discussion started by: LisaS
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. SuSE

problem of readdir on IA64 suse

Dear Experts, i am trying to find whether the given name is file or a directory dirp = opendir(dirname); direntp = readdir(dirp); if(direntp->d_type & DT_DIR) { printf("\n is a dirctory"); } else { //dir_or_file = Mtrue; printf("\n not a directory"); } it always... (9 Replies)
Discussion started by: vin_pll
9 Replies

7. Emergency UNIX and Linux Support

Gbrowse and GD installation in ia64 linux problem facing...

Hi all, I'm trying to install of Gbrowse recently. Unfortunately, I stuck at the step to install GD which are prerequisite for Gbrowse installation. I got try to install it, but it seems like got a lot of error message occurred :( And still can't fix the problem yet. I'm using ia64 linux... (10 Replies)
Discussion started by: patrick87
10 Replies

8. Programming

request_irq always returns EINVAL

request_irq always returns EINVAL What am I doing wrong here ? int mydrvr_open(struct inode *inode, struct file *filp) { int ret; printk("<1> \nModule Opened!"); //disable_irq(4); //free_irq(4, NULL); ret = request_irq(4, &imr_interrupt_handler,IRQF_SHARED,... (0 Replies)
Discussion started by: dragonpoint
0 Replies

9. Programming

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... (1 Reply)
Discussion started by: sajjar
1 Replies

10. Emergency UNIX and Linux Support

Redhat 4 and X-Fi Titanium not working

Hi, I have a dell T3500 running redhat 4 U8 with a X-Fi Titanium sound card. However alsaconf cant seem to see it. It shows up in lspci: uname -a Linux swlin114 2.6.9-89.0.23.ELsmp #1 SMP Fri Mar 5 23:27:13 EST 2010 x86_64 x86_64 x86_64 GNU/Linux 01:00.0 Audio device: Creative Labs... (2 Replies)
Discussion started by: chris.lewis28
2 Replies
explain_shmat_or_die(3) 				     Library Functions Manual					   explain_shmat_or_die(3)

NAME
explain_shmat_or_die - shared memory attach and report errors SYNOPSIS
#include <libexplain/shmat.h> void *explain_shmat_or_die(int shmid, const void *shmaddr, int shmflg); void *explain_shmat_on_error(int shmid, const void *shmaddr, int shmflg); DESCRIPTION
The explain_shmat_or_die function is used to call the shmat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_shmat(3) function, and then the process terminates by calling exit(EXIT_FAILURE). The explain_shmat_on_error function is used to call the shmat(2) system call. On failure an explanation will be printed to stderr, obtained from the explain_shmat(3) function, but still returns to the caller. shmid The shmid, exactly as to be passed to the shmat(2) system call. shmaddr The shmaddr, exactly as to be passed to the shmat(2) system call. shmflg The shmflg, exactly as to be passed to the shmat(2) system call. RETURN VALUE
The explain_shmat_or_die function only returns on success, see shmat(2) for more information. On failure, prints an explanation and exits, it does not return. The explain_shmat_on_error function always returns the value return by the wrapped shmat(2) system call. EXAMPLE
The explain_shmat_or_die function is intended to be used in a fashion similar to the following example: void *result = explain_shmat_or_die(shmid, shmaddr, shmflg); SEE ALSO
shmat(2) shared memory attach explain_shmat(3) explain shmat(2) errors exit(2) terminate the calling process COPYRIGHT
libexplain version 0.52 Copyright (C) 2011 Peter Miller explain_shmat_or_die(3)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy