summaryrefslogtreecommitdiff
path: root/src/support
diff options
context:
space:
mode:
authorKeith Bostic <keith@wiredtiger.com>2015-04-02 13:06:19 -0400
committerKeith Bostic <keith@wiredtiger.com>2015-04-02 13:06:19 -0400
commitd3dacbffd2a87ea79ec05fa569bdd5d34f90254c (patch)
tree7c7c324ccee91fb31c7aca145ab230aff2e5058e /src/support
parenteee8167eb19ca4e9b779b0364bbaef1b920150f8 (diff)
downloadmongo-d3dacbffd2a87ea79ec05fa569bdd5d34f90254c.tar.gz
Make --with-spinlock=pthread_logging option compile again.
Remove the WT_SESSION_IMPL argument to the fprintf, vfprintf, fflush and fclose functions, there are places we want to use it that don't have session handles, and it's not currently needed. Clean up error handling in the vfprintf function.
Diffstat (limited to 'src/support')
-rw-r--r--src/support/err.c26
-rw-r--r--src/support/filename.c2
-rw-r--r--src/support/mutex.c17
3 files changed, 20 insertions, 25 deletions
diff --git a/src/support/err.c b/src/support/err.c
index fc6569cb81e..34e44701ea0 100644
--- a/src/support/err.c
+++ b/src/support/err.c
@@ -16,15 +16,12 @@ static int
__handle_error_default(WT_EVENT_HANDLER *handler,
WT_SESSION *wt_session, int error, const char *errmsg)
{
- WT_SESSION_IMPL *session;
-
WT_UNUSED(handler);
+ WT_UNUSED(wt_session);
WT_UNUSED(error);
- session = (WT_SESSION_IMPL *)wt_session;
-
- WT_RET(__wt_fprintf(session, stderr, "%s\n", errmsg));
- WT_RET(__wt_fflush(session, stderr));
+ WT_RET(__wt_fprintf(stderr, "%s\n", errmsg));
+ WT_RET(__wt_fflush(stderr));
return (0);
}
@@ -36,14 +33,11 @@ static int
__handle_message_default(WT_EVENT_HANDLER *handler,
WT_SESSION *wt_session, const char *message)
{
- WT_SESSION_IMPL *session;
-
WT_UNUSED(handler);
+ WT_UNUSED(wt_session);
- session = (WT_SESSION_IMPL *)wt_session;
-
- WT_RET(__wt_fprintf(session, stdout, "%s\n", message));
- WT_RET(__wt_fflush(session, stdout));
+ WT_RET(__wt_fprintf(stdout, "%s\n", message));
+ WT_RET(__wt_fflush(stdout));
return (0);
}
@@ -181,13 +175,13 @@ __wt_eventv(WT_SESSION_IMPL *session, int msg_event, int error,
* example, we can end up here without a session.)
*/
if (session == NULL) {
- WT_RET(__wt_fprintf(session, stderr,
+ WT_RET(__wt_fprintf(stderr,
"WiredTiger Error%s%s: ",
error == 0 ? "" : ": ",
error == 0 ? "" : __wt_strerror(session, error, NULL, 0)));
- WT_RET(__wt_vfprintf(session, stderr, fmt, ap));
- WT_RET(__wt_fprintf(session, stderr, "\n"));
- return (__wt_fflush(session, stderr));
+ WT_RET(__wt_vfprintf(stderr, fmt, ap));
+ WT_RET(__wt_fprintf(stderr, "\n"));
+ return (__wt_fflush(stderr));
}
p = s;
diff --git a/src/support/filename.c b/src/support/filename.c
index db466ed3bd4..2d284aeb0b0 100644
--- a/src/support/filename.c
+++ b/src/support/filename.c
@@ -104,7 +104,7 @@ __wt_sync_and_rename_fp(
*fpp = NULL;
/* Flush to disk and close the handle. */
- WT_RET(__wt_fclose(session, &fp, WT_FHANDLE_WRITE));
+ WT_RET(__wt_fclose(&fp, WT_FHANDLE_WRITE));
/* Rename the source file to the target. */
WT_RET(__wt_rename(session, from, to));
diff --git a/src/support/mutex.c b/src/support/mutex.c
index fa85cfc33d5..d81ac51c0d9 100644
--- a/src/support/mutex.c
+++ b/src/support/mutex.c
@@ -32,7 +32,7 @@ __wt_spin_lock_register_lock(WT_SESSION_IMPL *session, WT_SPINLOCK *t)
for (i = 0; i < WT_SPINLOCK_MAX; i++)
if (conn->spinlock_list[i] == NULL &&
- WT_ATOMIC_CAS(conn->spinlock_list[i], NULL, t))
+ WT_ATOMIC_CAS8(conn->spinlock_list[i], NULL, t))
return (0);
WT_RET_MSG(session, ENOMEM,
@@ -76,7 +76,8 @@ __wt_spin_lock_unregister_lock(WT_SESSION_IMPL *session, WT_SPINLOCK *t)
static int
__spin_lock_next_id(WT_SESSION_IMPL *session, int *idp)
{
- static int lock_id = 0, next_id = 0;
+ static uint64_t lock_id = 0;
+ static int next_id = 0;
WT_DECL_RET;
/* If we've ever registered this location, we already have an ID. */
@@ -89,7 +90,7 @@ __spin_lock_next_id(WT_SESSION_IMPL *session, int *idp)
* This work only gets done once per library instantiation, there
* isn't a performance concern.
*/
- while (!WT_ATOMIC_CAS(lock_id, 0, 1))
+ while (!WT_ATOMIC_CAS8(lock_id, 0, 1))
__wt_yield();
/* Allocate a blocking ID for this location. */
@@ -194,7 +195,7 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag)
continue;
}
- WT_RET(__wt_fprintf(session, conn->stat_fp,
+ WT_RET(__wt_fprintf(conn->stat_fp,
"%s %" PRIu64 " %s spinlock %s: acquisitions\n",
conn->stat_stamp,
spin->counter <= ignore ? 0 : spin->counter,
@@ -202,12 +203,12 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag)
if (FLD_ISSET(conn->stat_flags, WT_CONN_STAT_CLEAR))
spin->counter = 0;
}
- WT_RET(__wt_fprintf(session, conn->stat_fp,
+ WT_RET(__wt_fprintf(conn->stat_fp,
"%s %" PRIu64 " %s spinlock %s: acquisitions\n",
conn->stat_stamp,
block_manager <= ignore ? 0 : block_manager,
tag, "block manager"));
- WT_RET(__wt_fprintf(session, conn->stat_fp,
+ WT_RET(__wt_fprintf(conn->stat_fp,
"%s %" PRIu64 " %s spinlock %s: acquisitions\n",
conn->stat_stamp,
btree_page <= ignore ? 0 : btree_page,
@@ -222,7 +223,7 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag)
if (p->name == NULL)
continue;
- WT_RET(__wt_fprintf(session, conn->stat_fp,
+ WT_RET(__wt_fprintf(conn->stat_fp,
"%s %d %s spinlock %s acquired by %s(%d)\n",
conn->stat_stamp,
p->total <= ignore ? 0 : p->total,
@@ -236,7 +237,7 @@ __wt_statlog_dump_spinlock(WT_CONNECTION_IMPL *conn, const char *tag)
if (t->name == NULL)
continue;
- WT_RET(__wt_fprintf(session, conn->stat_fp,
+ WT_RET(__wt_fprintf(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],