* simple helper functions.
*
* Russ Dill <Russ.Dill@asu.edu> 2001-2003
- * Rewrited by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
+ * Rewritten by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static int daemonized;
+long uptime(void)
+{
+ struct sysinfo info;
+ sysinfo(&info);
+ printf("uptime %ld\n", (long)info.uptime);
+ return info.uptime;
+}
+
/*
* This function makes sure our first socket calls
void background(const char *pidfile)
{
#ifdef __uClinux__
- LOG(LOG_ERR, "Cannot background in uclinux (yet)");
+ LOG(LOG_ERR, "Cannot background in uclinux (yet)");
#else /* __uClinux__ */
int pid_fd;
- if (!pidfile) return;
-
- pid_fd = pidfile_acquire(pidfile); /* hold lock during fork. */
+ /* hold lock during fork. */
+ pid_fd = pidfile_acquire(pidfile);
if (daemon(0, 0) == -1) {
perror("fork");
exit(1);