1 /*
2 * Copyright 2016-2025 The OSHI Project Contributors
3 * SPDX-License-Identifier: MIT
4 */
5 package oshi.software.os;
6
7 import java.util.List;
8
9 import oshi.annotation.concurrent.ThreadSafe;
10
11 /**
12 * The File System is a logical arrangement, usually in a hierarchial tree, where files are placed for storage and
13 * retrieval. It may consist of one or more file stores.
14 */
15 @ThreadSafe
16 public interface FileSystem {
17
18 /**
19 * Get file stores on this machine
20 *
21 * Instantiates a list of {@link oshi.software.os.OSFileStore} objects, representing a storage pool, device,
22 * partition, volume, concrete file system or other implementation specific means of file storage.
23 *
24 * @return A list of {@link oshi.software.os.OSFileStore} objects or an empty array if none are present.
25 */
26 List<OSFileStore> getFileStores();
27
28 /**
29 * Get file stores on this machine
30 *
31 * Instantiates a list of {@link oshi.software.os.OSFileStore} objects, representing a storage pool, device,
32 * partition, volume, concrete file system or other implementation specific means of file storage.
33 *
34 * @param localOnly If true, filters the list to only local file stores. On Windows, also excluded CD-ROM drives.
35 *
36 * @return A list of {@link oshi.software.os.OSFileStore} objects or an empty array if none are present.
37 */
38 List<OSFileStore> getFileStores(boolean localOnly);
39
40 /**
41 * The current number of open file descriptors. A file descriptor is an abstract handle used to access I/O resources
42 * such as files and network connections. On UNIX-based systems there is a system-wide limit on the number of open
43 * file descriptors.
44 *
45 * On Windows systems, this method returns the total number of handles held by Processes. While Windows handles are
46 * conceptually similar to file descriptors, they may also refer to a number of non-I/O related objects.
47 *
48 * @return The number of open file descriptors if available, 0 otherwise.
49 */
50 long getOpenFileDescriptors();
51
52 /**
53 * The maximum number of open file descriptors. A file descriptor is an abstract handle used to access I/O resources
54 * such as files and network connections. On UNIX-based systems there is a system-wide limit on the number of open
55 * file descriptors.
56 *
57 * On Windows systems, this method returns the theoretical max number of handles (2^24-2^15 on 32-bit, 2^24-2^16 on
58 * 64-bit). There may be a lower per-process limit. While Windows handles are conceptually similar to file
59 * descriptors, they may also refer to a number of non-I/O related objects.
60 *
61 * @return The maximum number of file descriptors if available, 0 otherwise.
62 */
63 long getMaxFileDescriptors();
64
65 /**
66 * The maximum number of open file descriptors per process. This returns the upper limit which applies to each
67 * process. The actual limit of a process may be lower if configured.
68 *
69 * @return The maximum number of file descriptors of each process if available, 0 otherwise.
70 */
71 long getMaxFileDescriptorsPerProcess();
72 }