added COW_ERR_POISON

error_handling
Avril 3 years ago
parent 960f18a6e0
commit 30a0176604
Signed by: flanchan
GPG Key ID: 284488987C31F630

@ -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;
}

Loading…
Cancel
Save