Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PojavLauncherTeam
GitHub Repository: PojavLauncherTeam/openjdk-multiarch-jdk8u
Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/solaris/classes/sun/nio/fs/BsdFileSystem.java
32288 views
1
/*
2
* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
3
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
*
5
* This code is free software; you can redistribute it and/or modify it
6
* under the terms of the GNU General Public License version 2 only, as
7
* published by the Free Software Foundation. Oracle designates this
8
* particular file as subject to the "Classpath" exception as provided
9
* by Oracle in the LICENSE file that accompanied this code.
10
*
11
* This code is distributed in the hope that it will be useful, but WITHOUT
12
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* version 2 for more details (a copy is included in the LICENSE file that
15
* accompanied this code).
16
*
17
* You should have received a copy of the GNU General Public License version
18
* 2 along with this work; if not, write to the Free Software Foundation,
19
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20
*
21
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22
* or visit www.oracle.com if you need additional information or have any
23
* questions.
24
*/
25
26
package sun.nio.fs;
27
28
import java.nio.file.*;
29
import java.io.IOException;
30
import java.util.*;
31
import java.security.AccessController;
32
import sun.security.action.GetPropertyAction;
33
34
/**
35
* Bsd implementation of FileSystem
36
*/
37
38
class BsdFileSystem extends UnixFileSystem {
39
40
BsdFileSystem(UnixFileSystemProvider provider, String dir) {
41
super(provider, dir);
42
}
43
44
@Override
45
public WatchService newWatchService()
46
throws IOException
47
{
48
// use polling implementation until we implement a BSD/kqueue one
49
return new PollingWatchService();
50
}
51
52
// lazy initialization of the list of supported attribute views
53
private static class SupportedFileFileAttributeViewsHolder {
54
static final Set<String> supportedFileAttributeViews =
55
supportedFileAttributeViews();
56
private static Set<String> supportedFileAttributeViews() {
57
Set<String> result = new HashSet<String>();
58
result.addAll(standardFileAttributeViews());
59
return Collections.unmodifiableSet(result);
60
}
61
}
62
63
@Override
64
public Set<String> supportedFileAttributeViews() {
65
return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews;
66
}
67
68
@Override
69
void copyNonPosixAttributes(int ofd, int nfd) {
70
}
71
72
/**
73
* Returns object to iterate over mount entries
74
*/
75
@Override
76
Iterable<UnixMountEntry> getMountEntries() {
77
ArrayList<UnixMountEntry> entries = new ArrayList<UnixMountEntry>();
78
try {
79
long iter = BsdNativeDispatcher.getfsstat();
80
try {
81
for (;;) {
82
UnixMountEntry entry = new UnixMountEntry();
83
int res = BsdNativeDispatcher.fsstatEntry(iter, entry);
84
if (res < 0)
85
break;
86
entries.add(entry);
87
}
88
} finally {
89
BsdNativeDispatcher.endfsstat(iter);
90
}
91
92
} catch (UnixException x) {
93
// nothing we can do
94
}
95
return entries;
96
}
97
98
99
100
@Override
101
FileStore getFileStore(UnixMountEntry entry) throws IOException {
102
return new BsdFileStore(this, entry);
103
}
104
}
105
106