* earlier) kernel. 2.2.x and higher flush filesystem buffers automatically.
*/
-#include "internal.h"
#include <sys/param.h>
#include <sys/syslog.h>
#include <unistd.h> /* for getopt() */
+#include <stdlib.h>
-
-#if defined(__GLIBC__)
-#include <sys/kdaemon.h>
+#if __GNU_LIBRARY__ > 5
+ #include <sys/kdaemon.h>
#else
-static _syscall2(int, bdflush, int, func, int, data);
-#endif /* __GLIBC__ */
+ extern int bdflush (int func, long int data);
+#endif
+
+#include "busybox.h"
static unsigned int sync_duration = 30;
static unsigned int flush_duration = 5;
flush_duration = atoi(optarg);
break;
default:
- usage(update_usage);
+ show_usage();
}
}
pid = fork();
if (pid < 0)
- exit(FALSE);
+ return EXIT_FAILURE;
else if (pid == 0) {
/* Become a proper daemon */
setsid();
chdir("/");
+#ifdef OPEN_MAX
for (pid = 0; pid < OPEN_MAX; pid++) close(pid);
+#else
+ /* glibc 2.1.92 requires using sysconf(_SC_OPEN_MAX) */
+ for (pid = 0; pid < sysconf(_SC_OPEN_MAX); pid++) close(pid);
+#endif
/*
* This is no longer necessary since 1.3.5x, but it will harmlessly
syslog(LOG_INFO,
"This kernel does not need update(8). Exiting.");
closelog();
- exit(TRUE);
+ return EXIT_SUCCESS;
}
}
}
}
- return( TRUE);
+ return EXIT_SUCCESS;
}
/*