diff --git a/bundle.json b/bundle.json index 29817f761749b88cac792a9ac81176ae8054c717..9db5bf723184f9710b59e20d904cdb7a5422f872 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 13ee1ca214ec6c2838d8a5415c7d47268457c7b7..0000000000000000000000000000000000000000 --- 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 7f6adfac84d6bf36fb8b5a419e4edf38ca29bb3e..0000000000000000000000000000000000000000 --- 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 8291466ae6c5c4a49377bdb5af457fca6e613b31..0000000000000000000000000000000000000000 --- 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; -}