Changeset 1690
- Timestamp:
- 02/22/2007 01:24:47 PM (20 months ago)
- Files:
-
- 1 modified
-
trunk/src/network_gthread_aio.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/network_gthread_aio.c
r1659 r1690 83 83 84 84 c->file.copy.offset = 0; 85 c->file.copy.length = toSend;85 c->file.copy.length = 0; 86 86 87 87 /* open a file in /dev/shm to write to */ … … 97 97 } else { 98 98 c->file.mmap.offset = 0; 99 c->file.mmap.length = c->file.copy.length; /* align to page-size */99 c->file.mmap.length = toSend; 100 100 101 101 c->file.mmap.start = mmap(0, c->file.mmap.length, … … 111 111 112 112 if (c->file.mmap.start != MAP_FAILED) { 113 lseek(c->file.fd, c->file.start + c->offset, SEEK_SET); 114 115 if (-1 == (r = read(c->file.fd, c->file.mmap.start, c->file.copy.length))) { 113 if (-1 == (r = pread(c->file.fd, c->file.mmap.start, toSend, c->file.start + c->offset))) { 116 114 switch(errno) { 117 115 default: … … 121 119 } 122 120 } else if (r == 0) { 123 ERROR(" read() returned 0 ... not good: %s", "");121 ERROR("pread(%s) returned 0 ... not good", BUF_STR(c->file.name)); 124 122 125 123 c->async.ret_val = NETWORK_STATUS_FATAL_ERROR; 126 } else if (r != c->file.copy.length) { 127 ERROR("read() returned %d instead of %d", r, c->file.copy.length); 128 129 c->async.ret_val = NETWORK_STATUS_FATAL_ERROR; 124 } else { 125 c->file.copy.length = r; 130 126 } 131 127 }

