1/*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2000-2009 Oracle. All rights reserved. 5 * 6 * $Id$ 7 */ 8 9#include "db_config.h" 10 11#include "db_int.h" 12 13/* 14 * __db_util_logset -- 15 * Log that we're running. 16 * 17 * PUBLIC: int __db_util_logset __P((const char *, char *)); 18 */ 19int 20__db_util_logset(progname, fname) 21 const char *progname; 22 char *fname; 23{ 24 pid_t pid; 25 FILE *fp; 26 time_t now; 27 char time_buf[CTIME_BUFLEN]; 28 29 if ((fp = fopen(fname, "w")) == NULL) 30 goto err; 31 32 (void)time(&now); 33 34 __os_id(NULL, &pid, NULL); 35 fprintf(fp, 36 "%s: %lu %s", progname, (u_long)pid, __os_ctime(&now, time_buf)); 37 38 if (fclose(fp) == EOF) 39 goto err; 40 41 return (0); 42 43err: fprintf(stderr, "%s: %s: %s\n", progname, fname, strerror(errno)); 44 return (1); 45} 46