Sponsored Content
Full Discussion: Wierd C program. Help Needed
Top Forums Programming Wierd C program. Help Needed Post 302145812 by n1djs on Thursday 15th of November 2007 09:21:26 AM
Old 11-15-2007
A SEGV by definition mean, you are trying to write to a segment outside of memory allocated to you. In the first case, you had no storage allocated, only pointers, so the first write gave you the SEGV. The second one is more difficult to detect an error. As long as you are writing to ANY memory allocated to you, you won't get a SEGV. Your pointers just happen to point to allocated memory, in this case your j[] character array. Write enough stuff there, and you'll get a SEGV there also, when you fall off the end of your allocated memory. The compiler & run time libs have no idea if you want to point to allocated memory, or where in that allocated memory you want to point, with your pointers. As long as you are pointing to allocated memory, the runtime, won't issue a SEGV (You are not writing outside of allocated memory)
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Wierd Message????

I am getting this message when I run my script. $ runscript.sh Not connected to any service! Here is the beginning of the script: # 1 - failure # # variable declaration FILEDATE=`date +"%Y%m%d"` Not connected to any service! Right after the FILEDATE gets loaded I get that... (6 Replies)
Discussion started by: lesstjm
6 Replies

2. Programming

Wierd pipe problem

I have encountered a strange problem dealing with pipes and forking. The program basicaly does this: cat file | tbl | eqn | groff Now, I have a parent process that forks children that that exec the stuff that they should. The pipes defined in the parent are the ones used. The chain goes... (1 Reply)
Discussion started by: denoir
1 Replies

3. Solaris

wierd sparc 5

Hi! I own a sparc 5 and i seem to have a strange problem. When its off, it starts by itself... Sounds a bit strange? Iknow. Does anyone know whats causing this?? Could it be the network card? or is it someting in ENV or some other configuration?? //dOzY (5 Replies)
Discussion started by: dozy
5 Replies

4. UNIX for Dummies Questions & Answers

Wierd networking issue

I have Debian Etch release as a fresh install on a PIII to be a router/firewall. I've configured networking, and utilized Shorewall to set up iptables scripting. I've installed dhcp3, both client and server, to pull an ip from my broadband cable modem, and dish out ip's to a switch for other... (2 Replies)
Discussion started by: pflink
2 Replies

5. Programming

Help needed regarding c program

Hi, Currently, i have an application that does logging of messages into a text file and i record the timing for the messages in a format. However, i need to log the messages up to millisec level and the struct tm i am using now only support up to sec, is there any other way to get millisec? ... (2 Replies)
Discussion started by: dwgi32
2 Replies

6. UNIX for Advanced & Expert Users

Which Base Level Filesets needed by a specific program?

hello... thats a great forum btw :) my problem is that I need a list of the Base Level Filesets (BLF) which are needed by a specific program. Is there any command/tool which shows me that? during the installation I can choose "Preview only" so that I can see what BLF´s are missing etc but... (4 Replies)
Discussion started by: cypher82
4 Replies

7. UNIX for Dummies Questions & Answers

Help needed to run simple java program in linux

Hi guys , This is the first time i m running java application inside linux. i have installed jdk-6u20-linux-i586-rpm.bin jre-6u20-linux-i586-rpm.bin in my linux machine. and set JAVA_HOME and JRE_HOME variables respectively. # echo $JAVA_HOME /usr/java/jdk1.6.0_20/ # echo $JRE_HOME... (6 Replies)
Discussion started by: pinga123
6 Replies

8. Debian

Change the privileges needed to run a program

