Lines Matching refs:fd
85 static int network_write_error(int fd, log_error_st *errh) { in network_write_error() argument
97 log_error(errh,__FILE__,__LINE__,"send failed: %d %d",lastError,fd); in network_write_error()
109 log_perror(errh,__FILE__,__LINE__,"write failed: %d",fd); in network_write_error()
123 static ssize_t network_write_data_len(int fd, const char *data, off_t len) { in network_write_data_len() argument
125 return send(fd, data, len, 0); in network_write_data_len()
127 return write(fd, data, len); in network_write_data_len()
131 static int network_write_accounting(const int fd, chunkqueue * const cq, off_t * const p_max_bytes,… in network_write_accounting() argument
139 return network_write_error(fd, errh); in network_write_accounting()
149 static int network_write_mem_chunk(const int fd, chunkqueue * const cq, off_t * const p_max_bytes, … in network_write_mem_chunk() argument
155 ssize_t wr = network_write_data_len(fd, c->mem->ptr + c->offset, c_len); in network_write_mem_chunk()
156 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, c_len); in network_write_mem_chunk()
164 static int network_write_file_chunk_no_mmap(const int fd, chunkqueue * const cq, off_t * const p_ma… in network_write_file_chunk_no_mmap() argument
173 if (c->file.fd < 0 && 0 != chunkqueue_open_file_chunk(cq, errh)) return -1; in network_write_file_chunk_no_mmap()
175 toSend = chunk_file_pread(c->file.fd, buf, toSend, c->offset); in network_write_file_chunk_no_mmap()
181 ssize_t wr = network_write_data_len(fd, buf, toSend); in network_write_file_chunk_no_mmap()
182 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, toSend); in network_write_file_chunk_no_mmap()
193 network_write_setjmp_write_cb (void *fd, const void *data, off_t len) in network_write_setjmp_write_cb() argument
195 return network_write_data_len((int)(uintptr_t)fd, data, len); in network_write_setjmp_write_cb()
199 static int network_write_file_chunk_mmap(const int fd, chunkqueue * const cq, off_t * const p_max_b… in network_write_file_chunk_mmap() argument
205 return network_write_file_chunk_no_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_mmap()
215 (void *)(uintptr_t)fd, data, toSend); in network_write_file_chunk_mmap()
216 return network_write_accounting(fd,cq,p_max_bytes,errh,(ssize_t)wr,toSend); in network_write_file_chunk_mmap()
254 static int network_writev_mem_chunks(const int fd, chunkqueue * const cq, off_t * const p_max_bytes… in network_writev_mem_chunks() argument
274 ssize_t wr = writev(fd, chunks, num_chunks); in network_writev_mem_chunks()
275 return network_write_accounting(fd, cq, p_max_bytes, errh, wr, toSend); in network_writev_mem_chunks()
295 static int network_write_file_chunk_sendfile(const int fd, chunkqueue * const cq, off_t * const p_m… in network_write_file_chunk_sendfile() argument
307 if (c->file.fd < 0 && 0 != chunkqueue_open_file_chunk(cq, errh)) return -1; in network_write_file_chunk_sendfile()
314 wr = sendfile(fd, c->file.fd, &offset, toSend); in network_write_file_chunk_sendfile()
320 wr = sendfile(c->file.fd, fd, offset, &written, NULL, 0); in network_write_file_chunk_sendfile()
325 wr = sendfile(c->file.fd, fd, offset, toSend, NULL, &written, 0); in network_write_file_chunk_sendfile()
331 fvec.sfv_fd = c->file.fd; in network_write_file_chunk_sendfile()
337 wr = sendfilev(fd, &fvec, 1, (size_t *)&written); in network_write_file_chunk_sendfile()
371 return network_write_file_chunk_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_sendfile()
373 return network_write_file_chunk_no_mmap(fd, cq, p_max_bytes, errh); in network_write_file_chunk_sendfile()
376 log_perror(errh, __FILE__, __LINE__, "sendfile(): fd: %d", fd); in network_write_file_chunk_sendfile()
388 "sendfile(): fd: %d file truncated", fd); in network_write_file_chunk_sendfile()
406 static int network_write_chunkqueue_writev(const int fd, chunkqueue * const cq, off_t max_bytes, lo… in network_write_chunkqueue_writev() argument
413 rc = network_writev_mem_chunks(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
415 rc = network_write_mem_chunk(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
420 rc = network_write_file_chunk_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
422 rc = network_write_file_chunk_no_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_writev()
434 static int network_write_chunkqueue_sendfile(const int fd, chunkqueue * const cq, off_t max_bytes, … in network_write_chunkqueue_sendfile() argument
441 rc = network_writev_mem_chunks(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
443 rc = network_write_mem_chunk(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
448 rc = network_write_file_chunk_sendfile(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
450 rc = network_write_file_chunk_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()
452 rc = network_write_file_chunk_no_mmap(fd, cq, &max_bytes, errh); in network_write_chunkqueue_sendfile()