libreplace: Add usleep implementation.
authorJelmer Vernooij <jelmer@samba.org>
Sat, 24 Mar 2012 20:17:56 +0000 (21:17 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Sat, 24 Mar 2012 21:41:05 +0000 (22:41 +0100)
lib/replace/replace.c
lib/replace/replace.h

index 03fae90859c0b1710d340fc43a50c3ca8e9be3e4..892f56792c97b42317cc97311e6e8af020eeed20 100644 (file)
@@ -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 */
index f2b1952376c0c6a323935c353ce69594f7594f90..776da8aa4a13d97cf64d044ef942802c50de1ed4 100644 (file)
@@ -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 */