jdk/src/share/back/log_messages.c
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2003-2005 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include "util.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <time.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <errno.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <sys/types.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "proc_md.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "log_messages.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#ifdef JDWP_LOGGING
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define MAXLEN_INTEGER          20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define MAXLEN_FILENAME         256
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define MAXLEN_TIMESTAMP        80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define MAXLEN_LOCATION         (MAXLEN_FILENAME+MAXLEN_INTEGER+16)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#define MAXLEN_MESSAGE          256
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define MAXLEN_EXEC             (MAXLEN_FILENAME*2+MAXLEN_INTEGER+16)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
static MUTEX_T my_mutex = MUTEX_INIT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
/* Static variables (should be protected with mutex) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
static int logging;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static FILE * log_file;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
static char logging_filename[MAXLEN_FILENAME+1+6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
static char location_stamp[MAXLEN_LOCATION+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
static PID_T processPid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
static int open_count;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
/* Ascii id of current native thread. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
get_time_stamp(char *tbuf, size_t ltbuf)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    char format[MAXLEN_TIMESTAMP+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    unsigned millisecs = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    time_t t = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    GETMILLSECS(millisecs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    if ( time(&t) == (time_t)(-1) )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        t = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    (void)strftime(format, sizeof(format),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                /* Break this string up for SCCS's sake */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                "%" "d.%" "m.%" "Y %" "T.%%.3d %" "Z", localtime(&t));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
    (void)snprintf(tbuf, ltbuf, format, (int)(millisecs));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
/* Get basename of filename */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
static const char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
file_basename(const char *file)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    char *p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    char *p2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
    if ( file==NULL )
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
        return "unknown";
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    p1 = strrchr(file, '\\');
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    p2 = strrchr(file, '/');
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    p1 = ((p1 > p2) ? p1 : p2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    if (p1 != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
        file = p1 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    return file;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
/* Fill in the exact source location of the LOG entry. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
fill_location_stamp(const char *flavor, const char *file, int line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    (void)snprintf(location_stamp, sizeof(location_stamp),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
                    "%s:\"%s\":%d;",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
                    flavor, file_basename(file), line);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    location_stamp[sizeof(location_stamp)-1] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
/* Begin a log entry. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
log_message_begin(const char *flavor, const char *file, int line)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    MUTEX_LOCK(my_mutex); /* Unlocked in log_message_end() */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    if ( logging ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        location_stamp[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        fill_location_stamp(flavor, file, line);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
/* Standard Logging Format Entry */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
static void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
standard_logging_format(FILE *fp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        const char *datetime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
        const char *level,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
        const char *product,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
        const char *module,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
        const char *optional,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
        const char *messageID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
        const char *message)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    const char *format;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /* "[#|Date&Time&Zone|LogLevel|ProductName|ModuleID|
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *     OptionalKey1=Value1;OptionalKeyN=ValueN|MessageID:MessageText|#]\n"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    format="[#|%s|%s|%s|%s|%s|%s:%s|#]\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    print_message(fp, "", "", format,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
            datetime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
            level,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
            product,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
            module,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
            optional,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
            messageID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
            message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
/* End a log entry */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
log_message_end(const char *format, ...)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    if ( logging ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
        va_list ap;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        THREAD_T tid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
        char datetime[MAXLEN_TIMESTAMP+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
        const char *level;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
        const char *product;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
        const char *module;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
        char optional[MAXLEN_INTEGER+6+MAXLEN_INTEGER+6+MAXLEN_LOCATION+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
        const char *messageID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
        char message[MAXLEN_MESSAGE+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
        /* Grab the location, start file if needed, and clear the lock */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
        if ( log_file == NULL && open_count == 0 && logging_filename[0] != 0 ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
            open_count++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
            log_file = fopen(logging_filename, "w");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
            if ( log_file!=NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
                (void)setvbuf(log_file, NULL, _IOLBF, BUFSIZ);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                logging = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        if ( log_file != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
            /* Get the rest of the needed information */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
            tid = GET_THREAD_ID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
            level = "FINEST"; /* FIXUP? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
            product = "J2SE1.5"; /* FIXUP? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
            module = "jdwp"; /* FIXUP? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
            messageID = ""; /* FIXUP: Unique message string ID? */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
            (void)snprintf(optional, sizeof(optional),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                        "LOC=%s;PID=%d;THR=t@%d",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
                        location_stamp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                        (int)processPid,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                        (int)tid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
            /* Construct message string. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
            va_start(ap, format);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
            (void)vsnprintf(message, sizeof(message), format, ap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
            va_end(ap);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
            get_time_stamp(datetime, sizeof(datetime));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
            /* Send out standard logging format message */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
            standard_logging_format(log_file,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                datetime,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
                level,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
                product,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                module,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                optional,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                messageID,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
                message);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
        location_stamp[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    MUTEX_UNLOCK(my_mutex); /* Locked in log_message_begin() */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
/* Set up the logging with the name of a logging file. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
setup_logging(const char *filename, unsigned flags)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
#ifdef JDWP_LOGGING
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    FILE *fp = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /* Turn off logging */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    logging = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    gdata->log_flags = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    /* Just return if not doing logging */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    if ( filename==NULL || flags==0 )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    /* Create potential filename for logging */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    processPid = GETPID();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    (void)snprintf(logging_filename, sizeof(logging_filename),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                    "%s.%d", filename, (int)processPid);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    /* Turn on logging (do this last) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    logging = 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    gdata->log_flags = flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
/* Finish up logging, flush output to the logfile. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
finish_logging(int exit_code)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
#ifdef JDWP_LOGGING
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    MUTEX_LOCK(my_mutex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    if ( logging ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        logging = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
        if ( log_file != NULL ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
            (void)fflush(log_file);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
            (void)fclose(log_file);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
            log_file = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    MUTEX_UNLOCK(my_mutex);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
}