File tree Expand file tree Collapse file tree 3 files changed +16
-10
lines changed
substratevm/src/com.oracle.svm.core.posix/src/com/oracle/svm/core/posix Expand file tree Collapse file tree 3 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ public static boolean isOpen(int fd) {
4444 LinuxStat .stat64 stat = StackValue .get (LinuxStat .stat64 .class );
4545 result = LinuxStat .fstat64 (fd , stat );
4646 } else if (Platform .includedIn (Platform .DARWIN .class )) {
47- DarwinStat .stat64 stat = StackValue .get (DarwinStat .stat64 .class );
48- result = DarwinStat .fstat64 (fd , stat );
47+ DarwinStat .stat stat = StackValue .get (DarwinStat .stat .class );
48+ result = DarwinStat .fstat (fd , stat );
4949 } else {
5050 throw VMError .shouldNotReachHere ("Unsupported platform" );
5151 }
@@ -62,8 +62,8 @@ public static SignedWord getSize(int fd) {
6262 size = stat .st_size ();
6363 }
6464 } else if (Platform .includedIn (Platform .DARWIN .class )) {
65- DarwinStat .stat64 stat = StackValue .get (DarwinStat .stat64 .class );
66- if (DarwinStat .NoTransitions .fstat64 (fd , stat ) == 0 ) {
65+ DarwinStat .stat stat = StackValue .get (DarwinStat .stat .class );
66+ if (DarwinStat .NoTransitions .fstat (fd , stat ) == 0 ) {
6767 size = stat .st_size ();
6868 }
6969 }
Original file line number Diff line number Diff line change @@ -95,6 +95,6 @@ public List<String> getOptions() {
9595
9696 @ Override
9797 public List <String > getMacroDefinitions () {
98- return Arrays .asList ("_GNU_SOURCE" , "_LARGEFILE64_SOURCE" );
98+ return Arrays .asList ("_GNU_SOURCE" , "_LARGEFILE64_SOURCE" , "_DARWIN_USE_64_BIT_INODE" );
9999 }
100100}
Original file line number Diff line number Diff line change 4040@ CContext (PosixDirectives .class )
4141public class DarwinStat {
4242
43+ /*
44+ * NOTE that we set _DARWIN_USE_64_BIT_INODE in the C directives to force a layout for struct
45+ * stat with a 64-bit st_ino, and we have to call functions with a $INODE64 suffix to match,
46+ * such as fstat$INODE64.
47+ */
48+
4349 @ CStruct (addStructKeyword = true )
44- public interface stat64 extends PointerBase {
50+ public interface stat extends PointerBase {
4551 @ CField
4652 long st_size ();
4753 }
4854
49- @ CFunction ("fstat64 " )
50- public static native int fstat64 (int fd , stat64 buf );
55+ @ CFunction ("fstat$INODE64 " )
56+ public static native int fstat (int fd , stat buf );
5157
5258 public static class NoTransitions {
53- @ CFunction (transition = CFunction .Transition .NO_TRANSITION )
54- public static native int fstat64 (int fd , stat64 buf );
59+ @ CFunction (value = "fstat$INODE64" , transition = CFunction .Transition .NO_TRANSITION )
60+ public static native int fstat (int fd , stat buf );
5561 }
5662}
You can’t perform that action at this time.
0 commit comments