Update static functions to encode negative errors in
returned pointers.
Signed-off-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Ioan-Teodor Teugea <ioan_teodor.teugea@stud.acs.upb.ro>
Reviewed-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1248
a = pprocess->_a;
tid = find_and_reserve_tid();
- if (tid < 0) {
- err = EAGAIN;
+ if (unlikely(tid < 0)) {
+ err = -EAGAIN;
goto err_out;
}
pthread = uk_zalloc(a, sizeof(*pthread));
- if (!pthread) {
- err = ENOMEM;
+ if (unlikely(!pthread)) {
+ err = -ENOMEM;
goto err_free_tid;
}
err_free_tid:
release_tid(tid);
err_out:
- return ERR2PTR(-err);
+ return ERR2PTR(err);
}
/* Free thread that is part of a process