arch/esp32: use kernel internal API for libc stubs

Signed-off-by: Petro Karashchenko <petro.karashchenko@gmail.com>
This commit is contained in:
Petro Karashchenko 2023-08-08 01:37:16 +03:00 committed by Tiago Medicci Serrano
parent 1b0baa8337
commit 2c346c4c89
6 changed files with 149 additions and 144 deletions

View File

@ -31,9 +31,11 @@
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/lib/lib.h>
#include "rom/esp32c3_libc_stubs.h"
/****************************************************************************
@ -59,12 +61,12 @@ struct _reent;
int _close_r(struct _reent *r, int fd)
{
return close(fd);
return nx_close(fd);
}
int _fstat_r(struct _reent *r, int fd, struct stat *statbuf)
{
return fstat(fd, statbuf);
return nx_fstat(fd, statbuf);
}
int _getpid_r(struct _reent *r)
@ -74,11 +76,10 @@ int _getpid_r(struct _reent *r)
int _kill_r(struct _reent *r, int pid, int sig)
{
return kill(pid, sig);
return nxsig_kill(pid, sig);
}
int _link_r(struct _reent *r, const char *oldpath,
const char *newpath)
int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
{
/* TODO */
@ -87,22 +88,20 @@ int _link_r(struct _reent *r, const char *oldpath,
int _lseek_r(struct _reent *r, int fd, int offset, int whence)
{
return lseek(fd, offset, whence);
return nx_seek(fd, offset, whence);
}
int _open_r(struct _reent *r, const char *pathname,
int flags, int mode)
int _open_r(struct _reent *r, const char *pathname, int flags, int mode)
{
return open(pathname, flags, mode);
return nx_open(pathname, flags, mode);
}
int _read_r(struct _reent *r, int fd, void *buf, int count)
{
return read(fd, buf, count);
return nx_read(fd, buf, count);
}
int _rename_r(struct _reent *r, const char *oldpath,
const char *newpath)
int _rename_r(struct _reent *r, const char *oldpath, const char *newpath)
{
return rename(oldpath, newpath);
}
@ -112,13 +111,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t increment)
/* TODO: sbrk is only supported on Kernel mode */
errno = -ENOMEM;
return (void *) -1;
return (void *)-1;
}
int _stat_r(struct _reent *r, const char *pathname,
struct stat *statbuf)
int _stat_r(struct _reent *r, const char *pathname, struct stat *statbuf)
{
return stat(pathname, statbuf);
return nx_stat(pathname, statbuf, 1);
}
clock_t _times_r(struct _reent *r, struct tms *buf)
@ -128,12 +126,12 @@ clock_t _times_r(struct _reent *r, struct tms *buf)
int _unlink_r(struct _reent *r, const char *pathname)
{
return unlink(pathname);
return nx_unlink(pathname);
}
int _write_r(struct _reent *r, int fd, const void *buf, int count)
{
return write(fd, buf, count);
return nx_write(fd, buf, count);
}
int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
@ -143,22 +141,22 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
void *_malloc_r(struct _reent *r, size_t size)
{
return malloc(size);
return lib_malloc(size);
}
void *_realloc_r(struct _reent *r, void *ptr, size_t size)
{
return realloc(ptr, size);
return lib_realloc(ptr, size);
}
void *_calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
return calloc(nmemb, size);
return lib_calloc(nmemb, size);
}
void _free_r(struct _reent *r, void *ptr)
{
free(ptr);
lib_free(ptr);
}
void _abort(void)
@ -237,7 +235,7 @@ struct _reent *__getreent(void)
{
/* TODO */
return (struct _reent *) NULL;
return (struct _reent *)NULL;
}
int _system_r(struct _reent *r, const char *command)
@ -253,42 +251,42 @@ int _system_r(struct _reent *r, const char *command)
static const struct syscall_stub_table g_stub_table =
{
.__getreent = &__getreent,
._malloc_r = &_malloc_r,
._free_r = &_free_r,
._realloc_r = &_realloc_r,
._calloc_r = &_calloc_r,
._abort = NULL,
._system_r = &_system_r,
._rename_r = &_rename_r,
._times_r = &_times_r,
._gettimeofday_r = &_gettimeofday_r,
._raise_r = &_raise_r,
._unlink_r = &_unlink_r,
._link_r = &_link_r,
._stat_r = &_stat_r,
._fstat_r = &_fstat_r,
._sbrk_r = &_sbrk_r,
._getpid_r = &_getpid_r,
._kill_r = &_kill_r,
._exit_r = NULL,
._close_r = &_close_r,
._open_r = &_open_r,
._write_r = &_write_r,
._lseek_r = &_lseek_r,
._read_r = &_read_r,
._lock_init = &_lock_init,
._lock_init_recursive = &_lock_init_recursive,
._lock_close = &_lock_close,
._lock_close_recursive = &_lock_close_recursive,
._lock_acquire = &_lock_acquire,
._lock_acquire_recursive = &_lock_acquire_recursive,
._lock_try_acquire = &_lock_try_acquire,
._lock_try_acquire_recursive = &_lock_try_acquire_recursive,
._lock_release = &_lock_release,
._lock_release_recursive = &_lock_release_recursive,
._printf_float = NULL,
._scanf_float = NULL,
.__getreent = &__getreent,
._malloc_r = &_malloc_r,
._free_r = &_free_r,
._realloc_r = &_realloc_r,
._calloc_r = &_calloc_r,
._abort = &_abort,
._system_r = &_system_r,
._rename_r = &_rename_r,
._times_r = &_times_r,
._gettimeofday_r = &_gettimeofday_r,
._raise_r = &_raise_r,
._unlink_r = &_unlink_r,
._link_r = &_link_r,
._stat_r = &_stat_r,
._fstat_r = &_fstat_r,
._sbrk_r = &_sbrk_r,
._getpid_r = &_getpid_r,
._kill_r = &_kill_r,
._exit_r = NULL,
._close_r = &_close_r,
._open_r = &_open_r,
._write_r = &_write_r,
._lseek_r = &_lseek_r,
._read_r = &_read_r,
._lock_init = &_lock_init,
._lock_init_recursive = &_lock_init_recursive,
._lock_close = &_lock_close,
._lock_close_recursive = &_lock_close_recursive,
._lock_acquire = &_lock_acquire,
._lock_acquire_recursive = &_lock_acquire_recursive,
._lock_try_acquire = &_lock_try_acquire,
._lock_try_acquire_recursive = &_lock_try_acquire_recursive,
._lock_release = &_lock_release,
._lock_release_recursive = &_lock_release_recursive,
._printf_float = NULL,
._scanf_float = NULL
};
/****************************************************************************

View File

@ -26,7 +26,6 @@
#include <assert.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
@ -35,7 +34,9 @@
#include <sys/types.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/lib/lib.h>
#include "esp_rom_caps.h"
#include "rom/libc_stubs.h"
@ -69,22 +70,22 @@ static mutex_t g_nxlock_recursive;
int _close_r(struct _reent *r, int fd)
{
return close(fd);
return nx_close(fd);
}
int _fstat_r(struct _reent *r, int fd, struct stat *statbuf)
{
return fstat(fd, statbuf);
return nx_fstat(fd, statbuf);
}
int _getpid_r(struct _reent *r)
{
return getpid();
return nxsched_getpid();
}
int _kill_r(struct _reent *r, int pid, int sig)
{
return kill(pid, sig);
return nxsig_kill(pid, sig);
}
int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -96,17 +97,17 @@ int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
int lseek_r(struct _reent *r, int fd, int offset, int whence)
{
return lseek(fd, offset, whence);
return nx_seek(fd, offset, whence);
}
int _open_r(struct _reent *r, const char *pathname, int flags, int mode)
{
return open(pathname, flags, mode);
return nx_open(pathname, flags, mode);
}
int read_r(struct _reent *r, int fd, void *buf, int count)
{
return read(fd, buf, count);
return nx_read(fd, buf, count);
}
int _rename_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -119,12 +120,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t increment)
/* TODO: sbrk is only supported on Kernel mode */
errno = -ENOMEM;
return (void *) -1;
return (void *)-1;
}
int _stat_r(struct _reent *r, const char *pathname, struct stat *statbuf)
{
return stat(pathname, statbuf);
return nx_stat(pathname, statbuf, 1);
}
clock_t _times_r(struct _reent *r, struct tms *buf)
@ -134,12 +135,12 @@ clock_t _times_r(struct _reent *r, struct tms *buf)
int _unlink_r(struct _reent *r, const char *pathname)
{
return unlink(pathname);
return nx_unlink(pathname);
}
int write_r(struct _reent *r, int fd, const void *buf, int count)
{
return write(fd, buf, count);
return nx_write(fd, buf, count);
}
int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
@ -149,22 +150,22 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
void *_malloc_r(struct _reent *r, size_t size)
{
return malloc(size);
return lib_malloc(size);
}
void *_realloc_r(struct _reent *r, void *ptr, size_t size)
{
return realloc(ptr, size);
return lib_realloc(ptr, size);
}
void *_calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
return calloc(nmemb, size);
return lib_calloc(nmemb, size);
}
void _free_r(struct _reent *r, void *ptr)
{
free(ptr);
lib_free(ptr);
}
void _abort(void)
@ -295,7 +296,7 @@ struct _reent *__getreent(void)
{
/* TODO */
return (struct _reent *) NULL;
return (struct _reent *)NULL;
}
int _system_r(struct _reent *r, const char *command)
@ -408,7 +409,7 @@ void esp_setup_syscall_table(void)
extern void esp_rom_newlib_init_common_mutexes(_LOCK_T, _LOCK_T);
int magic_val = ROM_MUTEX_MAGIC;
_LOCK_T magic_mutex = (_LOCK_T) &magic_val;
_LOCK_T magic_mutex = (_LOCK_T)&magic_val;
esp_rom_newlib_init_common_mutexes(magic_mutex, magic_mutex);
}

