summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStewart Smith <stewart@linux.vnet.ibm.com>2015-12-15 19:18:45 +1100
committerStewart Smith <stewart@linux.vnet.ibm.com>2015-12-15 19:18:45 +1100
commit041d482397092e992c692b2b3d8534d8b84ca75f (patch)
tree374d0caef8d1799f279a561834352e0e3145302a
parent3f88fcdc897615e48c83d5a6f312127a90c9e3a5 (diff)
downloadffs-041d482397092e992c692b2b3d8534d8b84ca75f.zip
ffs-041d482397092e992c692b2b3d8534d8b84ca75f.tar.gz
remove unused mq
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r--Makefile.am1
-rw-r--r--clib/mq.h151
-rw-r--r--clib/src/mq.c215
-rw-r--r--clib/test/mq.c81
4 files changed, 0 insertions, 448 deletions
diff --git a/Makefile.am b/Makefile.am
index 34f625b..c2214ba 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -14,7 +14,6 @@ libclib_a_SOURCES = \
clib/src/tree.c \
clib/src/tree_iter.c \
clib/src/value.c \
- clib/src/mq.c \
clib/src/trace_indent.c \
clib/src/checksum.c
diff --git a/clib/mq.h b/clib/mq.h
deleted file mode 100644
index 23657c6..0000000
--- a/clib/mq.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: clib/mq.h $ */
-/* */
-/* OpenPOWER FFS Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-/*!
- * @file mqueue.h
- * @brief Message queues
- * @author Shaun Wetzstein <shaun@us.ibm.com>
- * @date 2010-2011
- */
-
-#ifndef __MQUEUE_H__
-#define __MQUEUE_H__
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <mqueue.h>
-
-#include "attribute.h"
-
-/* ==================================================================== */
-
-typedef struct mqueue mqueue_t; //!< Alias for the @em mqueue class
-typedef struct mq_attr mqueue_attr_t;
-
-#define INIT_MQUEUE {NULL,-1,-1}
-
-/*!
- * @brief POSIX message queues
- */
-struct mqueue {
- char *service; //!< Message queue name
-
- mqd_t in; //!< Inbound message queue
- mqd_t out; //!< Outbound message queue
-};
-
-/* ==================================================================== */
-
-/*!
- * @brief Constructs a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param service [in] mqueue service name
- * @return None
- * @throws UNEXPECTED if @em self pointer is NULL
- */
-extern int mqueue_init(mqueue_t *, const char *)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Destructs a @em mqueue object
- * @details Closes all message queues associated with this \em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @return None
- */
-extern int mqueue_delete(mqueue_t *)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Create the server-side of a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param tid [in] thread id
- * @return None
- */
-extern int mqueue_create(mqueue_t *, pid_t)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Create the client-side of a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param path [in] FIX ME
- * @return None
- */
-extern int mqueue_open(mqueue_t *, char *)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Close a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param path [in] FIX ME
- * @return None
- */
-extern int mqueue_close(mqueue_t *, char *)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Get message queue operating attributes of a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @return Initialized mqueue_attr object
- */
-extern mqueue_attr_t mqueue_getattr(mqueue_t *)
-/*! @cond */
-__nonnull((1)) /*! @endcond */ ;
-
-/*!
- * @brief Write (send) a message to a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param ptr [in] Reference to data bytes to send
- * @param ptr [in] Length (in bytes) of the data bytes
- * @return non-0 on success, 0 othereise
- */
-extern int mqueue_send(mqueue_t *, void *, size_t)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-/*!
- * @brief Read (receive) a message from a @em mqueue object
- * @memberof mqueue
- * @param self [in] mqueue object @em self pointer
- * @param ptr [out] Reference to data bytes to send
- * @param ptr [in] Length (in bytes) of the buffer referenced by @em ptr
- * @return non-0 on success, 0 othereise
- */
-extern int mqueue_receive(mqueue_t *, void *, size_t)
-/*! @cond */
-__nonnull((1, 2)) /*! @endcond */ ;
-
-#endif /* __MQUEUE_H__ */
diff --git a/clib/src/mq.c b/clib/src/mq.c
deleted file mode 100644
index cf75e89..0000000
--- a/clib/src/mq.c
+++ /dev/null
@@ -1,215 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: clib/src/mq.c $ */
-/* */
-/* OpenPOWER FFS Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-/*
- * File: mqueue.c
- * Author: Shaun Wetzstein <shaun@us.ibm.com>
- * Descr: POSIX message queue wrapper
- * Note:
- * Date: 10/07/10
- */
-
-#include <unistd.h>
-#include <stdarg.h>
-#include <stdlib.h>
-#include <malloc.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <fcntl.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "libclib.h"
-#include "mq.h"
-
-#define MQUEUE_ROOT "/dev/mqueue"
-
-/* ======================================================================= */
-
-int mqueue_init(mqueue_t * self, const char *service)
-{
- assert(self != NULL);
-
- self->service = strdup(service);
- self->in = self->out = (mqd_t) - 1;
-
- return 0;
-}
-
-int mqueue_create(mqueue_t * self, pid_t tid)
-{
- assert(self != NULL);
-
- char path[pathconf(MQUEUE_ROOT, _PC_PATH_MAX)];
-
- sprintf(path, "%s/%d->%s", MQUEUE_ROOT, tid, self->service);
-
- self->out = open(path, O_WRONLY | O_CREAT, S_IWUSR);
- if (self->out == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
-
- sprintf(path, "%s/%d<-%s", MQUEUE_ROOT, tid, self->service);
-
- self->in = open(path, O_RDONLY | O_CREAT, S_IRUSR);
- if (self->in == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
-
- return 0;
-}
-
-int mqueue_open(mqueue_t * self, char *path)
-{
- assert(self != NULL);
-
- if (path != NULL) {
- char *endp = NULL;
- (void)strtol(path + 1, &endp, 10);
-
- if (strncmp(endp, "->", 2) == 0) {
- self->in = mq_open((char *)path, O_RDONLY,
- S_IRWXU, NULL);
- if (self->in == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
- } else if (strncmp(endp, "<-", 2) == 0) {
- self->out = mq_open((char *)path, O_WRONLY,
- S_IRWXU, NULL);
- if (self->out == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
- } else {
- UNEXPECTED("'%s' invalid service", path);
- return -1;
- }
- }
-
- return 0;
-}
-
-int mqueue_close(mqueue_t * self, char *path)
-{
- assert(self != NULL);
-
- if (path != NULL) {
- char *endp = NULL;
- (void)strtol(path + 1, &endp, 10);
-
- if (strncmp(endp, "->", 2) == 0) {
- if (self->in != (mqd_t) - 1)
- mq_close(self->in), self->in = (mqd_t) - 1;
- } else if (strncmp(endp, "<-", 2) == 0) {
- if (self->out != (mqd_t) - 1)
- mq_close(self->out), self->out = (mqd_t) - 1;
- } else {
- UNEXPECTED("'%s' invalid service", path);
- return -1;
- }
- }
-
- return 0;
-}
-
-mqueue_attr_t mqueue_getattr(mqueue_t * self)
-{
- assert(self != NULL);
-
- mqueue_attr_t attr;
- mq_getattr(self->in, &attr);
-
- return attr;
-}
-
-int mqueue_delete(mqueue_t * self)
-{
- assert(self != NULL);
-
- char path[pathconf(MQUEUE_ROOT, _PC_PATH_MAX)];
- if (self->in != (mqd_t) - 1) {
- sprintf(path, "%s/%d->%s",
- MQUEUE_ROOT, gettid(), self->service);
- unlink(path);
- if (mq_close(self->in) == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
- self->in = (mqd_t) - 1;
- }
-
- if (self->out != (mqd_t) - 1) {
- sprintf(path, "%s/%d<-%s",
- MQUEUE_ROOT, gettid(), self->service);
- unlink(path);
- if (mq_close(self->in) == (mqd_t) - 1) {
- ERRNO(errno);
- return -1;
- }
- self->out = (mqd_t) - 1;
- }
-
- if (self->service) {
- free((void *)self->service);
- self->service = NULL;
- }
-
- return 0;
-}
-
-int mqueue_send(mqueue_t * self, void *ptr, size_t len)
-{
- assert(self != NULL);
-
- int rc = mq_send(self->out, (char *)ptr, len, 0);
- if (rc == -1) {
- ERRNO(errno);
- return -1;
- }
-
- return rc;
-}
-
-int mqueue_receive(mqueue_t * self, void *ptr, size_t len)
-{
- assert(self != NULL);
-
- int rc = mq_receive(self->in, (char *)ptr, len, 0);
- if (rc == -1) {
- ERRNO(errno);
- return -1;
- }
-
- return rc;
-}
-
-/* ======================================================================= */
diff --git a/clib/test/mq.c b/clib/test/mq.c
deleted file mode 100644
index 8cdcb0c..0000000
--- a/clib/test/mq.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* IBM_PROLOG_BEGIN_TAG */
-/* This is an automatically generated prolog. */
-/* */
-/* $Source: clib/test/mq.c $ */
-/* */
-/* OpenPOWER FFS Project */
-/* */
-/* Contributors Listed Below - COPYRIGHT 2014,2015 */
-/* [+] International Business Machines Corp. */
-/* */
-/* */
-/* Licensed under the Apache License, Version 2.0 (the "License"); */
-/* you may not use this file except in compliance with the License. */
-/* You may obtain a copy of the License at */
-/* */
-/* http://www.apache.org/licenses/LICENSE-2.0 */
-/* */
-/* Unless required by applicable law or agreed to in writing, software */
-/* distributed under the License is distributed on an "AS IS" BASIS, */
-/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or */
-/* implied. See the License for the specific language governing */
-/* permissions and limitations under the License. */
-/* */
-/* IBM_PROLOG_END_TAG */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-#include <clib/vector.h>
-#include <clib/vector_iter.h>
-
-#include <clib/misc.h>
-#include <clib/mq.h>
-
-#define SIZE 2550
-
-int main(void) {
- vector_t a = INIT_VECTOR;
- vector_init(&a, "my_vector", 4, 1024);
-
- vector_put(&a, 52, (uint32_t[]){52});
- vector_put(&a, 53, (uint32_t[]){53});
- vector_put(&a, 167, (uint32_t[]){167});
- vector_put(&a, 223, (uint32_t[]){223});
- vector_put(&a, 78, (uint32_t[]){78});
- vector_put(&a, 205, (uint32_t[]){205});
- vector_put(&a, 183, (uint32_t[]){183});
- vector_put(&a, 150, (uint32_t[]){150});
- vector_put(&a, 90, (uint32_t[]){90});
- vector_put(&a, 66, (uint32_t[]){66});
- vector_put(&a, 91, (uint32_t[]){91});
- vector_put(&a, 45, (uint32_t[]){45});
- vector_put(&a, 211, (uint32_t[]){211});
- uint32_t arr[] = {55,56,57,58,59,60,61,62,63};
- vector_put(&a, 985, arr, 9);
-
- vector_iter_t it;
- vector_iter_init(&it, &a, VI_FLAG_FWD);
-
- uint32_t * j;
- vector_for_each(&it, j) {
- printf("XXX i[%d]\n", *j);
- }
-
- vector_dump(&a, stdout);
-
- mqueue_t mq = INIT_MQUEUE;
- mqueue_init(&mq, "dbs");
- mqueue_create(&mq, gettid());
-
- vector_send(&a, &mq);
- vector_delete(&a);
-
- sleep(1);
-
- mqueue_delete(&mq);
-
- return 0;
-}
OpenPOWER on IntegriCloud