89 if ((iov == NULL) || (iovcnt > IOV_MAX)) {
93 for (i = 0; i < iovcnt; ++i) {
94 if (SSIZE_MAX - buflen < iov[i].iov_len) {
98 buflen += iov[i].iov_len;
105 totallen = buflen *
sizeof(char);
106#ifdef LOSCFG_KERNEL_VM
109 buf = (
char *)
malloc(totallen);
117#ifdef LOSCFG_KERNEL_VM
126 totalbyteswritten = (offset == NULL) ? write(fd, buf, bytestowrite)
127 : pwrite(fd, buf, bytestowrite, *offset);
128#ifdef LOSCFG_KERNEL_VM
133 return totalbyteswritten;
VOID LOS_VFree(const VOID *addr)
VOID * LOS_VMalloc(size_t size)
void * malloc(size_t size)
动态分配内存块大小
void free(void *ptr)
释放ptr所指向的内存空间
static int iov_trans_to_buf(char *buf, ssize_t totallen, const struct iovec *iov, int iovcnt)