src/solaris/native/java/io/io_util_md.c

Print this page




 199         else if (lseek64(fd, current, SEEK_SET) == -1)
 200             return 0;
 201     }
 202 
 203     *pbytes = size - current;
 204     return 1;
 205 }
 206 
 207 jint
 208 handleSetLength(FD fd, jlong length)
 209 {
 210     int result;
 211     RESTARTABLE(ftruncate64(fd, length), result);
 212     return result;
 213 }
 214 
 215 size_t
 216 getLastErrorString(char *buf, size_t len)
 217 {
 218     if (errno == 0 || len < 1) return 0;
 219 
 220     const char *err = strerror(errno);
 221     size_t n = strlen(err);
 222     if (n >= len)
 223         n = len - 1;
 224 
 225     strncpy(buf, err, n);
 226     buf[n] = '\0';
 227     return n;
 228 }


 199         else if (lseek64(fd, current, SEEK_SET) == -1)
 200             return 0;
 201     }
 202 
 203     *pbytes = size - current;
 204     return 1;
 205 }
 206 
 207 jint
 208 handleSetLength(FD fd, jlong length)
 209 {
 210     int result;
 211     RESTARTABLE(ftruncate64(fd, length), result);
 212     return result;
 213 }
 214 
 215 size_t
 216 getLastErrorString(char *buf, size_t len)
 217 {
 218     if (errno == 0 || len < 1) return 0;
 219     getErrorString(errno, buf, len);
 220     return strlen(buf);







 221 }