Thank you for explanation. I think I pinpointed a culprit code, which happen to be part of parsing config file.
The code in red was not there, so for a line that would start with # comment the code tries to access buf[-1]. How peculiar that the error lingered there and was never causing troubles before my stack shifted as a result of arrays size growth.
BTW, the segfault happen on the consequent fgetc after the line with starting # hash mark.
Hi.
Can someone to help me in a segfault problem?
I have a big C++ program that crash from time to time because it receive the SIGSEGV signal.
So my question is: Can I find, without using gdb or other debugging tools, which line from source code cause that problem? Or if exist some gdb API... (1 Reply)
Here is my initiating code:
#define NUM 20
static struct tab {
int count;
int use;
} tab;
int curtab = 0;
int tab_create(int tab_count)
{
curtab++;
tab.use = 1;
tab.count = tab_count;
kprintf("here!");
return curtab;
} (2 Replies)
Hello - I am finding difficulty in creating and allocating correct size to File Systems on solarix x86 box. Please see below contents I followed on screen and in the end It shows that /app file system is created of size 135GB , I wanted it to be 30gb as mentioned during 'format' command in 'Enter... (7 Replies)
Hi
I am getting a strange segmentation fault during the unwind
process. I am trying to throw an object of an Exception class.
During the DoThrow (in libC.a) the stack starts growing until a
Signal is received.
The object thrown is of a class that inherits from a common class,
and the signal... (0 Replies)
i wrote handler for sigsegv such that i can allocate memory for a variable to which
sigsegv generated for illlegal acces of memory.
my code is
#include <signal.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
char *j;
void segv_handler(int dummy)
{
j=(char *)malloc(10);
... (4 Replies)
Hello,
One of our customer is getting segmentation fault when he runs his shell script which invokes our executable on AIX 6.1.
On AIX 5.3, there were no issues.
Here is the truss output.
811242: __loadx(0x0A040000, 0xF0D3A26C, 0x00000000, 0x00000009, 0x00000000) = 0xF026E884... (0 Replies)
I receive a sigsegv failure. I was under the impression that a core file is created everytime a sigsegv occurrs and the process is terminated. I have had two recent occurrances of a core file not being created. Does anyone know why a core file would not be created. (2 Replies)
While running script I am getting an error like
Few lines in data are not being processed.
After googling it I came to know that adding such line would give some memory to it
ini_set("memory_limit","64M");
my input file size is 1 GB.
Is that memory limit is based on RAM we have on... (1 Reply)
Hi
I want to create a SIGSEGV when program tries to access one particular area in memory. Is this possible. If so whats the command. (4 Replies)
Discussion started by: jionnet
4 Replies
LEARN ABOUT OPENSOLARIS
pthread_attr_setguardsize
pthread_attr_getguardsize(3C) Standard C Library Functions pthread_attr_getguardsize(3C)NAME
pthread_attr_getguardsize, pthread_attr_setguardsize - get or set thread guardsize attribute
SYNOPSIS
cc -mt [ flag... ] file... -lpthread [ library... ]
#include <pthread.h>
int pthread_attr_getguardsize(const pthread_attr_t *restrict attr,
size_t *restrict guardsize);
int pthread_attr_setguardsize(pthread_attr_t *attr, size_t guardsize);
DESCRIPTION
The guardsize attribute controls the size of the guard area for the created thread's stack. The guardsize attribute provides protection
against overflow of the stack pointer. If a thread's stack is created with guard protection, the implementation allocates extra memory at
the overflow end of the stack as a buffer against stack overflow of the stack pointer. If an application overflows into this buffer an
error results (possibly in a SIGSEGV signal being delivered to the thread).
The guardsize attribute is provided to the application for two reasons:
1. Overflow protection can potentially result in wasted system resources. An application that creates a large number of threads,
and which knows its threads will never overflow their stack, can save system resources by turning off guard areas.
2. When threads allocate large data structures on the stack, large guard areas may be needed to detect stack overflow.
The pthread_attr_getguardsize() function gets the guardsize attribute in the attr object. This attribute is returned in the guardsize
parameter.
The pthread_attr_setguardsize() function sets the guardsize attribute in the attr object. The new value of this attribute is obtained from
the guardsize parameter. If guardsize is 0, a guard area will not be provided for threads created with attr. If guardsize is greater than
0, a guard area of at least size guardsize bytes is provided for each thread created with attr.
A conforming implementation is permitted to round up the value contained in guardsize to a multiple of the configurable system variable
PAGESIZE. If an implementation rounds up the value of guardsize to a multiple of PAGESIZE, a call to pthread_attr_getguardsize() specify-
ing attr will store in the guardsize parameter the guard size specified by the previous pthread_attr_setguardsize() function call.
The default value of the guardsize attribute is PAGESIZE bytes. The actual value of PAGESIZE is implementation-dependent and may not be
the same on all implementations.
If the stackaddr attribute has been set (that is, the caller is allocating and managing its own thread stacks), the guardsize attribute is
ignored and no protection will be provided by the implementation. It is the responsibility of the application to manage stack overflow
along with stack allocation and management in this case.
RETURN VALUES
If successful, the pthread_attr_getguardsize() and pthread_attr_setguardsize() functions return 0. Otherwise, an error number is returned
to indicate the error.
ERRORS
The pthread_attr_getguardsize() and pthread_attr_setguardsize() functions will fail if:
EINVAL The attribute attr is invalid.
EINVAL The parameter guardsize is invalid.
EINVAL The parameter guardsize contains an invalid value.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO sysconf(3C), pthread_attr_init(3C), attributes(5), standards(5)SunOS 5.11 23 mar 2005 pthread_attr_getguardsize(3C)