unix 套接字错误 14:EFAULT(错误地址) [英] unix socket error 14: EFAULT (bad address)

查看:80
本文介绍了unix 套接字错误 14:EFAULT(错误地址)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个非常简单的问题,但我整个周末都没有找到任何答案.我正在使用 sendto() 函数,它返回错误代码 14:EFAULT.手册页将其描述为:

为参数指定了无效的用户空间地址."

我确信这是在谈论我指定的 IP 地址,但现在我怀疑它可能是它所指的消息缓冲区的内存地址 - 我找不到在任何地方对此有任何澄清,任何人都可以澄清吗?

解决方案

EFAULT 如果某些参数的内存地址传递给 sendto(或更一般地传递​​给任何系统调用)无效.将其视为内核领域中有关系统调用的一种 SIGSEGV.例如,如果您传递一个空或无效的缓冲区指针(用于读取、写入、发送、接收...),您会得到

参见 errno(3)sendto(2) 等...手册页.

EFAULT 与 IP 地址完全无关.

I have a very simple question, but I have not managed to find any answers to it all weekend. I am using the sendto() function and it is returning error code 14: EFAULT. The man pages describe it as:

"An invalid user space address was specified for an argument."

I was convinced that this was talking about the IP address I was specifying, but now I suspect it may be the memory address of the message buffer that it is referring to - I can't find any clarification on this anywhere, can anyone clear this up?

解决方案

EFAULT It happen if the memory address of some argument passed to sendto (or more generally to any system call) is invalid. Think of it as a sort of SIGSEGV in kernel land regarding your syscall. For instance, if you pass a null or invalid buffer pointer (for reading, writing, sending, recieving...), you get that

See errno(3), sendto(2) etc... man pages.

EFAULT is not related to IP addresses at all.

这篇关于unix 套接字错误 14:EFAULT(错误地址)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