-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
In order to implement POSIX compatibility, for #7, to port things like SQLite, MojoELF, nedmalloc, and V2Lin, we need to implement pthreads, and semaphores, it seems.
For instance, the unbuildable surface required by V2Lin looks like:
tyson@tyson-Lenovo-ideapad-120S-14IAP:~/Orion/user/apps/system$ make
===> v2lin_v02/lib/lwdLib.c
gcc-6 -I../../include -I../.. -I/usr/lib/gcc/x86_64-linux-gnu/6/include -nostdinc -g -O2 -m64 -mno-red-zone -fno-stack-protector -lssp -O2 -g -Wall -Wshadow -fno-stack-protector -Wconversion -std=c99 -c v2lin_v02/lib/lwdLib.c -o v2lin_v02/lib/lwdLib.o
In file included from v2lin_v02/lib/lwdLib.c:28:0:
../../include/stdio.h: In function ‘__sputc’:
../../include/stdio.h:460:23: warning: conversion to ‘unsigned char’ from ‘int’ may alter its value [-Wconversion]
return (*_p->_p++ = _c);
^~
In file included from ../../include/signal.h:43:0,
from v2lin_v02/lib/lwdLib.c:30:
../../include/sys/_ucontext.h: At top level:
../../include/sys/_ucontext.h:46:2: error: unknown type name ‘mcontext_t’
mcontext_t uc_mcontext;
^~~~~~~~~~
In file included from v2lin_v02/lib/internal.h:29:0,
from v2lin_v02/lib/lwdLib.c:33:
v2lin_v02/lib/v2lpthread.h:68:2: error: unknown type name ‘pthread_attr_t’
pthread_attr_t attr;
^~~~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:69:21: error: field ‘prv_priority’ has incomplete type
struct sched_param prv_priority;
^~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:80:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t tdelete_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:81:2: error: unknown type name ‘pthread_cond_t’
pthread_cond_t t_deletable;
^~~~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:84:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t dbcst_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:85:2: error: unknown type name ‘pthread_cond_t’
pthread_cond_t delete_bcplt;
^~~~~~~~~~~~~~
v2lin_v02/lib/v2lpthread.h:95:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t *waiting_m;
^~~~~~~~~~~~~~~
In file included from v2lin_v02/lib/vxw_hdrs.h:28:0,
from v2lin_v02/lib/internal.h:31,
from v2lin_v02/lib/lwdLib.c:33:
../../include/sys/types.h: In function ‘__bitcount16’:
../../include/sys/types.h:327:7: warning: conversion to ‘__uint16_t {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
_x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
^
../../include/sys/types.h:328:7: warning: conversion to ‘__uint16_t {aka short unsigned int}’ from ‘int’ may alter its value [-Wconversion]
_x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
^
In file included from ../../include/sys/types.h:376:0,
from v2lin_v02/lib/vxw_hdrs.h:28,
from v2lin_v02/lib/internal.h:31,
from v2lin_v02/lib/lwdLib.c:33:
../../include/sys/select.h: At top level:
../../include/sys/select.h:105:54: warning: ‘struct timeval’ declared inside parameter list will not be visible outside of this definition or declaration
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
^~~~~~~
In file included from v2lin_v02/lib/vxw_hdrs.h:28:0,
from v2lin_v02/lib/internal.h:31,
from v2lin_v02/lib/lwdLib.c:33:
../../include/sys/types.h: In function ‘__major’:
../../include/sys/types.h:393:36: warning: conversion to ‘int’ from ‘dev_t {aka long unsigned int}’ may alter its value [-Wconversion]
return (((_d >> 32) & 0xffffff00) | ((_d >> 8) & 0xff));
~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~
../../include/sys/types.h: In function ‘__minor’:
../../include/sys/types.h:399:32: warning: conversion to ‘int’ from ‘dev_t {aka long unsigned int}’ may alter its value [-Wconversion]
return (((_d >> 24) & 0xff00) | (_d & 0xffff00ff));
~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
../../include/sys/types.h: In function ‘__makedev’:
../../include/sys/types.h:405:26: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) |
^
../../include/sys/types.h:405:47: warning: conversion to ‘long unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
return (((dev_t)(_Major & 0xffffff00) << 32) | ((_Major & 0xff) << 8) |
^
../../include/sys/types.h:406:49: warning: conversion to ‘unsigned int’ from ‘int’ may change the sign of the result [-Wsign-conversion]
((dev_t)(_Minor & 0xff00) << 24) | (_Minor & 0xffff00ff));
^
In file included from v2lin_v02/lib/lwdLib.c:33:0:
v2lin_v02/lib/internal.h: At top level:
v2lin_v02/lib/internal.h:37:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t wdog_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/internal.h:47:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t sem_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/internal.h:48:2: error: unknown type name ‘pthread_cond_t’
pthread_cond_t sem_send;
^~~~~~~~~~~~~~
v2lin_v02/lib/internal.h:52:2: error: unknown type name ‘pthread_mutex_t’
pthread_mutex_t smdel_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/internal.h:53:2: error: unknown type name ‘pthread_cond_t’
pthread_cond_t smdel_cplt;
^~~~~~~~~~~~~~
v2lin_v02/lib/internal.h:83:8: error: unknown type name ‘pthread_mutex_t’
extern pthread_mutex_t task_list_lock;
^~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:43:8: error: unknown type name ‘pthread_mutex_t’
static pthread_mutex_t wdog_list_lock = PTHREAD_MUTEX_INITIALIZER;
^~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:43:41: error: ‘PTHREAD_MUTEX_INITIALIZER’ undeclared here (not in a function)
static pthread_mutex_t wdog_list_lock = PTHREAD_MUTEX_INITIALIZER;
^~~~~~~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘wdog_valid’:
v2lin_v02/lib/lwdLib.c:60:2: warning: implicit declaration of function ‘pthread_cleanup_push’ [-Wimplicit-function-declaration]
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, (void *) &wdog_list_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:60:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, (void *) &wdog_list_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:60:42: note: each undeclared identifier is reported only once for each function it appears in
v2lin_v02/lib/lwdLib.c:61:2: warning: implicit declaration of function ‘pthread_mutex_lock’ [-Wimplicit-function-declaration]
pthread_mutex_lock(&wdog_list_lock);
^~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:81:2: warning: implicit declaration of function ‘pthread_cleanup_pop’ [-Wimplicit-function-declaration]
pthread_cleanup_pop(1);
^~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘link_wdog’:
v2lin_v02/lib/lwdLib.c:93:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, (void *) &wdog_list_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘unlink_wdog’:
v2lin_v02/lib/lwdLib.c:132:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, (void *) &wdog_list_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘process_tick_for’:
v2lin_v02/lib/lwdLib.c:215:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, &wdId->wdog_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:229:5: warning: implicit declaration of function ‘pthread_mutex_unlock’ [-Wimplicit-function-declaration]
pthread_mutex_unlock(&wdId->wdog_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:229:5: warning: declaration of ‘pthread_mutex_unlock’ shadows previous non-variable [-Wshadow]
v2lin_v02/lib/lwdLib.c: In function ‘wdCancel’:
v2lin_v02/lib/lwdLib.c:271:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, &wdId->wdog_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘wdCreate’:
v2lin_v02/lib/lwdLib.c:296:3: warning: implicit declaration of function ‘pthread_mutex_init’ [-Wimplicit-function-declaration]
pthread_mutex_init(&(new_wdog->wdog_lock), (pthread_mutexattr_t *) NULL);
^~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:296:47: error: ‘pthread_mutexattr_t’ undeclared (first use in this function)
pthread_mutex_init(&(new_wdog->wdog_lock), (pthread_mutexattr_t *) NULL);
^~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:296:68: error: expected expression before ‘)’ token
pthread_mutex_init(&(new_wdog->wdog_lock), (pthread_mutexattr_t *) NULL);
^
v2lin_v02/lib/lwdLib.c: In function ‘wdDelete’:
v2lin_v02/lib/lwdLib.c:313:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, (void *) &(wdId->wdog_lock));
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘wdStart’:
v2lin_v02/lib/lwdLib.c:335:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, &wdId->wdog_lock);
^~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c: In function ‘self_starter’:
v2lin_v02/lib/lwdLib.c:384:3: warning: implicit declaration of function ‘pthread_create’ [-Wimplicit-function-declaration]
pthread_create(&(task->pthrid), &(task->attr), task_wrapper, (void *) task);
^~~~~~~~~~~~~~
In file included from v2lin_v02/lib/lwdLib.c:33:0:
v2lin_v02/lib/lwdLib.c: In function ‘wdogShow’:
v2lin_v02/lib/internal.h:92:42: error: ‘pthread_mutex_unlock’ undeclared (first use in this function)
pthread_cleanup_push((void (*)(void *)) pthread_mutex_unlock, m); \
^
v2lin_v02/lib/lwdLib.c:413:2: note: in expansion of macro ‘pthread_mutex_clean_lock’
pthread_mutex_clean_lock(&wdog_list_lock);
^~~~~~~~~~~~~~~~~~~~~~~~
v2lin_v02/lib/lwdLib.c:415:17: warning: format ‘%x’ expects argument of type ‘unsigned int’, but argument 3 has type ‘void (*)(int)’ [-Wformat=]
fprintf(out,"%x %i %i\n", wd->timeout_func, wd->ticks_remaining, wd->timeout_parm);
^
make: *** [../../Mk/l4.build.mk:62: v2lin_v02/lib/lwdLib.o] Error 1
For NEDMalloc:
tyson@tyson-Lenovo-ideapad-120S-14IAP:~/Orion/user/lib/linux$ cat NMB1 | grep error
malloc.c.h:2055:3: error: unknown type name ‘pthread_t’
malloc.c.h:2069:3: error: unknown type name ‘pthread_t’
malloc.c.h:2117:3: error: unknown type name ‘pthread_t’
nedmalloc.c:299:28: error: ‘malloc’ undeclared here (not in a function)
nedmalloc.c:300:36: error: ‘calloc’ undeclared here (not in a function)
nedmalloc.c:301:37: error: ‘realloc’ undeclared here (not in a function)
nedmalloc.c:302:25: error: ‘free’ undeclared here (not in a function)
nedmalloc.c:252:19: error: unknown type name ‘pthread_key_t’