Home
last modified time | relevance | path

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

123

/system/update_engine/payload_consumer/
Dfile_descriptor.cc39 CHECK_EQ(fd_, -1); in Open()
40 return ((fd_ = HANDLE_EINTR(open(path, flags, mode))) >= 0); in Open()
44 CHECK_EQ(fd_, -1); in Open()
45 return ((fd_ = HANDLE_EINTR(open(path, flags))) >= 0); in Open()
49 CHECK_GE(fd_, 0); in Read()
50 return HANDLE_EINTR(read(fd_, buf, count)); in Read()
54 CHECK_GE(fd_, 0); in Write()
60 ssize_t ret = HANDLE_EINTR(write(fd_, char_buf, count)); in Write()
73 CHECK_GE(fd_, 0); in Seek()
74 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.cc45 fd_.reset(new EintrSafeFileDescriptor); in SetUp()
46 ASSERT_TRUE(fd_->Open(temp_file_.path().c_str(), O_RDWR, 0600)); in SetUp()
48 void TearDown() override { fd_->Close(); } in TearDown()
50 FileDescriptorPtr fd_; member in chromeos_update_engine::BzipExtentWriterTest
66 BzipExtentWriter bzip_writer(std::make_unique<DirectExtentWriter>(fd_)); in TEST_F()
98 BzipExtentWriter bzip_writer(std::make_unique<DirectExtentWriter>(fd_)); 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
68 DirectExtentWriter direct_writer{fd_}; in TEST_F()
86 DirectExtentWriter direct_writer{fd_}; in TEST_F()
110 DirectExtentWriter direct_writer{fd_}; in WriteAlignedExtents()
150 DirectExtentWriter direct_writer{fd_}; 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::__anon8b2d8b280111::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.cc32 ReactiveSemaphore::ReactiveSemaphore(unsigned int value) : fd_(eventfd(value, EFD_SEMAPHORE | EFD_N… in ReactiveSemaphore()
33 ASSERT(fd_ != -1); in ReactiveSemaphore()
38 RUN_NO_INTR(close_status = close(fd_)); in ~ReactiveSemaphore()
44 auto read_result = eventfd_read(fd_, &val); in Decrease()
50 auto write_result = eventfd_write(fd_, val); in Increase()
55 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::__anonca8e5d900111::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/fs_mgr/libsnapshot/
Dcow_writer.cpp82 CowWriter::CowWriter(const CowOptions& options) : ICowWriter(options), fd_(-1) { in CowWriter()
128 fd_ = owned_fd_; in SetFd()
131 fd_ = fd; in SetFd()
189 if (lseek(fd_.get(), 0, SEEK_SET) < 0) { in OpenForWrite()
200 if (!android::base::WriteFully(fd_, &header_, sizeof(header_))) { in OpenForWrite()
208 if (!android::base::WriteFully(fd_, data.data(), header_.buffer_size)) { in OpenForWrite()
219 if (lseek(fd_.get(), sizeof(header_) + header_.buffer_size, SEEK_SET) < 0) { in OpenForWrite()
233 if (!reader->Parse(fd_, {label}) || !reader->GetHeader(&header_)) { in OpenForAppend()
254 if (lseek(fd_.get(), next_op_pos_, SEEK_SET) < 0) { in OpenForAppend()
410 if (lseek(fd_.get(), next_op_pos_, SEEK_SET) < 0) { in Finalize()
[all …]
Dcow_reader.cpp34 CowReader::CowReader() : fd_(-1), header_(), fd_size_(0) {} in CowReader()
47 fd_ = owned_fd_.get(); in InitForMerge()
49 auto pos = lseek(fd_.get(), 0, SEEK_END); in InitForMerge()
56 if (lseek(fd_.get(), 0, SEEK_SET) < 0) { in InitForMerge()
60 if (!android::base::ReadFully(fd_, &header_, sizeof(header_))) { in InitForMerge()
74 fd_ = fd; in Parse()
76 auto pos = lseek(fd_.get(), 0, SEEK_END); in Parse()
83 if (lseek(fd_.get(), 0, SEEK_SET) < 0) { in Parse()
87 if (!android::base::ReadFully(fd_, &header_, sizeof(header_))) { in Parse()
140 pos = lseek(fd_.get(), init_offset, SEEK_SET); in ParseOps()
[all …]
/system/logging/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/core/init/
Dkeychords_test.cpp61 int fd_; member in android::init::__anon781e2fd10111::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/aosp/
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::__anonc507cc7e0111::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
/system/core/fs_mgr/libdm/
Ddm.cpp47 DeviceMapper::DeviceMapper() : fd_(-1) { in DeviceMapper()
48 fd_ = TEMP_FAILURE_RETRY(open("/dev/device-mapper", O_RDWR | O_CLOEXEC)); in DeviceMapper()
49 if (fd_ < 0) { in DeviceMapper()
76 if (ioctl(fd_, DM_DEV_CREATE, &io)) { in CreateDevice()
111 if (ioctl(fd_, DM_DEV_REMOVE, &io)) { in DeleteDevice()
145 if (ioctl(fd_, DM_DEV_REMOVE, &io)) { in DeleteDeviceDeferred()
214 if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) { in GetDeviceUniquePath()
230 if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) { in GetDetailedInfo()
239 if (ioctl(fd_, DM_DEV_STATUS, &io) < 0) { in GetState()
258 if (ioctl(fd_, DM_DEV_SUSPEND, &io) < 0) { in ChangeState()
[all …]

123