Home
last modified time | relevance | path

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

12345678910>>...50

/frameworks/base/libs/androidfw/
DObbFile.cpp88 int fd; in readFrom() local
91 fd = ::open(filename, O_RDONLY); in readFrom()
92 if (fd < 0) { in readFrom()
96 success = readFrom(fd); in readFrom()
97 close(fd); in readFrom()
100 ALOGW("failed to read from %s (fd=%d)\n", filename, fd); in readFrom()
107 bool ObbFile::readFrom(int fd) in readFrom() argument
109 if (fd < 0) { in readFrom()
114 return parseObbFile(fd); in readFrom()
117 bool ObbFile::parseObbFile(int fd) in parseObbFile() argument
[all …]
DBackupHelpers.cpp86 read_snapshot_file(int fd, KeyedVector<String8,FileState>* snapshot) in read_snapshot_file() argument
92 amt = read(fd, &header, sizeof(header)); in read_snapshot_file()
107 amt = read(fd, &file, sizeof(FileState)); in read_snapshot_file()
119 amt = read(fd, filename, nameBufSize); in read_snapshot_file()
143 write_snapshot_file(int fd, const KeyedVector<String8,FileRec>& snapshot) in write_snapshot_file() argument
158 LOGP("write_snapshot_file fd=%d\n", fd); in write_snapshot_file()
163 amt = write(fd, &header, sizeof(header)); in write_snapshot_file()
175 amt = write(fd, &r.s, sizeof(FileState)); in write_snapshot_file()
182 amt = write(fd, name.string(), nameLen); in write_snapshot_file()
190 amt = write(fd, &padding, paddingLen); in write_snapshot_file()
[all …]
/frameworks/base/services/core/jni/
Dcom_android_server_UsbDeviceManager.cpp46 static void set_accessory_string(JNIEnv *env, int fd, int cmd, jobjectArray strArray, int index) in set_accessory_string() argument
51 ioctl(fd, cmd, buffer); in set_accessory_string()
63 int fd = open(DRIVER_NAME, O_RDWR); in android_server_UsbDeviceManager_getAccessoryStrings() local
64 if (fd < 0) { in android_server_UsbDeviceManager_getAccessoryStrings()
71 set_accessory_string(env, fd, ACCESSORY_GET_STRING_MANUFACTURER, strArray, 0); in android_server_UsbDeviceManager_getAccessoryStrings()
72 set_accessory_string(env, fd, ACCESSORY_GET_STRING_MODEL, strArray, 1); in android_server_UsbDeviceManager_getAccessoryStrings()
73 set_accessory_string(env, fd, ACCESSORY_GET_STRING_DESCRIPTION, strArray, 2); in android_server_UsbDeviceManager_getAccessoryStrings()
74 set_accessory_string(env, fd, ACCESSORY_GET_STRING_VERSION, strArray, 3); in android_server_UsbDeviceManager_getAccessoryStrings()
75 set_accessory_string(env, fd, ACCESSORY_GET_STRING_URI, strArray, 4); in android_server_UsbDeviceManager_getAccessoryStrings()
76 set_accessory_string(env, fd, ACCESSORY_GET_STRING_SERIAL, strArray, 5); in android_server_UsbDeviceManager_getAccessoryStrings()
[all …]
Dcom_android_server_PersistentDataBlockService.cpp35 uint64_t get_block_device_size(int fd) in get_block_device_size() argument
40 ret = ioctl(fd, BLKGETSIZE64, &size); in get_block_device_size()
48 int wipe_block_device(int fd) in wipe_block_device() argument
52 uint64_t len = get_block_device_size(fd); in wipe_block_device()
60 ret = ioctl(fd, BLKSECDISCARD, &range); in wipe_block_device()
65 ret = ioctl(fd, BLKDISCARD, &range); in wipe_block_device()
82 int fd = open(path.c_str(), O_RDONLY); in com_android_server_PersistentDataBlockService_getBlockDeviceSize() local
84 if (fd < 0) in com_android_server_PersistentDataBlockService_getBlockDeviceSize()
87 const uint64_t size = get_block_device_size(fd); in com_android_server_PersistentDataBlockService_getBlockDeviceSize()
89 close(fd); in com_android_server_PersistentDataBlockService_getBlockDeviceSize()
[all …]
/frameworks/base/core/java/android/net/
DLocalSocketImpl.java45 private FileDescriptor fd; field in LocalSocketImpl
65 FileDescriptor myFd = fd; in available()
88 FileDescriptor myFd = fd; in read()
106 FileDescriptor myFd = fd; in read()
141 FileDescriptor myFd = fd; in write()
155 FileDescriptor myFd = fd; in write()
162 private native int read_native(FileDescriptor fd) throws IOException; in read_native() argument
164 FileDescriptor fd) throws IOException; in readba_native() argument
166 FileDescriptor fd) throws IOException; in writeba_native() argument
167 private native void write_native(int b, FileDescriptor fd) in write_native() argument
[all …]
/frameworks/base/core/jni/
Dandroid_util_MemoryIntArray.cpp39 int fd = ashmem_create_region(nameStr, ashmemSize); in android_util_MemoryIntArray_create() local
42 if (fd < 0) { in android_util_MemoryIntArray_create()
47 int setProtResult = ashmem_set_prot_region(fd, PROT_READ | PROT_WRITE); in android_util_MemoryIntArray_create()
53 return fd; in android_util_MemoryIntArray_create()
56 static jlong android_util_MemoryIntArray_open(JNIEnv* env, jobject clazz, jint fd, in android_util_MemoryIntArray_open() argument
59 if (fd < 0) { in android_util_MemoryIntArray_open()
64 if (!ashmem_valid(fd)) { in android_util_MemoryIntArray_open()
69 int ashmemSize = ashmem_get_size_region(fd); in android_util_MemoryIntArray_open()
84 void* ashmemAddr = mmap(NULL, ashmemSize, protMode, MAP_SHARED, fd, 0); in android_util_MemoryIntArray_open()
91 int mmapedSize = ashmem_get_size_region(fd); in android_util_MemoryIntArray_open()
[all …]
Dfd_utils.cpp177 static FileDescriptorInfo* CreateFromFd(int fd, fail_fn_t fail_fn);
185 const int fd; member in FileDescriptorInfo
195 explicit FileDescriptorInfo(int fd);
197 FileDescriptorInfo(struct stat stat, const std::string& file_path, int fd, int open_flags,
207 static bool GetSocketName(const int fd, std::string* result);
215 FileDescriptorInfo* FileDescriptorInfo::CreateFromFd(int fd, fail_fn_t fail_fn) { in CreateFromFd() argument
219 if (TEMP_FAILURE_RETRY(fstat(fd, &f_stat)) == -1) { in CreateFromFd()
220 fail_fn(android::base::StringPrintf("Unable to stat %d", fd)); in CreateFromFd()
227 if (!GetSocketName(fd, &socket_name)) { in CreateFromFd()
234 fd)); in CreateFromFd()
[all …]
Dandroid_hardware_SerialPort.cpp135 int fd = jniGetFDFromFileDescriptor(env, fileDescriptor); in android_hardware_SerialPort_open() local
137 fd = fcntl(fd, F_DUPFD_CLOEXEC, 0); in android_hardware_SerialPort_open()
138 if (fd < 0) { in android_hardware_SerialPort_open()
142 env->SetIntField(thiz, field_context, fd); in android_hardware_SerialPort_open()
145 if (tcgetattr(fd, &tio)) in android_hardware_SerialPort_open()
156 tcsetattr(fd, TCSANOW, &tio); in android_hardware_SerialPort_open()
157 tcflush(fd, TCIFLUSH); in android_hardware_SerialPort_open()
163 int fd = env->GetIntField(thiz, field_context); in android_hardware_SerialPort_close() local
164 close(fd); in android_hardware_SerialPort_close()
171 int fd = env->GetIntField(thiz, field_context); in android_hardware_SerialPort_read_array() local
[all …]
Dandroid_net_LocalSocketImpl.cpp61 int fd; in socket_connect_local() local
68 fd = jniGetFDFromFileDescriptor(env, fileDescriptor); in socket_connect_local()
77 fd, in socket_connect_local()
99 int fd; in socket_bind_local() local
106 fd = jniGetFDFromFileDescriptor(env, fileDescriptor); in socket_bind_local()
114 ret = socket_local_server_bind(fd, nameUtf8.c_str(), namespaceId); in socket_bind_local()
129 static ssize_t socket_read_all(JNIEnv *env, jobject thisJ, int fd, in socket_read_all() argument
135 ret = ReceiveFileDescriptorVector(fd, buffer, len, 64, &received_fds); in socket_read_all()
169 for (auto &fd : received_fds) { in socket_read_all() local
171 static_cast<void>(fd.release()); in socket_read_all()
[all …]
Dandroid_backup_BackupHelperDispatcher.cpp52 int fd = jniGetFDFromFileDescriptor(env, fdObj); in readHeader_native() local
54 amt = read(fd, &flattenedHeader.headerSize, sizeof(flattenedHeader.headerSize)); in readHeader_native()
64 lseek(fd, remainingHeader, SEEK_CUR); in readHeader_native()
70 amt = read(fd, &flattenedHeader.version, in readHeader_native()
82 lseek(fd, remainingHeader, SEEK_CUR); in readHeader_native()
109 amt = read(fd, buf, flattenedHeader.nameLength); in readHeader_native()
117 lseek(fd, remainingHeader, SEEK_CUR); in readHeader_native()
129 int fd = jniGetFDFromFileDescriptor(env, fdObj); in skipChunk_native() local
131 lseek(fd, bytesToSkip, SEEK_CUR); in skipChunk_native()
152 int fd = jniGetFDFromFileDescriptor(env, fdObj); in allocateHeader_native() local
[all …]
/frameworks/native/services/utils/tests/
DPriorityDumper_test.cpp50 PriorityDumperTest() : dumper_(), dumpAlldumper_(), fd(1) {} in PriorityDumperTest()
53 int fd; member in PriorityDumperTest
64 EXPECT_CALL(dumper_, dumpAll(fd, ElementsAreArray(args), /*asProto=*/false)); in TEST_F()
65 dumper_.priorityDump(fd, args); in TEST_F()
71 EXPECT_CALL(dumper_, dumpAll(fd, ElementsAreArray(args), /*asProto=*/false)); in TEST_F()
72 dumper_.priorityDump(fd, args); in TEST_F()
79 EXPECT_CALL(dumper_, dumpCritical(fd, ElementsAreArray(strippedArgs), /*asProto=*/false)); in TEST_F()
80 dumper_.priorityDump(fd, args); in TEST_F()
89 EXPECT_CALL(dumper_, dumpCritical(fd, ElementsAreArray(strippedArgs), /*asProto=*/false)); in TEST_F()
90 dumper_.priorityDump(fd, args); in TEST_F()
[all …]
/frameworks/base/services/core/java/com/android/server/connectivity/
DTcpKeepaliveController.java111 public static TcpKeepalivePacketData getTcpKeepalivePacket(@NonNull FileDescriptor fd) in getTcpKeepalivePacket() argument
114 final TcpKeepalivePacketDataParcelable tcpDetails = switchToRepairMode(fd); in getTcpKeepalivePacket()
117 switchOutOfRepairMode(fd); in getTcpKeepalivePacket()
128 private static TcpKeepalivePacketDataParcelable switchToRepairMode(FileDescriptor fd) in switchToRepairMode() argument
130 if (DBG) Log.i(TAG, "switchToRepairMode to start tcp keepalive : " + fd); in switchToRepairMode()
138 srcSockAddr = Os.getsockname(fd); in switchToRepairMode()
152 dstSockAddr = Os.getpeername(fd); in switchToRepairMode()
166 dropAllIncomingPackets(fd, true); in switchToRepairMode()
169 Os.setsockoptInt(fd, IPPROTO_TCP, TCP_REPAIR, TCP_REPAIR_ON); in switchToRepairMode()
172 if (!isSocketIdle(fd)) { in switchToRepairMode()
[all …]
/frameworks/native/libs/binder/
DMemoryHeapBase.cpp49 int fd = ashmem_create_region(name == nullptr ? "MemoryHeapBase" : name, size); in MemoryHeapBase() local
50 ALOGE_IF(fd<0, "error creating ashmem region: %s", strerror(errno)); in MemoryHeapBase()
51 if (fd >= 0) { in MemoryHeapBase()
52 if (mapfd(fd, size) == NO_ERROR) { in MemoryHeapBase()
54 ashmem_set_prot_region(fd, PROT_READ); in MemoryHeapBase()
68 int fd = open(device, open_flags); in MemoryHeapBase() local
69 ALOGE_IF(fd<0, "error opening %s: %s", device, strerror(errno)); in MemoryHeapBase()
70 if (fd >= 0) { in MemoryHeapBase()
73 if (mapfd(fd, size) == NO_ERROR) { in MemoryHeapBase()
79 MemoryHeapBase::MemoryHeapBase(int fd, size_t size, uint32_t flags, off_t offset) in MemoryHeapBase() argument
[all …]
/frameworks/base/cmds/incidentd/src/
DFdBuffer.cpp47 status_t FdBuffer::read(int fd, int64_t timeout) { in read() argument
48 struct pollfd pfds = {.fd = fd, .events = POLLIN}; in read()
51 fcntl(fd, F_SETFL, fcntl(fd, F_GETFL, 0) | O_NONBLOCK); in read()
85 ::read(fd, mBuffer->writeBuffer(), mBuffer->currentToWrite())); in read()
90 VLOG("Fail to read %d: %s", fd, strerror(errno)); in read()
94 VLOG("Reached EOF of fd=%d", fd); in read()
105 status_t FdBuffer::readFully(int fd) { in readFully() argument
121 TEMP_FAILURE_RETRY(::read(fd, mBuffer->writeBuffer(), mBuffer->currentToWrite())); in readFully()
123 VLOG("Fail to read %d: %s", fd, strerror(errno)); in readFully()
137 status_t FdBuffer::readProcessedDataInStream(int fd, unique_fd toFd, unique_fd fromFd, in readProcessedDataInStream() argument
[all …]
/frameworks/native/opengl/libs/EGL/
DFileBlobCache.cpp57 int fd = open(mFilename.c_str(), O_RDONLY, 0); in FileBlobCache() local
58 if (fd == -1) { in FileBlobCache()
67 if (fstat(fd, &statBuf) == -1) { in FileBlobCache()
69 close(fd); in FileBlobCache()
78 close(fd); in FileBlobCache()
83 PROT_READ, MAP_PRIVATE, fd, 0)); in FileBlobCache()
87 close(fd); in FileBlobCache()
95 close(fd); in FileBlobCache()
101 close(fd); in FileBlobCache()
110 close(fd); in FileBlobCache()
[all …]
/frameworks/av/media/codec2/vndk/internal/
DC2ParamInternal.h23 inline static uint32_t GetOffset(const C2FieldDescriptor &fd) { in GetOffset()
24 return fd._mFieldId._mOffset; in GetOffset()
27 inline static void SetOffset(C2FieldDescriptor &fd, uint32_t offset) { in SetOffset()
28 fd._mFieldId._mOffset = offset; in SetOffset()
31 inline static uint32_t GetEndOffset(const C2FieldDescriptor &fd, uint32_t paramSize = 0) {
32 uint32_t endOffset = fd._mFieldId._mOffset + fd._mExtent * fd._mFieldId._mSize;
34 return fd._mExtent ? endOffset : std::max(endOffset, paramSize);
37 inline static uint32_t GetSize(const C2FieldDescriptor &fd) { in GetSize()
38 return fd._mFieldId._mSize; in GetSize()
61 inline static _C2FieldId GetField(const C2FieldDescriptor &fd) { in GetField()
[all …]
/frameworks/base/core/tests/coretests/src/android/os/
DRedactingFileDescriptorTest.java66 final FileDescriptor fd = RedactingFileDescriptor.open(mContext, mFile, MODE_READ_ONLY, in testSingleByte() local
70 assertEquals(buf.length, Os.read(fd, buf, 0, buf.length)); in testSingleByte()
82 final FileDescriptor fd = RedactingFileDescriptor.open(mContext, mFile, MODE_READ_ONLY, in testRanges() local
86 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 90)); in testRanges()
89 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 95)); in testRanges()
92 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 100)); in testRanges()
95 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 195)); in testRanges()
98 assertEquals(buf.length, Os.pread(fd, buf, 0, 10, 395)); in testRanges()
104 final FileDescriptor fd = RedactingFileDescriptor.open(mContext, mFile, MODE_READ_ONLY, in testEntireFile() local
107 try (FileInputStream in = new FileInputStream(fd)) { in testEntireFile()
[all …]
/frameworks/base/cmds/statsd/src/storage/
DStorageManager.cpp104 int fd = open(file, O_WRONLY | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR); in writeFile() local
105 if (fd == -1) { in writeFile()
112 if (android::base::WriteFully(fd, buffer, numBytes)) { in writeFile()
118 int result = fchown(fd, AID_STATSD, AID_STATSD); in writeFile()
123 close(fd); in writeFile()
132 int fd = open(TRAIN_INFO_PATH, O_WRONLY | O_CREAT | O_CLOEXEC, S_IRUSR | S_IWUSR); in writeTrainInfo() local
133 if (fd == -1) { in writeTrainInfo()
141 result = write(fd, &TRAIN_INFO_FILE_MAGIC, sizeof(TRAIN_INFO_FILE_MAGIC)); in writeTrainInfo()
144 close(fd); in writeTrainInfo()
150 result = write(fd, &trainVersionCode, trainVersionCodeByteCount); in writeTrainInfo()
[all …]
/frameworks/base/cmds/idmap/
Dcreate.cpp35 int fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY | O_CREAT | O_TRUNC, 0644)); in open_idmap() local
36 if (fd == -1) { in open_idmap()
40 if (fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0) { in open_idmap()
44 if (TEMP_FAILURE_RETRY(flock(fd, LOCK_EX)) != 0) { in open_idmap()
49 return fd; in open_idmap()
51 if (fd != -1) { in open_idmap()
52 close(fd); in open_idmap()
58 int write_idmap(int fd, const uint32_t *data, size_t size) in write_idmap() argument
60 if (lseek(fd, 0, SEEK_SET) < 0) { in write_idmap()
65 ssize_t w = TEMP_FAILURE_RETRY(write(fd, data + size - bytesLeft, bytesLeft)); in write_idmap()
[all …]
/frameworks/base/libs/androidfw/tests/
DBackupData_test.cpp60 int fd = ::open(mFilename.string(), O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR); in SetUp() local
61 if (fd < 0) { in SetUp()
75 int fd = ::open(mFilename.string(), O_WRONLY); in TEST_F() local
76 BackupDataWriter* writer = new BackupDataWriter(fd); in TEST_F()
83 ::close(fd); in TEST_F()
84 fd = ::open(mFilename.string(), O_RDONLY); in TEST_F()
85 BackupDataReader* reader = new BackupDataReader(fd); in TEST_F()
117 int fd = ::open(mFilename.string(), O_WRONLY); in TEST_F() local
118 BackupDataWriter* writer = new BackupDataWriter(fd); in TEST_F()
124 ::close(fd); in TEST_F()
[all …]
/frameworks/native/cmds/dumpstate/
DDumpstateService.cpp192 status_t DumpstateService::dump(int fd, const Vector<String16>&) { in dump() argument
194 dprintf(fd, "Bugreport not in progress yet"); in dump()
200 dprintf(fd, "id: %d\n", ds_->id_); in dump()
201 dprintf(fd, "pid: %d\n", ds_->pid_); in dump()
202 dprintf(fd, "update_progress: %s\n", ds_->options_->do_progress_updates ? "true" : "false"); in dump()
203 dprintf(fd, "last_percent_progress: %d\n", ds_->last_reported_percent_progress_); in dump()
204 dprintf(fd, "progress:\n"); in dump()
205 ds_->progress_->Dump(fd, " "); in dump()
206 dprintf(fd, "args: %s\n", ds_->options_->args.c_str()); in dump()
207 dprintf(fd, "extra_options: %s\n", ds_->options_->extra_options.c_str()); in dump()
[all …]
/frameworks/base/libs/hwui/service/
DGraphicsStatsService.cpp51 explicit FileDescriptor(int fd) : mFd(fd) {} in FileDescriptor() argument
67 explicit FileOutputStreamLite(int fd) : mCopyAdapter(fd), mImpl(&mCopyAdapter) {} in FileOutputStreamLite() argument
85 explicit FDAdapter(int fd) : mFd(fd) {} in FDAdapter()
108 FileDescriptor fd{open(path.c_str(), O_RDONLY)}; in parseFromFile() local
109 if (!fd.valid()) { in parseFromFile()
119 if (fstat(fd, &sb) || sb.st_size < sHeaderSize) { in parseFromFile()
129 void* addr = mmap(nullptr, sb.st_size, PROT_READ, MAP_SHARED, fd, 0); in parseFromFile()
229 void dumpAsTextToFd(protos::GraphicsStatsProto* proto, int fd) { in dumpAsTextToFd() argument
236 dprintf(fd, "\nPackage: %s", proto->package_name().c_str()); in dumpAsTextToFd()
237 dprintf(fd, "\nVersion: %" PRId64, proto->version_code()); in dumpAsTextToFd()
[all …]
/frameworks/av/media/mtp/tests/
DMtpFfsHandle_test.cpp66 int fd[2]; in MtpFfsHandleTest() local
69 EXPECT_EQ(pipe(fd), 0); in MtpFfsHandleTest()
70 control.reset(fd[0]); in MtpFfsHandleTest()
71 handle->mControl.reset(fd[1]); in MtpFfsHandleTest()
73 EXPECT_EQ(pipe(fd), 0); in MtpFfsHandleTest()
74 EXPECT_EQ(fcntl(fd[0], F_SETPIPE_SZ, 1048576), 1048576); in MtpFfsHandleTest()
75 bulk_in.reset(fd[0]); in MtpFfsHandleTest()
76 handle->mBulkIn.reset(fd[1]); in MtpFfsHandleTest()
78 EXPECT_EQ(pipe(fd), 0); in MtpFfsHandleTest()
79 EXPECT_EQ(fcntl(fd[0], F_SETPIPE_SZ, 1048576), 1048576); in MtpFfsHandleTest()
[all …]
/frameworks/rs/driver/
DrsdShader.cpp315 void RsdShader::logUniform(const Element *field, const float *fd, uint32_t arraySize ) { in logUniform() argument
324 ALOGV("{%f, %f, %f, %f", fd[0], fd[4], fd[8], fd[12]); in logUniform()
325 ALOGV(" %f, %f, %f, %f", fd[1], fd[5], fd[9], fd[13]); in logUniform()
326 ALOGV(" %f, %f, %f, %f", fd[2], fd[6], fd[10], fd[14]); in logUniform()
327 ALOGV(" %f, %f, %f, %f}", fd[3], fd[7], fd[11], fd[15]); in logUniform()
330 ALOGV("{%f, %f, %f", fd[0], fd[3], fd[6]); in logUniform()
331 ALOGV(" %f, %f, %f", fd[1], fd[4], fd[7]); in logUniform()
332 ALOGV(" %f, %f, %f}", fd[2], fd[5], fd[8]); in logUniform()
335 ALOGV("{%f, %f", fd[0], fd[2]); in logUniform()
336 ALOGV(" %f, %f}", fd[1], fd[3]); in logUniform()
[all …]
/frameworks/opt/net/wifi/libwifi_hal/
Dwifi_hal_common.cpp57 int fd; in insmod() local
59 fd = TEMP_FAILURE_RETRY(open(filename, O_RDONLY | O_CLOEXEC | O_NOFOLLOW)); in insmod()
60 if (fd < 0) { in insmod()
65 ret = syscall(__NR_finit_module, fd, args, 0); in insmod()
67 close(fd); in insmod()
95 int fd; in wifi_change_driver_state() local
99 fd = TEMP_FAILURE_RETRY(open(WIFI_DRIVER_STATE_CTRL_PARAM, O_WRONLY)); in wifi_change_driver_state()
100 if (fd < 0) { in wifi_change_driver_state()
105 if (TEMP_FAILURE_RETRY(write(fd, state, len)) != len) { in wifi_change_driver_state()
109 close(fd); in wifi_change_driver_state()
[all …]

12345678910>>...50