/*- * See the file LICENSE for redistribution information. * * Copyright (c) 2000-2005 * Sleepycat Software. All rights reserved. * * $Id: util_log.c,v 12.4 2005/10/12 17:47:17 bostic Exp $ */ #include "db_config.h" #ifndef NO_SYSTEM_INCLUDES #include #include #if TIME_WITH_SYS_TIME #include #include #else #if HAVE_SYS_TIME_H #include #else #include #endif #endif #include #endif #include "db_int.h" /* * __db_util_logset -- * Log that we're running. * * PUBLIC: int __db_util_logset __P((const char *, char *)); */ int __db_util_logset(progname, fname) const char *progname; char *fname; { pid_t pid; db_threadid_t tid; FILE *fp; time_t now; if ((fp = fopen(fname, "w")) == NULL) goto err; (void)time(&now); __os_id(NULL, &pid, &tid); fprintf(fp, "%s: %lu %s", progname, (u_long)pid, ctime(&now)); if (fclose(fp) == EOF) goto err; return (0); err: fprintf(stderr, "%s: %s: %s\n", progname, fname, strerror(errno)); return (1); }