mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8151430: (fs) BasicFileAttributeView.setTimes should support setting file create time on OS X
Reviewed-by: alanb
This commit is contained in:
parent
57e0da1578
commit
6397d564a5
7 changed files with 272 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -30,6 +30,9 @@
|
|||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef _ALLBSD_SOURCE
|
||||
#include <sys/attr.h>
|
||||
#endif
|
||||
|
||||
/* To be able to name the Java constants the same as the C constants without
|
||||
having the preprocessor rewrite those identifiers, add PREFIX_ to all
|
||||
|
@ -140,4 +143,17 @@ class UnixConstants {
|
|||
static final int PREFIX_AT_REMOVEDIR = 00;
|
||||
#endif
|
||||
|
||||
// flags used with setattrlist
|
||||
#ifdef _ALLBSD_SOURCE
|
||||
static final int PREFIX_ATTR_CMN_CRTIME = ATTR_CMN_CRTIME;
|
||||
static final int PREFIX_ATTR_CMN_MODTIME = ATTR_CMN_MODTIME;
|
||||
static final int PREFIX_ATTR_CMN_ACCTIME = ATTR_CMN_ACCTIME;
|
||||
static final int PREFIX_FSOPT_NOFOLLOW = FSOPT_NOFOLLOW;
|
||||
#else
|
||||
// not supported (dummy values will not be used at runtime).
|
||||
static final int PREFIX_ATTR_CMN_CRTIME = 00;
|
||||
static final int PREFIX_ATTR_CMN_MODTIME = 00;
|
||||
static final int PREFIX_ATTR_CMN_ACCTIME = 00;
|
||||
static final int PREFIX_FSOPT_NOFOLLOW = 00;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ class UnixFileAttributeViews {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Posix extends Basic implements PosixFileAttributeView {
|
||||
static class Posix extends Basic implements PosixFileAttributeView {
|
||||
private static final String PERMISSIONS_NAME = "permissions";
|
||||
private static final String OWNER_NAME = "owner";
|
||||
private static final String GROUP_NAME = "group";
|
||||
|
@ -331,7 +331,7 @@ class UnixFileAttributeViews {
|
|||
}
|
||||
}
|
||||
|
||||
private static class Unix extends Posix {
|
||||
static class Unix extends Posix {
|
||||
private static final String MODE_NAME = "mode";
|
||||
private static final String INO_NAME = "ino";
|
||||
private static final String DEV_NAME = "dev";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue