Sponsored Content
Top Forums Programming Problem accessing struct member Post 302097821 by Corona688 on Tuesday 28th of November 2006 10:22:15 PM
Old 11-28-2006
Quote:
How do I define a pointer to the above structure variable X of the type ucontext_t from within another function?
Code:
void foo()
{
  struct A a;
  ucontext_t *p=&(a.X);
}

Note that you can't return that pointer. It will cease to be valid when the function returns as it's a local variable.

Last edited by Corona688; 11-28-2006 at 11:29 PM..
 

10 More Discussions You Might Find Interesting

1. Programming

struct tm problem

I receive an integer as argument for a function. within function definition i want it to be of type struct tm. eg.. main() { int a; ...... } function(...,..,a,..) int a; { struct tm tm; if(!a) ^ time(&a); ^ ... (4 Replies)
Discussion started by: bankpro
4 Replies

2. Shell Programming and Scripting

Problem accessing csh ?? (Newbie)

Hi All, Just recently started using a program in Unix for a client. I was sent a script to use but for some reason it's not working. The person who created the script first suggested I may need to edit the first line of the script so that it has the correct path for the csh file: #!/bin/csh -f... (3 Replies)
Discussion started by: gmalt
3 Replies

3. Solaris

Problem with accessing SAN disks

Hi, I'm having a problem when attempting to define the OCR location for my 10g RAC setup on Solaris 10. I get the following error: The specified shared raw partition /dev/did/rdsk/d1s0 may not have the correct permission. Verify that the partition is owned by Oracle user. As per the Oracle10g... (15 Replies)
Discussion started by: michael.chow
15 Replies

4. Solaris

Problem Accessing disk

Basically I´m Absolutely New to Opensolaris (Started Using It This Morning), I´m Following A Tutorial On How To Access NTFS Partitions. Device Driver Utility Finds It And Says Everythings Fine With It DISK : ST3160022ACE Capacity : 160G Driver ... (7 Replies)
Discussion started by: xXCanisLupusXx
7 Replies

5. UNIX for Advanced & Expert Users

problem with netfilter hook function struct skbuff *sock is null..

iam trying to built a firewall.so i have used netfilter for it. in function main_hook sock_buff is returning null and in my log file continuously "sock buff null" is printed plse help to solve this problem.. (using print_string iam printing strings on current terminal (terminal we ping)) ... (1 Reply)
Discussion started by: pavan6754
1 Replies

6. Programming

Compiling virtual network adapter driver problem (net_device struct)

Hi, I found on linuxgazette.net/93/bhaskaran.html page very useful sample of virtual driver (not connected to real hardware). I try to compile it with no effect. So: I got fresh Ubuntu 9.10 (kernel 2.6.31-14) My source is saved in networkAdapter.c file in /usr/src/myModules directory. I... (21 Replies)
Discussion started by: Chrisdot
21 Replies

7. IP Networking

Problem accessing my domain from some computers

I hope I'm posting this in the right forum... Hi, I'm a newbie trying to set up my own home web server. I have an old laptop where I have a LAMP set up. Virgin Media won't give me a static IP so I am using dyndns, my IP hasn't changed for months anyway... So the problem is this... The... (5 Replies)
Discussion started by: Percyval
5 Replies

8. Programming

Problem defining a struct

I have the following code and getting the compilation errors baseLib/DynBaseObj.h:80: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:89: error: expected constructor, destructor, or type conversion before ‘(' token baseLib/DynBaseObj.h:101:... (0 Replies)
Discussion started by: kristinu
0 Replies

9. Programming

Storing C++-struct in file - problem when adding new item in struct

Hi, I have received an application that stores some properties in a file. The existing struct looks like this: struct TData { UINT uSizeIncludingStrings; // copy of Telnet data struct UINT uSize; // basic properties: TCHAR szHost; //defined in Sshconfig UINT iPortNr; TCHAR... (2 Replies)
Discussion started by: Powerponken
2 Replies

10. 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
GETCONTEXT(3)						   BSD Library Functions Manual 					     GETCONTEXT(3)

NAME
getcontext, getcontextx, setcontext -- get and set user thread context LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <ucontext.h> int getcontext(ucontext_t *ucp); ucontext_t * getcontextx(void); int setcontext(const ucontext_t *ucp); DESCRIPTION
The getcontext() function saves the current thread's execution context in the structure pointed to by ucp. This saved context may then later be restored by calling setcontext(). The getcontextx() function saves the current execution context in the newly allocated structure ucontext_t, which is returned on success. If architecture defines additional CPU states that can be stored in extended blocks referenced from the ucontext_t, the memory for them may be allocated and their context also stored. Memory returned by getcontextx() function shall be freed using free(3). The setcontext() function makes a previously saved thread context the current thread context, i.e., the current context is lost and setcontext() does not return. Instead, execution continues in the context specified by ucp, which must have been previously initialized by a call to getcontext(), makecontext(3), or by being passed as an argument to a signal handler (see sigaction(2)). If ucp was initialized by getcontext(), then execution continues as if the original getcontext() call had just returned (again). If ucp was initialized by makecontext(3), execution continues with the invocation of the function specified to makecontext(3). When that function returns, ucp->uc_link determines what happens next: if ucp->uc_link is NULL, the process exits; otherwise, setcontext(ucp->uc_link) is implicitly invoked. If ucp was initialized by the invocation of a signal handler, execution continues at the point the thread was interrupted by the signal. RETURN VALUES
If successful, getcontext() returns zero and setcontext() does not return; otherwise -1 is returned. The getcontextx() returns pointer to the allocated and initialized context on success, and NULL on failure. ERRORS
No errors are defined for getcontext() or setcontext(). The getcontextx() may return the following errors in errno: [ENOMEM] No memory was available to allocate for the context or some extended state. SEE ALSO
sigaction(2), sigaltstack(2), makecontext(3), ucontext(3) BSD
March 13, 2013 BSD
All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy