@ -18,6 +18,8 @@ enum cow_err_kind {
COW_ERR_SIZE,
/// `mmap()` failed.
COW_ERR_MAP,
/// Trying to use a poisoned cow
COW_ERR_POISONED,
_COW_ERR_SIZE,
};
@ -122,7 +122,9 @@ void cow_free(cow_t* restrict cow)
cow_t* cow_clone(const cow_t* cow)
{
if(UNLIKELY(cow->poisoned)) {
_cow_set_err(COW_ERR_POISONED);
TRACE("WARNING: attempted to clone poisoned object at %p", (const void*)cow);
return NULL;
}
cow_t clone;
@ -21,6 +21,7 @@ namespace _cow_error {
setmsg(ret, COW_ERR_FDCREATE, "failed to create shmfd (memfd_create())");
setmsg(ret, COW_ERR_SIZE, "failed to set shmfd size (ftruncate())");
setmsg(ret, COW_ERR_MAP, "failed to map shmfd (mmap())");
setmsg(ret, COW_ERR_POISONED, "trying to use a poisoned cow");
return ret;