From da60020f463d0b58fc1671c9134661035fef7c9b Mon Sep 17 00:00:00 2001 From: chenziang_sjtu <1094744965@qq.com> Date: Thu, 7 Nov 2024 14:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=A0=E9=99=A4libsync?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bundle.json | 10 --------- libsync/BUILD.gn | 34 ------------------------------ libsync/include/sync.h | 20 ------------------ libsync/src/sync.c | 47 ------------------------------------------ 4 files changed, 111 deletions(-) delete mode 100644 libsync/BUILD.gn delete mode 100644 libsync/include/sync.h delete mode 100644 libsync/src/sync.c diff --git a/bundle.json b/bundle.json index 29817f7..9db5bf7 100644 --- a/bundle.json +++ b/bundle.json @@ -32,7 +32,6 @@ "//commonlibrary/memory_utils/libdmabufheap:libdmabufheap", "//commonlibrary/memory_utils/libmeminfo:libmeminfo", "//commonlibrary/memory_utils/libpurgeablemem:libpurgeablemem", - "//commonlibrary/memory_utils/libsync:libsync", "//commonlibrary/memory_utils/libpurgeablemem:purgeable_memory_ndk" ], "inner_kits": [ @@ -54,15 +53,6 @@ "header_base": "//commonlibrary/memory_utils/libmeminfo/include" } }, - { - "name": "//commonlibrary/memory_utils/libsync:libsync", - "header": { - "header_files": [ - "sync.h" - ], - "header_base": "//commonlibrary/memory_utils/libsync/include" - } - }, { "name": "//commonlibrary/memory_utils/libpurgeablemem:libpurgeablemem", "header": { diff --git a/libsync/BUILD.gn b/libsync/BUILD.gn deleted file mode 100644 index 13ee1ca..0000000 --- a/libsync/BUILD.gn +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (c) 2024 Huawei Device Co., Ltd. -# 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. - -import("//build/ohos.gni") - -config("libsync_config") { - include_dirs = [ "include" ] -} - -ohos_shared_library("libsync") { - sources = [ "src/sync.c" ] - include_dirs = [ "include" ] - - public_configs = [ ":libsync_config" ] - subsystem_name = "commonlibrary" - part_name = "memory_utils" - - sanitize = { - cfi = true - cfi_cross_dso = true - debug = false - } - branch_protector_ret = "pac_ret" -} diff --git a/libsync/include/sync.h b/libsync/include/sync.h deleted file mode 100644 index 7f6adfa..0000000 --- a/libsync/include/sync.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * 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. - */ -#ifndef COMM_UTILS_SYNC_H -#define COMM_UTILS_SYNC_H - -int SyncWait(int fileDescriptor, int timeout); - -#endif diff --git a/libsync/src/sync.c b/libsync/src/sync.c deleted file mode 100644 index 8291466..0000000 --- a/libsync/src/sync.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2024 Huawei Device Co., Ltd. - * 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. - */ -#include "sync.h" -#include -#include -#include - -int SyncWait(int fileDescriptor, int timeout) -{ - if (fileDescriptor < 0) { - errno = EINVAL; - return -1; - } - - struct pollfd pfd = { .fd = fileDescriptor, .events = POLLIN }; - int pollResult; - - while (1) { - pollResult = poll(&pfd, 1, timeout); - - if (pollResult > 0) { - if (pfd.revents & (POLLERR | POLLNVAL)) { - errno = EINVAL; - return -1; - } - return 0; - } else if (pollResult == 0) { - errno = ETIME; - return -1; - } else if (pollResult != -1 || (errno != EINTR && errno != EAGAIN)) { - break; - } - } - return pollResult; -} -- Gitee