Select Git revision
Forked from
jupyter4jsc / j4j_notebooks
Source project has a limited visibility.
simple_archiver.c 10.40 KiB
/* Connect to pool and subscribe to many events, archiving all CDOs */
/*
* Copyright (C) 2020 Cray Computer GmbH
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/* needed before inclusion of cheat.h: */
#ifndef __BASE_FILE__
#define __BASE_FILE__ __FILE__
#endif
#include "cheat.h"
#include "maestro.h"
#include "maestro/i_statistics.h"
#include "maestro/logging.h"
#include <string.h>
#include <unistd.h>
#include <inttypes.h>
/* simplify logging */
#define DEBUG(...) LOG_DEBUG(MSTRO_LOG_MODULE_USER,__VA_ARGS__)
#define INFO(...) LOG_INFO(MSTRO_LOG_MODULE_USER,__VA_ARGS__)
#define WARN(...) LOG_WARN(MSTRO_LOG_MODULE_USER,__VA_ARGS__)
#define ERR(...) LOG_ERR(MSTRO_LOG_MODULE_USER,__VA_ARGS__)
// a list (used as stack) to store CDO handles
CHEAT_DECLARE(
struct cdo_list_entry {
mstro_cdo cdo;
struct cdo_list_entry *next;
};
struct cdo_list_entry *g_cdo_handles = NULL;
struct cdo_list_entry *
push_cdo(mstro_cdo c)
{
struct cdo_list_entry *e = malloc(sizeof(struct cdo_list_entry));
if(e!=NULL) {
e->cdo = c;
e->next = g_cdo_handles;
g_cdo_handles = e;