diff --git a/src/modules/system/system.c b/src/modules/system/system.c
index 86f692ff74cdd659b26de088444de920e7625344..bfb9cdb207ae6c2036caecce74c62e47a2e07214 100644
--- a/src/modules/system/system.c
+++ b/src/modules/system/system.c
@@ -43,6 +43,7 @@
 #include "pike_rusage.h"
 #include "pike_netlib.h"
 #include "pike_cpulib.h"
+#include "fdlib.h"
 
 #ifdef HAVE_SYS_TYPES_H
 #include <sys/types.h>
@@ -99,14 +100,6 @@
 #include <sys/prctl.h>
 #endif /* HAVE_SYS_PRCTL_H */
 
-#ifdef HAVE_UTIME_H
-#include <utime.h>
-#endif
-
-#ifdef HAVE_SYS_UTIME_H
-#include <sys/utime.h>
-#endif
-
 #ifdef HAVE_NETINFO_NI_H
 #include <netinfo/ni.h>
 #endif
@@ -657,21 +650,13 @@ void f_utime(INT32 args)
 
   {
     /*&#()&@(*#&$ NT ()*&#)(&*@$#*/
-#ifdef _UTIMBUF_DEFINED
-    struct _utimbuf b;
-#else
-    struct utimbuf b;
-#endif
+    struct fd_utimbuf b;
 
     b.actime=atime;
     b.modtime=mtime;
     do {
       THREADS_ALLOW_UID();
-#ifdef HAVE__UTIME
-      err = _utime (path, &b);
-#else
-      err = utime(path, &b);
-#endif
+      err = fd_utime(path, &b);
       THREADS_DISALLOW_UID();
       if (err >= 0 || errno != EINTR) break;
       check_threads_etc();