06-23-2010
c calling conventions
C calling convention we all know defines a way how the parameters are pushed onto the stack.
My question is when and how does this C calling conventions matters to a user?
When the user will have to bother about the calling conventions in his project?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have 2 scripts, one is the .profile and the other is a SID selector for Oracle Databases.
But when I call one from the other, even though it seems to have worked, it doesn't.
Can anyone help??
******************* .profile**********************
#!/bin/ksh
.... (5 Replies)
Discussion started by: dnkansah
5 Replies
2. Shell Programming and Scripting
OK, I'm very new to shell scripting, and I'm trying to write a (very) simple wrapper for sendmail that outputs all the arguments as well as the file that called sendmail to an output file which can later be looked over.
Is it possible to get a file's name and path that called a script? (0 Replies)
Discussion started by: ghstber
0 Replies
3. UNIX for Advanced & Expert Users
Hello,
I'm wondering what is the naming conventions for *.so shared libraries in linux. For example, a library in /lib, say libcrypt-2.7.so has a symbolic link called libcrypt.so.1 pointing to it, yet libncursesw.so.5.6 has a symbolic link called libncursesw.so.5 pointing to it. What is the... (2 Replies)
Discussion started by: neked
2 Replies
4. Solaris
These are findings by me with my little experience with Solaris 10. Please correct me if wrong..
In x86 systems with ide hard disk:
c= controller
d=disk
s=slice
1.Here controller c0 means the primary ide controller ide0.
controller c1 means the secondary ide controller ide1.
... (5 Replies)
Discussion started by: saagar
5 Replies
5. UNIX for Dummies Questions & Answers
I would like to use an automated checker for adherence to CSS coding conventions. I have browsed the web, but no tool I came across checks for coding conventions, only syntax. Here is a general list of requirements:
- Style definitions should be separated by one blank line
- Indentation is 2... (0 Replies)
Discussion started by: figaro
0 Replies
6. UNIX for Dummies Questions & Answers
i was viewing the gawk's man file,checked the man faqs,didnt find anything about the char "e" meaning
.TP
.B \e`
matches the empty string at the beginning of a buffer (string).
.TP
.B \e'
matches the empty string at the end of a buffer.after convention,it should looks like thie
\` ... (2 Replies)
Discussion started by: b33713
2 Replies
7. UNIX for Dummies Questions & Answers
is there a typographic convention that is followed in the man pages.
where could a description be found.
at this time i am in man stty and the author uses upper case in some places.
and my brain is just burning to a fizzle while studying a book on bash and trying to stay in scope of the... (1 Reply)
Discussion started by: cowLips
1 Replies
8. Shell Programming and Scripting
Hi. I have been running some scripts ok with no extension on the name, and they work fine. What difference does it make if I call them whatever.sh? And I have some scripts starting #!/bin/bash - which debian recognises as shell scritps, even without the .sh ending - and some which don't. I'm sure... (8 Replies)
Discussion started by: triplemaya
8 Replies
9. Cybersecurity
Hey guys, not sure should I post it here or in 'What is on Your Mind?'
I'm discussing usage of DSL (domain specific language) in security tools with my colleagues. We haven't been able to reach an agreement over naming conventions.
There are many tools using DSL: splunk, sumologic,... (2 Replies)
Discussion started by: Tobby P
2 Replies
10. Linux
I'm slowly hacking away at a zsh script that shows some promise as a command line tool. I want to learn more about the conventions regarding command line tool development in Unix (and/or macOS), but don't really know where to look for this information.
What is the correct way, or convention, to... (2 Replies)
Discussion started by: MonilGomes
2 Replies
EXEC(2) System Calls Manual EXEC(2)
NAME
exec, execl, _clock - execute a file
SYNOPSIS
#include <u.h>
#include <libc.h>
int exec(char *name, char* argv[])
int execl(char *name, ...)
long *_clock;
DESCRIPTION
Exec and execl overlay the calling process with the named file, then transfer to the entry point of the image of the file.
Name points to the name of the file to be executed; it must not be a directory, and the permissions must allow the current user to execute
it (see stat(2)). It should also be a valid binary image, as defined in the a.out(6) for the current machine architecture, or a shell
script (see rc(1)). The first line of a shell script must begin with followed by the name of the program to interpret the file and any
initial arguments to that program, for example
#!/bin/rc
ls | mc
When a C program is executed, it is called as follows:
void main(int argc, char *argv[])
Argv is a copy of the array of argument pointers passed to exec; that array must end in a null pointer, and argc is the number of elements
before the null pointer. By convention, the first argument should be the name of the program to be executed. Execl is like exec except
that argv will be an array of the parameters that follow name in the call. The last argument to execl must be a null pointer.
For a file beginning #!, the arguments passed to the program (/bin/rc in the example above) will be the name of the file being executed,
any arguments on the #! line, the name of the file again, and finally the second and subsequent arguments given to the original exec call.
The result honors the two conventions of a program accepting as argument a file to be interpreted and argv[0] naming the file being exe-
cuted.
Most attributes of the calling process are carried into the result; in particular, files remain open across exec (except those opened with
OCEXEC OR'd into the open mode; see open(2)); and the working directory and environment (see env(3)) remain the same. However, a newly
exec'ed process has no notification handler (see notify(2)).
When the new program begins, the global cell _clock is set to the address of a cell that keeps approximate time expended by the process at
user level. The time is measured in milliseconds but is updated at a system-dependent lower rate. This clock is typically used by the
profiler but is available to all programs.
The above conventions apply to C programs; the raw system interface to the new image is as follows: the word pointed to by the stack
pointer is argc; the words beyond that are the zeroth and subsequent elements of argv, followed by a terminating null pointer; and the
return register (e.g. R0 on the 68020) contains the address of the clock.
Alef
In Alef, the intent and syntax are the same but the implementation is different. Exec (or execl; this description applies to either) may
be called only by a proc holding a single task, typically the implicit main task of the proc. First, access(2) is called to see if the
named file exists and has execute permission. If not, exec returns -1 immediately. Otherwise, it will never return: it frees resources
private to the invoking proc and calls the exec system call. If this fails, it calls the bare _exits system call (see exits(2)) with the
error string as argument. Therefore, if the file looks executable, the calling process is lost, whether the exec succeeds or not.
SOURCE
/sys/src/libc/9syscall
/sys/src/libc/port/execl.c
SEE ALSO
intro(2), stat(2)
DIAGNOSTICS
If these functions fail, they return and set errstr. There can be no return from a successful exec or execl; the calling image is lost.
EXEC(2)