View File

@ -24,7 +24,6 @@
#include <assert.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -33,7 +32,10 @@
#include <sys/stat.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/lib/lib.h>
#include "rom/esp32_libc_stubs.h"
/****************************************************************************
@ -59,22 +61,22 @@ struct _reent;
int _close_r(struct _reent *r, int fd)
{
return close(fd);
return nx_close(fd);
}
int _fstat_r(struct _reent *r, int fd, struct stat *statbuf)
{
return fstat(fd, statbuf);
return nx_fstat(fd, statbuf);
}
int _getpid_r(struct _reent *r)
{
return getpid();
return nxsched_getpid();
}
int _kill_r(struct _reent *r, int pid, int sig)
{
return kill(pid, sig);
return nxsig_kill(pid, sig);
}
int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -86,17 +88,17 @@ int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
int lseek_r(struct _reent *r, int fd, int offset, int whence)
{
return lseek(fd, offset, whence);
return nx_seek(fd, offset, whence);
}
int _open_r(struct _reent *r, const char *pathname, int flags, int mode)
{
return open(pathname, flags, mode);
return nx_open(pathname, flags, mode);
}
int read_r(struct _reent *r, int fd, void *buf, int count)
{
return read(fd, buf, count);
return nx_read(fd, buf, count);
}
int _rename_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -109,12 +111,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t increment)
/* TODO: sbrk is only supported on Kernel mode */
errno = -ENOMEM;
return (void *) -1;
return (void *)-1;
}
int _stat_r(struct _reent *r, const char *pathname, struct stat *statbuf)
{
return stat(pathname, statbuf);
return nx_stat(pathname, statbuf, 1);
}
clock_t _times_r(struct _reent *r, struct tms *buf)
@ -124,12 +126,12 @@ clock_t _times_r(struct _reent *r, struct tms *buf)
int _unlink_r(struct _reent *r, const char *pathname)
{
return unlink(pathname);
return nx_unlink(pathname);
}
int write_r(struct _reent *r, int fd, const void *buf, int count)
{
return write(fd, buf, count);
return nx_write(fd, buf, count);
}
int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
@ -139,22 +141,22 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
void *_malloc_r(struct _reent *r, size_t size)
{
return malloc(size);
return lib_malloc(size);
}
void *_realloc_r(struct _reent *r, void *ptr, size_t size)
{
return realloc(ptr, size);
return lib_realloc(ptr, size);
}
void *_calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
return calloc(nmemb, size);
return lib_calloc(nmemb, size);
}
void _free_r(struct _reent *r, void *ptr)
{
free(ptr);
lib_free(ptr);
}
void _abort(void)
@ -233,7 +235,7 @@ struct _reent *__getreent(void)
{
/* TODO */
return (struct _reent *) NULL;
return (struct _reent *)NULL;
}
int _system_r(struct _reent *r, const char *command)
@ -324,14 +326,14 @@ void esp_setup_syscall_table(void)
/* Newlib 2.2.0 is used in ROM, the following lock symbols are defined: */
extern _lock_t __sfp_lock;
__sfp_lock = (_lock_t) &g_nxlock_recursive;
__sfp_lock = (_lock_t)&g_nxlock_recursive;
extern _lock_t __sinit_lock;
__sinit_lock = (_lock_t) &g_nxlock_recursive;
__sinit_lock = (_lock_t)&g_nxlock_recursive;
extern _lock_t __env_lock_object;
__env_lock_object = (_lock_t) &g_nxlock_recursive;
__env_lock_object = (_lock_t)&g_nxlock_recursive;
extern _lock_t __tz_lock_object;
__tz_lock_object = (_lock_t) &g_nxlock_common;
__tz_lock_object = (_lock_t)&g_nxlock_common;
}

