Home
last modified time | relevance | path

Searched refs:fd_ (Results 1 – 25 of 75) sorted by relevance

123

/system/update_engine/payload_consumer/
Dfile_descriptor.cc32 CHECK_EQ(fd_, -1); in Open()
33 return ((fd_ = HANDLE_EINTR(open(path, flags, mode))) >= 0); in Open()
37 CHECK_EQ(fd_, -1); in Open()
38 return ((fd_ = HANDLE_EINTR(open(path, flags))) >= 0); in Open()
42 CHECK_GE(fd_, 0); in Read()
43 return HANDLE_EINTR(read(fd_, buf, count)); in Read()
47 CHECK_GE(fd_, 0); in Write()
53 ssize_t ret = HANDLE_EINTR(write(fd_, char_buf, count)); in Write()
66 CHECK_GE(fd_, 0); in Seek()
67 return lseek64(fd_, offset, whence); in Seek()
[all …]
Dfile_writer.cc24 CHECK_EQ(fd_, -1); in Open()
25 fd_ = open(path, flags, mode); in Open()
26 if (fd_ < 0) in Open()
32 CHECK_GE(fd_, 0); in Write()
37 ssize_t rc = write(fd_, char_bytes + bytes_written, count - bytes_written); in Write()
47 CHECK_GE(fd_, 0); in Close()
48 int rc = close(fd_); in Close()
52 fd_ = -2; in Close()
Dcached_file_descriptor.h34 CachedFileDescriptor(FileDescriptorPtr fd, size_t cache_size) : fd_(fd) { in CachedFileDescriptor()
40 return fd_->Open(path, flags, mode); in Open()
43 return fd_->Open(path, flags); in Open()
46 return fd_->Read(buf, count); in Read()
50 uint64_t BlockDevSize() override { return fd_->BlockDevSize(); } in BlockDevSize()
55 return fd_->BlkIoctl(request, start, length, result); in BlkIoctl()
59 bool IsSettingErrno() override { return fd_->IsSettingErrno(); } in IsSettingErrno()
60 bool IsOpen() override { return fd_->IsOpen(); } in IsOpen()
66 FileDescriptorPtr fd_; variable
Dextent_reader_unittest.cc59 fd_.reset(new EintrSafeFileDescriptor()); in SetUp()
60 ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDONLY, 0600)); in SetUp()
62 void TearDown() override { fd_->Close(); } in TearDown()
74 FileDescriptorPtr fd_; member in chromeos_update_engine::ExtentReaderTest
82 EXPECT_TRUE(reader.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
94 EXPECT_TRUE(reader.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
103 EXPECT_TRUE(reader.Init(fd_, {}, kBlockSize)); in TEST_F()
113 EXPECT_TRUE(reader.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
122 EXPECT_TRUE(reader.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
129 reader.Init(fd_, {}, kBlockSize); in TEST_F()
[all …]
Dbzip_extent_writer_unittest.cc46 fd_.reset(new EintrSafeFileDescriptor); in SetUp()
47 ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDWR, 0600)); in SetUp()
49 void TearDown() override { fd_->Close(); } in TearDown()
51 FileDescriptorPtr fd_; member in chromeos_update_engine::BzipExtentWriterTest
69 bzip_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
102 bzip_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
Dcached_file_descriptor.cc43 if (fd_->Seek(next_offset, SEEK_SET) < 0) { in Seek()
76 return FlushCache() && fd_->Flush(); in Flush()
81 return FlushCache() && fd_->Close(); in Close()
87 auto bytes_wrote = fd_->Write(cache_.data() + begin, bytes_cached_ - begin); in FlushCache()
Dextent_writer_unittest.cc50 fd_.reset(new EintrSafeFileDescriptor); in SetUp()
51 ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDWR, 0600)); in SetUp()
53 void TearDown() override { fd_->Close(); } in TearDown()
61 FileDescriptorPtr fd_; member in chromeos_update_engine::ExtentWriterTest
70 direct_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
89 direct_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
114 direct_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in WriteAlignedExtents()
155 direct_writer.Init(fd_, {extents.begin(), extents.end()}, kBlockSize)); in TEST_F()
Dxz_extent_writer_unittest.cc90 EXPECT_TRUE(xz_writer_->Init(fd_, {}, 1024)); in WriteAll()
103 FileDescriptorPtr fd_; member in chromeos_update_engine::XzExtentWriterTest
133 EXPECT_TRUE(xz_writer_->Init(fd_, {}, 1024)); in TEST_F()
141 EXPECT_TRUE(xz_writer_->Init(fd_, {}, 1024)); in TEST_F()
/system/bt/gd/os/linux_generic/
Dreactor_unittest.cc59 SampleReactable() : fd_(eventfd(0, EFD_NONBLOCK)) { in SampleReactable()
60 EXPECT_NE(fd_, -1); in SampleReactable()
64 close(fd_); in ~SampleReactable()
71 int fd_; member in bluetooth::os::__anon246caf610111::SampleReactable
82 FakeReactable() : fd_(eventfd(0, 0)), reactor_(nullptr) { in FakeReactable()
83 EXPECT_NE(fd_, -1); in FakeReactable()
86 FakeReactable(Reactor* reactor) : fd_(eventfd(0, 0)), reactor_(reactor) { in FakeReactable()
87 EXPECT_NE(fd_, -1); in FakeReactable()
91 close(fd_); in ~FakeReactable()
97 auto read_result = eventfd_read(fd_, &value); in OnReadReady()
[all …]
Dreactive_semaphore.cc31 ReactiveSemaphore::ReactiveSemaphore(unsigned int value) : fd_(eventfd(value, EFD_SEMAPHORE | EFD_N… in ReactiveSemaphore()
32 ASSERT(fd_ != -1); in ReactiveSemaphore()
37 RUN_NO_INTR(close_status = close(fd_)); in ~ReactiveSemaphore()
43 auto read_result = eventfd_read(fd_, &val); in Decrease()
49 auto write_result = eventfd_write(fd_, val); in Increase()
54 return fd_; in GetFd()
Dthread_unittest.cc33 …explicit SampleReactable(Thread* thread) : thread_(thread), fd_(eventfd(0, 0)), is_same_thread_che… in SampleReactable()
34 EXPECT_NE(fd_, 0); in SampleReactable()
38 close(fd_); in ~SampleReactable()
45 eventfd_read(fd_, &val); in OnReadReady()
53 int fd_; member in bluetooth::os::__anonb7ed5ea90111::SampleReactable
89 sample_reactable.fd_, in TEST_F()
92 int fd = sample_reactable.fd_; in TEST_F()
Drepeating_alarm.cc39 RepeatingAlarm::RepeatingAlarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOC… in RepeatingAlarm()
40 ASSERT(fd_ != -1); in RepeatingAlarm()
43 fd_, common::Bind(&RepeatingAlarm::on_fire, common::Unretained(this)), common::Closure()); in RepeatingAlarm()
50 RUN_NO_INTR(close_status = TIMERFD_CLOSE(fd_)); in ~RepeatingAlarm()
59 int result = TIMERFD_SETTIME(fd_, 0, &timer_itimerspec, nullptr); in Schedule()
68 int result = TIMERFD_SETTIME(fd_, 0, &disarm_itimerspec, nullptr); in Cancel()
76 auto bytes_read = read(fd_, &times_invoked, sizeof(uint64_t)); in on_fire()
Dalarm.cc40 Alarm::Alarm(Handler* handler) : handler_(handler), fd_(TIMERFD_CREATE(ALARM_CLOCK, 0)) { in Alarm()
41 ASSERT_LOG(fd_ != -1, "cannot create timerfd: %s", strerror(errno)); in Alarm()
44 fd_, common::Bind(&Alarm::on_fire, common::Unretained(this)), Closure()); in Alarm()
51 RUN_NO_INTR(close_status = TIMERFD_CLOSE(fd_)); in ~Alarm()
59 int result = TIMERFD_SETTIME(fd_, 0, &timer_itimerspec, nullptr); in Schedule()
68 int result = TIMERFD_SETTIME(fd_, 0, &disarm_itimerspec, nullptr); in Cancel()
76 auto bytes_read = read(fd_, &times_invoked, sizeof(uint64_t)); in on_fire()
Dhandler.cc39 …: tasks_(new std::queue<OnceClosure>()), thread_(thread), fd_(eventfd(0, EFD_SEMAPHORE | EFD_NONBL… in Handler()
40 ASSERT(fd_ != -1); in Handler()
42 fd_, common::Bind(&Handler::handle_next_event, common::Unretained(this)), common::Closure()); in Handler()
52 RUN_NO_INTR(close_status = close(fd_)); in ~Handler()
66 auto write_result = eventfd_write(fd_, val); in Post()
80 while (eventfd_read(fd_, &val) == 0) { in Clear()
97 auto read_result = eventfd_read(fd_, &val); in handle_next_event()
/system/teeui/libteeui/src/
Devdev.cpp177 EventDev::EventDev() : fd_(-1), path_("") {} in EventDev()
178 EventDev::EventDev(const std::string& path) : fd_(-1), path_(path) {} in EventDev()
179 EventDev::EventDev(EventDev&& other) : fd_(other.fd_), path_(std::move(other.path_)) { in EventDev()
180 other.fd_ = -1; in EventDev()
184 fd_ = other.fd_; in operator =()
186 other.fd_ = -1; in operator =()
190 if (fd_ >= 0) { in grab()
193 fd_ = TEMP_FAILURE_RETRY(open(path_.c_str(), O_RDWR | O_NONBLOCK)); in grab()
194 if (fd_ < 0) { in grab()
198 int error = ioctl(fd_, EVIOCGRAB, 1); in grab()
[all …]
/system/memory/libmemunreachable/
DLeakPipe.h78 LeakPipeBase() : fd_(-1) {} in LeakPipeBase()
82 void SetFd(int fd) { fd_ = fd; } in SetFd()
85 close(fd_); in Close()
86 fd_ = -1; in Close()
90 int fd_;
102 ssize_t ret = TEMP_FAILURE_RETRY(write(fd_, &value, sizeof(T))); in Send()
121 ssize_t ret = TEMP_FAILURE_RETRY(write(fd_, vector.data(), size)); in SendVector()
140 ssize_t ret = TEMP_FAILURE_RETRY(read(fd_, reinterpret_cast<void*>(value), sizeof(T))); in Receive()
163 ssize_t ret = TEMP_FAILURE_RETRY(read(fd_, ptr, size)); in ReceiveVector()
/system/libbase/include/android-base/
Dunique_fd.h99 int fd = s.fd_;
100 s.fd_ = -1;
107 int get() const { return fd_; } in get()
128 tag(fd_, this, nullptr); in release()
129 int ret = fd_; in release()
130 fd_ = -1; in release()
138 if (fd_ != -1) { in reset()
139 close(fd_, this); in reset()
142 fd_ = new_value; in reset()
150 int fd_ = -1; variable
[all …]
/system/testing/gtest_extras/
DTest.cpp45 fd_(fd), in Test()
53 if (fd_ != -1) { in CloseFd()
54 close(fd_); in CloseFd()
55 fd_ = -1; in CloseFd()
86 ssize_t bytes = TEMP_FAILURE_RETRY(read(fd_, buffer, sizeof(buffer) - 1)); in Read()
106 while (fd_ != -1) { in ReadUntilClosed()
/system/libziparchive/
Dzip_writer_test.cc32 int fd_; member
37 fd_ = temp_file_->fd; in SetUp()
38 file_ = fdopen(fd_, "w"); in SetUp()
59 ASSERT_GE(0, lseek(fd_, 0, SEEK_SET)); in TEST_F()
62 ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false)); in TEST_F()
91 ASSERT_GE(0, lseek(fd_, 0, SEEK_SET)); in TEST_F()
94 ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false)); in TEST_F()
126 ASSERT_GE(0, lseek(fd_, 0, SEEK_SET)); in TEST_F()
129 ASSERT_EQ(0, OpenArchiveFd(fd_, "temp", &handle, false)); in TEST_F()
160 ASSERT_GE(0, lseek(fd_, 0, SEEK_SET)); in TEST_F()
[all …]
/system/core/adb/
Dshell_service_protocol.cpp25 ShellProtocol::ShellProtocol(borrowed_fd fd) : fd_(fd) { in ShellProtocol()
35 if (!ReadFdExactly(fd_, buffer_, kHeaderSize)) { in Read()
46 if (read_length && !ReadFdExactly(fd_, data(), read_length)) { in Read()
61 return WriteFdExactly(fd_, buffer_, kHeaderSize + length); in Write()
/system/core/logd/
DRecordingLogBuffer.cpp42 if (!fd_.ok()) { in RecordLogMessage()
43 fd_.reset(open("/data/misc/logd/recorded-messages", in RecordLogMessage()
45 if (!fd_.ok()) { in RecordLogMessage()
50 WriteLogMessage(fd_.get(), meta, msg); in RecordLogMessage()
55 WriteLogMessage(fd_.get(), recorded_log_message, std::string(msg, len)); in RecordLogMessage()
/system/extras/libperfmgr/
DFileNode.cc60 fd_.reset(TEMP_FAILURE_RETRY( in Update()
63 if (fd_ == -1 || !android::base::WriteStringToFd(req_value, fd_)) { in Update()
66 << " with value: " << req_value << ", fd: " << fd_; in Update()
72 fsync(fd_); in Update()
79 fd_.reset(); in Update()
/system/core/init/
Dkeychords_test.cpp61 int fd_; member in android::init::__anon8ab3744a0111::EventHandler
64 EventHandler::EventHandler() : fd_(-1) {} in EventHandler()
66 EventHandler::EventHandler(EventHandler&& rval) noexcept : fd_(rval.fd_) { in EventHandler()
67 rval.fd_ = -1; in EventHandler()
71 fd_ = rval.fd_; in operator =()
72 rval.fd_ = -1; in operator =()
77 if (fd_ == -1) return; in ~EventHandler()
78 ::ioctl(fd_, UI_DEV_DESTROY); in ~EventHandler()
79 ::close(fd_); in ~EventHandler()
83 if (fd_ != -1) return true; in init()
[all …]
/system/update_engine/
Dlogging_android.cc123 fd_.reset(TEMP_FAILURE_RETRY( in FileLogger()
127 if (fd_ == -1) { in FileLogger()
135 if (fchmod(fd_.get(), 0640) == -1) { in FileLogger()
144 FileLogger(const FileLogger& other) { fd_.reset(dup(other.fd_)); } in FileLogger()
146 if (fd_ == -1) { in operator ()()
159 android::base::unique_fd fd_; member in chromeos_update_engine::__anonb48919950111::FileLogger
162 android::base::WriteFully(fd_, message.data(), message.size())); in WriteToFd()
/system/core/fastboot/device/
Dutility.h41 fd_ = {}; in ~PartitionHandle()
46 int fd() const { return fd_.get(); } in fd()
47 void set_fd(android::base::unique_fd&& fd) { fd_ = std::move(fd); } in set_fd()
51 android::base::unique_fd fd_; variable

123