Bash-Linux.com : Le SHELL pour les nuls

  Actuellement 50 lignes de commande et 1472 man disponibles
login as: root
root@213.186.33.18's password:
Last login: Mon Feb 13 0:26:56 2012 from 38.107.179.228
[root@bash-linux ~] # echo "Bienvenue sur Bash-Linux.com"_
 Manuel des commandes UNIX (man) Version anglaise

Indiquez la fonction :

Man Nanosleep en anglais

NANOSLEEP(2) Linux Programmer's Manual NANOSLEEP(2)
 
NAME


nanosleep - high-resolution sleep
 
SYNOPSIS


#include int nanosleep(const struct timespec *req, struct timespec *rem); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): nanosleep(): _POSIX_C_SOURCE >= 199309L
 
DESCRIPTION


nanosleep() suspends the execution of the calling thread until either at least the time specified in *req has elapsed, or the delivery of a signal that triggers the invocation of a handler in the calling thread or that terminates the process. If the call is interrupted by a signal handler, nanosleep() returns -1, sets errno to EINTR, and writes the remaining time into the structure pointed to by rem unless rem is NULL. The value of *rem can then be used to call nanosleep() again and complete the specified pause (but see NOTES). The structure timespec is used to specify intervals of time with nanosecond precision. It is defined as follows: struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* nanoseconds */ }; The value of the nanoseconds field must be in the range 0 to 999999999. Compared to sleep(3) and usleep(3), nanosleep() has the following advantages: it provides a higher resolution for specifying the sleep interval; POSIX.1 explicitly specifies that it does not interact with signals; and it makes the task of resuming a sleep that has been inter- rupted by a signal handler easier.
 
RETURN VALUE


On successfully sleeping for the requested interval, nanosleep() returns 0. If the call is interrupted by a signal handler or encoun- ters an error, then it returns -1, with errno set to indicate the error.
 
ERRORS


EFAULT Problem with copying information from user space. EINTR The pause has been interrupted by a non-blocked signal that was delivered to the thread. The remaining sleep time has been written into *rem so that the thread can easily call nanosleep() again and continue with the pause. EINVAL The value in the tv_nsec field was not in the range 0 to 999999999 or tv_sec was negative.
 
CONFORMING TO


POSIX.1-2001.
 
BUGS


Old behavior In order to support applications requiring much more precise pauses (e.g., in order to control some time-critical hardware), nanosleep() would handle pauses of up to 2 ms by busy waiting with microsecond pre- cision when called from a thread scheduled under a real-time policy like SCHED_FIFO or SCHED_RR. This special extension was removed in kernel 2.5.39, hence is still present in current 2.4 kernels, but not in 2.6 kernels. In Linux 2.4, if nanosleep() is stopped by a signal (e.g., SIGTSTP), then the call fails with the error EINTR after the thread is resumed by a SIGCONT signal. If the system call is subsequently restarted, then the time that the thread spent in the stopped state is not counted against the sleep interval.
 
NOTES


If the interval specified in req is not an exact multiple of the granu- larity underlying clock (see time(7)), then the interval will be rounded up to the next multiple. Furthermore, after the sleep com- pletes, there may still be a delay before the CPU becomes free to once again execute the calling thread. The fact that nanosleep() sleeps for a relative interval can be prob- lematic if the call is repeatedly restarted after being interrupted by signals, since the time between the interruptions and restarts of the call will lead to drift in the time when the sleep finally completes. This problem can be avoided by using clock_nanosleep(2) with an abso- lute time value. POSIX.1 specifies that nanosleep() should measure time against the CLOCK_REALTIME clock. However, Linux measures the time using the CLOCK_MONOTONIC clock. This probably does not matter, since the POSIX.1 specification for clock_settime() says that discontinuous changes in CLOCK_REALTIME should not affect nanosleep(): Setting the value of the CLOCK_REALTIME clock via clock_set- time() shall have no effect on threads that are blocked waiting for a relative time service based upon this clock, including the nanosleep() function; ... Consequently, these time services shall expire when the requested relative interval elapses, inde- pendently of the new or old value of the clock.
 
SEE ALSO


clock_nanosleep(2), sched_setscheduler(2), sleep(3), timer_create(3), usleep(3), time(7)
 
COLOPHON


This page is part of release 3.05 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. Linux 2008-06-24 NANOSLEEP(2)


 Dernières recherches
Man  en anglais Man nanosleep en anglaisMan  en français Man nanosleep en français
Man  en anglais Man fpathconf en anglaisMan  en français Man fpathconf en français
Man  en anglais Man inet_aton en anglaisMan  en français Man inet_aton en français
Man  en anglais Man ftp en anglaisMan  en français Man ftp en français
Man  en anglais Man strsignal en anglaisMan  en français Man strsignal en français
Man  en anglais Man bootparam en anglaisMan  en français Man bootparam en français
Man  en anglais Man inet_ntoa en anglaisMan  en français Man inet_ntoa en français
Man  en anglais Man setitimer en anglaisMan  en français Man setitimer en français
Man  en anglais Man alphasort en anglaisMan  en français Man alphasort en français
Man  en anglais Man tcsetattr en anglaisMan  en français Man tcsetattr en français
Man  en anglais Man badblocks en anglaisMan  en français Man badblocks en français
Man  en anglais Man sigsetops en anglaisMan  en français Man sigsetops en français
Man  en anglais Man protocols en anglaisMan  en français Man protocols en français
Man  en anglais Man postalias en anglaisMan  en français Man postalias en français
Man  en anglais Man wait en anglaisMan  en français Man wait en français

 Recherche

Dans ce moteur de recherche, vous pouvez taper directement votre besoin, en une phrase normale, humaine.
Exemple : vous cherchez comment remplacer un mot par un autre dans tous les fichiers d'un certain dossier. Vous pouvez écrire "Comment remplacer un mot par un autre dans tous les fichiers d'un dossier". Le moteur vous ramenera les résultats en fonction de leur pertinence.
Vous pouvez bien sûr ne chercher qu'un seul mot-clé, par exemple "find".
 Toutes les lignes de code
Par popularité
Par fonction
Recherche avancée
 Les logiciels SHELL/SSH
Putty
Astuces Bash
Faire du SHELL avec PHP!
 La doc officielle
Les man Linux en français
Les man Linux en anglais
 Proposer vos bash
Partagez vos lignes!
 Les requêtes
Déposer une requête
Voir/répondre à une requête
 Quelques sites interessants
Bons sites pour apprendre
 Rechercher