Newsgroup: it.comp.os.linux.development
Titolo: [LUNGO] Urgentissimo aiuto con delay->udelay

Devo fare un programma praticamente per ieri (si tratta di un test per 
un assunzione) e nel programma ho bisogno di creare delle pause molto 
inferiori ad un secondo.
USO SLACKWARE 10.2.
In MSDOS c'era delay.
Ho cercato un pò con google e ho trovato che in include/linux/delay.h 
c'è la funzione che fà per me: udelay!!!
Ora, non sono riuscito a trovare un esempio con questa funzione e io ho 
fatto questo programmino::
#include <stdio.h>
#include <linux/delay.h>
int main( void )
{
	printf( "1" );
	udelay( 500 ); // Dovrebbe attendere circa 1/2 secondo
	printf( "2\n" );
	return 0;
}
Poi ho fatto il make ed ecco il problema che succede::
gcc -c -g -Wall -D_GNU_SOURCE -O3 main.c -o ../obj/main.o
In file included from /usr/include/linux/delay.h:12,
                  from main.c:5:
/usr/include/linux/time.h:10: error: syntax error before "time_t"
/usr/include/linux/time.h:12: error: syntax error before '}' token
/usr/include/linux/time.h:89: error: syntax error before "time_t"
/usr/include/linux/time.h:120: error: field `it_interval' has incomplete 
type
/usr/include/linux/time.h:121: error: field `it_value' has incomplete type
/usr/include/linux/time.h:125: error: field `it_interval' has incomplete 
type
/usr/include/linux/time.h:126: error: field `it_value' has incomplete type
In file included from /usr/include/linux/sched.h:13,
                  from /usr/include/linux/delay.h:13,
                  from main.c:5:
/usr/include/linux/times.h:5: error: syntax error before "clock_t"
/usr/include/linux/times.h:7: error: syntax error before "tms_cutime"
/usr/include/linux/times.h:8: error: syntax error before "tms_cstime"
In file included from /usr/include/linux/sched.h:14,
                  from /usr/include/linux/delay.h:13,
                  from main.c:5:
/usr/include/linux/timex.h:173: error: field `time' has incomplete type
In file included from /usr/include/linux/sched.h:21,
                  from /usr/include/linux/delay.h:13,
                  from main.c:5:
/usr/include/asm/mmu.h:12: error: field `sem' has incomplete type
In file included from /usr/include/linux/signal.h:5,
                  from /usr/include/linux/sched.h:26,
                  from /usr/include/linux/delay.h:13,
                  from main.c:5:
/usr/include/asm/siginfo.h:48: error: syntax error before "clock_t"
/usr/include/asm/siginfo.h:62: error: syntax error before '}' token
/usr/include/asm/siginfo.h:63: error: syntax error before '}' token
In file included from /usr/include/linux/sched.h:82,
                  from /usr/include/linux/delay.h:13,
                  from main.c:5:
/usr/include/linux/resource.h:22: error: field `ru_utime' has incomplete 
type
/usr/include/linux/resource.h:23: error: field `ru_stime' has incomplete 
type
In file included from main.c:5:
/usr/include/linux/delay.h: In function `msecs_to_jiffies':
/usr/include/linux/delay.h:46: error: `MAX_JIFFY_OFFSET' undeclared 
(first use in this function)
/usr/include/linux/delay.h:46: error: (Each undeclared identifier is 
reported only once
/usr/include/linux/delay.h:46: error: for each function it appears in.)
/usr/include/linux/delay.h: In function `msleep':
/usr/include/linux/delay.h:59: error: `current' undeclared (first use in 
this function)
/usr/include/linux/delay.h: In function `ssleep':
/usr/include/linux/delay.h:65: error: `current' undeclared (first use in 
this function)
make: *** [all] Error 1
Penso che nella mia installazione di Slackware 10.2 (che non ha dato 
errori durante la fase di installazione) ci sia qualche problema...
Chi di voi sà come aiutarmi? C'è un altra via invece di usare udelay???
MI SCUSO CON TUTTI QUANTI VOI SE IL MIO MESSAGGIO RISULTASSE TROPPO 
LUNGO... Spero di non essere considerato OT...
Ciao a tutti, Keres.

 inferiori ad un secondo.
 man usleep
Max

Grazie, mi hai salvato la vita!!!
Ciao, Keres.

nanosleep, è dentro la time.h e si usa senza noie più o meno ovunque.
Ben