XenevaOS
Loading...
Searching...
No Matches
Functions
port.c File Reference
#include <time.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
#include <_xeneva.h>
#include <sys/_ketime.h>
#include <pthread.h>
Include dependency graph for port.c:

Functions

size_t dlmalloc_usable_size (void *ptr)
 
size_t _msize (void *ptr)
 
size_t malloc_usable_size (void *ptr)
 
int clock_gettime (int clock_id, struct timespec *ts)
 
struct tm * gmtime (const time_t *t)
 
struct tm * gmtime_r (const time_t *t, struct tm *out)
 
struct tm * localtime (const time_t *t)
 
struct tm * localtime_r (const time_t *t, struct tm *out)
 
time_t time (time_t *t)
 
double difftime (time_t a, time_t b)
 
int pthread_cond_init (pthread_cond_t *c, const pthread_condattr_t *a)
 
int pthread_cond_destroy (pthread_cond_t *c)
 
int pthread_cond_signal (pthread_cond_t *c)
 
int pthread_cond_broadcast (pthread_cond_t *c)
 
int pthread_cond_wait (pthread_cond_t *c, int volatile *m)
 
int pthread_cond_timedwait (pthread_cond_t *c, int volatile *m, const struct timespec *ts)
 

Function Documentation

◆ _msize()

size_t _msize ( void *  ptr)

◆ clock_gettime()

int clock_gettime ( int  clock_id,
struct timespec *  ts 
)

◆ difftime()

double difftime ( time_t  a,
time_t  b 
)

◆ dlmalloc_usable_size()

size_t dlmalloc_usable_size ( void *  ptr)

Port glue for QuickJS on XenevaOS (single-threaded).

libc bits quickjs.c needs that XEClib does not provide, following the original os.o semantics (msize via dlmalloc, no-op pthread cond vars, UTC local time) but completing them so the port builds from source:

  • _msize -> dlmalloc_usable_size (quickjs bookkeeping query)
  • clock_gettime for CLOCK_REALTIME/MONOTONIC via kernel wallclock/ms
  • a full gmtime/localtime (UTC) so struct tm is deterministic (XEClib's lacks tm_gmtoff/tm_zone -> quickjs Date would read slack)
  • pthread_cond* as no-ops: there is one JS thread on Xeneva

◆ gmtime()

struct tm * gmtime ( const time_t *  t)

◆ gmtime_r()

struct tm * gmtime_r ( const time_t *  t,
struct tm *  out 
)

◆ localtime()

struct tm * localtime ( const time_t *  t)

◆ localtime_r()

struct tm * localtime_r ( const time_t *  t,
struct tm *  out 
)

◆ malloc_usable_size()

size_t malloc_usable_size ( void *  ptr)

◆ pthread_cond_broadcast()

int pthread_cond_broadcast ( pthread_cond_t *  c)

◆ pthread_cond_destroy()

int pthread_cond_destroy ( pthread_cond_t *  c)

◆ pthread_cond_init()

int pthread_cond_init ( pthread_cond_t *  c,
const pthread_condattr_t *  a 
)

◆ pthread_cond_signal()

int pthread_cond_signal ( pthread_cond_t *  c)

◆ pthread_cond_timedwait()

int pthread_cond_timedwait ( pthread_cond_t *  c,
int volatile *  m,
const struct timespec *  ts 
)

◆ pthread_cond_wait()

int pthread_cond_wait ( pthread_cond_t *  c,
int volatile *  m 
)

◆ time()

time_t time ( time_t *  t)