libc: introduce "jehanne_" namespace
With this commit all functions declared in libc.h have been renamed with the "jehanne_" prefix. This is done for several reason: - it removes conflicts during symbol resolution when linking standard C libraries like newlib or musl - it allows programs depending on a standard C library to directly link to a library depending on our non standard libc (eg libsec). To ease transiction two files are provided: - sys/include/lib9.h that can be included instead of <libc.h> to use the old names (via a simple set of macros) - sys/src/lib/c/lib9.c that can be compiled with a program where the macro provided by lib9.h are too dumb (see for example rc or grep). In the kernel port/lib.h has been modified accordingly and some of the functions it directly provides has been renamed too (eg malloc in qmalloc.c and print in devcons.c).
This commit is contained in:
310
sys/include/lib9.h
Normal file
310
sys/include/lib9.h
Normal file
@ -0,0 +1,310 @@
|
||||
/*
|
||||
* This file is part of Jehanne.
|
||||
*
|
||||
* Copyright (C) 2017 Giacomo Tesio <giacomo@tesio.it>
|
||||
*
|
||||
* Jehanne is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, version 2 of the License.
|
||||
*
|
||||
* Jehanne is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Jehanne. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* lib9.h provides macros to map Plan9's libc functions to Jehanne one */
|
||||
|
||||
#include <libc.h>
|
||||
|
||||
#define memccpy jehanne_memccpy
|
||||
#define memset jehanne_memset
|
||||
#define memcmp jehanne_memcmp
|
||||
#define memcpy jehanne_memcpy
|
||||
#define memmove jehanne_memmove
|
||||
#define memchr jehanne_memchr
|
||||
#define strcat jehanne_strcat
|
||||
#define strchr jehanne_strchr
|
||||
#define strcmp jehanne_strcmp
|
||||
#define strcpy jehanne_strcpy
|
||||
#define strecpy jehanne_strecpy
|
||||
#define strdup jehanne_strdup
|
||||
#define strncat jehanne_strncat
|
||||
#define strncpy jehanne_strncpy
|
||||
#define strncmp jehanne_strncmp
|
||||
#define strpbrk jehanne_strpbrk
|
||||
#define strrchr jehanne_strrchr
|
||||
#define strtok jehanne_strtok
|
||||
#define strlen jehanne_strlen
|
||||
#define strspn jehanne_strspn
|
||||
#define strcspn jehanne_strcspn
|
||||
#define strstr jehanne_strstr
|
||||
#define cistrncmp jehanne_cistrncmp
|
||||
#define cistrcmp jehanne_cistrcmp
|
||||
#define cistrstr jehanne_cistrstr
|
||||
#define tokenize jehanne_tokenize
|
||||
#define runetochar jehanne_runetochar
|
||||
#define chartorune jehanne_chartorune
|
||||
#define runelen jehanne_runelen
|
||||
#define runenlen jehanne_runenlen
|
||||
#define fullrune jehanne_fullrune
|
||||
#define utflen jehanne_utflen
|
||||
#define utfnlen jehanne_utfnlen
|
||||
#define utfrune jehanne_utfrune
|
||||
#define utfrrune jehanne_utfrrune
|
||||
#define utfutf jehanne_utfutf
|
||||
#define utfecpy jehanne_utfecpy
|
||||
#define runestrcat jehanne_runestrcat
|
||||
#define runestrchr jehanne_runestrchr
|
||||
#define runestrcmp jehanne_runestrcmp
|
||||
#define runestrcpy jehanne_runestrcpy
|
||||
#define runestrncpy jehanne_runestrncpy
|
||||
#define runestrecpy jehanne_runestrecpy
|
||||
#define runestrdup jehanne_runestrdup
|
||||
#define runestrncat jehanne_runestrncat
|
||||
#define runestrncmp jehanne_runestrncmp
|
||||
#define runestrrchr jehanne_runestrrchr
|
||||
#define runestrlen jehanne_runestrlen
|
||||
#define runestrstr jehanne_runestrstr
|
||||
#define tolowerrune jehanne_tolowerrune
|
||||
#define totitlerune jehanne_totitlerune
|
||||
#define toupperrune jehanne_toupperrune
|
||||
#define tobaserune jehanne_tobaserune
|
||||
#define isalpharune jehanne_isalpharune
|
||||
#define isbaserune jehanne_isbaserune
|
||||
#define isdigitrune jehanne_isdigitrune
|
||||
#define islowerrune jehanne_islowerrune
|
||||
#define isspacerune jehanne_isspacerune
|
||||
#define istitlerune jehanne_istitlerune
|
||||
#define isupperrune jehanne_isupperrune
|
||||
#define malloc jehanne_malloc
|
||||
#define malloc jehanne_malloc
|
||||
#define mallocz jehanne_mallocz
|
||||
#define free jehanne_free
|
||||
#define msize jehanne_msize
|
||||
#define mallocalign jehanne_mallocalign
|
||||
#define calloc jehanne_calloc
|
||||
#define realloc jehanne_realloc
|
||||
#define setmalloctag jehanne_setmalloctag
|
||||
#define setrealloctag jehanne_setrealloctag
|
||||
#define getmalloctag jehanne_getmalloctag
|
||||
#define getrealloctag jehanne_getrealloctag
|
||||
#define malloctopoolblock jehanne_malloctopoolblock
|
||||
#define print jehanne_print
|
||||
#define print jehanne_print
|
||||
#define seprint jehanne_seprint
|
||||
#define vseprint jehanne_vseprint
|
||||
#define snprint jehanne_snprint
|
||||
#define vsnprint jehanne_vsnprint
|
||||
#define smprint jehanne_smprint
|
||||
#define vsmprint jehanne_vsmprint
|
||||
#define sprint jehanne_sprint
|
||||
#define fprint jehanne_fprint
|
||||
#define vfprint jehanne_vfprint
|
||||
#define runesprint jehanne_runesprint
|
||||
#define runesnprint jehanne_runesnprint
|
||||
#define runevsnprint jehanne_runevsnprint
|
||||
#define runeseprint jehanne_runeseprint
|
||||
#define runevseprint jehanne_runevseprint
|
||||
#define runesmprint jehanne_runesmprint
|
||||
#define runevsmprint jehanne_runevsmprint
|
||||
#define fmtfdinit jehanne_fmtfdinit
|
||||
#define fmtfdflush jehanne_fmtfdflush
|
||||
#define fmtstrinit jehanne_fmtstrinit
|
||||
#define fmtstrflush jehanne_fmtstrflush
|
||||
#define runefmtstrinit jehanne_runefmtstrinit
|
||||
#define runefmtstrflush jehanne_runefmtstrflush
|
||||
#define fmtinstall jehanne_fmtinstall
|
||||
#define dofmt jehanne_dofmt
|
||||
#define dorfmt jehanne_dorfmt
|
||||
#define fmtprint jehanne_fmtprint
|
||||
#define fmtvprint jehanne_fmtvprint
|
||||
#define fmtrune jehanne_fmtrune
|
||||
#define fmtstrcpy jehanne_fmtstrcpy
|
||||
#define fmtrunestrcpy jehanne_fmtrunestrcpy
|
||||
#define errfmt jehanne_errfmt
|
||||
#define unquotestrdup jehanne_unquotestrdup
|
||||
#define unquoterunestrdup jehanne_unquoterunestrdup
|
||||
#define quotestrdup jehanne_quotestrdup
|
||||
#define quoterunestrdup jehanne_quoterunestrdup
|
||||
#define quotestrfmt jehanne_quotestrfmt
|
||||
#define quoterunestrfmt jehanne_quoterunestrfmt
|
||||
#define quotefmtinstall jehanne_quotefmtinstall
|
||||
#define needsrcquote jehanne_needsrcquote
|
||||
#define srand jehanne_srand
|
||||
#define rand jehanne_rand
|
||||
#define nrand jehanne_nrand
|
||||
#define lrand jehanne_lrand
|
||||
#define lnrand jehanne_lnrand
|
||||
#define frand jehanne_frand
|
||||
#define truerand jehanne_truerand
|
||||
#define ntruerand jehanne_ntruerand
|
||||
#define getfcr jehanne_getfcr
|
||||
#define setfsr jehanne_setfsr
|
||||
#define setfcr jehanne_setfcr
|
||||
#define NaN jehanne_NaN
|
||||
#define Inf jehanne_Inf
|
||||
#define isNaN jehanne_isNaN
|
||||
#define isInf jehanne_isInf
|
||||
#define umuldiv jehanne_umuldiv
|
||||
#define muldiv jehanne_muldiv
|
||||
#define pow jehanne_pow
|
||||
#define atan2 jehanne_atan2
|
||||
#define fabs jehanne_fabs
|
||||
#define atan jehanne_atan
|
||||
#define log jehanne_log
|
||||
#define log10 jehanne_log10
|
||||
#define exp jehanne_exp
|
||||
#define floor jehanne_floor
|
||||
#define ceil jehanne_ceil
|
||||
#define hypot jehanne_hypot
|
||||
#define sin jehanne_sin
|
||||
#define cos jehanne_cos
|
||||
#define tan jehanne_tan
|
||||
#define asin jehanne_asin
|
||||
#define acos jehanne_acos
|
||||
#define sinh jehanne_sinh
|
||||
#define cosh jehanne_cosh
|
||||
#define tanh jehanne_tanh
|
||||
#define sqrt jehanne_sqrt
|
||||
#define fmod jehanne_fmod
|
||||
#define gmtime jehanne_gmtime
|
||||
#define localtime jehanne_localtime
|
||||
#define asctime jehanne_asctime
|
||||
#define ctime jehanne_ctime
|
||||
#define cputime jehanne_cputime
|
||||
#define times jehanne_times
|
||||
#define tm2sec jehanne_tm2sec
|
||||
#define nsec jehanne_nsec
|
||||
#define _assert jehanne__assert
|
||||
#define abs jehanne_abs
|
||||
#define atexit jehanne_atexit
|
||||
#define atexitdont jehanne_atexitdont
|
||||
#define atnotify jehanne_atnotify
|
||||
#define atof jehanne_atof
|
||||
#define atoi jehanne_atoi
|
||||
#define atol jehanne_atol
|
||||
#define atoll jehanne_atoll
|
||||
#define charstod jehanne_charstod
|
||||
#define chdir jehanne_chdir
|
||||
#define cleanname jehanne_cleanname
|
||||
#define dec64 jehanne_dec64
|
||||
#define enc64 jehanne_enc64
|
||||
#define dec32 jehanne_dec32
|
||||
#define enc32 jehanne_enc32
|
||||
#define dec16 jehanne_dec16
|
||||
#define enc16 jehanne_enc16
|
||||
#define encodefmt jehanne_encodefmt
|
||||
#define exits jehanne_exits
|
||||
#define frexp jehanne_frexp
|
||||
#define getcallerpc jehanne_getcallerpc
|
||||
#define getenv jehanne_getenv
|
||||
#define getfields jehanne_getfields
|
||||
#define gettokens jehanne_gettokens
|
||||
#define getuser jehanne_getuser
|
||||
#define getwd jehanne_getwd
|
||||
#define iounit jehanne_iounit
|
||||
#define labs jehanne_labs
|
||||
#define ldexp jehanne_ldexp
|
||||
#define longjmp jehanne_longjmp
|
||||
#define mktemp jehanne_mktemp
|
||||
#define modf jehanne_modf
|
||||
#define notejmp jehanne_notejmp
|
||||
#define nsec jehanne_nsec
|
||||
#define dup jehanne_dup
|
||||
#define ocreate jehanne_ocreate
|
||||
#define perror jehanne_perror
|
||||
#define pipe jehanne_pipe
|
||||
#define postnote jehanne_postnote
|
||||
#define pow10 jehanne_pow10
|
||||
#define putenv jehanne_putenv
|
||||
#define qsort jehanne_qsort
|
||||
#define bsearch jehanne_bsearch
|
||||
#define setjmp jehanne_setjmp
|
||||
#define strtod jehanne_strtod
|
||||
#define strtol jehanne_strtol
|
||||
#define strtoul jehanne_strtoul
|
||||
#define strtoll jehanne_strtoll
|
||||
#define strtoull jehanne_strtoull
|
||||
#define sysfatal jehanne_sysfatal
|
||||
#define syslog jehanne_syslog
|
||||
#define time jehanne_time
|
||||
#define tolower jehanne_tolower
|
||||
#define toupper jehanne_toupper
|
||||
#define ainc jehanne_ainc
|
||||
#define adec jehanne_adec
|
||||
#define _tas jehanne__tas
|
||||
#define lock jehanne_lock
|
||||
#define lockt jehanne_lockt
|
||||
#define unlock jehanne_unlock
|
||||
#define canlock jehanne_canlock
|
||||
#define lock; jehanne_lock;
|
||||
#define qlock jehanne_qlock
|
||||
#define qlockt jehanne_qlockt
|
||||
#define qunlock jehanne_qunlock
|
||||
#define canqlock jehanne_canqlock
|
||||
#define _qlockinit jehanne__qlockinit
|
||||
#define lock; jehanne_lock;
|
||||
#define rlock jehanne_rlock
|
||||
#define rlockt jehanne_rlockt
|
||||
#define runlock jehanne_runlock
|
||||
#define canrlock jehanne_canrlock
|
||||
#define wlock jehanne_wlock
|
||||
#define wlockt jehanne_wlockt
|
||||
#define wunlock jehanne_wunlock
|
||||
#define canwlock jehanne_canwlock
|
||||
#define rsleep jehanne_rsleep
|
||||
#define rsleept jehanne_rsleept
|
||||
#define rwakeup jehanne_rwakeup
|
||||
#define rwakeupall jehanne_rwakeupall
|
||||
#define privalloc jehanne_privalloc
|
||||
#define accept jehanne_accept
|
||||
#define announce jehanne_announce
|
||||
#define dial jehanne_dial
|
||||
#define setnetmtpt jehanne_setnetmtpt
|
||||
#define hangup jehanne_hangup
|
||||
#define listen jehanne_listen
|
||||
#define netmkaddr jehanne_netmkaddr
|
||||
#define reject jehanne_reject
|
||||
#define pushssl jehanne_pushssl
|
||||
#define pushtls jehanne_pushtls
|
||||
#define getnetconninfo jehanne_getnetconninfo
|
||||
#define freenetconninfo jehanne_freenetconninfo
|
||||
#define access jehanne_access
|
||||
#define awakened jehanne_awakened
|
||||
#define brk jehanne_brk
|
||||
#define execl jehanne_execl
|
||||
#define forgivewkp jehanne_forgivewkp
|
||||
#define fork jehanne_fork
|
||||
#define readn jehanne_readn
|
||||
#define segbrk jehanne_segbrk
|
||||
#define segbrk jehanne_segbrk
|
||||
#define segattach jehanne_segattach
|
||||
#define segdetach jehanne_segdetach
|
||||
#define segfree jehanne_segfree
|
||||
#define sleep jehanne_sleep
|
||||
#define stat jehanne_stat
|
||||
#define wait jehanne_wait
|
||||
#define waitpid jehanne_waitpid
|
||||
#define wstat jehanne_wstat
|
||||
#define dirstat jehanne_dirstat
|
||||
#define dirfstat jehanne_dirfstat
|
||||
#define dirwstat jehanne_dirwstat
|
||||
#define dirfwstat jehanne_dirfwstat
|
||||
#define dirread jehanne_dirread
|
||||
#define nulldir jehanne_nulldir
|
||||
#define dirreadall jehanne_dirreadall
|
||||
#define getpid jehanne_getpid
|
||||
#define getppid jehanne_getppid
|
||||
#define getmainpid jehanne_getmainpid
|
||||
#define rerrstr jehanne_rerrstr
|
||||
#define sysname jehanne_sysname
|
||||
#define werrstr jehanne_werrstr
|
||||
#define convM2D jehanne_convM2D
|
||||
#define convD2M jehanne_convD2M
|
||||
#define sizeD2M jehanne_sizeD2M
|
||||
#define dirmodefmt jehanne_dirmodefmt
|
||||
#define chartorune jehanne_chartorune
|
Reference in New Issue
Block a user