diff options
-rw-r--r-- | dist/s_string.ok | 3 | ||||
-rwxr-xr-x | dist/s_style | 9 | ||||
-rw-r--r-- | src/btree/bt_debug.c | 6 | ||||
-rw-r--r-- | src/btree/bt_huffman.c | 11 | ||||
-rw-r--r-- | src/conn/conn_api.c | 6 | ||||
-rw-r--r-- | src/conn/conn_stat.c | 20 | ||||
-rw-r--r-- | src/cursor/cur_backup.c | 20 | ||||
-rw-r--r-- | src/include/extern.h | 7 | ||||
-rw-r--r-- | src/include/misc.h | 5 | ||||
-rw-r--r-- | src/meta/meta_turtle.c | 30 | ||||
-rw-r--r-- | src/os_posix/os_stdio.c | 75 | ||||
-rw-r--r-- | src/support/err.c | 46 | ||||
-rw-r--r-- | src/support/mutex.c | 23 |
13 files changed, 158 insertions, 103 deletions
diff --git a/dist/s_string.ok b/dist/s_string.ok index 961c09bec26..86004e3d314 100644 --- a/dist/s_string.ok +++ b/dist/s_string.ok @@ -126,6 +126,7 @@ Filesystems FindFirstFile Fk FlushFileBuffers +Fprintf FreeBSD FreeBSD's FreeLibrary @@ -361,6 +362,7 @@ VLDB VMSG Vanishingly Vc +Vfprintf Vixie Vo Vv @@ -1147,6 +1149,7 @@ variable's vcell verrx versa +vfprintf vlcs vmsg vpack diff --git a/dist/s_style b/dist/s_style index 50d00ff1d7f..ccee9404441 100755 --- a/dist/s_style +++ b/dist/s_style @@ -64,6 +64,15 @@ for f in \ cat $t fi + if ! expr "$f" : 'src/os_posix/.*' > /dev/null && + ! expr "$f" : 'src/os_win/.*' > /dev/null && + ! expr "$f" : 'src/include/extern.h' > /dev/null && + ! expr "$f" : 'src/include/os.h' > /dev/null && + grep '__wt_errno' $f > $t; then + echo "$f: upper-level code should not call __wt_errno" + cat $t + fi + if ! expr "$f" : 'examples/c/.*' > /dev/null && ! expr "$f" : 'ext/datasources/helium/helium.c' > /dev/null && ! expr "$f" : 'src/include/os.h' > /dev/null && diff --git a/src/btree/bt_debug.c b/src/btree/bt_debug.c index e84a63695f9..007a1b3b051 100644 --- a/src/btree/bt_debug.c +++ b/src/btree/bt_debug.c @@ -99,8 +99,7 @@ __debug_config(WT_SESSION_IMPL *session, WT_DBG *ds, const char *ofile) return (__wt_scr_alloc(session, 512, &ds->msg)); /* If we're using a file, flush on each line. */ - if ((ds->fp = fopen(ofile, "w")) == NULL) - WT_RET_MSG(session, __wt_errno(), "%s", ofile); + WT_RET(__wt_fopen(session, ofile, "w", 0, &ds->fp)); (void)setvbuf(ds->fp, NULL, _IOLBF, 0); return (0); @@ -132,8 +131,7 @@ __dmsg_wrapup(WT_DBG *ds) } /* Close any file we opened. */ - if (ds->fp != NULL) - (void)fclose(ds->fp); + (void)__wt_fclose(session, &ds->fp); } /* diff --git a/src/btree/bt_huffman.c b/src/btree/bt_huffman.c index 80352a0f56c..7fa976203cd 100644 --- a/src/btree/bt_huffman.c +++ b/src/btree/bt_huffman.c @@ -156,15 +156,11 @@ __huffman_confchk_file( /* Check the file exists. */ WT_RET(__wt_strndup(session, v->str + len, v->len - len, &fname)); - fp = fopen(fname, "r"); - __wt_free(session, fname); - if (fp == NULL) - WT_RET_MSG(session, __wt_errno(), - "unable to read Huffman table file %s", fname); + WT_RET(__wt_fopen(session, fname, "r", WT_FOPEN_FIXED, &fp)); /* Optionally return the file handle. */ if (fpp == NULL) - (void)fclose(fp); + (void)__wt_fclose(session, &fp); else *fpp = fp; @@ -368,8 +364,7 @@ __wt_huffman_read(WT_SESSION_IMPL *session, WT_CONFIG_ITEM *ip, if (0) { err: __wt_free(session, table); } - if (fp != NULL) - (void)fclose(fp); + (void)__wt_fclose(session, &fp); return (ret); } diff --git a/src/conn/conn_api.c b/src/conn/conn_api.c index 01ad93844dd..3fcd970a3e8 100644 --- a/src/conn/conn_api.c +++ b/src/conn/conn_api.c @@ -1388,7 +1388,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[]) if (exist) return (0); - WT_RET(__wt_fp_open(session, WT_BASECONFIG_SET, "w", &fp)); + WT_RET(__wt_fopen(session, WT_BASECONFIG_SET, "w", 0, &fp)); fprintf(fp, "%s\n\n", "# Do not modify this file.\n" @@ -1441,7 +1441,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[]) } /* Flush to disk and close our handle. */ - WT_ERR(__wt_fp_close(session, &fp)); + WT_ERR(__wt_fclose(session, &fp)); /* * Rename the file into place: that's an atomic operation so we can be @@ -1449,7 +1449,7 @@ __conn_write_base_config(WT_SESSION_IMPL *session, const char *cfg[]) */ WT_ERR(__wt_rename(session, WT_BASECONFIG_SET, WT_BASECONFIG)); -err: WT_TRET(__wt_fp_close(session, &fp)); +err: WT_TRET(__wt_fclose(session, &fp)); /* Discard any damaged temporary file, not required but cleaner. */ WT_TRET(__wt_remove_if_exists(session, WT_BASECONFIG_SET)); diff --git a/src/conn/conn_stat.c b/src/conn/conn_stat.c index 9dc05909d0a..d801309d72e 100644 --- a/src/conn/conn_stat.c +++ b/src/conn/conn_stat.c @@ -166,10 +166,10 @@ __statlog_dump(WT_SESSION_IMPL *session, const char *name, int conn_stats) sizeof(WT_DSRC_STATS) / sizeof(WT_STATS); for (i = 0, stats = WT_CURSOR_STATS(cursor); i < max; ++i, ++stats) - WT_ERR_TEST((fprintf(conn->stat_fp, + WT_ERR(__wt_fprintf(session, conn->stat_fp, "%s %" PRIu64 " %s %s\n", conn->stat_stamp, - stats->v, name, stats->desc) < 0), __wt_errno()); + stats->v, name, stats->desc)); WT_ERR(cursor->close(cursor)); break; case EBUSY: @@ -300,13 +300,10 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp) if ((log_file = conn->stat_fp) == NULL || path == NULL || strcmp(tmp->mem, path->mem) != 0) { conn->stat_fp = NULL; - if (log_file != NULL) - WT_RET(fclose(log_file) == 0 ? 0 : __wt_errno()); - + WT_RET(__wt_fclose(session, &log_file)); if (path != NULL) (void)strcpy(path->mem, tmp->mem); - WT_RET_TEST((log_file = - fopen(tmp->mem, "a")) == NULL, __wt_errno()); + WT_RET(__wt_fopen(session, tmp->mem, "a", 0, &log_file)); } conn->stat_fp = log_file; @@ -346,9 +343,7 @@ __statlog_log_one(WT_SESSION_IMPL *session, WT_ITEM *path, WT_ITEM *tmp) WT_RET(__statlog_lsm_apply(session)); /* Flush. */ - WT_RET(fflush(conn->stat_fp) == 0 ? 0 : __wt_errno()); - - return (0); + return (__wt_fflush(session, conn->stat_fp)); } /* @@ -533,10 +528,7 @@ __wt_statlog_destroy(WT_SESSION_IMPL *session, int is_close) conn->stat_session = NULL; conn->stat_tid_set = 0; conn->stat_format = NULL; - if (conn->stat_fp != NULL) { - WT_TRET(fclose(conn->stat_fp) == 0 ? 0 : __wt_errno()); - conn->stat_fp = NULL; - } + WT_TRET(__wt_fclose(session, &conn->stat_fp)); conn->stat_path = NULL; conn->stat_sources = NULL; conn->stat_stamp = NULL; diff --git a/src/cursor/cur_backup.c b/src/cursor/cur_backup.c index c85e9e24fb2..0d8c1d215db 100644 --- a/src/cursor/cur_backup.c +++ b/src/cursor/cur_backup.c @@ -249,10 +249,7 @@ __backup_start( * Close any hot backup file. * We're about to open the incremental backup file. */ - if (cb->bfp != NULL) { - WT_TRET(fclose(cb->bfp) == 0 ? 0 : __wt_errno()); - cb->bfp = NULL; - } + WT_TRET(__wt_fclose(session, &cb->bfp)); WT_ERR(__backup_file_create(session, cb, log_only)); WT_ERR(__backup_list_append( session, cb, WT_INCREMENTAL_BACKUP)); @@ -270,10 +267,7 @@ __backup_start( } err: /* Close the hot backup file. */ - if (cb->bfp != NULL) { - WT_TRET(fclose(cb->bfp) == 0 ? 0 : __wt_errno()); - cb->bfp = NULL; - } + WT_TRET(__wt_fclose(session, &cb->bfp)); if (ret != 0) { WT_TRET(__backup_cleanup_handles(session, cb)); WT_TRET(__backup_stop(session)); @@ -354,8 +348,7 @@ __backup_all(WT_SESSION_IMPL *session, WT_CURSOR_BACKUP *cb) while ((ret = cursor->next(cursor)) == 0) { WT_ERR(cursor->get_key(cursor, &key)); WT_ERR(cursor->get_value(cursor, &value)); - WT_ERR_TEST((fprintf( - cb->bfp, "%s\n%s\n", key, value) < 0), __wt_errno()); + WT_ERR(__wt_fprintf(session, cb->bfp, "%s\n%s\n", key, value)); /* * While reading the metadata file, check there are no "sources" @@ -470,9 +463,9 @@ __backup_file_create( WT_RET(__wt_filename(session, WT_INCREMENTAL_BACKUP, &path)); else WT_RET(__wt_filename(session, WT_METADATA_BACKUP, &path)); - WT_ERR_TEST((cb->bfp = fopen(path, "w")) == NULL, __wt_errno()); + ret = __wt_fopen(session, path, "w", 0, &cb->bfp); -err: __wt_free(session, path); + __wt_free(session, path); return (ret); } @@ -518,8 +511,7 @@ __wt_backup_list_uri_append( /* Add the metadata entry to the backup file. */ WT_RET(__wt_metadata_search(session, name, &value)); - WT_RET_TEST( - (fprintf(cb->bfp, "%s\n%s\n", name, value) < 0), __wt_errno()); + WT_RET(__wt_fprintf(session, cb->bfp, "%s\n%s\n", name, value)); __wt_free(session, value); /* Add file type objects to the list of files to be copied. */ diff --git a/src/include/extern.h b/src/include/extern.h index e977ff5c96e..a27fb587069 100644 --- a/src/include/extern.h +++ b/src/include/extern.h @@ -485,8 +485,11 @@ extern int __wt_rename(WT_SESSION_IMPL *session, const char *from, const char *t extern int __wt_read( WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, size_t len, void *buf); extern int __wt_write(WT_SESSION_IMPL *session, WT_FH *fh, wt_off_t offset, size_t len, const void *buf); extern void __wt_sleep(uint64_t seconds, uint64_t micro_seconds); -extern int __wt_fp_open(WT_SESSION_IMPL *session, const char *name, const char *mode, FILE **fpp); -extern int __wt_fp_close(WT_SESSION_IMPL *session, FILE **fpp); +extern int __wt_fopen(WT_SESSION_IMPL *session, const char *name, const char *mode, u_int flags, FILE **fpp); +extern int __wt_vfprintf(WT_SESSION_IMPL *session, FILE *fp, const char *fmt, va_list ap); +extern int __wt_fprintf(WT_SESSION_IMPL *session, FILE *fp, const char *fmt, ...) WT_GCC_FUNC_DECL_ATTRIBUTE((format (printf, 3, 4))); +extern int __wt_fflush(WT_SESSION_IMPL *session, FILE *fp); +extern int __wt_fclose(WT_SESSION_IMPL *session, FILE **fpp); extern uint64_t __wt_strtouq(const char *nptr, char **endptr, int base); extern int __wt_thread_create(WT_SESSION_IMPL *session, wt_thread_t *tidret, void *(*func)(void *), void *arg); extern int __wt_thread_join(WT_SESSION_IMPL *session, wt_thread_t tid); diff --git a/src/include/misc.h b/src/include/misc.h index 02b21db6b1f..5e8122316a3 100644 --- a/src/include/misc.h +++ b/src/include/misc.h @@ -32,6 +32,11 @@ #define WT_DIRLIST_INCLUDE 0x2 /* Include files matching prefix */ /* + * FILE handle open configuration. + */ +#define WT_FOPEN_FIXED 0x1 /* Path isn't relative to home */ + +/* * Sizes that cannot be larger than 2**32 are stored in uint32_t fields in * common structures to save space. To minimize conversions from size_t to * uint32_t through the code, we use the following macros. diff --git a/src/meta/meta_turtle.c b/src/meta/meta_turtle.c index 5983fb12e38..041494aec97 100644 --- a/src/meta/meta_turtle.c +++ b/src/meta/meta_turtle.c @@ -72,16 +72,13 @@ __metadata_load_hot_backup(WT_SESSION_IMPL *session) WT_DECL_ITEM(key); WT_DECL_ITEM(value); WT_DECL_RET; - char *path; - - path = NULL; + int exist; /* Look for a hot backup file: if we find it, load it. */ - WT_RET(__wt_filename(session, WT_METADATA_BACKUP, &path)); - fp = fopen(path, "r"); - __wt_free(session, path); - if (fp == NULL) + WT_RET(__wt_exist(session, WT_METADATA_BACKUP, &exist)); + if (!exist) return (0); + WT_RET(__wt_fopen(session, WT_METADATA_BACKUP, "r", 0, &fp)); /* Read line pairs and load them into the metadata file. */ WT_ERR(__wt_scr_alloc(session, 512, &key)); @@ -98,7 +95,7 @@ __metadata_load_hot_backup(WT_SESSION_IMPL *session) F_SET(S2C(session), WT_CONN_WAS_BACKUP); -err: WT_TRET(fclose(fp) == 0 ? 0 : __wt_errno()); +err: WT_TRET(__wt_fclose(session, &fp)); __wt_scr_free(session, &key); __wt_scr_free(session, &value); return (ret); @@ -230,26 +227,21 @@ __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep) FILE *fp; WT_DECL_ITEM(buf); WT_DECL_RET; - int match; - char *path; + int exist, match; *valuep = NULL; - path = NULL; - /* * Open the turtle file; there's one case where we won't find the turtle * file, yet still succeed. We create the metadata file before creating * the turtle file, and that means returning the default configuration * string for the metadata file. */ - WT_RET(__wt_filename(session, WT_METADATA_TURTLE, &path)); - if ((fp = fopen(path, "r")) == NULL) - ret = __wt_errno(); - __wt_free(session, path); - if (fp == NULL) + WT_RET(__wt_exist(session, WT_METADATA_TURTLE, &exist)); + if (!exist) return (strcmp(key, WT_METAFILE_URI) == 0 ? - __metadata_config(session, valuep) : ret); + __metadata_config(session, valuep) : WT_NOTFOUND); + WT_RET(__wt_fopen(session, WT_METADATA_TURTLE, "r", 0, &fp)); /* Search for the key. */ WT_ERR(__wt_scr_alloc(session, 512, &buf)); @@ -271,7 +263,7 @@ __wt_turtle_read(WT_SESSION_IMPL *session, const char *key, char **valuep) /* Copy the value for the caller. */ WT_ERR(__wt_strdup(session, buf->data, valuep)); -err: WT_TRET(fclose(fp) == 0 ? 0 : __wt_errno()); +err: WT_TRET(__wt_fclose(session, &fp)); __wt_scr_free(session, &buf); return (ret); } diff --git a/src/os_posix/os_stdio.c b/src/os_posix/os_stdio.c index 62c02babc54..b27b0e33af1 100644 --- a/src/os_posix/os_stdio.c +++ b/src/os_posix/os_stdio.c @@ -9,17 +9,26 @@ #include "wt_internal.h" /* - * __wt_fp_open -- + * __wt_fopen -- * Open a FILE handle. */ int -__wt_fp_open(WT_SESSION_IMPL *session, - const char *name, const char *mode, FILE **fpp) +__wt_fopen(WT_SESSION_IMPL *session, + const char *name, const char *mode, u_int flags, FILE **fpp) { WT_DECL_RET; - char *path; + const char *path; + char *buf; - WT_RET(__wt_filename(session, name, &path)); + WT_RET(__wt_verbose(session, WT_VERB_FILEOPS, "%s: fopen", name)); + + buf = NULL; + if (LF_ISSET(WT_FOPEN_FIXED)) + path = name; + else { + WT_RET(__wt_filename(session, name, &buf)); + path = buf; + } #ifdef _WIN32 { @@ -38,17 +47,67 @@ __wt_fp_open(WT_SESSION_IMPL *session, if (*fpp == NULL) ret = __wt_errno(); - __wt_free(session, path); + if (buf != NULL) + __wt_free(session, buf); + + if (ret == 0) + return (0); + WT_RET_MSG(session, ret, "%s: fopen", name); +} + +/* + * __wt_vfprintf -- + * Vfprintf for a FILE handle. + */ +int +__wt_vfprintf(WT_SESSION_IMPL *session, FILE *fp, const char *fmt, va_list ap) +{ + WT_DECL_RET; + + WT_UNUSED(session); + + return (vfprintf(fp, fmt, ap) < 0 ? __wt_errno() : ret); +} + +/* + * __wt_fprintf -- + * Fprintf for a FILE handle. + */ +int +__wt_fprintf(WT_SESSION_IMPL *session, FILE *fp, const char *fmt, ...) + WT_GCC_FUNC_ATTRIBUTE((format (printf, 3, 4))) +{ + WT_DECL_RET; + va_list ap; + + WT_UNUSED(session); + + va_start(ap, fmt); + ret = __wt_vfprintf(session, fp, fmt, ap); + va_end(ap); return (ret); } /* - * __wt_fp_close -- + * __wt_fflush -- + * Flush a FILE handle. + */ +int +__wt_fflush(WT_SESSION_IMPL *session, FILE *fp) +{ + WT_UNUSED(session); + + /* Flush the handle. */ + return (fflush(fp) == 0 ? 0 : __wt_errno()); +} + +/* + * __wt_fclose -- * Close a FILE handle. */ int -__wt_fp_close(WT_SESSION_IMPL *session, FILE **fpp) +__wt_fclose(WT_SESSION_IMPL *session, FILE **fpp) { WT_DECL_RET; diff --git a/src/support/err.c b/src/support/err.c index 800a52901d0..4e4bf9b1c8a 100644 --- a/src/support/err.c +++ b/src/support/err.c @@ -14,14 +14,18 @@ */ static int __handle_error_default(WT_EVENT_HANDLER *handler, - WT_SESSION *session, int error, const char *errmsg) + WT_SESSION *wt_session, int error, const char *errmsg) { + WT_SESSION_IMPL *session; + WT_UNUSED(handler); - WT_UNUSED(session); WT_UNUSED(error); - return (fprintf(stderr, "%s\n", errmsg) >= 0 && - fflush(stderr) == 0 ? 0 : __wt_errno()); + session = (WT_SESSION_IMPL *)wt_session; + + WT_RET(__wt_fprintf(session, stderr, "%s\n", errmsg)); + WT_RET(__wt_fflush(session, stderr)); + return (0); } /* @@ -30,13 +34,17 @@ __handle_error_default(WT_EVENT_HANDLER *handler, */ static int __handle_message_default(WT_EVENT_HANDLER *handler, - WT_SESSION *session, const char *message) + WT_SESSION *wt_session, const char *message) { + WT_SESSION_IMPL *session; + WT_UNUSED(handler); - WT_UNUSED(session); - return (printf("%s\n", message) >= 0 && - fflush(stdout) == 0 ? 0 : __wt_errno()); + session = (WT_SESSION_IMPL *)wt_session; + + WT_RET(__wt_fprintf(session, stdout, "%s\n", message)); + WT_RET(__wt_fflush(session, stdout)); + return (0); } /* @@ -45,10 +53,10 @@ __handle_message_default(WT_EVENT_HANDLER *handler, */ static int __handle_progress_default(WT_EVENT_HANDLER *handler, - WT_SESSION *session, const char *operation, uint64_t progress) + WT_SESSION *wt_session, const char *operation, uint64_t progress) { WT_UNUSED(handler); - WT_UNUSED(session); + WT_UNUSED(wt_session); WT_UNUSED(operation); WT_UNUSED(progress); @@ -61,10 +69,10 @@ __handle_progress_default(WT_EVENT_HANDLER *handler, */ static int __handle_close_default(WT_EVENT_HANDLER *handler, - WT_SESSION *session, WT_CURSOR *cursor) + WT_SESSION *wt_session, WT_CURSOR *cursor) { WT_UNUSED(handler); - WT_UNUSED(session); + WT_UNUSED(wt_session); WT_UNUSED(cursor); return (0); @@ -172,13 +180,15 @@ __wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error, * first session, but if the allocation of the first session fails, for * example, we can end up here without a session.) */ - if (session == NULL) - return (fprintf(stderr, "WiredTiger Error%s%s: ", + if (session == NULL) { + WT_RET(__wt_fprintf(session, stderr, + "WiredTiger Error%s%s: ", error == 0 ? "" : ": ", - error == 0 ? "" : wiredtiger_strerror(error)) < 0 || - vfprintf(stderr, fmt, ap) < 0 || - fprintf(stderr, "\n") < 0 || - fflush(stderr) != 0 ? __wt_errno() : 0); + error == 0 ? "" : wiredtiger_strerror(error))); + WT_RET(__wt_vfprintf(session, stderr, fmt, ap)); + WT_RET(__wt_fprintf(session, stderr, "\n")); + WT_RET(__wt_fflush(session, stderr)); + } p = s; end = s + sizeof(s); diff --git a/src/support/mutex.c b/src/support/mutex.c index c35656051f6..fa85cfc33d5 100644 --- a/src/support/mutex.c +++ b/src/support/mutex.c @@ -194,27 +194,24 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag) continue; } - WT_RET_TEST((fprintf(conn->stat_fp, + WT_RET(__wt_fprintf(session, conn->stat_fp, "%s %" PRIu64 " %s spinlock %s: acquisitions\n", conn->stat_stamp, spin->counter <= ignore ? 0 : spin->counter, - tag, spin->name) < 0), - __wt_errno()); + tag, spin->name)); if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_CLEAR)) spin->counter = 0; } - WT_RET_TEST((fprintf(conn->stat_fp, + WT_RET(__wt_fprintf(session, conn->stat_fp, "%s %" PRIu64 " %s spinlock %s: acquisitions\n", conn->stat_stamp, block_manager <= ignore ? 0 : block_manager, - tag, "block manager") < 0), - __wt_errno()); - WT_RET_TEST((fprintf(conn->stat_fp, + tag, "block manager")); + WT_RET(__wt_fprintf(session, conn->stat_fp, "%s %" PRIu64 " %s spinlock %s: acquisitions\n", conn->stat_stamp, btree_page <= ignore ? 0 : btree_page, - tag, "btree page") < 0), - __wt_errno()); + tag, "btree page")); /* * Output the number of times each location acquires its spinlock and @@ -225,12 +222,12 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag) if (p->name == NULL) continue; - WT_RET_TEST((fprintf(conn->stat_fp, + WT_RET(__wt_fprintf(session, conn->stat_fp, "%s %d %s spinlock %s acquired by %s(%d)\n", conn->stat_stamp, p->total <= ignore ? 0 : p->total, tag, - p->name, p->file, p->line) < 0), __wt_errno()); + p->name, p->file, p->line)); if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_CLEAR)) p->total = 0; @@ -239,13 +236,13 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag) if (t->name == NULL) continue; - WT_RET_TEST((fprintf(conn->stat_fp, + WT_RET(__wt_fprintf(session, conn->stat_fp, "%s %d %s spinlock %s: %s(%d) blocked by %s(%d)\n", conn->stat_stamp, p->blocked[j] <= ignore ? 0 : p->blocked[j], tag, p->name, p->file, p->line, - t->file, t->line) < 0), __wt_errno()); + t->file, t->line)); if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_CLEAR)) p->blocked[j] = 0; } |