Android-cuttlefish cvd tool
adb
sysdeps
uio.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2018 The Android Open Source Project
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <sys/types.h>
20
21
#include <algorithm>
22
23
#include "
adb_unique_fd.h
"
24
25
#if defined(_WIN32)
26
27
// Layout of this struct must match struct WSABUF (verified via static assert in sysdeps_win32.cpp)
28
struct
adb_iovec
{
29
unsigned
int
iov_len;
30
void
* iov_base;
31
};
32
33
ssize_t
adb_writev
(
borrowed_fd
fd,
const
adb_iovec
* iov,
int
iovcnt);
34
35
#else
36
37
#include <sys/uio.h>
38
using
adb_iovec
=
struct
iovec;
39
inline
ssize_t
adb_writev
(
borrowed_fd
fd,
const
adb_iovec
* iov,
int
iovcnt) {
40
return
writev(fd.
get
(), iov,
std::min
(iovcnt, IOV_MAX));
41
}
42
43
#endif
44
45
#pragma GCC poison writev
adb_unique_fd.h
min
#define min(a, b)
Definition:
ext4_utils.h:44
android::base::borrowed_fd
Definition:
unique_fd.h:292
android::base::borrowed_fd::get
int get() const
Definition:
unique_fd.h:297
adb_writev
ssize_t adb_writev(borrowed_fd fd, const adb_iovec *iov, int iovcnt)
Definition:
uio.h:39
adb_iovec
iovec adb_iovec
Definition:
uio.h:38
Generated by
1.9.4