diff options
Diffstat (limited to 'nslcd/hackers.c')
-rw-r--r-- | nslcd/hackers.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/nslcd/hackers.c b/nslcd/hackers.c new file mode 100644 index 0000000..57d4f97 --- /dev/null +++ b/nslcd/hackers.c @@ -0,0 +1,42 @@ +#include <stdbool.h> +#include <string.h> +#include <errno.h> +#include <stdlib.h> +#include <pthread.h> +#include "hackers_watch.h" +#include "log.h" + +void *hackers_session_worker(void *sess) { + hackers_worker(sess); + return NULL; +} + +struct session *hackers_session_create(pthread_t *thread) { + struct session *session = malloc(sizeof(struct session)); + if (session == NULL) { + log_log(LOG_CRIT, "hackers_session_create(): malloc() failed to allocate memory"); + exit(EXIT_FAILURE); + } + if (pthread_create(thread, NULL, hackers_session_worker, (void*)session)) { + log_log(LOG_ERR, "unable to start hackers worker thread: %s", + strerror(errno)); + exit(EXIT_FAILURE); + } + return session; +} + +void hackers_session_check(struct session *sess) { + /* do nothing */ +} + +void hackers_session_close(struct session *sess) { + /* do nothing */ +} + +void hackers_session_messup(struct session *sess) { + pthread_rwlock_rdlock(&(sess->lock)); +} + +void hackers_session_cleanup(struct session *sess) { + pthread_rwlock_unlock(&(sess->lock)); +} |