Skip to content

Commit 5594d6b

Browse files
Aleksei Voitylovjerboaa
authored andcommitted
8368522: (fs) BasicFileAttributes Linux musl 1.2.5 incompatibility with statx
Reviewed-by: sgehwolf, bpb
1 parent afda8ad commit 5594d6b

File tree

2 files changed

+38
-49
lines changed

2 files changed

+38
-49
lines changed

src/java.base/unix/native/libnio/fs/UnixNativeDispatcher.c

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
#include <grp.h>
5656

5757
#ifdef __linux__
58+
#include <stdint.h> // For uintXX_t types used in statx support
5859
#include <sys/syscall.h>
5960
#include <sys/sysmacros.h> // makedev macros
6061
#endif
@@ -70,19 +71,12 @@
7071
// by defining binary compatible statx structs in this file and
7172
// not relying on included headers.
7273

73-
#ifndef __GLIBC__
74-
// Alpine doesn't know these types, define them
75-
typedef unsigned int __uint32_t;
76-
typedef unsigned short __uint16_t;
77-
typedef unsigned long int __uint64_t;
78-
#endif
79-
8074
/*
8175
* Timestamp structure for the timestamps in struct statx.
8276
*/
8377
struct my_statx_timestamp {
8478
int64_t tv_sec;
85-
__uint32_t tv_nsec;
79+
uint32_t tv_nsec;
8680
int32_t __reserved;
8781
};
8882

@@ -92,27 +86,27 @@ struct my_statx_timestamp {
9286
*/
9387
struct my_statx
9488
{
95-
__uint32_t stx_mask;
96-
__uint32_t stx_blksize;
97-
__uint64_t stx_attributes;
98-
__uint32_t stx_nlink;
99-
__uint32_t stx_uid;
100-
__uint32_t stx_gid;
101-
__uint16_t stx_mode;
102-
__uint16_t __statx_pad1[1];
103-
__uint64_t stx_ino;
104-
__uint64_t stx_size;
105-
__uint64_t stx_blocks;
106-
__uint64_t stx_attributes_mask;
89+
uint32_t stx_mask;
90+
uint32_t stx_blksize;
91+
uint64_t stx_attributes;
92+
uint32_t stx_nlink;
93+
uint32_t stx_uid;
94+
uint32_t stx_gid;
95+
uint16_t stx_mode;
96+
uint16_t __statx_pad1[1];
97+
uint64_t stx_ino;
98+
uint64_t stx_size;
99+
uint64_t stx_blocks;
100+
uint64_t stx_attributes_mask;
107101
struct my_statx_timestamp stx_atime;
108102
struct my_statx_timestamp stx_btime;
109103
struct my_statx_timestamp stx_ctime;
110104
struct my_statx_timestamp stx_mtime;
111-
__uint32_t stx_rdev_major;
112-
__uint32_t stx_rdev_minor;
113-
__uint32_t stx_dev_major;
114-
__uint32_t stx_dev_minor;
115-
__uint64_t __statx_pad2[14];
105+
uint32_t stx_rdev_major;
106+
uint32_t stx_rdev_minor;
107+
uint32_t stx_dev_major;
108+
uint32_t stx_dev_minor;
109+
uint64_t __statx_pad2[14];
116110
};
117111

118112
// statx masks, flags, constants

test/jdk/java/nio/file/attribute/BasicFileAttributeView/libCreationTimeHelper.c

Lines changed: 19 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include <stdbool.h>
2525
#if defined(__linux__)
2626
#include <stdio.h>
27+
#include <stdint.h>
2728
#include <string.h>
2829
#include <sys/types.h>
2930
#include <sys/stat.h>
@@ -44,19 +45,13 @@
4445
#define AT_FDCWD -100
4546
#endif
4647

47-
#ifndef __GLIBC__
48-
// Alpine doesn't know these types, define them
49-
typedef unsigned int __uint32_t;
50-
typedef unsigned short __uint16_t;
51-
typedef unsigned long int __uint64_t;
52-
#endif
5348

5449
/*
5550
* Timestamp structure for the timestamps in struct statx.
5651
*/
5752
struct my_statx_timestamp {
5853
int64_t tv_sec;
59-
__uint32_t tv_nsec;
54+
uint32_t tv_nsec;
6055
int32_t __reserved;
6156
};
6257

@@ -66,27 +61,27 @@ struct my_statx_timestamp {
6661
*/
6762
struct my_statx
6863
{
69-
__uint32_t stx_mask;
70-
__uint32_t stx_blksize;
71-
__uint64_t stx_attributes;
72-
__uint32_t stx_nlink;
73-
__uint32_t stx_uid;
74-
__uint32_t stx_gid;
75-
__uint16_t stx_mode;
76-
__uint16_t __statx_pad1[1];
77-
__uint64_t stx_ino;
78-
__uint64_t stx_size;
79-
__uint64_t stx_blocks;
80-
__uint64_t stx_attributes_mask;
64+
uint32_t stx_mask;
65+
uint32_t stx_blksize;
66+
uint64_t stx_attributes;
67+
uint32_t stx_nlink;
68+
uint32_t stx_uid;
69+
uint32_t stx_gid;
70+
uint16_t stx_mode;
71+
uint16_t __statx_pad1[1];
72+
uint64_t stx_ino;
73+
uint64_t stx_size;
74+
uint64_t stx_blocks;
75+
uint64_t stx_attributes_mask;
8176
struct my_statx_timestamp stx_atime;
8277
struct my_statx_timestamp stx_btime;
8378
struct my_statx_timestamp stx_ctime;
8479
struct my_statx_timestamp stx_mtime;
85-
__uint32_t stx_rdev_major;
86-
__uint32_t stx_rdev_minor;
87-
__uint32_t stx_dev_major;
88-
__uint32_t stx_dev_minor;
89-
__uint64_t __statx_pad2[14];
80+
uint32_t stx_rdev_major;
81+
uint32_t stx_rdev_minor;
82+
uint32_t stx_dev_major;
83+
uint32_t stx_dev_minor;
84+
uint64_t __statx_pad2[14];
9085
};
9186

9287
typedef int statx_func(int dirfd, const char *restrict pathname, int flags,

0 commit comments

Comments
 (0)