Mercurial > hg > graal-compiler
comparison src/share/vm/runtime/os.cpp @ 2491:0654ee04b214
Merge with OpenJDK.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Fri, 22 Apr 2011 15:30:53 +0200 |
parents | a2babfb34c24 677234770800 |
children | 04b9a2566eec |
comparison
equal
deleted
inserted
replaced
2490:29246b1d2d3c | 2491:0654ee04b214 |
---|---|
631 guarantee(*q == badResourceValue, | 631 guarantee(*q == badResourceValue, |
632 "Thing freed should be malloc result."); | 632 "Thing freed should be malloc result."); |
633 *q = (u_char)freeBlockPad; | 633 *q = (u_char)freeBlockPad; |
634 } | 634 } |
635 if (PrintMalloc && tty != NULL) | 635 if (PrintMalloc && tty != NULL) |
636 fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (intptr_t)memblock); | 636 fprintf(stderr, "os::free " SIZE_FORMAT " bytes --> " PTR_FORMAT "\n", size, (uintptr_t)memblock); |
637 } else if (PrintMalloc && tty != NULL) { | 637 } else if (PrintMalloc && tty != NULL) { |
638 // tty->print_cr("os::free %p", memblock); | 638 // tty->print_cr("os::free %p", memblock); |
639 fprintf(stderr, "os::free " PTR_FORMAT "\n", (intptr_t)memblock); | 639 fprintf(stderr, "os::free " PTR_FORMAT "\n", (uintptr_t)memblock); |
640 } | 640 } |
641 #endif | 641 #endif |
642 ::free((char*)memblock - space_before); | 642 ::free((char*)memblock - space_before); |
643 } | 643 } |
644 | 644 |
1077 "%/lib/rt.jar:" | 1077 "%/lib/rt.jar:" |
1078 "%/lib/sunrsasign.jar:" | 1078 "%/lib/sunrsasign.jar:" |
1079 "%/lib/jsse.jar:" | 1079 "%/lib/jsse.jar:" |
1080 "%/lib/jce.jar:" | 1080 "%/lib/jce.jar:" |
1081 "%/lib/charsets.jar:" | 1081 "%/lib/charsets.jar:" |
1082 | |
1083 // ## TEMPORARY hack to keep the legacy launcher working when | |
1084 // ## only the boot module is installed (cf. j.l.ClassLoader) | |
1085 "%/lib/modules/jdk.boot.jar:" | |
1086 | |
1087 "%/classes"; | 1082 "%/classes"; |
1088 char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep); | 1083 char* sysclasspath = format_boot_path(classpath_format, home, home_len, fileSep, pathSep); |
1089 if (sysclasspath == NULL) return false; | 1084 if (sysclasspath == NULL) return false; |
1090 Arguments::set_sysclasspath(sysclasspath); | 1085 Arguments::set_sysclasspath(sysclasspath); |
1091 | 1086 |
1294 result = true; | 1289 result = true; |
1295 } | 1290 } |
1296 } | 1291 } |
1297 return result; | 1292 return result; |
1298 } | 1293 } |
1294 | |
1295 // Read file line by line, if line is longer than bsize, | |
1296 // skip rest of line. | |
1297 int os::get_line_chars(int fd, char* buf, const size_t bsize){ | |
1298 size_t sz, i = 0; | |
1299 | |
1300 // read until EOF, EOL or buf is full | |
1301 while ((sz = (int) read(fd, &buf[i], 1)) == 1 && i < (bsize-1) && buf[i] != '\n') { | |
1302 ++i; | |
1303 } | |
1304 | |
1305 if (buf[i] == '\n') { | |
1306 // EOL reached so ignore EOL character and return | |
1307 | |
1308 buf[i] = 0; | |
1309 return (int) i; | |
1310 } | |
1311 | |
1312 buf[i+1] = 0; | |
1313 | |
1314 if (sz != 1) { | |
1315 // EOF reached. if we read chars before EOF return them and | |
1316 // return EOF on next call otherwise return EOF | |
1317 | |
1318 return (i == 0) ? -1 : (int) i; | |
1319 } | |
1320 | |
1321 // line is longer than size of buf, skip to EOL | |
1322 int ch; | |
1323 while (read(fd, &ch, 1) == 1 && ch != '\n') { | |
1324 // Do nothing | |
1325 } | |
1326 | |
1327 // return initial part of line that fits in buf. | |
1328 // If we reached EOF, it will be returned on next call. | |
1329 | |
1330 return (int) i; | |
1331 } |