Home
last modified time | relevance | path

Searched refs:fd (Results 1 – 25 of 87) sorted by relevance

1234

/art/libartbase/base/
Dfile_magic.cc34 File fd(filename, O_RDONLY, /* check_usage= */ false); in OpenAndReadMagic() local
35 if (fd.Fd() == -1) { in OpenAndReadMagic()
39 if (!ReadMagicAndReset(fd.Fd(), magic, error_msg)) { in OpenAndReadMagic()
43 return fd; in OpenAndReadMagic()
46 bool ReadMagicAndReset(int fd, uint32_t* magic, std::string* error_msg) { in ReadMagicAndReset() argument
47 if (lseek(fd, 0, SEEK_SET) != 0) { in ReadMagicAndReset()
51 int n = TEMP_FAILURE_RETRY(read(fd, magic, sizeof(*magic))); in ReadMagicAndReset()
56 if (lseek(fd, 0, SEEK_SET) != 0) { in ReadMagicAndReset()
Dmemfd_test.cc23 int fd = art::memfd_create("memfd_create_test", 0); in TEST() local
24 if (fd < 0) { in TEST()
29 ASSERT_TRUE(close(fd) == 0 || errno != EBADF); in TEST()
Dzip_archive.cc213 static void SetCloseOnExec(int fd) { in SetCloseOnExec() argument
216 UNUSED(fd); in SetCloseOnExec()
220 int flags = fcntl(fd, F_GETFD); in SetCloseOnExec()
222 PLOG(WARNING) << "fcntl(" << fd << ", F_GETFD) failed"; in SetCloseOnExec()
225 int rc = fcntl(fd, F_SETFD, flags | FD_CLOEXEC); in SetCloseOnExec()
227 PLOG(WARNING) << "fcntl(" << fd << ", F_SETFD, " << flags << ") failed"; in SetCloseOnExec()
248 ZipArchive* ZipArchive::OpenFromFd(int fd, const char* filename, std::string* error_msg) { in OpenFromFd() argument
249 return OpenFromFdInternal(fd, /*assume_ownership=*/true, filename, error_msg); in OpenFromFd()
252 ZipArchive* ZipArchive::OpenFromOwnedFd(int fd, const char* filename, std::string* error_msg) { in OpenFromOwnedFd() argument
253 return OpenFromFdInternal(fd, /*assume_ownership=*/false, filename, error_msg); in OpenFromOwnedFd()
[all …]
Dscoped_flock.h57 static ScopedFlock DupOf(const int fd, const std::string& path,
71 LockedFile(int fd, const std::string& path, bool check_usage, bool read_only_mode) in LockedFile() argument
72 : FdFile(fd, path, check_usage, read_only_mode) { in LockedFile()
Dmemfd.cc93 android::base::unique_fd fd(art::memfd_create("test_android_memfd", MFD_ALLOW_SEALING)); in IsSealFutureWriteSupportedInternal() local
94 if (fd == -1) { in IsSealFutureWriteSupportedInternal()
99 if (fcntl(fd, F_ADD_SEALS, F_SEAL_FUTURE_WRITE) == -1) { in IsSealFutureWriteSupportedInternal()
Dmem_map_unix.cc27 void* MemMap::TargetMMap(void* start, size_t len, int prot, int flags, int fd, off_t fd_off) { in TargetMMap() argument
28 return mmap(start, len, prot, flags, fd, fd_off); in TargetMMap()
Dzip_archive_test.cc53 int fd = open(tmp.GetFilename().c_str(), O_RDONLY | O_CLOEXEC); in TEST_F() local
54 ASSERT_NE(-1, fd); in TEST_F()
58 ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buf, kBufSize)); in TEST_F()
Dsocket_peer_is_trusted.cc30 bool SocketPeerIsTrusted(int fd) { in SocketPeerIsTrusted() argument
33 if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &cr_length) != 0) { in SocketPeerIsTrusted()
Dmem_map.h199 int fd, in MapFile() argument
208 fd, in MapFile()
233 int fd,
302 int fd,
388 int fd,
395 int fd,
439 int fd,
444 static void* TargetMMap(void* start, size_t len, int prot, int flags, int fd, off_t fd_off);
Dzip_archive.h94 static ZipArchive* OpenFromFd(int fd, const char* filename, std::string* error_msg);
95 static ZipArchive* OpenFromOwnedFd(int fd, const char* filename, std::string* error_msg);
106 static ZipArchive* OpenFromFdInternal(int fd,
Dscoped_flock.cc103 ScopedFlock LockedFile::DupOf(const int fd, const std::string& path, in DupOf() argument
107 UNUSED(fd); in DupOf()
119 new LockedFile(DupCloexec(fd), path, /* check_usage= */ false, read_only_mode)); in DupOf()
Dmem_map_windows.cc50 void* MemMap::TargetMMap(void* start, size_t len, int prot, int flags, int fd, off_t fd_off) { in TargetMMap() argument
93 HANDLE file_handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); in TargetMMap()
106 HANDLE handle = ::CreateFileMapping(reinterpret_cast<HANDLE>(_get_osfhandle(fd)), in TargetMMap()
/art/runtime/jit/
Djit_memory_region_test.cc62 android::base::unique_fd fd(JitMemoryRegion::CreateZygoteMemory(page_size, &error_msg)); in BasicTest() local
63 CHECK_NE(fd.get(), -1); in BasicTest()
67 mmap(nullptr, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0)); in BasicTest()
76 bool res = JitMemoryRegion::ProtectZygoteMemory(fd.get(), &error_msg); in BasicTest()
85 mmap(nullptr, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0)); in BasicTest()
118 android::base::unique_fd fd(JitMemoryRegion::CreateZygoteMemory(page_size, &error_msg)); in TestUnmapWritableAfterFork() local
119 CHECK_NE(fd.get(), -1); in TestUnmapWritableAfterFork()
123 mmap(nullptr, page_size, PROT_READ | PROT_WRITE, MAP_SHARED, fd.get(), 0)); in TestUnmapWritableAfterFork()
133 mmap(nullptr, page_size, PROT_READ, MAP_SHARED, fd.get(), 0)); in TestUnmapWritableAfterFork()
137 bool res = JitMemoryRegion::ProtectZygoteMemory(fd.get(), &error_msg); in TestUnmapWritableAfterFork()
[all …]
Djit_memory_region.cc513 int fd = art::memfd_create(kRegionName, MFD_ALLOW_SEALING); in CreateZygoteMemory() local
514 if (fd == -1) { in CreateZygoteMemory()
521 if (ftruncate(fd, capacity) != 0) { in CreateZygoteMemory()
528 return fd; in CreateZygoteMemory()
533 int fd; in CreateZygoteMemory() local
534 palette_status_t status = PaletteAshmemCreateRegion(kRegionName, capacity, &fd); in CreateZygoteMemory()
542 return fd; in CreateZygoteMemory()
545 bool JitMemoryRegion::ProtectZygoteMemory(int fd, std::string* error_msg) { in ProtectZygoteMemory() argument
547 if (fcntl(fd, F_ADD_SEALS, F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL | F_SEAL_FUTURE_WRITE) in ProtectZygoteMemory()
555 palette_status_t status = PaletteAshmemSetProtRegion(fd, PROT_READ | PROT_EXEC); in ProtectZygoteMemory()
[all …]
/art/openjdkjvm/
DOpenjdkJvm.cc84 int fd = TEMP_FAILURE_RETRY(open(fname, flags & ~JVM_O_DELETE, mode)); in JVM_Open() local
85 if (fd < 0) { in JVM_Open()
94 return fd; in JVM_Open()
98 JNIEXPORT jint JVM_Close(jint fd) { in JVM_Close() argument
100 return close(fd); in JVM_Close()
104 JNIEXPORT jint JVM_Read(jint fd, char* buf, jint nbytes) { in JVM_Read() argument
105 return TEMP_FAILURE_RETRY(read(fd, buf, nbytes)); in JVM_Read()
109 JNIEXPORT jint JVM_Write(jint fd, char* buf, jint nbytes) { in JVM_Write() argument
110 return TEMP_FAILURE_RETRY(write(fd, buf, nbytes)); in JVM_Write()
114 JNIEXPORT jlong JVM_Lseek(jint fd, jlong offset, jint whence) { in JVM_Lseek() argument
[all …]
/art/libarttools/
Dart_exec.cc116 int fd; in ParseOptions() local
117 if (!ParseInt(fd_str, &fd)) { in ParseOptions()
120 options.keep_fds.insert(fd); in ParseOptions()
165 int fd; in CloseFds() local
166 if (!ParseInt(dir_entry.path().filename(), &fd)) { in CloseFds()
169 open_fds.push_back(fd); in CloseFds()
174 for (int fd : open_fds) { in CloseFds() local
175 if (keep_fds.find(fd) == keep_fds.end()) { in CloseFds()
176 if (close(fd) != 0) { in CloseFds()
177 Result<void> error = ErrnoErrorf("Failed to close FD {}", fd); in CloseFds()
[all …]
/art/libprofile/profile/
Dprofile_boot_info.cc41 bool ProfileBootInfo::Save(int fd) const { in Save()
56 if (!WriteBuffer(fd, buffer.data(), buffer.size())) { in Save()
62 bool ProfileBootInfo::Load(int fd, const std::vector<const DexFile*>& dex_files) { in Load() argument
66 int bytes_read = TEMP_FAILURE_RETRY(read(fd, &string_length, sizeof(uint8_t))); in Load()
83 bytes_read = TEMP_FAILURE_RETRY(read(fd, data.get(), string_length)); in Load()
111 int bytes_read = TEMP_FAILURE_RETRY(read(fd, &dex_file_index, sizeof(dex_file_index))); in Load()
115 bytes_read = TEMP_FAILURE_RETRY(read(fd, &method_id, sizeof(method_id))); in Load()
Dprofile_boot_info.h44 bool Save(int fd) const;
48 bool Load(int fd, const std::vector<const DexFile*>& dex_files);
Dprofile_helpers.h29 inline bool WriteBuffer(int fd, const uint8_t* buffer, size_t byte_count) { in WriteBuffer() argument
31 int bytes_written = TEMP_FAILURE_RETRY(write(fd, buffer, byte_count)); in WriteBuffer()
/art/libartbase/base/unix_file/
Dfd_file.cc74 static ssize_t pread(int fd, void* data, size_t byte_count, off64_t offset) { in pread() argument
82 auto handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); in pread()
103 static ssize_t pwrite(int fd, const void* buf, size_t count, off64_t offset) { in pwrite() argument
111 auto handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); in pwrite()
132 static int fsync(int fd) { in fsync() argument
133 auto handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd)); in fsync()
149 FdFile::FdFile(int fd, bool check_usage) in FdFile() argument
150 : FdFile(fd, std::string(), check_usage) {} in FdFile()
152 FdFile::FdFile(int fd, const std::string& path, bool check_usage) in FdFile() argument
153 : FdFile(fd, path, check_usage, false) {} in FdFile()
[all …]
Dfd_file.h42 FdFile(int fd, bool check_usage);
43 FdFile(int fd, const std::string& path, bool check_usage);
44 FdFile(int fd, const std::string& path, bool check_usage, bool read_only_mode);
60 void Reset(int fd, bool check_usage);
149 static bool IsOpenFd(int fd);
/art/libnativebridge/tests/
DCodeCacheStatFail_test.cpp29 int fd = creat(codeCache(), O_RDWR); in TEST_F() local
30 ASSERT_NE(-1, fd); in TEST_F()
31 close(fd); in TEST_F()
/art/runtime/
Dmonitor_android.cc49 int fd = open("/proc/self/cmdline", O_RDONLY | O_CLOEXEC); in LogContentionEvent() local
50 read(fd, proc_name, sizeof(proc_name) - 1); in LogContentionEvent()
51 close(fd); in LogContentionEvent()
/art/dt_fd_forward/
Ddt_fd_forward.cc108 static void SendListenMessage(const android::base::unique_fd& fd) { in SendListenMessage() argument
109 TEMP_FAILURE_RETRY(send(fd, kListenStartMessage, sizeof(kListenStartMessage), MSG_EOR)); in SendListenMessage()
113 static int DupCloexec(int fd) { in DupCloexec() argument
115 return fcntl(fd, F_DUPFD_CLOEXEC, 0); in DupCloexec()
117 return dup(fd); in DupCloexec()
133 static void SendListenEndMessage(const android::base::unique_fd& fd) { in SendListenEndMessage() argument
134 TEMP_FAILURE_RETRY(send(fd, kListenEndMessage, sizeof(kListenEndMessage), MSG_EOR)); in SendListenEndMessage()
249 explicit ScopedEventFdLock(const android::base::unique_fd& fd) : fd_(fd), data_(0) { in ScopedEventFdLock() argument
288 static void SendAcceptMessage(int fd) { in SendAcceptMessage() argument
289 TEMP_FAILURE_RETRY(send(fd, kAcceptMessage, sizeof(kAcceptMessage), MSG_EOR)); in SendAcceptMessage()
[all …]
/art/libartpalette/apex/
Dpalette_test.cc89 int fd; in TEST_F()
90 EXPECT_EQ(PALETTE_STATUS_OK, PaletteAshmemCreateRegion("ashmem-test", 4096, &fd)); in TEST_F()
91 EXPECT_EQ(PALETTE_STATUS_OK, PaletteAshmemSetProtRegion(fd, PROT_READ | PROT_EXEC)); in TEST_F()
92 EXPECT_EQ(0, close(fd)); in TEST_F()

1234