Che materia stai cercando?

Sistemi operativi - Syscall exec Appunti scolastici Premium

Appunti di sistemi operativi per l'esame dei professori Cotroneo e Natella. gli argomenti trattati sono i seguenti: System call exec: name, sypnosis, description, return value, errors, examples, application usage, future directions, see also, derivation.

Esame di Sistemi operativi docente Prof. D. Cotroneo

Anteprima

ESTRATTO DOCUMENTO

exec http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html

The Single UNIX ® Specification, Version 2

Copyright © 1997 The Open Group

NAME

environ, execl, execv, execle, execve, execlp, execvp - execute a file

SYNOPSIS

#include <unistd.h>

extern char **environ;

int execl(const char *path, const char *arg0, ... /*, (char *)0 */);

int execv(const char *path, char *const argv[]);

int execle(const char *path,

const char *arg0, ... /*, (char *)0, char *const envp[]*/);

int execve(const char *path, char *const char *const

argv[], envp[]);

int execlp(const char *file, const char *arg0, ... /*, (char *)0 */);

int execvp(const char *file, char *const argv[]);

DESCRIPTION

The exec functions replace the current process image with a new process image. The new

image is constructed from a regular, executable file called the new process image file. There

is no return from a successful exec, because the calling process image is overlaid by the new

process image.

When a C-language program is executed as a result of this call, it is entered as a C-language

function call as follows:

int main (int argc, char *argv[]);

where argc is the argument count and argv is an array of character pointers to the arguments

themselves. In addition, the following variable:

extern char **environ;

is initialised as a pointer to an array of character pointers to the environment strings. The argv

and environ arrays are each terminated by a null pointer. The null pointer terminating the

argv array is not counted in argc.

Conforming multi-threaded applications will not use the environ variable to access or modify

any environment variable while any other thread is concurrently modifying any environment

variable. A call to any function dependent on any environment variable is considered a use of

the environ variable to access that environment variable.

The arguments specified by a program with one of the exec functions are passed on to the

new process image in the corresponding main() arguments.

The argument path points to a pathname that identifies the new process image file.

The argument file is used to construct a pathname that identifies the new process image file.

1 di 6 12/05/2010 14:40

exec http://www.opengroup.org/onlinepubs/007908799/xsh/exec.html

If the file argument contains a slash character, the file argument is used as the pathname for

this file. Otherwise, the path prefix for this file is obtained by a search of the directories

passed as the environment variable (see specification, ). If this

XBD Environment Variables

environment variable is not present, the results of the search are implementation-dependent.

execlp() and execvp() use the

If the process image file is not a valid executable object,

contents of that file as standard input to a command interpreter conforming to system(). In

this case, the command interpreter becomes the new process image.

The arguments represented by arg0, ... are pointers to null-terminated character strings. These

strings constitute the argument list available to the new process image. The list is terminated

by a null pointer. The argument arg0 should point to a filename that is associated with the

process being started by one of the exec functions.

The argument argv is an array of character pointers to null-terminated strings. The last

member of this array must be a null pointer. These strings constitute the argument list

available to the new process image. The value in argv[0] should point to a filename that is

associated with the process being started by one of the exec functions.

The argument envp is an array of character pointers to null-terminated strings. These strings

constitute the environment for the new process image. The envp array is terminated by a null

pointer.

For those forms not containing an envp pointer (.Fn execl , execv(), execlp() and execvp()),

the environment for the new process image is taken from the external variable environ in the

calling process.

The number of bytes available for the new process' combined argument and environment lists

is {ARG_MAX}. It is implementation-dependent whether null terminators, pointers, and/or

any alignment bytes are included in this total.

File descriptors open in the calling process image remain open in the new process image,

except for those whose close-on-exec flag FD_CLOEXEC is set. For those file descriptors

that remain open, all attributes of the open file description, including file locks remain

unchanged.

Directory streams open in the calling process image are closed in the new process image.

The state of conversion descriptors and message catalogue descriptors in the new process

image is undefined. For the new process, the equivalent of:

setlocale(LC_ALL, "C")

is executed at startup.

Signals set to the default action (SIG_DFL) in the calling process image are set to the default

action in the new process image. Signals set to be ignored (SIG_IGN) by the calling process

image are set to be ignored by the new process image. Signals set to be caught by the calling

process image are set to the default action in the new process image (see <signal.h>). After

a successful call to any of the exec functions, alternate signal stacks are not preserved and the

SA_ONSTACK flag is cleared for all signals.

After a successful call to any of the exec functions, any functions previously registered by

atexit() are no longer registered.

2 di 6 12/05/2010 14:40


PAGINE

6

PESO

118.86 KB

AUTORE

N. A.

PUBBLICATO

+1 anno fa


DETTAGLI
Corso di laurea: Corso di laurea in ingegneria informatica
SSD:
A.A.: 2013-2014

I contenuti di questa pagina costituiscono rielaborazioni personali del Publisher N. A. di informazioni apprese con la frequenza delle lezioni di Sistemi operativi e studio autonomo di eventuali libri di riferimento in preparazione dell'esame finale o della tesi. Non devono intendersi come materiale ufficiale dell'università Napoli Federico II - Unina o del prof Cotroneo Domenico.

Acquista con carta o conto PayPal

Scarica il file tutte le volte che vuoi

Paga con un conto PayPal per usufruire della garanzia Soddisfatto o rimborsato

Recensioni
Ti è piaciuto questo appunto? Valutalo!

Altri appunti di Sistemi operativi

Sistemi Operativi
Dispensa
Sistemi Operativi
Dispensa
Sistemi operativi - schema suntivo per la prova pratica
Appunto
Tesine sui sistemi operativi
Appunto