View File

@ -24,7 +24,6 @@
#include <assert.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -33,7 +32,10 @@
#include <sys/stat.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/lib/lib.h>
#include "rom/esp32s2_libc_stubs.h"
/****************************************************************************
@ -59,22 +61,22 @@ struct _reent;
int _close_r(struct _reent *r, int fd)
{
return close(fd);
return nx_close(fd);
}
int _fstat_r(struct _reent *r, int fd, struct stat *statbuf)
{
return fstat(fd, statbuf);
return nx_fstat(fd, statbuf);
}
int _getpid_r(struct _reent *r)
{
return getpid();
return nxsched_getpid();
}
int _kill_r(struct _reent *r, int pid, int sig)
{
return kill(pid, sig);
return nxsig_kill(pid, sig);
}
int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -86,17 +88,17 @@ int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
int lseek_r(struct _reent *r, int fd, int offset, int whence)
{
return lseek(fd, offset, whence);
return nx_seek(fd, offset, whence);
}
int _open_r(struct _reent *r, const char *pathname, int flags, int mode)
{
return open(pathname, flags, mode);
return nx_open(pathname, flags, mode);
}
int read_r(struct _reent *r, int fd, void *buf, int count)
{
return read(fd, buf, count);
return nx_read(fd, buf, count);
}
int _rename_r(struct _reent *r, const char *oldpath, const char *newpath)
@ -109,12 +111,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t increment)
/* TODO: sbrk is only supported on Kernel mode */
errno = -ENOMEM;
return (void *) -1;
return (void *)-1;
}
int _stat_r(struct _reent *r, const char *pathname, struct stat *statbuf)
{
return stat(pathname, statbuf);
return nx_stat(pathname, statbuf, 1);
}
clock_t _times_r(struct _reent *r, struct tms *buf)
@ -124,12 +126,12 @@ clock_t _times_r(struct _reent *r, struct tms *buf)
int _unlink_r(struct _reent *r, const char *pathname)
{
return unlink(pathname);
return nx_unlink(pathname);
}
int write_r(struct _reent *r, int fd, const void *buf, int count)
{
return write(fd, buf, count);
return nx_write(fd, buf, count);
}
int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
@ -139,22 +141,22 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
void *_malloc_r(struct _reent *r, size_t size)
{
return malloc(size);
return lib_malloc(size);
}
void *_realloc_r(struct _reent *r, void *ptr, size_t size)
{
return realloc(ptr, size);
return lib_realloc(ptr, size);
}
void *_calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
return calloc(nmemb, size);
return lib_calloc(nmemb, size);
}
void _free_r(struct _reent *r, void *ptr)
{
free(ptr);
lib_free(ptr);
}
void _abort(void)
@ -233,7 +235,7 @@ struct _reent *__getreent(void)
{
/* TODO */
return (struct _reent *) NULL;
return (struct _reent *)NULL;
}
int _system_r(struct _reent *r, const char *command)
@ -323,8 +325,8 @@ void esp_setup_syscall_table(void)
/* Newlib 3.0.0 is used in ROM, the following lock symbols are defined: */
extern _lock_t __sinit_recursive_mutex;
__sinit_recursive_mutex = (_lock_t) &g_nxlock_recursive;
__sinit_recursive_mutex = (_lock_t)&g_nxlock_recursive;
extern _lock_t __sfp_recursive_mutex;
__sfp_recursive_mutex = (_lock_t) &g_nxlock_recursive;
__sfp_recursive_mutex = (_lock_t)&g_nxlock_recursive;
}

