Sponsored Content
Top Forums Programming C. To segmentation fault or not to segmentation fault, that is the question. Post 303032350 by nezabudka on Friday 15th of March 2019 12:55:00 PM
Old 03-15-2019
Hi,
Both systems are 64 bit?
Maybe this is due to the red zone in the stack?

--- Post updated at 19:55 ---

Or maybe on the second system the usual garbage enters this area of the stack?
 

10 More Discussions You Might Find Interesting

1. Programming

segmentation fault

sometimes for this code i get a segmentation fault for codes llike this : int main{ int * a= 0; int b; a = (int*)malloc(sizeof(int)); ///some code using these variable but no freeing of a if(a){ free(a); a = 0; } return... (3 Replies)
Discussion started by: wojtyla
3 Replies

2. AIX

Segmentation fault

Hi , During execution a backup binary i get following error "Program error 11 (Segmentation fault), saving core file in '/usr/datatools" Riyaz (2 Replies)
Discussion started by: rshaikh
2 Replies

3. Linux

Segmentation fault

Hi, on a linux Red HAT(with Oracle DB 9.2.0.7) I have following error : RMAN> delete obsolete; RMAN retention policy will be applied to the command RMAN retention policy is set to redundancy 2 using channel ORA_DISK_1 Segmentation fault What does it mean ? And the solution ? Many thanks. (0 Replies)
Discussion started by: big123456
0 Replies

4. Programming

segmentation fault

If I do this. Assume struct life { char *nolife; } struct life **life; // malloc initialization & everything if(life->nolife == 0) Would I get error at life->nolife if it is equal to 0. wrong accession? (3 Replies)
Discussion started by: joey
3 Replies

5. Programming

Segmentation fault.

I'm getting a segmentation fault. I'm new to Linux programming. Thanks so much for all of your input.:eek: #include </usr/include/mysql++/mysql++.h> #include <stdio.h> #include <iostream> #include <sstream> #include <string.h> using namespace std; int outputToImport(const char*... (1 Reply)
Discussion started by: sepoto
1 Replies

6. Programming

Segmentation fault in C

i have this code int already_there(char *client_names, char *username) { int i; for(i = 0; i<NUM; i++) { printf("HERE\n"); if (strcmp(client_names, username)==0) return(1); } return(0); } and i get a segmentation fault, whats wrong here? (7 Replies)
Discussion started by: omega666
7 Replies

7. UNIX for Advanced & Expert Users

segmentation fault with ps

What does this mean and why is this happening? $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps -ef | grep ocular Segmentation fault (core dumped) $ ps aux | grep ocular Segmentation fault (core dumped) $ ps Segmentation fault (core dumped) $ pkill okular $ ps... (1 Reply)
Discussion started by: cokedude
1 Replies

8. Programming

Using gdb, ignore beginning segmentation fault until reproduce environment segmentation fault

I use a binary name (ie polo) it gets some parameter , so for debugging normally i do this : i wrote script for watchdog my app (polo) and check every second if it's not running then start it , the problem is , if my app , remain in state of segmentation fault for a while (ie 15 ... (6 Replies)
Discussion started by: pooyair
6 Replies

9. Homework & Coursework Questions

Segmentation Fault

this is a network programming code to run a rock paper scissors in a client and server. I completed it and it was working without any error. After I added the findWinner function to the server code it starts giving me segmentation fault. -the segmentation fault is fixed Current problem -Also... (3 Replies)
Discussion started by: femchi
3 Replies

10. Solaris

Segmentation fault

Hi Guys, I just installed and booted a zone called testzone. When I logged in remotely and tried changing to root user I get this error: "Segmentation fault" Can someone please help me resolve this? Thanks alot (2 Replies)
Discussion started by: cjashu
2 Replies
sigaltstack(2)							   System Calls 						    sigaltstack(2)

NAME
sigaltstack - set or get signal alternate stack context SYNOPSIS
#include <signal.h> int sigaltstack(const stack_t *restrict ss, stack_t *restrict oss); DESCRIPTION
The sigaltstack() function allows a thread to define and examine the state of an alternate stack area on which signals are processed. If ss is non-zero, it specifies a pointer to and the size of a stack area on which to deliver signals, and informs the system whether the thread is currently executing on that stack. When a signal's action indicates its handler should execute on the alternate signal stack (speci- fied with a sigaction(2) call), the system checks whether the thread chosen to execute the signal handler is currently executing on that stack. If the thread is not currently executing on the signal stack, the system arranges a switch to the alternate signal stack for the duration of the signal handler's execution. The stack_t structure includes the following members: int *ss_sp long ss_size int ss_flags If ss is not NULL, it points to a structure specifying the alternate signal stack that will take effect upon successful return from sigalt- stack(). The ss_sp and ss_size members specify the new base and size of the stack, which is automatically adjusted for direction of growth and alignment. The ss_flags member specifies the new stack state and may be set to the following: SS_DISABLE The stack is to be disabled and ss_sp and ss_size are ignored. If SS_DISABLE is not set, the stack will be enabled. If oss is not NULL, it points to a structure specifying the alternate signal stack that was in effect prior to the call to sigaltstack(). The ss_sp and ss_size members specify the base and size of that stack. The ss_flags member specifies the stack's state, and may contain the following values: SS_ONSTACK The thread is currently executing on the alternate signal stack. Attempts to modify the alternate signal stack while the thread is executing on it will fail. SS_DISABLE The alternate signal stack is currently disabled. RETURN VALUES
Upon successful completion, 0 is return. Otherwise, -1 is returned and errno is set to indicate the error. ERRORS
The sigaltstack() function will fail if: EFAULT The ss or oss argument points to an illegal address. EINVAL The ss argument is not a null pointer, and the ss_flags member pointed to by ss contains flags other than SS_DISABLE. ENOMEM The size of the alternate stack area is less than MINSIGSTKSZ. EPERM An attempt was made to modify an active stack. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Interface Stability |Standard | +-----------------------------+-----------------------------+ |MT-Level |Async-Signal-Safe | +-----------------------------+-----------------------------+ SEE ALSO
getcontext(2), mmap(2), sigaction(2), ucontext.h(3HEAD), attributes(5), standards(5) NOTES
The value SIGSTKSZ is defined to be the number of bytes that would be used to cover the usual case when allocating an alternate stack area. The value MINSIGSTKSZ is defined to be the minimum stack size for a signal handler. In computing an alternate stack size, a program should add that amount to its stack requirements to allow for the operating system overhead. The following code fragment is typically used to allocate an alternate stack with an adjacent red zone (an unmapped page) to guard against stack overflow, as with default stacks: #include <signal.h> #include <sys/mman.h> stack_t sigstk; sigstk.ss_sp = mmap(NULL, SIGSTKSZ, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); if (sigstk.ss_sp == MAP_FAILED) /* error return */; sigstk.ss_size = SIGSTKSZ; sigstk.ss_flags = 0; if (sigaltstack(&sigstk, NULL) < 0) perror("sigaltstack"); SunOS 5.10 1 Nov 2003 sigaltstack(2)
All times are GMT -4. The time now is 10:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy