aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAndrei Homescu <ahomescu@google.com>2023-04-18 21:11:29 +0000
committerAndrei Homescu <ahomescu@google.com>2023-04-18 21:11:29 +0000
commitdbf56c5c98e7ac300d9712a3fa99df9985a5ecfa (patch)
treef2f53af4f9477bf2c76623a874f611f3dc710a15 /lib
parent4904bc8d0c0ba5c31ee80b1c478dc63d7691d84a (diff)
downloadcommon-dbf56c5c98e7ac300d9712a3fa99df9985a5ecfa.tar.gz
lib/libc: Add io_handle.h header
Add the io_handle.h header to our libc instead of importing the one from trusty/kernel since that doesn't always work correctly. Bug: 230134581 Change-Id: Idc325e9a81d5a3efd0f3a62742e98a9334c8e973
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/include_common/io_handle.h22
-rw-r--r--lib/libc/io_handle.c2
-rw-r--r--lib/libc/stdio.c2
3 files changed, 24 insertions, 2 deletions
diff --git a/lib/libc/include_common/io_handle.h b/lib/libc/include_common/io_handle.h
new file mode 100644
index 00000000..45995617
--- /dev/null
+++ b/lib/libc/include_common/io_handle.h
@@ -0,0 +1,22 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#include <lib/io.h>
+#include <stdio.h>
+
+io_handle_t* fd_io_handle(int fd);
+io_handle_t* file_io_handle(FILE* file);
diff --git a/lib/libc/io_handle.c b/lib/libc/io_handle.c
index d42a2355..54613ddc 100644
--- a/lib/libc/io_handle.c
+++ b/lib/libc/io_handle.c
@@ -21,9 +21,9 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <io_handle.h>
#include <lib/io.h>
#include <stdio.h>
-#include <trusty/io_handle.h>
io_handle_t* fd_io_handle(int fd) {
if ((fd == 0) || (fd == 1) || (fd == 2)) {
diff --git a/lib/libc/stdio.c b/lib/libc/stdio.c
index 49671d4f..1d526145 100644
--- a/lib/libc/stdio.c
+++ b/lib/libc/stdio.c
@@ -20,12 +20,12 @@
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
+#include <io_handle.h>
#include <printf.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
-#include <trusty/io_handle.h>
#if LK_LIBC_IMPLEMENTATION_IS_LK
#define DEFINE_STDIO_DESC(id) \