Hi everyone, I have an issue with a project of mine. I have to run a program on a terminal which requires to be logged in as su to have it run it. Given that I'm having problem to use expect to give the password I'd like to change the privilege of that program from SU to normal user ( I have the SU... (13 Replies)
Discussion started by: gaisselick87
13 Replies

9. Programming

Wrapper for unix program - urgent help needed

Hello all , i need some help asap i have a program that keeps killing the machine when i did google searches and 2 days later i ran strace it seems the programm keeps making a system call to gettimeofday to i guess increment a counter ? gettimeofday({1347986584, 464904}, NULL) = 0... (6 Replies)
Discussion started by: NetworkLearning
6 Replies

10. Homework & Coursework Questions

C++ Environment needed on Solaris,Program lifecycle

Hello, I would like to build some sample C++ application on Solaris SunOS 5.8 Generic Virtual sun4v sparc. so I would like to know what are the compilation utilities and runtime utilities I need to get in my machine and will any one explain me the detaied life cycle of program like what... (1 Reply)
Discussion started by: Revathi R
1 Replies
GETCONF(1)						    BSD General Commands Manual 						GETCONF(1)

NAME
getconf -- retrieve standard configuration variables SYNOPSIS
getconf [-v environment] path_var file getconf [-v environment] system_var DESCRIPTION
The getconf utility prints the value of a POSIX or X/Open path or system configuration variable to the standard output. If the specified variable is undefined, the string ``undefined'' is output. The first form of the command, with two mandatory arguments, retrieves file- and file system-specific configuration variables using pathconf(2). The second form, with a single argument, retrieves system configuration variables using confstr(3) and sysconf(3), depending on the type of variable. As an extension, the second form can also be used to query static limits from <limits.h>. All sysconf(3) and pathconf(2) variables use the same name as the manifest constants defined in the relevant standard C-language bindings, including any leading underscore or prefix. That is to say, system_var might be ARG_MAX or _POSIX_VERSION, as opposed to the sysconf(3) names _SC_ARG_MAX or _SC_POSIX_VERSION. Variables retrieved from confstr(3) have the leading '_CS_' stripped off; thus, _CS_PATH is queried by a system_var of ``PATH''. Programming Environments The -v environment option specifies a IEEE Std 1003.1-2001 (``POSIX.1'') programming environment under which the values are to be queried. This option currently does nothing, but may in the future be used to select between 32-bit and 64-bit execution environments on platforms which support both. Specifying an environment which is not supported on the current execution platform gives undefined results. The standard programming environments are as follows: POSIX_V6_ILP32_OFF32 Exactly 32-bit integer, long, pointer, and file offset. Supported platforms: None. POSIX_V6_ILP32_OFFBIG Exactly 32-bit integer, long, and pointer; at least 64-bit file offset. Supported platforms: IA32, PowerPC. POSIX_V6_LP64_OFF64 Exactly 32-bit integer; exactly 64-bit long, pointer, and file offset. Supported platforms: Alpha, SPARC64. POSIX_V6_LPBIG_OFFBIG At least 32-bit integer; at least 64-bit long, pointer, and file offset. Supported platforms: None. The command: getconf POSIX_V6_WIDTH_RESTRICTED_ENVS returns a newline-separated list of environments in which the width of certain fundamental types is no greater than the width of the native C type long. At present, all programming environments supported by FreeBSD have this property. Several of the confstr(3) variables provide information on the necessary compiler and linker flags to use the standard programming environments described above. Many of these values are also available through the sysctl(8) mechanism. EXIT STATUS
The getconf utility exits 0 on success, and >0 if an error occurs. EXAMPLES
The command: getconf PATH will display the system default setting for the PATH environment variable. The command: getconf NAME_MAX /tmp will display the maximum length of a filename in the /tmp directory. The command: getconf -v POSIX_V6_LPBIG_OFFBIG LONG_MAX will display the maximum value of the C type long in the POSIX_V6_LPBIG_OFFBIG programming environment, if the system supports that environ- ment. DIAGNOSTICS
Use of a system_var or path_var which is completely unrecognized is considered an error, causing a diagnostic message to be written to stan- dard error. One which is known but merely undefined does not result in an error indication. The getconf utility recognizes all of the vari- ables defined for IEEE Std 1003.1-2001 (``POSIX.1''), including those which are not currently implemented. SEE ALSO
pathconf(2), confstr(3), sysconf(3), sysctl(8) STANDARDS
The getconf utility is expected to be compliant with IEEE Std 1003.1-2001 (``POSIX.1''). HISTORY
The getconf utility first appeared in FreeBSD 5.0. AUTHORS
Garrett A. Wollman <wollman@lcs.mit.edu> BSD
September 18, 2002 BSD
All times are GMT -4. The time now is 01:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy