uiomove 内核服务
用途
在内核空间和由uio结构定义的空间之间移动数据块。
语法
参数
| 项 | 描述 |
|---|---|
| CP | 指定将数据移动到内核内存中或从中移动数据的地址。 |
| n | 指定要移动的字节数。 |
| rw | 表示移动的方向:
|
| 乌约普 | 指向uio结构,该结构描述了数据传输中使用的缓冲区。 |
描述
uiomove内核服务在内核空间和uio结构描述的空间之间移动指定字节数的数据。 设备驱动程序上半部分,尤其是字符设备驱动程序,经常使用uiomove服务将数据传输到用户区域或从用户区域传出。 "(《世界人权宣言》) uio_resid 和 uio_iovcnt fields in the uio structure describing the data area must be greater than 0 or an error is returned.
uiomove服务移动的数据字节数由 n或uio_resid参数指定,以较少者为准。 如果n或uio_resid参数为 0,则不移动数据。 "(《世界人权宣言》) uio_segflg field in the uio structure is used to indicate if the move is accessing a user- or kernel-data area, or if the caller requires cross-memory operations and has provided the required cross-memory descriptors. 如果指定了跨内存操作,则必须在uio_xmem数组中为每个iovec元素。
如果移动成功,uio结构中的以下字段将被更新:
| 字段 | 描述 |
|---|---|
| uio_iov | 指定当前iovec元素。 |
| uio_xmem | 指定当前xmem元素。 |
| uio_iovcnt | 指定剩余iovec元素。 |
| uio_iovdcnt | 指定已处理的iovec元素。 |
| uio_offset | 指定执行 I/O 操作的设备上的字符偏移量。 |
| uio_resid | 指定uio结构描述的数据区中剩余的字符总数。 |
| iov_base | 指定当前数据区描述的地址iovec元素。 |
| iov_len | 指定当前缓冲区中剩余数据区的长度iovec元素。 |
执行环境
只能从进程环境中调用uiomove内核服务。
返回值
| 项 | 描述 |
|---|---|
| 重大安全事件数量 | 指示成功完成。 |
| ENOMEM | 表示缓冲区中没有任何空间。 |
| EIO | 指示永久 I/O 错误文件空间。 |
| ENOSPC | 指示磁盘空间不足。 |
| EFAULT | 指示一个无效的用户位置。 |