diff options
author | Ken Raeburn <raeburn@mit.edu> | 2006-01-25 06:21:47 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2006-01-25 06:21:47 +0000 |
commit | 58e2e98200ca8d8f9a9cff9758e11fd860c0046c (patch) | |
tree | 8be5dc11e66167694d99ba1fdad86d0561d588ab /src/util | |
parent | fee0fe0e00f4afa98de8779dfe66043456610f82 (diff) | |
download | krb5-58e2e98200ca8d8f9a9cff9758e11fd860c0046c.tar.gz krb5-58e2e98200ca8d8f9a9cff9758e11fd860c0046c.tar.xz krb5-58e2e98200ca8d8f9a9cff9758e11fd860c0046c.zip |
* threads.c (krb5int_mutex_alloc, krb5int_mutex_free, krb5int_mutex_lock,
krb5int_mutex_unlock): New functions.
(krb5int_mutex_lock_update_stats, krb5int_mutex_unlock_update_stats,
krb5int_mutex_report_stats): Always define, even if not doing anything.
* libkrb5support.exports: Export the new functions.
ticket: 3417
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17607 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/support/ChangeLog | 9 | ||||
-rw-r--r-- | src/util/support/libkrb5support.exports | 4 | ||||
-rw-r--r-- | src/util/support/threads.c | 41 |
3 files changed, 53 insertions, 1 deletions
diff --git a/src/util/support/ChangeLog b/src/util/support/ChangeLog index 8aa8414c34..d40ec99cd2 100644 --- a/src/util/support/ChangeLog +++ b/src/util/support/ChangeLog @@ -1,3 +1,12 @@ +2006-01-25 Ken Raeburn <raeburn@mit.edu> + + * threads.c (krb5int_mutex_alloc, krb5int_mutex_free, + krb5int_mutex_lock, krb5int_mutex_unlock): New functions. + (krb5int_mutex_lock_update_stats, + krb5int_mutex_unlock_update_stats, krb5int_mutex_report_stats): + Always define, even if not doing anything. + * libkrb5support.exports: Export the new functions. + 2005-09-09 Ken Raeburn <raeburn@mit.edu> * fake_addrinfo.c (getaddrinfo): Conditionalize last change on diff --git a/src/util/support/libkrb5support.exports b/src/util/support/libkrb5support.exports index 9607ef8226..d06911d533 100644 --- a/src/util/support/libkrb5support.exports +++ b/src/util/support/libkrb5support.exports @@ -11,3 +11,7 @@ krb5int_gai_strerror krb5int_getnameinfo krb5int_in6addr_any krb5int_pthread_loaded +krb5int_mutex_alloc +krb5int_mutex_free +krb5int_mutex_lock +krb5int_mutex_unlock diff --git a/src/util/support/threads.c b/src/util/support/threads.c index 8a00e4c2bd..d3b5c1bef3 100644 --- a/src/util/support/threads.c +++ b/src/util/support/threads.c @@ -585,7 +585,7 @@ krb5int_mutex_report_stats(k5_mutex_t *m) sd_hold); } } -#elif defined _WIN32 +#else /* On Windows, everything defined in the export list must be defined. The UNIX systems where we're using the export list don't seem to care. */ @@ -606,3 +606,42 @@ krb5int_mutex_report_stats(k5_mutex_t *m) { } #endif + +/* Mutex allocation functions, for use in plugins that may not know + what options a given set of libraries was compiled with. */ +int KRB5_CALLCONV +krb5int_mutex_alloc (k5_mutex_t **m) +{ + k5_mutex_t *ptr; + int err; + + ptr = malloc (sizeof (k5_mutex_t)); + if (ptr == NULL) + return errno; + err = k5_mutex_init (ptr); + if (err) { + free (ptr); + return err; + } + *m = ptr; + return 0; +} + +void KRB5_CALLCONV +krb5int_mutex_free (k5_mutex_t *m) +{ + (void) k5_mutex_destroy (m); + free (m); +} + +/* Callable versions of the various macros. */ +int KRB5_CALLCONV +krb5int_mutex_lock (k5_mutex_t *m) +{ + return k5_mutex_lock (m); +} +int KRB5_CALLCONV +krb5int_mutex_unlock (k5_mutex_t *m) +{ + return k5_mutex_unlock (m); +} |