Maximum size of message for strerror_r on VxWorks

荒凉一梦 提交于 2019-12-11 01:24:44

问题


VxWorks provides a version of strerror_r that only takes two parameters.

STATUS strerror_r
(
    int errcode, /* error number */
    char *buffer /* string buffer */
)

cURL mentions MAXERRSTR_SIZE.

The vxworks-style strerror_r() does use the buffer we pass to the function. The buffer size should be at least MAXERRSTR_SIZE (150) defined in rtsold.h

But I can't seem to find the file rtsold.h anywhere in the distribution.

What is the maximum size of the message copied into the buffer? Is there a #define or integer constant defined somewhere?


回答1:


For future reference. The maximum size is NAME_MAX, or 255 bytes at the time of this writing. Keep in mind the termination byte, and pass a buffer of at least 256 bytes to be safe. (It seems I could have just consulted the source for strerror_r on VxWorks. I'm sorry, I didn't know that).



来源:https://stackoverflow.com/questions/22856387/maximum-size-of-message-for-strerror-r-on-vxworks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!