| Josh Gao | 116aa0a | 2018-04-05 17:55:25 -0700 | [diff] [blame] | 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 | #if defined(_WIN32) | 
|  | 22 |  | 
|  | 23 | // Layout of this struct must match struct WSABUF (verified via static assert in sysdeps_win32.cpp) | 
|  | 24 | struct adb_iovec { | 
|  | 25 | size_t iov_len; | 
|  | 26 | void* iov_base; | 
|  | 27 | }; | 
|  | 28 |  | 
| Ian Kasprzak | 2c58e19 | 2019-04-25 15:59:28 +0000 | [diff] [blame] | 29 | ssize_t adb_writev(int fd, const adb_iovec* iov, int iovcnt); | 
| Josh Gao | 116aa0a | 2018-04-05 17:55:25 -0700 | [diff] [blame] | 30 |  | 
|  | 31 | #else | 
|  | 32 |  | 
|  | 33 | #include <sys/uio.h> | 
|  | 34 | using adb_iovec = struct iovec; | 
| Ian Kasprzak | 2c58e19 | 2019-04-25 15:59:28 +0000 | [diff] [blame] | 35 | #define adb_writev writev | 
| Josh Gao | 116aa0a | 2018-04-05 17:55:25 -0700 | [diff] [blame] | 36 |  | 
|  | 37 | #endif | 
|  | 38 |  | 
|  | 39 | #pragma GCC poison writev |