Sponsored Content
Top Forums Programming Dereferencing pointer to a shared memory struct Post 302494141 by Corona688 on Saturday 5th of February 2011 03:16:49 PM
Old 02-05-2011
Typo.

Code:
struct iostruct *test;

Code:
struct io_struct *test;

You can actually declare pointers to structure types you've never declared anywhere if you never dereference them, but when you do try and use their members, you get something like this... Smilie
 

10 More Discussions You Might Find Interesting

1. Programming

Accesing structure member:Error:dereferencing pointer to incomplete type

$ gcc -Wall -Werror struct.c struct.c: In function `main': struct.c:18: error: dereferencing pointer to incomplete type $ cat struct.c #include <stdio.h> #include <stdlib.h> #include <string.h> /*Declaration of structure*/ struct human { char *first; char gender; int age; } man,... (3 Replies)
Discussion started by: amit4g
3 Replies

2. Programming

Pointer to a struct (with pointers) *** glibc detected *** double free

I am using a structure defined as follows struct gene_square { double *x; double *y; };I have class, with a member function which is a pointer of this type: gene_square* m_Genes;I am allocating memory in the constructors like this: m_Genes = new gene_square; for (ii=0;... (1 Reply)
Discussion started by: jatoo
1 Replies

3. UNIX for Dummies Questions & Answers

Build Error: error: dereferencing pointer to incomplete type

I'm getting the following Error: prepare_pcap.c: In function `prepare_pkts': prepare_pcap.c:127: error: dereferencing pointer to incomplete type prepare_pcap.c:138: error: dereferencing pointer to incomplete type ==================================== This is the part of the relevant... (8 Replies)
Discussion started by: katwala
8 Replies

4. Programming

Dereferencing pointer to incomplete type

// Hello all, I am having this error "Dereferencing pointer to incomplete type " on these 2 lines: xpoint = my_point->x; ypoint = my_point->y; I am having no clue y this is happening. Any help would be greately appreciated!!!! #include<stdio.h> #include<string.h>... (2 Replies)
Discussion started by: mind@work
2 Replies

5. Programming

linked list node with pointer to struct

Suppose to have: struct Tstudent { string name, surname; int matriculation_num; }; struct Tnode { Tstudent* student; Tnodo* next; } L;I want to deference that "student" pointer. For example, I tried with: *(L->student).matriculation_numbut it not worked, as terminal... (4 Replies)
Discussion started by: Luke Bonham
4 Replies

6. Programming

Compilation Error: dereferencing pointer to incomplete type

I am getting a dereferencing pointer to incomplete type error when i compile the following code on lines highlighted in red. Can anyone help me in identifying what is wrong in the code? #include<stdio.h> #include<stdlib.h> typedef struct{ int info; struct node* link ; } node; void... (3 Replies)
Discussion started by: sreeharshasn
3 Replies

7. Programming

Shared library with acces to shared memory.

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

8. Programming

Check The value a pointer returned by struct s_client != 0

Hi guys , i got segment fault , and when i trace , found it happens since the value of pointer which is returned by Struct S_client (*ptr) is zero if (ptr !=0)i know , adding above line of code is not the solution and not correct for the case since above line only check for the pointer... (1 Reply)
Discussion started by: pooyair
1 Replies

9. Programming

Declare member of struct as a pointer in c

I have a uint8_t *C = malloc(24*sizeof(uint8_t)); I need to send some integers and this *C to another node(in ad hoc network). So I am going to use a struct ` struct fulMsg { int msgType; int msgCount; //uint8_t *CC; } fulMsg_t; typedef struct fulMsg fulMsg_tt;` there is a method... (1 Reply)
Discussion started by: chap
1 Replies

10. UNIX for Advanced & Expert Users

Get pointer for existing device class (struct class) in Linux kernel module

Hi all! I am trying to register a device in an existing device class, but I am having trouble getting the pointer to an existing class. I can create a class in a module, get the pointer to it and then use it to register the device with: *cl = class_create(THIS_MODULE, className);... (0 Replies)
Discussion started by: hdaniel@ualg.pt
0 Replies
shmctl(2)							System Calls Manual							 shmctl(2)

Name
       shmctl - shared memory control operations

Syntax
       #include <sys/types.h>
       #include <sys/ipc.h>
       #include <sys/shm.h>

       int shmctl (shmid, cmd, buf)
       int shmid, cmd;
       struct shmid_ds *buf;

Description
       The system call provides a variety of shared memory control operations, as specified by cmd.  The following cmds are available:

       IPC_STAT       Place  the  current  value  of each member of the data structure associated with shmid into the structure pointed to by buf.
		      The contents of this structure are defined in

       IPC_SET	      Set the value of the following members of the data structure associated with shmid to the corresponding value found  in  the
		      structure pointed to by buf:
		      shm_perm.uid
		      shm_perm.gid
		      shm_perm.mode    /* only low 9 bits */

		       This  cmd  can  only be executed by a process that has an effective user ID equal to either that of the superuser or to the
		       value of in the data structure associated with shmid.

       IPC_RMID       Remove the shared memory identifier specified by shmid from the system and destroy the shared memory segment and data struc-
		      ture  associated	with  it. This cmd can only be executed by a process that has an effective user ID equal to either that of
		      the superuser or to the value of in the data structure associated with shmid.

       SHM_LOCK       Lock the shared memory segment specified by shmid in memory.  Lock prevents the shared memory segment from being swapped	or
		      paged.  This cmd can only be executed by a process that has an effective user ID equal to the superuser.

       SHM_UNLOCK     Unlock  the shared memory segment specified by shmid.  This cmd can only be executed by a process that has an effective user
		      ID equal to the superuser.

Return Values
       Upon successful completion, a value of zero (0) is returned.  Otherwise, a value of -1 is returned, and	errno  is  set	to  indicated  the
       error.

Diagnostics
       The system call fails if any of the following is true:

       [EINVAL]       The shmid is not a valid shared memory identifier.

       [EINVAL]       The cmd is not a valid command.

       [EACCES]       The cmd is equal to IPC_STAT, and read permission is denied to the calling process.  For further information, see

       [EPERM]	      The  cmd is equal to IPC_RMID or IPC_SET, and the effective user ID of the calling process is not equal to that of the supe-
		      ruser or to the value of in the data structure associated with shmid.

       [EPERM]	      The cmd is equal to SHM_LOCK or SHM_UNLOCK and the effective user ID of the calling process is not  equal  to  that  of  the
		      superuser.

       [EINVAL]       The cmd is equal to SHM_LOCK, and the shared memory segment is currently locked by this process.

       [EINVAL]       The  cmd	is equal to SHM_UNLOCK, and the shared memory segment specified by shmid is not currently locked in memory by this
		      process.

       [EFAULT]       The buf points to an illegal address.

See Also
       shmget(2), shmop(2)

																	 shmctl(2)
All times are GMT -4. The time now is 03:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy