os.c revision 9fe9eb9ee5171b8065013300dbea8c8d6e9b589b
/*
* Copyright (C) 1999-2001 Internet Software Consortium.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
* INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
* FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
* WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: os.c,v 1.2 2001/07/18 18:42:13 gson Exp $ */
#include <config.h>
#include <stdarg.h>
#include <ctype.h>
#include <errno.h>
#include <io.h>
#include <process.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>
#include <named/ntservice.h>
void
ns_paths_init() {
if (!Initialized)
Initialized = TRUE;
}
static void
setup_syslog(const char *progname) {
int options;
#ifdef LOG_NDELAY
options |= LOG_NDELAY;
#endif
}
void
ns_os_init(const char *progname) {
}
void
ns_os_daemonize(void) {
int fd;
/*
* on even if it fails.
*
* XXXMLG The close() calls here are unneeded on all but NetBSD, but
* are harmless to include everywhere. dup2() is supposed to close
* the FD if it is in use, but unproven-pthreads-0.16 is broken
* and will end up closing the wrong FD. This will be fixed eventually,
* and these calls will be removed.
*/
if (fd != -1) {
}
}
void
ns_os_chroot(const char *root) {
}
void
ns_os_inituserinfo(const char *username) {
}
void
ns_os_changeuser(void) {
}
void
ns_os_minprivs(void) {
}
static int
int fd;
return (-1);
return (-1);
if (append)
else {
}
return (fd);
}
static void
cleanup_pidfile(void) {
}
}
void
ns_os_writepidfile(const char *filename) {
int fd;
/*
* The caller must ensure any required synchronization.
*/
ns_main_earlyfatal("couldn't malloc '%s': %s",
/* This is safe. */
if (fd < 0)
ns_main_earlyfatal("couldn't open pid file '%s': %s",
ns_main_earlyfatal("could not fdopen() pid file '%s': %s",
ns_main_earlyfatal("fprintf() to pid file '%s' failed",
filename);
ns_main_earlyfatal("fflush() to pid file '%s' failed",
filename);
}
void
ns_os_shutdown(void) {
closelog();
ntservice_shutdown(); /* This MUST be the last thing done */
}