Clean up some code

This commit is contained in:
Justine Tunney 2022-12-11 14:30:50 -08:00
parent 531bfbd61f
commit ed161b240e
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
17 changed files with 107 additions and 182 deletions

View file

@ -22,7 +22,7 @@
/**
* Converts timespec to scalar.
*
. * This returns the absolute number of nanoseconds in a timespec. If
* This returns the absolute number of nanoseconds in a timespec. If
* overflow happens, then `INT64_MAX` or `INT64_MIN` is returned. The
* `errno` variable isn't changed.
*

View file

@ -35,9 +35,10 @@
* @param bytes is number of bytes to allocate
* @return return 0 or EINVAL or ENOMEM w/o setting errno
* @see memalign()
* @returnserrno
* @threadsafe
*/
int posix_memalign(void **pp, size_t alignment, size_t bytes) {
errno_t posix_memalign(void **pp, size_t alignment, size_t bytes) {
int e;
void *m;
size_t q, r;
@ -46,11 +47,11 @@ int posix_memalign(void **pp, size_t alignment, size_t bytes) {
if (!r && q && IS2POW(q)) {
e = errno;
m = memalign(alignment, bytes);
errno = e;
if (m) {
*pp = m;
return 0;
} else {
errno = e;
return ENOMEM;
}
} else {

View file

@ -16,10 +16,11 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/x/x.h"

View file

@ -214,7 +214,7 @@ syscon open O_VERIFY 0 0 0x00200000 0 0 0 #
syscon open O_SHLOCK 0 0x00000010 0x00000010 0x00000010 0x00000010 0 #
syscon open O_EXLOCK 0 0x00000020 0x00000020 0x00000020 0x00000020 0 #
syscon open O_TTY_INIT 0 0 0x00080000 0 0 0 #
syscon compat O_LARGEFILE 0100000 0 0 0 0 0 #
syscon compat O_LARGEFILE 0x00008000 0 0 0 0 0 #
# mmap() flags
# the revolutionary praxis of malloc()

View file

@ -1,2 +1,2 @@
.include "o/libc/sysv/consts/syscon.internal.inc"
.syscon compat,O_LARGEFILE,0100000,0,0,0,0,0
.syscon compat,O_LARGEFILE,0x00008000,0,0,0,0,0

View file

@ -26,7 +26,7 @@
* pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
* // ...
* pthread_mutex_lock(&lock);
* pthread_cond_broadcast(&cond, &lock);
* pthread_cond_broadcast(&cond);
* pthread_mutex_unlock(&lock);
*
* This function has no effect if there aren't any threads currently