system_intf.ml (4638B)
1 (* Unison file synchronizer: src/system/system_intf.ml *) 2 (* Copyright 1999-2020, Benjamin C. Pierce 3 4 This program is free software: you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation, either version 3 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License 15 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 *) 17 18 module type Core = sig 19 20 type fspath 21 val mfspath : fspath Umarshal.t 22 type dir_handle = { readdir : unit -> string; closedir : unit -> unit } 23 24 val symlink : string -> fspath -> unit 25 val readlink : fspath -> string 26 val chown : fspath -> int -> int -> unit 27 val chmod : fspath -> int -> unit 28 val utimes : fspath -> float -> float -> unit 29 val unlink : fspath -> unit 30 val rmdir : fspath -> unit 31 val mkdir : fspath -> Unix.file_perm -> unit 32 val rename : fspath -> fspath -> unit 33 val stat : fspath -> Unix.LargeFile.stats 34 val lstat : fspath -> Unix.LargeFile.stats 35 val opendir : fspath -> dir_handle 36 val openfile : 37 fspath -> Unix.open_flag list -> Unix.file_perm -> Unix.file_descr 38 39 (****) 40 41 val open_out_gen : open_flag list -> int -> fspath -> out_channel 42 val open_in_bin : fspath -> in_channel 43 val file_exists : fspath -> bool 44 45 (****) 46 47 (* [clone_path] does not raise exceptions. *) 48 val clone_path : fspath -> fspath -> bool 49 (* [clone_file] does not raise exceptions. *) 50 val clone_file : Unix.file_descr -> Unix.file_descr -> bool 51 (* [copy_file] updates destination file seek position if and only if 52 writing succeeded, returning the number of bytes written. *) 53 val copy_file : Unix.file_descr -> Unix.file_descr -> int64 -> int -> int 54 55 (****) 56 57 val hasInodeNumbers : unit -> bool 58 val hasSymlink : unit -> bool 59 60 (* [hasCorrectCTime] is true when [stat] and [lstat] return the status change 61 * time. This is commonly broken on Windows, where creation time (completely 62 * unrelated to ctime; it is the birthtime) is returned instead. However, it 63 * is possible to get the correct status change time on Windows, which is why 64 * [hasCorrectCTime] can have a different value on different systems. *) 65 val hasCorrectCTime : bool 66 67 (****) 68 69 exception XattrNotSupported 70 71 val xattr_list : fspath -> (string * int) list 72 val xattr_get : fspath -> string -> string 73 val xattr_set : fspath -> string -> string -> unit 74 val xattr_remove : fspath -> string -> unit 75 76 (* [xattrUpdatesCTime] is true if changes to extended attributes update the 77 * file ctime. This means that extended attribute changes can be quickly 78 * detected by looking at ctime change. If file ctime is not updated then 79 * xattrs have to be scanned every time to detect changes. *) 80 val xattrUpdatesCTime : bool 81 82 (****) 83 84 val acl_get_text : fspath -> string 85 val acl_set_text : fspath -> string -> unit 86 87 end 88 89 module type Full = sig 90 91 include Core with type fspath = string 92 93 val extendedPath : string -> fspath 94 95 val putenv : string -> string -> unit 96 val getenv : string -> string 97 val argv : unit -> string array 98 99 val fspathToDebugString : fspath -> string 100 101 val open_in_gen : open_flag list -> int -> fspath -> in_channel 102 103 val link : fspath -> fspath -> unit 104 val chdir : fspath -> unit 105 val getcwd : unit -> fspath 106 107 val create_process : 108 string -> string array -> 109 Unix.file_descr -> Unix.file_descr -> Unix.file_descr -> int 110 val open_process_in : string -> in_channel 111 val open_process_args_in : string -> string array -> in_channel 112 val open_process_out : string -> out_channel 113 val open_process_full : 114 string -> in_channel * out_channel * in_channel 115 val open_process_args_full : 116 string -> string array -> in_channel * out_channel * in_channel 117 val process_in_pid : in_channel -> int 118 val process_out_pid : out_channel -> int 119 val process_full_pid : in_channel * out_channel * in_channel -> int 120 val close_process_in : in_channel -> Unix.process_status 121 val close_process_out : out_channel -> Unix.process_status 122 val close_process_full : 123 in_channel * out_channel * in_channel -> Unix.process_status 124 125 type terminalStateFunctions = 126 { defaultTerminal : unit -> unit; rawTerminal : unit -> unit; 127 startReading : unit -> unit; stopReading : unit -> unit } 128 val terminalStateFunctions : unit -> terminalStateFunctions 129 130 val termVtCapable : Unix.file_descr -> bool 131 132 val has_stdout : info:string -> bool 133 val has_stderr : info:string -> bool 134 135 end