Disabled external gits

This commit is contained in:
2022-04-07 18:46:57 +02:00
parent 88cb3426ad
commit 15e7120d6d
5316 changed files with 4563444 additions and 6 deletions

View File

@@ -0,0 +1,46 @@
BIN := ../$(notdir $(lastword $(abspath .))).so
EXT_H := h
EXT_HPP := h hh hpp hxx h++
EXT_C := c
EXT_CXX := C cc cpp cxx c++
INCLUDE_DIR := ../include
SOURCE_DIR := .
WILD_EXT = $(strip $(foreach EXT,$($(1)),$(wildcard $(2)/*.$(EXT))))
HDRS_C := $(call WILD_EXT,EXT_H,$(INCLUDE_DIR))
HDRS_CXX := $(call WILD_EXT,EXT_HPP,$(INCLUDE_DIR))
SRCS_C := $(call WILD_EXT,EXT_C,$(SOURCE_DIR))
SRCS_CXX := $(call WILD_EXT,EXT_CXX,$(SOURCE_DIR))
OBJS := $(SRCS_C:%=%.o) $(SRCS_CXX:%=%.o)
CC := $(CC)
CCFLAGS := -Wall -Wextra -Wfatal-errors -O2 -std=c11 -fPIC -I$(INCLUDE_DIR)
CXX := $(CXX)
CXXFLAGS := -Wall -Wextra -Wfatal-errors -O2 -std=c++17 -fPIC -I$(INCLUDE_DIR)
LD := $(if $(SRCS_CXX),$(CXX),$(CC))
LDFLAGS := -shared
LDLIBS :=
.PHONY: build clean
build: $(BIN)
clean:
$(RM) $(OBJS) $(BIN)
define BUILD_C
%.$(1).o: %.$(1) $$(HDRS_C) Makefile
$$(CC) $$(CCFLAGS) -c -o $$@ $$<
endef
$(foreach EXT,$(EXT_C),$(eval $(call BUILD_C,$(EXT))))
define BUILD_CXX
%.$(1).o: %.$(1) $$(HDRS_CXX) Makefile
$$(CXX) $$(CXXFLAGS) -c -o $$@ $$<
endef
$(foreach EXT,$(EXT_CXX),$(eval $(call BUILD_CXX,$(EXT))))
$(BIN): $(OBJS) Makefile
$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)

View File

@@ -0,0 +1,36 @@
#include <stdbool.h>
/** Define a proposition as likely true.
* @param prop Proposition
**/
#undef likely
#ifdef __GNUC__
#define likely(prop) \
__builtin_expect((prop) ? true : false, true /* likely */)
#else
#define likely(prop) \
(prop)
#endif
/** Define a proposition as likely false.
* @param prop Proposition
**/
#undef unlikely
#ifdef __GNUC__
#define unlikely(prop) \
__builtin_expect((prop) ? true : false, false /* unlikely */)
#else
#define unlikely(prop) \
(prop)
#endif
/** Define a variable as unused.
**/
#undef unused
#ifdef __GNUC__
#define unused(variable) \
variable __attribute__((unused))
#else
#define unused(variable)
#warning This compiler has no support for GCC attributes
#endif

View File

@@ -0,0 +1,141 @@
/**
* @file tm.c
* @author Cedric Hölzl
*
* @section LICENSE
*
* [...]
*
* @section DESCRIPTION
*
* Implementation of your own transaction manager.
* You can completely rewrite this file (and create more files) as you wish.
* Only the interface (i.e. exported symbols and semantic) must be preserved.
**/
// Requested features
#define _GNU_SOURCE
#define _POSIX_C_SOURCE 200809L
#ifdef __STDC_NO_ATOMICS__
#error Current C11 compiler does not support atomic operations
#endif
// External headers
// Internal headers
#include <tm.h>
#include "macros.h"
/** Create (i.e. allocate + init) a new shared memory region, with one first non-free-able allocated segment of the requested size and alignment.
* @param size Size of the first shared segment of memory to allocate (in bytes), must be a positive multiple of the alignment
* @param align Alignment (in bytes, must be a power of 2) that the shared memory region must support
* @return Opaque shared memory region handle, 'invalid_shared' on failure
**/
shared_t tm_create(size_t unused(size), size_t unused(align)) {
// TODO: tm_create(size_t, size_t)
return invalid_shared;
}
/** Destroy (i.e. clean-up + free) a given shared memory region.
* @param shared Shared memory region to destroy, with no running transaction
**/
void tm_destroy(shared_t unused(shared)) {
// TODO: tm_destroy(shared_t)
}
/** [thread-safe] Return the start address of the first allocated segment in the shared memory region.
* @param shared Shared memory region to query
* @return Start address of the first allocated segment
**/
void* tm_start(shared_t unused(shared)) {
// TODO: tm_start(shared_t)
return NULL;
}
/** [thread-safe] Return the size (in bytes) of the first allocated segment of the shared memory region.
* @param shared Shared memory region to query
* @return First allocated segment size
**/
size_t tm_size(shared_t unused(shared)) {
// TODO: tm_size(shared_t)
return 0;
}
/** [thread-safe] Return the alignment (in bytes) of the memory accesses on the given shared memory region.
* @param shared Shared memory region to query
* @return Alignment used globally
**/
size_t tm_align(shared_t unused(shared)) {
// TODO: tm_align(shared_t)
return 0;
}
/** [thread-safe] Begin a new transaction on the given shared memory region.
* @param shared Shared memory region to start a transaction on
* @param is_ro Whether the transaction is read-only
* @return Opaque transaction ID, 'invalid_tx' on failure
**/
tx_t tm_begin(shared_t unused(shared), bool unused(is_ro)) {
// TODO: tm_begin(shared_t)
return invalid_tx;
}
/** [thread-safe] End the given transaction.
* @param shared Shared memory region associated with the transaction
* @param tx Transaction to end
* @return Whether the whole transaction committed
**/
bool tm_end(shared_t unused(shared), tx_t unused(tx)) {
// TODO: tm_end(shared_t, tx_t)
return false;
}
/** [thread-safe] Read operation in the given transaction, source in the shared region and target in a private region.
* @param shared Shared memory region associated with the transaction
* @param tx Transaction to use
* @param source Source start address (in the shared region)
* @param size Length to copy (in bytes), must be a positive multiple of the alignment
* @param target Target start address (in a private region)
* @return Whether the whole transaction can continue
**/
bool tm_read(shared_t unused(shared), tx_t unused(tx), void const* unused(source), size_t unused(size), void* unused(target)) {
// TODO: tm_read(shared_t, tx_t, void const*, size_t, void*)
return false;
}
/** [thread-safe] Write operation in the given transaction, source in a private region and target in the shared region.
* @param shared Shared memory region associated with the transaction
* @param tx Transaction to use
* @param source Source start address (in a private region)
* @param size Length to copy (in bytes), must be a positive multiple of the alignment
* @param target Target start address (in the shared region)
* @return Whether the whole transaction can continue
**/
bool tm_write(shared_t unused(shared), tx_t unused(tx), void const* unused(source), size_t unused(size), void* unused(target)) {
// TODO: tm_write(shared_t, tx_t, void const*, size_t, void*)
return false;
}
/** [thread-safe] Memory allocation in the given transaction.
* @param shared Shared memory region associated with the transaction
* @param tx Transaction to use
* @param size Allocation requested size (in bytes), must be a positive multiple of the alignment
* @param target Pointer in private memory receiving the address of the first byte of the newly allocated, aligned segment
* @return Whether the whole transaction can continue (success/nomem), or not (abort_alloc)
**/
alloc_t tm_alloc(shared_t unused(shared), tx_t unused(tx), size_t unused(size), void** unused(target)) {
// TODO: tm_alloc(shared_t, tx_t, size_t, void**)
return abort_alloc;
}
/** [thread-safe] Memory freeing in the given transaction.
* @param shared Shared memory region associated with the transaction
* @param tx Transaction to use
* @param target Address of the first byte of the previously allocated segment to deallocate
* @return Whether the whole transaction can continue
**/
bool tm_free(shared_t unused(shared), tx_t unused(tx), void* unused(target)) {
// TODO: tm_free(shared_t, tx_t, void*)
return false;
}