mmftpd: Minor fixes to build with glibc again
authorMatthew Mondor <mmondor@pulsar-zone.net>
Fri, 4 Dec 2015 16:18:47 +0000 (16:18 +0000)
committerMatthew Mondor <mmondor@pulsar-zone.net>
Fri, 4 Dec 2015 16:18:47 +0000 (16:18 +0000)
mmsoftware/mmftpd/src/mmftpd.c
tests/pthread_utils/mm_pthread_sleep.h

index 1cfbdef..4475e90 100644 (file)
@@ -46,6 +46,7 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <stdio.h>
+
 #ifdef __GLIBC__
 #include <crypt.h>
 #endif
@@ -4653,7 +4654,12 @@ static void
 thread_init(void)
 {
     (void) pthread_mutexattr_init(&thread_ma);
+#ifdef __GLIBC__
+    int pthread_mutexattr_settype(pthread_mutexattr_t *, int);
+    (void) pthread_mutexattr_settype(&thread_ma, PTHREAD_MUTEX_RECURSIVE_NP);
+#else
     (void) pthread_mutexattr_settype(&thread_ma, PTHREAD_MUTEX_RECURSIVE);
+#endif
 }
 
 static void *
index 93b6766..2c394f4 100644 (file)
 
 
 
+#ifdef __GLIBC__
+#define TIMEVAL_TO_TIMESPEC(tv, ts) {                                   \
+        (ts)->tv_sec = (tv)->tv_sec;                                    \
+        (ts)->tv_nsec = (tv)->tv_usec * 1000;                           \
+}
+#define timespecadd(tsp, usp, vsp)                                      \
+        do {                                                            \
+                (vsp)->tv_sec = (tsp)->tv_sec + (usp)->tv_sec;          \
+                (vsp)->tv_nsec = (tsp)->tv_nsec + (usp)->tv_nsec;       \
+                if ((vsp)->tv_nsec >= 1000000000L) {                    \
+                        (vsp)->tv_sec++;                                \
+                        (vsp)->tv_nsec -= 1000000000L;                  \
+                }                                                       \
+        } while (/* CONSTCOND */ 0)
+#endif
+
+
+
 extern int             pthread_nanosleep(struct timespec *);
 extern int             pthread_microsleep(struct timeval *);
 extern int             pthread_millisleep(unsigned int);