int tracer_copy_out( struct tracer *t, const void *data, const void *uaddr, int length ) { int result; static int has_fast_write=1; UPTRINT_T iuaddr = (UPTRINT_T)uaddr; if(length==0) return 0; #if !defined(CCTOOLS_CPU_I386) if(!tracer_is_64bit(t)) iuaddr &= 0xffffffff; #endif if(has_fast_write) { result = full_pwrite64(t->memory_file,data,length,iuaddr); if( result!=length ) { has_fast_write = 0; debug(D_SYSCALL,"writing to /proc/X/mem failed, falling back to slow ptrace write"); } else { return result; } } result = tracer_copy_out_slow(t,data,(void*)iuaddr,length); return result; }
static INT64_T chirp_fs_local_pwrite(int fd, const void *buffer, INT64_T length, INT64_T offset) { INT64_T result; result = full_pwrite64(fd, buffer, length, offset); if(result < 0 && errno == ESPIPE) { /* if this is a pipe, then just write without the offset. */ result = full_write(fd, buffer, length); } return result; }
static INT64_T chirp_fs_local_pwrite(int fd, const void *buffer, INT64_T length, INT64_T offset) { PREAMBLE("pwrite(%d, %p, %zu, %" PRId64 ")", fd, buffer, (size_t)length, offset); SETUP_FILE rc = full_pwrite64(lfd, buffer, length, offset); if(rc < 0 && errno == ESPIPE) { /* if this is a pipe, then just write without the offset. */ rc = full_write(lfd, buffer, length); } PROLOGUE }