View File

@ -24,7 +24,6 @@
#include <assert.h>
#include <fcntl.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
@ -33,7 +32,10 @@
#include <sys/stat.h>
#include <unistd.h>
#include <nuttx/signal.h>
#include <nuttx/mutex.h>
#include <nuttx/lib/lib.h>
#include "rom/esp32s3_libc_stubs.h"
/****************************************************************************
@ -61,26 +63,25 @@ struct _reent;
int _close_r(struct _reent *r, int fd)
{
return close(fd);
return nx_close(fd);
}
int _fstat_r(struct _reent *r, int fd, struct stat *statbuf)
{
return fstat(fd, statbuf);
return nx_fstat(fd, statbuf);
}
int _getpid_r(struct _reent *r)
{
return getpid();
return nxsched_getpid();
}
int _kill_r(struct _reent *r, int pid, int sig)
{
return kill(pid, sig);
return nxsig_kill(pid, sig);
}
int _link_r(struct _reent *r, const char *oldpath,
const char *newpath)
int _link_r(struct _reent *r, const char *oldpath, const char *newpath)
{
/* TODO */
@ -89,22 +90,20 @@ int _link_r(struct _reent *r, const char *oldpath,
int lseek_r(struct _reent *r, int fd, int offset, int whence)
{
return lseek(fd, offset, whence);
return nx_seek(fd, offset, whence);
}
int _open_r(struct _reent *r, const char *pathname,
int flags, int mode)
int _open_r(struct _reent *r, const char *pathname, int flags, int mode)
{
return open(pathname, flags, mode);
return nx_open(pathname, flags, mode);
}
int read_r(struct _reent *r, int fd, void *buf, int count)
{
return read(fd, buf, count);
return nx_read(fd, buf, count);
}
int _rename_r(struct _reent *r, const char *oldpath,
const char *newpath)
int _rename_r(struct _reent *r, const char *oldpath, const char *newpath)
{
return rename(oldpath, newpath);
}
@ -114,13 +113,12 @@ void *_sbrk_r(struct _reent *r, ptrdiff_t increment)
/* TODO: sbrk is only supported on Kernel mode */
errno = -ENOMEM;
return (void *) -1;
return (void *)-1;
}
int _stat_r(struct _reent *r, const char *pathname,
struct stat *statbuf)
int _stat_r(struct _reent *r, const char *pathname, struct stat *statbuf)
{
return stat(pathname, statbuf);
return nx_stat(pathname, statbuf, 1);
}
clock_t _times_r(struct _reent *r, struct tms *buf)
@ -130,12 +128,12 @@ clock_t _times_r(struct _reent *r, struct tms *buf)
int _unlink_r(struct _reent *r, const char *pathname)
{
return unlink(pathname);
return nx_unlink(pathname);
}
int write_r(struct _reent *r, int fd, const void *buf, int count)
{
return write(fd, buf, count);
return nx_write(fd, buf, count);
}
int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
@ -145,22 +143,22 @@ int _gettimeofday_r(struct _reent *r, struct timeval *tv, void *tz)
void *_malloc_r(struct _reent *r, size_t size)
{
return malloc(size);
return lib_malloc(size);
}
void *_realloc_r(struct _reent *r, void *ptr, size_t size)
{
return realloc(ptr, size);
return lib_realloc(ptr, size);
}
void *_calloc_r(struct _reent *r, size_t nmemb, size_t size)
{
return calloc(nmemb, size);
return lib_calloc(nmemb, size);
}
void _free_r(struct _reent *r, void *ptr)
{
free(ptr);
lib_free(ptr);
}
void _abort(void)
@ -289,7 +287,7 @@ struct _reent *__getreent(void)
{
/* TODO */
return (struct _reent *) NULL;
return (struct _reent *)NULL;
}
int _system_r(struct _reent *r, const char *command)
@ -389,6 +387,6 @@ void esp_setup_syscall_table(void)
extern void esp_rom_newlib_init_common_mutexes(_lock_t, _lock_t);
int magic_val = ROM_MUTEX_MAGIC;
_lock_t magic_mutex = (_lock_t) &magic_val;
_lock_t magic_mutex = (_lock_t)&magic_val;
esp_rom_newlib_init_common_mutexes(magic_mutex, magic_mutex);
}

