Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,15 @@ COPY --from=builder \

# Binaries
COPY --from=builder \
"/usr/local/bin/capio_posix_unit_test[s]" \
"/usr/local/bin/capio_posix_unit_test[s]*" \
"/usr/local/bin/capio_server" \
"/usr/local/bin/capio_server_unit_test[s]" \
"/usr/local/bin/capio_syscall_unit_test[s]" \
"/usr/local/bin/capio_integration_test[s]" \
"/usr/local/bin/capio_backend_unit_tests" \
"/usr/local/bin/capio_integration_test_map" \
"/usr/local/bin/capio_integration_test_merge" \
"/usr/local/bin/capio_integration_test_split" \
"/usr/local/bin/capio_server_unit_test[s]*" \
"/usr/local/bin/capio_syscall_unit_test[s]*" \
"/usr/local/bin/capio_integration_test[s]*" \
"/usr/local/bin/capio_backend_unit_tests*" \
"/usr/local/bin/capio_integration_test_map*" \
"/usr/local/bin/capio_integration_test_merge*" \
"/usr/local/bin/capio_integration_test_split*" \
"/opt/capio/capiorun/capiorun" \
/usr/local/bin/

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ Bash.
> oy just want to coordinate IO operations between workflow steps!

Compatible on:
- ![Architecture](https://img.shields.io/badge/Architecture-x86_64-blue.svg)
- ![Architecture](https://img.shields.io/badge/Architecture-risc--v-green.svg)
- ![Architecture](https://img.shields.io/badge/Architecture-arm64-red.svg) coming soon!
- ![Architecture](https://img.shields.io/badge/Architecture-x86__64_/_amd64-50C878.svg)
- ![Architecture](https://img.shields.io/badge/Architecture-RISC--V_(riscv64)-50C878.svg)
- ![Architecture](https://img.shields.io/badge/Architecture-ARM64_coming_soon-red.svg)

---
## Automatic install with SPACK
Expand Down
7 changes: 7 additions & 0 deletions docker-development/build-and-startup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env bash

cd ..
docker build -t alphaunito/capio --build-arg CAPIO_LOG=ON --build-arg CMAKE_BUILD_TYPE=Debug .
cd docker-development

docker compose up
34 changes: 34 additions & 0 deletions docker-development/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
services:
node1:
image: alphaunito/capio:latest
tty: true
working_dir: /shared
volumes:
- shared_data:/shared
networks:
capio_net:
aliases:
- node1
environment:
- CAPIO_LOG_LEVEL=-1

node2:
image: alphaunito/capio:latest
tty: true
working_dir: /shared
volumes:
- shared_data:/shared
networks:
capio_net:
aliases:
- node2
environment:
- CAPIO_LOG_LEVEL=-1


volumes:
shared_data:

networks:
capio_net:
driver: bridge
11 changes: 8 additions & 3 deletions src/common/capio/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@ constexpr char CAPIO_SERVER_ARG_PARSER_CONFIG_BACKEND_HELP[] =
constexpr int DEFAULT_CAPIO_BACKEND_PORT = 2222;
constexpr int CAPIO_BACKEND_DEFAULT_SLEEP_TIME = 300;
constexpr char MULTICAST_DISCOVERY_ADDR[] = "234.234.234.1";
constexpr char MULTICAST_CONTROLPL_ADDR[] = "234.234.234.2";
constexpr int MULTICAST_DISCOVERY_PORT = 2223;
constexpr int MULTICAST_ALIVE_TOKEN_MESSAGE_SIZE =
HOST_NAME_MAX + 10; // hostname + : + sizeof(port)
#endif // CAPIO_COMMON_CONSTANTS_HPP
constexpr int MULTICAST_CONTROLPL_PORT = 2224;

// hostname + : + sizeof(port)
constexpr int MULTICAST_ALIVE_TOKEN_MESSAGE_SIZE = HOST_NAME_MAX + 10;
constexpr int MULTICAST_CONTROLPL_MESSAGE_SIZE = HOST_NAME_MAX + PATH_MAX + 10;

#endif // CAPIO_COMMON_CONSTANTS_HPP
4 changes: 1 addition & 3 deletions src/common/capio/env.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ inline const std::filesystem::path &get_capio_dir() {

if (val == nullptr) {
ERR_EXIT("Fatal: CAPIO_DIR not provided!");

} else {

const char *realpath_res = capio_realpath(val, buf.get());
if (realpath_res == nullptr) {
ERR_EXIT("error CAPIO_DIR: directory %s does not "
Expand Down Expand Up @@ -111,4 +109,4 @@ inline std::string get_capio_workflow_name() {
return name;
}

#endif // CAPIO_COMMON_ENV_HPP
#endif // CAPIO_COMMON_ENV_HPP
2 changes: 1 addition & 1 deletion src/common/capio/filesystem.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,4 @@ inline bool is_capio_path(const std::filesystem::path &path_to_check) {
return std::regex(computed);
}

#endif // CAPIO_COMMON_FILESYSTEM_HPP
#endif // CAPIO_COMMON_FILESYSTEM_HPP
4 changes: 2 additions & 2 deletions src/common/capio/logger.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline thread_local char logfile_path[PATH_MAX]{'\0'};
inline thread_local int current_log_level = 0;
inline thread_local bool logging_syscall =
false; // this variable tells the logger that syscall logging
// has started and we are not in setup phase
// has started and we are not in setup phase

#ifndef CAPIO_MAX_LOG_LEVEL // capio max log level. defaults to -1, where everything is logged
#define CAPIO_MAX_LOG_LEVEL -1
Expand Down Expand Up @@ -372,7 +372,7 @@ inline bool syscall_no_intercept_flag = false;
#define ERR_EXIT(fmt, ...) \
if (!continue_on_error) { \
syscall_no_intercept_flag = true; \
char tmp_buf[1024]; \
char tmp_buf[5120]; \
sprintf(tmp_buf, fmt, ##__VA_ARGS__); \
char node_name[HOST_NAME_MAX]{0}; \
gethostname(node_name, HOST_NAME_MAX); \
Expand Down
2 changes: 1 addition & 1 deletion src/common/capio/requests.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ constexpr const int CAPIO_REQUEST_POSIX_DIR_COMMITTED = 13;

constexpr const int CAPIO_NR_REQUESTS = 14;

#endif // CAPIO_COMMON_REQUESTS_HPP
#endif // CAPIO_COMMON_REQUESTS_HPP
3 changes: 2 additions & 1 deletion src/common/capio/response_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class ResponseQueue {

ResponseQueue(const ResponseQueue &) = delete;
ResponseQueue &operator=(const ResponseQueue &) = delete;

~ResponseQueue() {
START_LOG(capio_syscall(SYS_gettid), "call(_shm_name=%s)", _shm_name.c_str());
if (require_cleanup) {
Expand All @@ -67,4 +68,4 @@ class ResponseQueue {
_shared_mutex.unlock();
}
};
#endif // CAPIO_RESPONSE_QUEUE_HPP
#endif // CAPIO_RESPONSE_QUEUE_HPP
2 changes: 1 addition & 1 deletion src/common/capio/shm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ void *get_shm_if_exist(const std::string &shm_name) {
return p;
}

#endif // CAPIO_COMMON_SHM_HPP
#endif // CAPIO_COMMON_SHM_HPP
2 changes: 1 addition & 1 deletion src/common/capio/syscall.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ inline char *syscall_no_intercept_realpath(const char *path, char *resolved) {
#define gettid() capio_syscall(SYS_gettid)
#endif

#endif // CAPIO_COMMON_SYSCALL_HPP
#endif // CAPIO_COMMON_SYSCALL_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@

#include "handlers/posix_readdir.hpp"

#endif // CAPIO_POSIX_HANDLERS_HPP
#endif // CAPIO_POSIX_HANDLERS_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/access.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ int faccessat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, lon
}
#endif // SYS_faccessat

#endif // CAPIO_POSIX_HANDLERS_ACCESS_HPP
#endif // CAPIO_POSIX_HANDLERS_ACCESS_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/chdir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ int chdir_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}

#endif // SYS_chdir
#endif // CAPIO_POSIX_HANDLERS_CHDIR_HPP
#endif // CAPIO_POSIX_HANDLERS_CHDIR_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/close.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ int close_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}

#endif // SYS_close
#endif // CAPIO_POSIX_HANDLERS_CLOSE_HPP
#endif // CAPIO_POSIX_HANDLERS_CLOSE_HPP
3 changes: 2 additions & 1 deletion src/posix/handlers/copy_file_range.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#ifndef CAPIO_COPY_FILE_RANGE_HPP
#define CAPIO_COPY_FILE_RANGE_HPP

int copy_file_range_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg5,
long *result) {
auto tid = static_cast<pid_t>(syscall_no_intercept(SYS_gettid));
Expand All @@ -20,4 +21,4 @@ int copy_file_range_handler(long arg0, long arg1, long arg2, long arg3, long arg

return CAPIO_POSIX_SYSCALL_SKIP;
}
#endif // CAPIO_COPY_FILE_RANGE_HPP
#endif // CAPIO_COPY_FILE_RANGE_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/dup.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ int dup3_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg
}
#endif // SYS_dup3

#endif // CAPIO_POSIX_HANDLERS_DUP_HPP
#endif // CAPIO_POSIX_HANDLERS_DUP_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/execve.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ int execve_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
}

#endif // SYS_execve
#endif // CAPIO_POSIX_HANDLERS_EXECVE_HPP
#endif // CAPIO_POSIX_HANDLERS_EXECVE_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/fchmod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ int fchmod_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
}

#endif // SYS_chmod
#endif // CAPIO_POSIX_HANDLERS_FCHMOD_HPP
#endif // CAPIO_POSIX_HANDLERS_FCHMOD_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/fchown.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ int fchown_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
}

#endif // SYS_chown
#endif // CAPIO_POSIX_HANDLERS_FCHOWN_HPP
#endif // CAPIO_POSIX_HANDLERS_FCHOWN_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/fcntl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ int fcntl_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
#endif

#endif // SYS_fcntl
#endif // CAPIO_POSIX_HANDLERS_FCNTL_HPP
#endif // CAPIO_POSIX_HANDLERS_FCNTL_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/fgetxattr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ int fgetxattr_handler(long arg0, long arg1, long arg2, long arg3, long arg4, lon
}

#endif // SYS_fgetxattr
#endif // CAPIO_POSIX_HANDLERS_FGETXATTR_HPP
#endif // CAPIO_POSIX_HANDLERS_FGETXATTR_HPP
5 changes: 3 additions & 2 deletions src/posix/handlers/fork.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ int fork_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg

START_LOG(parent_tid, "call(pid=%ld)", pid);

if (pid == 0) { // child
if (pid == 0) {
// child
auto child_tid = static_cast<pid_t>(syscall_no_intercept(SYS_gettid));
init_process(child_tid);
*result = 0;
Expand All @@ -24,4 +25,4 @@ int fork_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg
}

#endif // SYS_fork
#endif // CAPIO_POSIX_HANDLERS_FORK_HPP
#endif // CAPIO_POSIX_HANDLERS_FORK_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/ioctl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ int ioctl_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}

#endif // SYS_ioctl
#endif // CAPIO_POSIX_HANDLERS_IOCTL_HPP
#endif // CAPIO_POSIX_HANDLERS_IOCTL_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/lseek.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ int lseek_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}

#endif // SYS_lseek || SYS_llseek
#endif // CAPIO_POSIX_HANDLERS_LSEEK_HPP
#endif // CAPIO_POSIX_HANDLERS_LSEEK_HPP
3 changes: 1 addition & 2 deletions src/posix/handlers/mkdir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ inline off64_t capio_mkdirat(int dirfd, const std::string_view &pathname, mode_t
}

if (is_capio_path(path)) {

create_request(-1, path, tid);
}
return CAPIO_POSIX_SYSCALL_REQUEST_SKIP;
Expand Down Expand Up @@ -75,4 +74,4 @@ int rmdir_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}
#endif // SYS_rmdir

#endif // CAPIO_POSIX_HANDLERS_MKDIR_HPP
#endif // CAPIO_POSIX_HANDLERS_MKDIR_HPP
5 changes: 1 addition & 4 deletions src/posix/handlers/posix_readdir.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ inline void init_posix_dirent() {
}

inline unsigned long int load_files_from_directory(const char *path) {

START_LOG(capio_syscall(SYS_gettid), "call(path=%s)", path);

syscall_no_intercept_flag = true;
Expand Down Expand Up @@ -178,7 +177,6 @@ inline struct dirent64 *capio_internal_readdir(DIR *dirp, long pid) {
}

DIR *opendir(const char *name) {

START_LOG(capio_syscall(SYS_gettid), "call(path=%s)", name);

if (is_forbidden_path(name)) {
Expand Down Expand Up @@ -380,7 +378,6 @@ void seekdir(DIR *dirp, long int loc) {
}

int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {

/*
* WARN: I have not yet clear the usage of this function, as such bugs are surely presents
* TODO: implement the correct handling logic for this method
Expand Down Expand Up @@ -412,4 +409,4 @@ int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {
return 0;
}

#endif // POSIX_READDIR_HPP
#endif // POSIX_READDIR_HPP
5 changes: 3 additions & 2 deletions src/posix/handlers/rename.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ int rename_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
auto newpath_abs = capio_absolute(newpath);
LOG("newpath absolute: %s", newpath_abs.c_str());

if (is_prefix(oldpath_abs, newpath_abs)) { // TODO: The check is more complex
if (is_prefix(oldpath_abs, newpath_abs)) {
// TODO: The check is more complex
errno = EINVAL;
*result = -errno;
return CAPIO_POSIX_SYSCALL_SUCCESS;
Expand All @@ -37,4 +38,4 @@ int rename_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long a
}

#endif // SYS_rename
#endif // CAPIO_POSIX_HANDLERS_RENAME_HPP
#endif // CAPIO_POSIX_HANDLERS_RENAME_HPP
5 changes: 3 additions & 2 deletions src/posix/handlers/stat.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ inline int capio_fstatat(int dirfd, const std::string_view &pathname, struct sta

std::filesystem::path path(pathname);
if (path.empty() && (flags & AT_EMPTY_PATH) == AT_EMPTY_PATH) {
if (dirfd == AT_FDCWD) { // operate on currdir
if (dirfd == AT_FDCWD) {
// operate on currdir
return capio_lstat(get_current_dir().native(), statbuf, tid);
}
// operate on dirfd. in this case dirfd can refer to any type of file
Expand Down Expand Up @@ -129,4 +130,4 @@ int stat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long arg
}
#endif // SYS_stat || SYS_stat64

#endif // CAPIO_POSIX_HANDLERS_STAT_HPP
#endif // CAPIO_POSIX_HANDLERS_STAT_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/statfs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ int fstatfs_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long
}

#endif // SYS_fstatfs || SYS_fstatfs64
#endif // CAPIO_POSIX_HANDLERS_STATFS_HPP
#endif // CAPIO_POSIX_HANDLERS_STATFS_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/statx.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ int statx_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long ar
}

#endif // SYS_statx
#endif // CAPIO_POSIX_HANDLERS_STATX_HPP
#endif // CAPIO_POSIX_HANDLERS_STATX_HPP
2 changes: 1 addition & 1 deletion src/posix/handlers/unlink.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ int unlinkat_handler(long arg0, long arg1, long arg2, long arg3, long arg4, long
}
#endif // SYS_unlinkat

#endif // CAPIO_POSIX_HANDLERS_UNLINK_HPP
#endif // CAPIO_POSIX_HANDLERS_UNLINK_HPP
Loading
Loading