index 388b7313322019706f5ace264f917ebc0fab94c8..fdbd285f107dff74aeb268eebe2e9fd84aec1700 100644 (file)
* Revisions by Christopher B. Browne, Liberty RMS
* Win32 Service code added by Dave Page
*
- * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.29 2005年01月26日 22:25:13 tgl Exp $
+ * $PostgreSQL: pgsql/contrib/pg_autovacuum/pg_autovacuum.c,v 1.30 2005年04月03日 00:01:51 tgl Exp $
*/
#include "postgres_fe.h"
#ifdef WIN32
#include <windows.h>
#endif
+#include <sys/stat.h>
+#include <fcntl.h>
#include "pg_autovacuum.h"
* Function used to detach the pg_autovacuum daemon from the tty and go into
* the background.
*
- * This code is mostly ripped directly from pm_dameonize in postmaster.c with
- * unneeded code removed.
+ * This code is ripped directly from pmdaemonize in postmaster.c.
*/
#ifndef WIN32
static void
daemonize(void)
{
+ int i;
pid_t pid;
pid = fork();
}
/* GH: If there's no setsid(), we hopefully don't need silent mode.
- * Until there's a better solution. */
+ * Until there's a better solution.
+ */
#ifdef HAVE_SETSID
if (setsid() < 0)
{
_exit(1);
}
#endif
-
+ i = open(NULL_DEV, O_RDWR);
+ dup2(i, 0);
+ dup2(i, 1);
+ dup2(i, 2);
+ close(i);
}
#endif /* WIN32 */