From: Jelmer Vernooij Date: Sat, 24 Mar 2012 20:17:56 +0000 (+0100) Subject: libreplace: Add usleep implementation. X-Git-Tag: samba-4.0.0alpha19~177 X-Git-Url: http://git.samba.org/?p=amitay%2Fsamba.git;a=commitdiff_plain;h=49eca290d37ad7564a3be3332ee76020ddb5a03f libreplace: Add usleep implementation. --- diff --git a/lib/replace/replace.c b/lib/replace/replace.c index 03fae90859c..892f56792c9 100644 --- a/lib/replace/replace.c +++ b/lib/replace/replace.c @@ -890,3 +890,17 @@ int rep_getpeereid(int s, uid_t *uid, gid_t *gid) #endif } #endif + +#ifndef HAVE_USLEEP +int rep_usleep(useconds_t sec) +{ + struct timeval tval; + /* + * Fake it with select... + */ + tval.tv_sec = 0; + tval.tv_usec = usecs/1000; + select(0,NULL,NULL,NULL,&tval); + return 0; +} +#endif /* HAVE_USLEEP */ diff --git a/lib/replace/replace.h b/lib/replace/replace.h index f2b1952376c..776da8aa4a1 100644 --- a/lib/replace/replace.h +++ b/lib/replace/replace.h @@ -835,4 +835,10 @@ char *rep_getpass(const char *prompt); int rep_getpeereid(int s, uid_t *uid, gid_t *gid); #endif +#ifndef HAVE_USLEEP +#define usleep rep_usleep +typedef long useconds_t; +int usleep(useconds_t); +#endif + #endif /* _LIBREPLACE_REPLACE_H */