06-13-2019
The standards don't specify how parameters are placed on the stack when a function is invoked and any code that assumes that parameters are placed on the stack in the order given (or in the reverse of the order given) in the function declaration is highly likely to fail on some operating systems on some hardware.
When an operating system is ported to or designed from scratch, the compiler group, the link editor group, and the operating system group will study the hardware design documents and agree on a scheme that they believe will be fast and conserve space on that hardware for the operating system being designed. Note that the scheme may well have exceptions that apply alternative behaviors when a function is invoked that takes a variable number of parameters (e.g., printf()). The only portable way to write functions like printf() is to use the macros defined in the Standard C header <stdarg.h> (i.e., va_start, va_arg, va_copy, and va_end).
These 3 Users Gave Thanks to Don Cragun For This Post:
8 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I'm sorry if something like this has already been posted, but I didn't find anything like it.
I'm using ksh The code that I've come up with will initially print what I want, but will then keep repeating the second number. I'm just trying to teach myself and can't seem to find the code to work.... (16 Replies)
Discussion started by: scott78
16 Replies
2. AIX
Hi,
I'm using xterm and aixterm with Mwm on AIX, and having trouble controlling icon placement when minimising windows. Basically when I run an xterm or aixterm I want to be able to specify where the icon will be if minimised.
The man page mentions the "#geometry Geometry" option to aixterm,... (1 Reply)
Discussion started by: cunningdavid
1 Replies
3. UNIX Desktop Questions & Answers
Hi,
I'm using xterm and aixterm with Mwm on AIX, and having trouble controlling icon placement when minimising windows. Basically when I run an xterm or aixterm I want to be able to specify where the icon will be if minimised.
The man page mentions the "#geometry Geometry" option to aixterm,... (1 Reply)
Discussion started by: cunningdavid
1 Replies
4. Programming
helo can u tell me what do you mean by stack winding and stack unwinding
Regards,
Amit (2 Replies)
Discussion started by: amitpansuria
2 Replies
5. Solaris
Is it possible to place the data in inner or outer edge with SVM ( solaris volume manager ) or VxVM like we can do in AIX LVM ? (1 Reply)
Discussion started by: fugitive
1 Replies
6. UNIX for Dummies Questions & Answers
Hi,
I am new to the linux kernel development area. I want to know what is the difference between kernel mode stack and user mode stack? Does each process has a user mode stack and a kernel mode stack?? Or Each process has a user mode stack and there is only one kernel mode stack that is shared by... (4 Replies)
Discussion started by: saurabhkoar
4 Replies
7. Cybersecurity
I have been asked to place 2 (1 NTOP & 1 SNORT) boxes within our network as part of our tool kit for network monitoring and Intrusion detection. Out network is very simplistic and it layed out like this:
internet
|
|
Cisco 1811 Router (8x Layer 2 switch ports)
... (0 Replies)
Discussion started by: metallica1973
0 Replies
8. UNIX for Advanced & Expert Users
Hi, I am programming in kernel, and I want to use a double linked list that holds infos that every process could access and modify THIS list. So, I suppose it is a 'global' variable since every process(thread) can reach it, I am wondering where to put it? by changing some of the kernel files? (1 Reply)
Discussion started by: louisTan
1 Replies
LEARN ABOUT HPUX
pthread_default_rsestacksize_np
pthread_default_rsestacksize_np(3T) pthread_default_rsestacksize_np(3T)
NAME
pthread_default_rsestacksize_np() - change the default stacksize.
SYNOPSIS
PARAMETERS
new_size The new default register stack size.
old_size Pointer to where the old default register stack size is returned.
DESCRIPTION
The function allows an application to change the default value for the rsestacksize attribute. This function must be called before any
threads have been created. The new default stack size is passed in the new_size parameter. If not NULL, the previous default stack size
is returned in old_size. If new_size is zero, this function can be used (at any time) to query the current default stack size.
On HP-UX, threads with default stack sizes are cached after they terminate. The next time a thread is created with a default stack size, a
cached thread (and its stack) are reused. This can result in significant performance improvements for
However, if the default register stack size is not appropriate for an application, it cannot take advantage of this performance enhance-
ment. By using the function, the threads library will change the default stack size so that it matches the applications needs. This
allows the application to utilize the performance benefit of cached threads. If either of the set register stack size APIs is called the
register stack portion of the stack space will be that large instead of size determined by the implementation. The memory stack portion
will be the remainder.
RETURN VALUE
Upon successful completion, returns zero. Otherwise, an error number is returned to indicate the error (the variable is not set).
ERRORS
If any of the following occur, the function returns the corresponding error number:
The value specified by
new_size is less than register stack required for a thread.
The calling process has already created threads (this must be called
before any threads are created).
AUTHOR
was developed by HP.
SEE ALSO
pthread_attr_getstacksize(3T), pthread_attr_setstacksize(3T), pthread_default_stacksize_np(3T).
STANDARDS CONFORMANCE
Pthread Library pthread_default_rsestacksize_np(3T)