View File

@ -46,6 +46,7 @@
/* Domain-specific allocations */
# define lib_malloc(s) kmm_malloc(s)
# define lib_calloc(n,s) kmm_calloc(n,s)
# define lib_malloc_size(p) kmm_malloc_size(p)
# define lib_zalloc(s) kmm_zalloc(s)
# define lib_realloc(p,s) kmm_realloc(p,s)
@ -55,6 +56,7 @@
/* User-accessible allocations */
# define lib_umalloc(s) kumm_malloc(s)
# define lib_ucalloc(n,s) kumm_calloc(n,s)
# define lib_umalloc_size(p) kumm_malloc_size(p)
# define lib_uzalloc(s) kumm_zalloc(s)
# define lib_urealloc(p,s) kumm_realloc(p,s)
@ -66,6 +68,7 @@
/* Domain-specific allocations */
# define lib_malloc(s) malloc(s)
# define lib_calloc(n,s) calloc(n,s)
# define lib_malloc_size(p) malloc_size(p)
# define lib_zalloc(s) zalloc(s)
# define lib_realloc(p,s) realloc(p,s)
@ -75,6 +78,7 @@
/* User-accessible allocations */
# define lib_umalloc(s) malloc(s)
# define lib_ucalloc(n,s) calloc(n,s)
# define lib_umalloc_size(p) malloc_size(p)
# define lib_uzalloc(s) zalloc(s)
# define lib_urealloc(p,s) realloc(p,s)