Most OpenSAF programs are multi-threaded, and code in shared libraries can be linked with application programs, which we must assume can also be multi-threaded. Therefore, you should always be careful to avoid using C library functions that are not thread-safe. Below is a list of C library functions that are categorized as MT-Unsafe (see POSIX Safety Concepts) in the Linux man pages. Some of these functions can however be used safely in a multithreaded program, provided that certain conditions are met. For example, the readdir function is safe provided that no other thread is accessing the same stream concurrently. If possible, avoid using these functions. If you do use them, you must ensure that the conditions for using them safely are met. For details regarding each function, please refer to the Linux man pages.
__after_morecore_hook | __free_hook | __malloc_check_init | __malloc_hook |
__malloc_initialize_hook | __memalign_hook | __realloc_hook | asctime |
clearenv | crypt | ctime | cuserid |
dbm_clearerr | dbm_close | dbm_delete | dbm_error |
dbm_fetch | dbm_firstkey | dbm_nextkey | dbm_open |
dbm_store | drand48 | ecvt | encrypt |
endfsent | endgrent | endhostent | endnetent |
endnetgrent | endprotoent | endpwent | endservent |
endspent | endttyent | endusershell | endutent |
endutxent | erand48 | error_at_line | ether_aton |
ether_ntoa | exit | fcloseall | fcvt |
fgetgrent | fgetpwent | fgetspent | fts_children |
fts_read | gamma | gammaf | gammal |
getaliasbyname | getaliasent | getchar_unlocked | getdate |
getfsent | getfsfile | getfsspec | getgrent |
getgrent_r | getgrgid | getgrnam | gethostbyaddr |
gethostbyname | gethostbyname2 | gethostent | gethostent_r |
getlogin | getlogin_r | getmntent | getnetbyaddr |
getnetbyname | getnetent | getnetgrent | getnetgrent_r |
getopt | getopt_long | getopt_long_only | getpass |
getprotobyname | getprotobynumber | getprotoent | getpwent |
getpwent_r | getpwnam | getpwuid | getrpcbyname |
getrpcbynumber | getrpcent | getservbyname | getservbyport |
getservent | getspent | getspent_r | getspnam |
getttyent | getttynam | getusershell | getutent |
getutid | getutline | getutxent | getutxid |
getutxline | getwchar_unlocked | glob | gmtime |
hcreate | hdestroy | hsearch | innetgr |
jrand48 | l64a | lcong48 | lgamma |
lgammaf | lgammal | localeconv | localtime |
login | login_tty | logout | logwtmp |
lrand48 | mallinfo | mblen | mbrlen |
mbrtowc | mbsnrtowcs | mbsrtowcs | mbtowc |
mcheck | mcheck_check_all | mcheck_pedantic | mprobe |
mrand48 | mtrace | muntrace | nrand48 |
profil | ptsname | putchar_unlocked | putenv |
pututline | pututxline | putwchar_unlocked | pvalloc |
qecvt | qfcvt | rcmd | rcmd_af |
re_comp | re_exec | readdir | rexec |
rexec_af | seed48 | setenv | setfsent |
setgrent | sethostent | sethostid | setkey |
setlocale | setlogmask | setnetent | setnetgrent |
setprotoent | setpwent | setservent | setspent |
setttyent | setusershell | setutent | setutxent |
sgetspent | siginterrupt | signal | sleep |
srand48 | strerror | strsignal | strtok |
tmpnam | ttyname | ttyslot | unsetenv |
updwtmp | utmpname | valloc | wcrtomb |
wcsnrtombs | wcsrtombs | wctomb | wordexp |
Below is a list of functions, variables and macros that are documented as obsolete, deprecated or legacy. We should avoid using them. For details regarding each function, please refer to the Linux man pages.
INADDR_NONE | LOG_NOWAIT | _BSD_SOURCE | _LARGEFILE_SOURCE |
_SVID_SOURCE | __GNU_LIBRARY__ | __after_morecore_hook | __free_hook |
__malloc_check_init | __malloc_hook | __malloc_initialize_hook | __memalign_hook |
__realloc_hook | __setfpucw | _fini | _init |
_res | asctime | asctime_r | atoq |
bcmp | bcopy | bzero | ctime |
ctime_r | drem | dremf | dreml |
ecvt | ecvt_r | endfsent | endutent |
fcvt | fcvt_r | finite | finitef |
finitel | freehostent | ftime | ftw |
gamma | gammaf | gammal | gcvt |
getfsent | getfsfile | getfsspec | gethostbyaddr |
gethostbyaddr_r | gethostbyname | gethostbyname2 | gethostbyname2_r |
gethostbyname_r | getipnodebyaddr | getipnodebyname | getpass |
getpw | gets | getutent | getutid |
getutline | getwd | gsignal | h_errno |
herror | hstrerror | index | inet_addr |
inet_lnaof | inet_makeaddr | inet_netof | infnan |
isascii | isinf | isinff | isinfl |
isnan | isnanf | isnanl | matherr |
memalign | mktemp | pthread_attr_getstackaddr | pthread_attr_setstackaddr |
pthread_kill_other_threads_np | pututline | pvalloc | qecvt |
qecvt_r | qfcvt | qfcvt_r | qgcvt |
rand_r | re_comp | re_exec | readdir64_r |
readdir_r | res_init | res_mkquery | res_query |
res_querydomain | res_search | res_send | rexec |
rexec_af | rindex | scalb | scalbf |
scalbl | setfsent | setutent | sigblock |
siggetmask | sighold | sigignore | siginterrupt |
sigmask | sigpause | sigrelse | sigset |
sigsetmask | sigstack | sigvec | ssignal |
svc_fds | svc_getreq | sys_errlist | sys_nerr |
tempnam | tkill | tmpnam | toascii |
towlower | towupper | ttyslot | ualarm |
ulimit | usleep | utmpname | valloc |
wctob |
Some old functions that only support IPv4 have been replaced with new functions supporting both IPv4 and IPv6. Although the old functions are not (yet) officially deprecated, we should use the new function in OpenSAF since OpenSAF supports both IPv4 and IPv6. Below is a list of functions that only support IPv4, and therefore should not be used:
inet_addr | inet_aton | inet_lnaof | inet_makeaddr |
inet_netof | inet_network | inet_ntoa |
The following functions should be avoided since they are difficult to use in a secure way. For more information about why these functions are unsecure, see e.g. Banned Function Calls
alloca | gets | scanf | sprintf |
sscanf | strcat | strcpy | strncat |
strncpy | strtok | swprintf | swscanf |
vsprintf | vswprintf | wcscat | wcscpy |
wcsncat | wcsncpy | wcstok | wmemcpy |
wscanf |