ovni/test/rt/nosv/attach.c

39 lines
721 B
C
Raw Normal View History

2023-02-27 13:40:20 +01:00
/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC)
2022-09-19 12:39:02 +02:00
* SPDX-License-Identifier: GPL-3.0-or-later */
2022-08-22 16:40:08 +02:00
#define _DEFAULT_SOURCE
#include <nosv.h>
#include <unistd.h>
2022-08-22 16:40:08 +02:00
#include "common.h"
int
main(void)
2022-08-22 16:40:08 +02:00
{
nosv_init();
nosv_task_type_t type;
if (nosv_type_init(&type, NULL, NULL, NULL, "adopted", NULL,
2022-09-30 10:25:09 +02:00
NULL, NOSV_TYPE_INIT_EXTERNAL)
!= 0)
2022-08-22 16:40:08 +02:00
die("nosv_type_init failed\n");
nosv_task_t task;
if (nosv_attach(&task, type, 0, NULL, 0) != 0)
2022-08-22 16:40:08 +02:00
die("nosv_attach failed\n");
usleep(100);
if (nosv_detach(0) != 0)
2022-08-22 16:40:08 +02:00
die("nosv_detach failed\n");
if (nosv_type_destroy(type, 0) != 0)
2022-08-22 16:40:08 +02:00
die("nosv_type_destroy failed\n");
if (nosv_shutdown() != 0)
2022-08-22 16:40:08 +02:00
die("nosv_shutdown failed\n");
return 0;
}