Subversion
|
General file I/O for Subversion. More...
#include <apr.h>
#include <apr_pools.h>
#include <apr_time.h>
#include <apr_hash.h>
#include <apr_tables.h>
#include <apr_file_io.h>
#include <apr_file_info.h>
#include <apr_thread_proc.h>
#include "svn_types.h"
#include "svn_string.h"
#include "svn_checksum.h"
Go to the source code of this file.
Data Structures | |
struct | svn_io_dirent2_t |
A set of directory entry data elements as returned by svn_io_get_dirents. More... | |
struct | svn_io_dirent_t |
Represents the kind and special status of a directory entry. More... | |
Typedefs | |
typedef enum svn_io_file_del_t | svn_io_file_del_t |
Used as an argument when creating temporary files to indicate when a file should be removed. More... | |
typedef struct svn_io_dirent2_t | svn_io_dirent2_t |
A set of directory entry data elements as returned by svn_io_get_dirents. More... | |
typedef struct svn_io_dirent_t | svn_io_dirent_t |
Represents the kind and special status of a directory entry. More... | |
typedef struct svn_stream_t | svn_stream_t |
An abstract stream of bytes–either incoming or outgoing or both. More... | |
typedef svn_error_t *(* | svn_read_fn_t) (void *baton, char *buffer, apr_size_t *len) |
Read handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_stream_skip_fn_t) (void *baton, apr_size_t len) |
Skip data handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_write_fn_t) (void *baton, const char *data, apr_size_t *len) |
Write handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_close_fn_t) (void *baton) |
Close handler function for a generic stream. More... | |
typedef struct svn_stream_mark_t | svn_stream_mark_t |
An opaque type which represents a mark on a stream. More... | |
typedef svn_error_t *(* | svn_stream_mark_fn_t) (void *baton, svn_stream_mark_t **mark, apr_pool_t *pool) |
Mark handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_stream_seek_fn_t) (void *baton, const svn_stream_mark_t *mark) |
Seek handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_stream_data_available_fn_t) (void *baton, svn_boolean_t *data_available) |
Poll handler for generic streams that support incomplete reads,. More... | |
typedef svn_error_t *(* | svn_stream_readline_fn_t) (void *baton, svn_stringbuf_t **stringbuf, const char *eol, svn_boolean_t *eof, apr_pool_t *pool) |
Readline handler function for a generic stream. More... | |
typedef svn_error_t *(* | svn_stream_lazyopen_func_t) (svn_stream_t **stream, void *baton, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
A function type provided for use as a callback from svn_stream_lazyopen_create() . More... | |
typedef svn_error_t *(* | svn_io_walk_func_t) (void *baton, const char *path, const apr_finfo_t *finfo, apr_pool_t *pool) |
Callback function type for svn_io_dir_walk() | |
Enumerations | |
enum | svn_io_file_del_t { svn_io_file_del_none = 0, svn_io_file_del_on_close, svn_io_file_del_on_pool_cleanup } |
Used as an argument when creating temporary files to indicate when a file should be removed. More... | |
Functions | |
svn_io_dirent2_t * | svn_io_dirent2_create (apr_pool_t *result_pool) |
Creates a new svn_io_dirent2_t structure. More... | |
svn_io_dirent2_t * | svn_io_dirent2_dup (const svn_io_dirent2_t *item, apr_pool_t *result_pool) |
Duplicates a svn_io_dirent2_t structure into result_pool. More... | |
svn_error_t * | svn_io_check_path (const char *path, svn_node_kind_t *kind, apr_pool_t *pool) |
Determine the kind of path. More... | |
svn_error_t * | svn_io_check_special_path (const char *path, svn_node_kind_t *kind, svn_boolean_t *is_special, apr_pool_t *pool) |
Like svn_io_check_path(), but also set *is_special to TRUE if the path is not a normal file. More... | |
svn_error_t * | svn_io_check_resolved_path (const char *path, svn_node_kind_t *kind, apr_pool_t *pool) |
Like svn_io_check_path(), but resolve symlinks. More... | |
svn_error_t * | svn_io_open_uniquely_named (apr_file_t **file, const char **unique_name, const char *dirpath, const char *filename, const char *suffix, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Open a new file (for reading and writing) with a unique name based on utf-8 encoded filename, in the directory dirpath. More... | |
svn_error_t * | svn_io_open_unique_file3 (apr_file_t **file, const char **temp_path, const char *dirpath, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Create a writable file, with an arbitrary and unique name, in the directory dirpath. More... | |
svn_error_t * | svn_io_open_unique_file2 (apr_file_t **f, const char **unique_name_p, const char *path, const char *suffix, svn_io_file_del_t delete_when, apr_pool_t *pool) |
Like svn_io_open_uniquely_named(), but takes a joined dirpath and filename, and a single pool. More... | |
svn_error_t * | svn_io_open_unique_file (apr_file_t **f, const char **unique_name_p, const char *path, const char *suffix, svn_boolean_t delete_on_close, apr_pool_t *pool) |
Like svn_io_open_unique_file2, but can't delete on pool cleanup. More... | |
svn_error_t * | svn_io_create_unique_link (const char **unique_name_p, const char *path, const char *dest, const char *suffix, apr_pool_t *pool) |
Like svn_io_open_unique_file(), except that instead of creating a file, a symlink is generated that references the path dest. More... | |
svn_error_t * | svn_io_read_link (svn_string_t **dest, const char *path, apr_pool_t *pool) |
Set *dest to the path that the symlink at path references. More... | |
svn_error_t * | svn_io_temp_dir (const char **dir, apr_pool_t *pool) |
Set *dir to a directory path (allocated in pool) deemed usable for the creation of temporary files and subdirectories. | |
svn_error_t * | svn_io_copy_file (const char *src, const char *dst, svn_boolean_t copy_perms, apr_pool_t *pool) |
Copy src to dst atomically, in a "byte-for-byte" manner. More... | |
svn_error_t * | svn_io_copy_perms (const char *src, const char *dst, apr_pool_t *pool) |
Copy permission flags from src onto the file at dst. More... | |
svn_error_t * | svn_io_copy_link (const char *src, const char *dst, apr_pool_t *pool) |
Copy symbolic link src to dst atomically. More... | |
svn_error_t * | svn_io_copy_dir_recursively (const char *src, const char *dst_parent, const char *dst_basename, svn_boolean_t copy_perms, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Recursively copy directory src into dst_parent, as a new entry named dst_basename. More... | |
svn_error_t * | svn_io_make_dir_recursively (const char *path, apr_pool_t *pool) |
Create directory path on the file system, creating intermediate directories as required, like mkdir -p . More... | |
svn_error_t * | svn_io_dir_empty (svn_boolean_t *is_empty_p, const char *path, apr_pool_t *pool) |
Set *is_empty_p to TRUE if directory path is empty, else to FALSE if it is not empty. More... | |
svn_error_t * | svn_io_append_file (const char *src, const char *dst, apr_pool_t *pool) |
Append src to dst. More... | |
svn_error_t * | svn_io_set_file_read_only (const char *path, svn_boolean_t ignore_enoent, apr_pool_t *pool) |
Make a file as read-only as the operating system allows. More... | |
svn_error_t * | svn_io_set_file_read_write (const char *path, svn_boolean_t ignore_enoent, apr_pool_t *pool) |
Make a file as writable as the operating system allows. More... | |
svn_error_t * | svn_io_set_file_read_write_carefully (const char *path, svn_boolean_t enable_write, svn_boolean_t ignore_enoent, apr_pool_t *pool) |
Similar to svn_io_set_file_read_* functions. More... | |
svn_error_t * | svn_io_set_file_executable (const char *path, svn_boolean_t executable, svn_boolean_t ignore_enoent, apr_pool_t *pool) |
Set path's "executability" (but do nothing if it is a symlink). More... | |
svn_error_t * | svn_io_is_file_executable (svn_boolean_t *executable, const char *path, apr_pool_t *pool) |
Determine whether a file is executable by the current user. More... | |
svn_error_t * | svn_io_read_length_line (apr_file_t *file, char *buf, apr_size_t *limit, apr_pool_t *pool) |
Read a line from file into buf, but not exceeding *limit bytes. More... | |
svn_error_t * | svn_io_file_affected_time (apr_time_t *apr_time, const char *path, apr_pool_t *pool) |
Set *apr_time to the time of last modification of the contents of the file path. More... | |
svn_error_t * | svn_io_set_file_affected_time (apr_time_t apr_time, const char *path, apr_pool_t *pool) |
Set the timestamp of file path to apr_time. More... | |
void | svn_io_sleep_for_timestamps (const char *path, apr_pool_t *pool) |
Sleep to ensure that any files modified after we exit have a different timestamp than the one we recorded. More... | |
svn_error_t * | svn_io_filesizes_different_p (svn_boolean_t *different_p, const char *file1, const char *file2, apr_pool_t *pool) |
Set *different_p to TRUE if file1 and file2 have different sizes, else set to FALSE. More... | |
svn_error_t * | svn_io_filesizes_three_different_p (svn_boolean_t *different_p12, svn_boolean_t *different_p23, svn_boolean_t *different_p13, const char *file1, const char *file2, const char *file3, apr_pool_t *scratch_pool) |
Set *different_p12 to non-zero if file1 and file2 have different sizes, else set to zero. More... | |
svn_error_t * | svn_io_file_checksum2 (svn_checksum_t **checksum, const char *file, svn_checksum_kind_t kind, apr_pool_t *pool) |
Return in *checksum the checksum of type kind of file Use pool for temporary allocations and to allocate *checksum. More... | |
svn_error_t * | svn_io_file_checksum (unsigned char digest[], const char *file, apr_pool_t *pool) |
Put the md5 checksum of file into digest. More... | |
svn_error_t * | svn_io_files_contents_same_p (svn_boolean_t *same, const char *file1, const char *file2, apr_pool_t *pool) |
Set *same to TRUE if file1 and file2 have the same contents, else set it to FALSE. More... | |
svn_error_t * | svn_io_files_contents_three_same_p (svn_boolean_t *same12, svn_boolean_t *same23, svn_boolean_t *same13, const char *file1, const char *file2, const char *file3, apr_pool_t *scratch_pool) |
Set *same12 to TRUE if file1 and file2 have the same contents, else set it to FALSE. More... | |
svn_error_t * | svn_io_file_create (const char *file, const char *contents, apr_pool_t *pool) |
Create a file at utf8-encoded path file with the contents given by the null-terminated string contents. More... | |
svn_error_t * | svn_io_file_create_bytes (const char *file, const void *contents, apr_size_t length, apr_pool_t *scratch_pool) |
Create a file at utf8-encoded path file with the contents given by contents of length bytes. More... | |
svn_error_t * | svn_io_file_create_empty (const char *file, apr_pool_t *scratch_pool) |
Create an empty file at utf8-encoded path file. More... | |
svn_error_t * | svn_io_file_lock (const char *lock_file, svn_boolean_t exclusive, apr_pool_t *pool) |
Lock file at lock_file. More... | |
svn_error_t * | svn_io_file_lock2 (const char *lock_file, svn_boolean_t exclusive, svn_boolean_t nonblocking, apr_pool_t *pool) |
Lock file at lock_file. More... | |
svn_error_t * | svn_io_lock_open_file (apr_file_t *lockfile_handle, svn_boolean_t exclusive, svn_boolean_t nonblocking, apr_pool_t *pool) |
Lock the file lockfile_handle. More... | |
svn_error_t * | svn_io_unlock_open_file (apr_file_t *lockfile_handle, apr_pool_t *pool) |
Unlock the file lockfile_handle. More... | |
svn_error_t * | svn_io_file_flush_to_disk (apr_file_t *file, apr_pool_t *pool) |
Flush any unwritten data from file to disk. More... | |
svn_error_t * | svn_io_dir_file_copy (const char *src_path, const char *dest_path, const char *file, apr_pool_t *pool) |
Copy the file whose basename (or relative path) is file within directory src_path to the same basename (or relative path) within directory dest_path. More... | |
svn_stream_t * | svn_stream_create (void *baton, apr_pool_t *pool) |
Create a generic stream. More... | |
void | svn_stream_set_baton (svn_stream_t *stream, void *baton) |
Set stream's baton to baton. | |
void | svn_stream_set_read2 (svn_stream_t *stream, svn_read_fn_t read_fn, svn_read_fn_t read_full_fn) |
Set stream's read functions to read_fn and read_full_fn. More... | |
void | svn_stream_set_read (svn_stream_t *stream, svn_read_fn_t read_fn) |
Set stream's read function to read_fn. More... | |
void | svn_stream_set_skip (svn_stream_t *stream, svn_stream_skip_fn_t skip_fn) |
Set stream's skip function to skip_fn. More... | |
void | svn_stream_set_write (svn_stream_t *stream, svn_write_fn_t write_fn) |
Set stream's write function to write_fn. | |
void | svn_stream_set_close (svn_stream_t *stream, svn_close_fn_t close_fn) |
Set stream's close function to close_fn. | |
void | svn_stream_set_mark (svn_stream_t *stream, svn_stream_mark_fn_t mark_fn) |
Set stream's mark function to mark_fn. More... | |
void | svn_stream_set_seek (svn_stream_t *stream, svn_stream_seek_fn_t seek_fn) |
Set stream's seek function to seek_fn. More... | |
void | svn_stream_set_data_available (svn_stream_t *stream, svn_stream_data_available_fn_t data_available) |
Set stream's data available function to data_available_fn. More... | |
void | svn_stream_set_readline (svn_stream_t *stream, svn_stream_readline_fn_t readline_fn) |
Set stream's readline function to readline_fn. More... | |
svn_stream_t * | svn_stream_empty (apr_pool_t *pool) |
Create a stream that is empty for reading and infinite for writing. | |
svn_stream_t * | svn_stream_disown (svn_stream_t *stream, apr_pool_t *pool) |
Return a stream allocated in pool which forwards all requests to stream. More... | |
svn_error_t * | svn_stream_open_readonly (svn_stream_t **stream, const char *path, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Create a stream to read the file at path. More... | |
svn_error_t * | svn_stream_open_writable (svn_stream_t **stream, const char *path, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Create a stream to write a file at path. More... | |
svn_error_t * | svn_stream_open_unique (svn_stream_t **stream, const char **temp_path, const char *dirpath, svn_io_file_del_t delete_when, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Create a writable stream to a file in the directory dirpath. More... | |
svn_stream_t * | svn_stream_from_aprfile2 (apr_file_t *file, svn_boolean_t disown, apr_pool_t *pool) |
Create a stream from an APR file. More... | |
svn_stream_t * | svn_stream_from_aprfile (apr_file_t *file, apr_pool_t *pool) |
Similar to svn_stream_from_aprfile2(), except that the file will always be disowned. More... | |
svn_error_t * | svn_stream_for_stdin2 (svn_stream_t **in, svn_boolean_t buffered, apr_pool_t *pool) |
Set *in to a generic stream connected to stdin, allocated in pool. More... | |
svn_error_t * | svn_stream_for_stdin (svn_stream_t **in, apr_pool_t *pool) |
Similar to svn_stream_for_stdin2(), but with buffering being disabled. More... | |
svn_error_t * | svn_stream_for_stderr (svn_stream_t **err, apr_pool_t *pool) |
Set *err to a generic stream connected to stderr, allocated in pool. More... | |
svn_error_t * | svn_stream_for_stdout (svn_stream_t **out, apr_pool_t *pool) |
Set *out to a generic stream connected to stdout, allocated in pool. More... | |
svn_error_t * | svn_stringbuf_from_stream (svn_stringbuf_t **result, svn_stream_t *stream, apr_size_t len_hint, apr_pool_t *result_pool) |
Read the contents of stream into memory, from its current position to its end, returning the data in *result. More... | |
svn_stream_t * | svn_stream_from_stringbuf (svn_stringbuf_t *str, apr_pool_t *pool) |
Return a generic stream connected to stringbuf str. More... | |
svn_stream_t * | svn_stream_from_string (const svn_string_t *str, apr_pool_t *pool) |
Return a generic read-only stream connected to string str. More... | |
svn_stream_t * | svn_stream_buffered (apr_pool_t *result_pool) |
Return a generic stream which implements buffered reads and writes. More... | |
svn_stream_t * | svn_stream_compressed (svn_stream_t *stream, apr_pool_t *pool) |
Return a stream that decompresses all data read and compresses all data written. More... | |
svn_stream_t * | svn_stream_checksummed2 (svn_stream_t *stream, svn_checksum_t **read_checksum, svn_checksum_t **write_checksum, svn_checksum_kind_t checksum_kind, svn_boolean_t read_all, apr_pool_t *pool) |
Return a stream that calculates checksums for all data read and written. More... | |
svn_stream_t * | svn_stream_checksummed (svn_stream_t *stream, const unsigned char **read_digest, const unsigned char **write_digest, svn_boolean_t read_all, apr_pool_t *pool) |
Similar to svn_stream_checksummed2(), but always returning the MD5 checksum in read_digest and write_digest. More... | |
svn_error_t * | svn_stream_contents_checksum (svn_checksum_t **checksum, svn_stream_t *stream, svn_checksum_kind_t kind, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Read the contents of the readable stream stream and return its checksum of type kind in *checksum. More... | |
svn_error_t * | svn_stream_read_full (svn_stream_t *stream, char *buffer, apr_size_t *len) |
Read from a generic stream until buffer is filled upto *len or until EOF is reached. More... | |
svn_boolean_t | svn_stream_supports_partial_read (svn_stream_t *stream) |
Returns TRUE if the generic stream supports svn_stream_read2(). More... | |
svn_error_t * | svn_stream_read2 (svn_stream_t *stream, char *buffer, apr_size_t *len) |
Read all currently available upto *len into buffer. More... | |
svn_error_t * | svn_stream_read (svn_stream_t *stream, char *buffer, apr_size_t *len) |
Read from a generic stream until the buffer is completely filled or EOF. More... | |
svn_error_t * | svn_stream_skip (svn_stream_t *stream, apr_size_t len) |
Skip len bytes from a generic stream. More... | |
svn_error_t * | svn_stream_write (svn_stream_t *stream, const char *data, apr_size_t *len) |
Write to a generic stream. More... | |
svn_error_t * | svn_stream_close (svn_stream_t *stream) |
Close a generic stream. More... | |
svn_error_t * | svn_stream_reset (svn_stream_t *stream) |
Reset a generic stream back to its origin. More... | |
svn_boolean_t | svn_stream_supports_mark (svn_stream_t *stream) |
Returns TRUE if the generic stream supports svn_stream_mark(). More... | |
svn_boolean_t | svn_stream_supports_reset (svn_stream_t *stream) |
Returns TRUE if the generic stream supports svn_stream_reset(). More... | |
svn_error_t * | svn_stream_mark (svn_stream_t *stream, svn_stream_mark_t **mark, apr_pool_t *pool) |
Set a mark at the current position of a generic stream, which can later be sought back to using svn_stream_seek(). More... | |
svn_error_t * | svn_stream_seek (svn_stream_t *stream, const svn_stream_mark_t *mark) |
Seek to a mark in a generic stream. More... | |
svn_error_t * | svn_stream_data_available (svn_stream_t *stream, svn_boolean_t *data_available) |
When a stream supports polling for available data, obtain a boolean indicating whether data is waiting to be read. More... | |
svn_stream_t * | svn_stream_tee (svn_stream_t *out1, svn_stream_t *out2, apr_pool_t *pool) |
Return a writable stream which, when written to, writes to both of the underlying streams. More... | |
svn_error_t * | svn_stream_puts (svn_stream_t *stream, const char *str) |
Write NULL-terminated string str to stream. More... | |
svn_error_t * | svn_stream_printf (svn_stream_t *stream, apr_pool_t *pool, const char *fmt,...) |
Write to stream using a printf-style fmt specifier, passed through apr_psprintf() using memory from pool. | |
svn_error_t * | svn_stream_printf_from_utf8 (svn_stream_t *stream, const char *encoding, apr_pool_t *pool, const char *fmt,...) |
Write to stream using a printf-style fmt specifier, passed through apr_psprintf() using memory from pool. More... | |
svn_error_t * | svn_stream_readline (svn_stream_t *stream, svn_stringbuf_t **stringbuf, const char *eol, svn_boolean_t *eof, apr_pool_t *pool) |
Allocate *stringbuf in pool, and read into it one line (terminated by eol) from stream. More... | |
svn_error_t * | svn_stream_copy3 (svn_stream_t *from, svn_stream_t *to, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Read the contents of the readable stream from and write them to the writable stream to calling cancel_func before copying each chunk. More... | |
svn_error_t * | svn_stream_copy2 (svn_stream_t *from, svn_stream_t *to, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Same as svn_stream_copy3() but the streams are not closed. More... | |
svn_error_t * | svn_stream_copy (svn_stream_t *from, svn_stream_t *to, apr_pool_t *pool) |
Same as svn_stream_copy3(), but without the cancellation function or stream closing. More... | |
svn_error_t * | svn_stream_contents_same2 (svn_boolean_t *same, svn_stream_t *stream1, svn_stream_t *stream2, apr_pool_t *pool) |
Set *same to TRUE if stream1 and stream2 have the same contents, else set it to FALSE. More... | |
svn_error_t * | svn_stream_contents_same (svn_boolean_t *same, svn_stream_t *stream1, svn_stream_t *stream2, apr_pool_t *pool) |
Same as svn_stream_contents_same2(), but the streams will not be closed. More... | |
svn_error_t * | svn_string_from_stream2 (svn_string_t **result, svn_stream_t *stream, apr_size_t len_hint, apr_pool_t *result_pool) |
Read the contents of stream into memory, from its current position to its end, returning the data in *result. More... | |
svn_error_t * | svn_string_from_stream (svn_string_t **result, svn_stream_t *stream, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Similar to svn_string_from_stream2(), but always passes 0 for len_hint. More... | |
svn_stream_t * | svn_stream_lazyopen_create (svn_stream_lazyopen_func_t open_func, void *open_baton, svn_boolean_t open_on_close, apr_pool_t *result_pool) |
Return a generic stream which wraps another primary stream, delaying the "opening" of that stream until the first time the returned stream is accessed. More... | |
svn_error_t * | svn_stringbuf_from_file2 (svn_stringbuf_t **result, const char *filename, apr_pool_t *pool) |
Set *result to a string containing the contents of filename, which is either "-" (indicating that stdin should be read) or the utf8-encoded path of a real file. More... | |
svn_error_t * | svn_stringbuf_from_file (svn_stringbuf_t **result, const char *filename, apr_pool_t *pool) |
Similar to svn_stringbuf_from_file2(), except that if filename is "-", return the error SVN_ERR_UNSUPPORTED_FEATURE and don't touch *result. More... | |
svn_error_t * | svn_stringbuf_from_aprfile (svn_stringbuf_t **result, apr_file_t *file, apr_pool_t *pool) |
Sets *result to a string containing the contents of the already opened file. More... | |
svn_error_t * | svn_io_remove_file2 (const char *path, svn_boolean_t ignore_enoent, apr_pool_t *scratch_pool) |
Remove file path, a utf8-encoded path. More... | |
svn_error_t * | svn_io_remove_file (const char *path, apr_pool_t *pool) |
Similar to svn_io_remove_file2(), except with ignore_enoent set to FALSE. More... | |
svn_error_t * | svn_io_remove_dir2 (const char *path, svn_boolean_t ignore_enoent, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool) |
Recursively remove directory path. More... | |
svn_error_t * | svn_io_remove_dir (const char *path, apr_pool_t *pool) |
Similar to svn_io_remove_dir2(), but with ignore_enoent set to FALSE and cancel_func and cancel_baton set to NULL . More... | |
svn_error_t * | svn_io_get_dir_filenames (apr_hash_t **dirents, const char *path, apr_pool_t *pool) |
Read all of the disk entries in directory path, a utf8-encoded path. More... | |
svn_error_t * | svn_io_get_dirents3 (apr_hash_t **dirents, const char *path, svn_boolean_t only_check_type, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Read all of the disk entries in directory path, a utf8-encoded path. More... | |
svn_error_t * | svn_io_get_dirents2 (apr_hash_t **dirents, const char *path, apr_pool_t *pool) |
Similar to svn_io_get_dirents3, but returns a mapping to svn_io_dirent_t structures instead of svn_io_dirent2_t and with only a single pool. More... | |
svn_error_t * | svn_io_get_dirents (apr_hash_t **dirents, const char *path, apr_pool_t *pool) |
Similar to svn_io_get_dirents2(), but *dirents is a hash table with svn_node_kind_t values. More... | |
svn_error_t * | svn_io_stat_dirent2 (const svn_io_dirent2_t **dirent_p, const char *path, svn_boolean_t verify_truename, svn_boolean_t ignore_enoent, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Create a svn_io_dirent2_t instance for path. More... | |
svn_error_t * | svn_io_stat_dirent (const svn_io_dirent2_t **dirent_p, const char *path, svn_boolean_t ignore_enoent, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Similar to svn_io_stat_dirent2(), but always passes FALSE for verify_truename. More... | |
svn_error_t * | svn_io_dir_walk2 (const char *dirname, apr_int32_t wanted, svn_io_walk_func_t walk_func, void *walk_baton, apr_pool_t *pool) |
Recursively walk the directory rooted at dirname, a utf8-encoded path, invoking walk_func (with walk_baton) for each item in the tree. More... | |
svn_error_t * | svn_io_dir_walk (const char *dirname, apr_int32_t wanted, svn_io_walk_func_t walk_func, void *walk_baton, apr_pool_t *pool) |
Similar to svn_io_dir_walk(), but only calls walk_func for files of type APR_DIR (directory) and APR_REG (regular file). More... | |
svn_error_t * | svn_io_start_cmd3 (apr_proc_t *cmd_proc, const char *path, const char *cmd, const char *const *args, const char *const *env, svn_boolean_t inherit, svn_boolean_t infile_pipe, apr_file_t *infile, svn_boolean_t outfile_pipe, apr_file_t *outfile, svn_boolean_t errfile_pipe, apr_file_t *errfile, apr_pool_t *pool) |
Start cmd with args, using utf8-encoded path as working directory. More... | |
svn_error_t * | svn_io_start_cmd2 (apr_proc_t *cmd_proc, const char *path, const char *cmd, const char *const *args, svn_boolean_t inherit, svn_boolean_t infile_pipe, apr_file_t *infile, svn_boolean_t outfile_pipe, apr_file_t *outfile, svn_boolean_t errfile_pipe, apr_file_t *errfile, apr_pool_t *pool) |
Similar to svn_io_start_cmd3() but with env always set to NULL. More... | |
svn_error_t * | svn_io_start_cmd (apr_proc_t *cmd_proc, const char *path, const char *cmd, const char *const *args, svn_boolean_t inherit, apr_file_t *infile, apr_file_t *outfile, apr_file_t *errfile, apr_pool_t *pool) |
Similar to svn_io_start_cmd2() but with infile_pipe, outfile_pipe, and errfile_pipe always FALSE. More... | |
svn_error_t * | svn_io_wait_for_cmd (apr_proc_t *cmd_proc, const char *cmd, int *exitcode, apr_exit_why_e *exitwhy, apr_pool_t *pool) |
Wait for the process *cmd_proc to complete and optionally retrieve its exit code. More... | |
svn_error_t * | svn_io_run_cmd (const char *path, const char *cmd, const char *const *args, int *exitcode, apr_exit_why_e *exitwhy, svn_boolean_t inherit, apr_file_t *infile, apr_file_t *outfile, apr_file_t *errfile, apr_pool_t *pool) |
Run a command to completion, by first calling svn_io_start_cmd() and then calling svn_io_wait_for_cmd(). More... | |
svn_error_t * | svn_io_run_diff2 (const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *exitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool) |
Invoke the configured diff program, with user_args (an array of utf8-encoded num_user_args arguments) if they are specified (that is, if user_args is non-NULL), or "-u" if they are not. More... | |
svn_error_t * | svn_io_run_diff (const char *dir, const char *const *user_args, int num_user_args, const char *label1, const char *label2, const char *from, const char *to, int *exitcode, apr_file_t *outfile, apr_file_t *errfile, const char *diff_cmd, apr_pool_t *pool) |
Similar to svn_io_run_diff2() but with diff_cmd encoded in internal encoding used by APR. More... | |
svn_error_t * | svn_io_run_diff3_3 (int *exitcode, const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, const char *diff3_cmd, const apr_array_header_t *user_args, apr_pool_t *pool) |
Invoke the configured diff3 program, in utf8-encoded dir like this: More... | |
svn_error_t * | svn_io_run_diff3_2 (int *exitcode, const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, const char *diff3_cmd, const apr_array_header_t *user_args, apr_pool_t *pool) |
Similar to svn_io_run_diff3_3(), but with diff3_cmd encoded in internal encoding used by APR. More... | |
svn_error_t * | svn_io_run_diff3 (const char *dir, const char *mine, const char *older, const char *yours, const char *mine_label, const char *older_label, const char *yours_label, apr_file_t *merged, int *exitcode, const char *diff3_cmd, apr_pool_t *pool) |
Similar to svn_io_run_diff3_2(), but with user_args set to NULL . More... | |
svn_error_t * | svn_io_parse_mimetypes_file (apr_hash_t **type_map, const char *mimetypes_file, apr_pool_t *pool) |
Parse utf8-encoded mimetypes_file as a MIME types file (such as is provided with Apache HTTP Server), and set *type_map to a hash mapping const char * filename extensions to const char * MIME types. More... | |
svn_error_t * | svn_io_detect_mimetype2 (const char **mimetype, const char *file, apr_hash_t *mimetype_map, apr_pool_t *pool) |
Examine utf8-encoded file to determine if it can be described by a known (as in, known by this function) Multipurpose Internet Mail Extension (MIME) type. More... | |
svn_error_t * | svn_io_detect_mimetype (const char **mimetype, const char *file, apr_pool_t *pool) |
Like svn_io_detect_mimetype2, but with mimetypes_map set to NULL . More... | |
svn_boolean_t | svn_io_is_binary_data (const void *buf, apr_size_t len) |
Examine up to len bytes of data in buf to determine if the can be considered binary data, in which case return TRUE. More... | |
svn_error_t * | svn_io_file_open (apr_file_t **new_file, const char *fname, apr_int32_t flag, apr_fileperms_t perm, apr_pool_t *pool) |
Wrapper for apr_file_open(). More... | |
svn_error_t * | svn_io_file_close (apr_file_t *file, apr_pool_t *pool) |
Wrapper for apr_file_close(). | |
svn_error_t * | svn_io_file_getc (char *ch, apr_file_t *file, apr_pool_t *pool) |
Wrapper for apr_file_getc(). | |
svn_error_t * | svn_io_file_putc (char ch, apr_file_t *file, apr_pool_t *pool) |
Wrapper for apr_file_putc(). More... | |
svn_error_t * | svn_io_file_info_get (apr_finfo_t *finfo, apr_int32_t wanted, apr_file_t *file, apr_pool_t *pool) |
Wrapper for apr_file_info_get(). | |
svn_error_t * | svn_io_file_size_get (svn_filesize_t *filesize_p, apr_file_t *file, apr_pool_t *pool) |
Set *filesize_p to the size of file. More... | |
svn_error_t * | svn_io_file_get_offset (apr_off_t *offset_p, apr_file_t *file, apr_pool_t *pool) |
Fetch the current offset of file into *offset_p. More... | |
svn_error_t * | svn_io_file_read (apr_file_t *file, void *buf, apr_size_t *nbytes, apr_pool_t *pool) |
Wrapper for apr_file_read(). | |
svn_error_t * | svn_io_file_read_full2 (apr_file_t *file, void *buf, apr_size_t nbytes, apr_size_t *bytes_read, svn_boolean_t *hit_eof, apr_pool_t *pool) |
Wrapper for apr_file_read_full(). More... | |
svn_error_t * | svn_io_file_read_full (apr_file_t *file, void *buf, apr_size_t nbytes, apr_size_t *bytes_read, apr_pool_t *pool) |
Similar to svn_io_file_read_full2 with hit_eof being set to NULL . More... | |
svn_error_t * | svn_io_file_seek (apr_file_t *file, apr_seek_where_t where, apr_off_t *offset, apr_pool_t *pool) |
Wrapper for apr_file_seek(). | |
svn_error_t * | svn_io_file_aligned_seek (apr_file_t *file, apr_off_t block_size, apr_off_t *buffer_start, apr_off_t offset, apr_pool_t *scratch_pool) |
Set the file pointer of the #APR_BUFFERED file to offset. More... | |
svn_error_t * | svn_io_file_write (apr_file_t *file, const void *buf, apr_size_t *nbytes, apr_pool_t *pool) |
Wrapper for apr_file_write(). | |
svn_error_t * | svn_io_file_flush (apr_file_t *file, apr_pool_t *scratch_pool) |
Wrapper for apr_file_flush(). More... | |
svn_error_t * | svn_io_file_write_full (apr_file_t *file, const void *buf, apr_size_t nbytes, apr_size_t *bytes_written, apr_pool_t *pool) |
Wrapper for apr_file_write_full(). | |
svn_error_t * | svn_io_write_atomic2 (const char *final_path, const void *buf, apr_size_t nbytes, const char *copy_perms_path, svn_boolean_t flush_to_disk, apr_pool_t *scratch_pool) |
Writes nbytes bytes from *buf to a temporary file inside the same directory as *final_path. More... | |
svn_error_t * | svn_io_write_atomic (const char *final_path, const void *buf, apr_size_t nbytes, const char *copy_perms_path, apr_pool_t *scratch_pool) |
Similar to svn_io_write_atomic2(), but with flush_to_disk set to TRUE . More... | |
svn_error_t * | svn_io_write_unique (const char **tmp_path, const char *dirpath, const void *buf, apr_size_t nbytes, svn_io_file_del_t delete_when, apr_pool_t *pool) |
Open a unique file in dirpath, and write nbytes from buf to the file before flushing it to disk and closing it. More... | |
svn_error_t * | svn_io_file_trunc (apr_file_t *file, apr_off_t offset, apr_pool_t *pool) |
Wrapper for apr_file_trunc(). More... | |
svn_error_t * | svn_io_stat (apr_finfo_t *finfo, const char *fname, apr_int32_t wanted, apr_pool_t *pool) |
Wrapper for apr_stat(). More... | |
svn_error_t * | svn_io_file_rename2 (const char *from_path, const char *to_path, svn_boolean_t flush_to_disk, apr_pool_t *pool) |
Rename and/or move the node (not necessarily a regular file) at from_path to a new path to_path within the same filesystem. More... | |
svn_error_t * | svn_io_file_rename (const char *from_path, const char *to_path, apr_pool_t *pool) |
Similar to svn_io_file_rename2(), but with flush_to_disk set to FALSE . More... | |
svn_error_t * | svn_io_file_move (const char *from_path, const char *to_path, apr_pool_t *pool) |
Move the file from from_path to to_path, even across device boundaries. More... | |
svn_error_t * | svn_io_dir_make (const char *path, apr_fileperms_t perm, apr_pool_t *pool) |
Wrapper for apr_dir_make(). More... | |
svn_error_t * | svn_io_dir_make_hidden (const char *path, apr_fileperms_t perm, apr_pool_t *pool) |
Same as svn_io_dir_make(), but sets the hidden attribute on the directory on systems that support it. | |
svn_error_t * | svn_io_dir_make_sgid (const char *path, apr_fileperms_t perm, apr_pool_t *pool) |
Same as svn_io_dir_make(), but attempts to set the sgid on the directory on systems that support it. More... | |
svn_error_t * | svn_io_dir_open (apr_dir_t **new_dir, const char *dirname, apr_pool_t *pool) |
Wrapper for apr_dir_open(). More... | |
svn_error_t * | svn_io_dir_close (apr_dir_t *thedir) |
Wrapper for apr_dir_close(). More... | |
svn_error_t * | svn_io_dir_remove_nonrecursive (const char *dirname, apr_pool_t *pool) |
Wrapper for apr_dir_remove(). More... | |
svn_error_t * | svn_io_dir_read (apr_finfo_t *finfo, apr_int32_t wanted, apr_dir_t *thedir, apr_pool_t *pool) |
Wrapper for apr_dir_read(). More... | |
svn_error_t * | svn_io_file_name_get (const char **filename, apr_file_t *file, apr_pool_t *pool) |
Wrapper for apr_file_name_get(). More... | |
svn_error_t * | svn_io_read_version_file (int *version, const char *path, apr_pool_t *pool) |
Set *version to the integer that starts the file at path. More... | |
svn_error_t * | svn_io_write_version_file (const char *path, int version, apr_pool_t *pool) |
Create (or overwrite) the file at path with new contents, formatted as a non-negative integer version followed by a single newline. More... | |
svn_error_t * | svn_io_file_readline (apr_file_t *file, svn_stringbuf_t **stringbuf, const char **eol, svn_boolean_t *eof, apr_size_t max_len, apr_pool_t *result_pool, apr_pool_t *scratch_pool) |
Read a line of text from a file, up to a specified length. More... | |
General file I/O for Subversion.
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations
Definition in file svn_io.h.
typedef struct svn_io_dirent2_t svn_io_dirent2_t |
A set of directory entry data elements as returned by svn_io_get_dirents.
Note that the first two fields are exactly identical to svn_io_dirent_t to allow returning a svn_io_dirent2_t as a svn_io_dirent_t.
Use svn_io_dirent2_create() to create new svn_dirent2_t instances or svn_io_dirent2_dup() to duplicate an existing instance.
typedef struct svn_io_dirent_t svn_io_dirent_t |
Represents the kind and special status of a directory entry.
Note that the first two fields are exactly identical to svn_io_dirent2_t to allow returning a svn_io_dirent2_t as a svn_io_dirent_t.
typedef enum svn_io_file_del_t svn_io_file_del_t |
Used as an argument when creating temporary files to indicate when a file should be removed.
Not specifying any of these means no removal at all.
enum svn_io_file_del_t |
Used as an argument when creating temporary files to indicate when a file should be removed.
Not specifying any of these means no removal at all.
Enumerator | |
---|---|
svn_io_file_del_none | No deletion ever. |
svn_io_file_del_on_close | Remove when the file is closed. |
svn_io_file_del_on_pool_cleanup | Remove when the associated pool is cleared. |
svn_error_t* svn_io_append_file | ( | const char * | src, |
const char * | dst, | ||
apr_pool_t * | pool | ||
) |
Append src to dst.
dst will be appended to if it exists, else it will be created. Both src and dst are utf8-encoded.
svn_error_t* svn_io_check_path | ( | const char * | path, |
svn_node_kind_t * | kind, | ||
apr_pool_t * | pool | ||
) |
Determine the kind of path.
path should be UTF-8 encoded.
If path is a file, set *kind to svn_node_file.
If path is a directory, set *kind to svn_node_dir.
If path does not exist, set *kind to svn_node_none.
If path exists but is none of the above, set *kind to svn_node_unknown.
If path is not a valid pathname, set *kind to svn_node_none. If unable to determine path's kind for any other reason, return an error, with *kind's value undefined.
Use pool for temporary allocations.
svn_error_t* svn_io_check_resolved_path | ( | const char * | path, |
svn_node_kind_t * | kind, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_check_path(), but resolve symlinks.
This returns the same varieties of kind as svn_io_check_path().
svn_error_t* svn_io_check_special_path | ( | const char * | path, |
svn_node_kind_t * | kind, | ||
svn_boolean_t * | is_special, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_check_path(), but also set *is_special to TRUE
if the path is not a normal file.
svn_error_t* svn_io_copy_dir_recursively | ( | const char * | src, |
const char * | dst_parent, | ||
const char * | dst_basename, | ||
svn_boolean_t | copy_perms, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Recursively copy directory src into dst_parent, as a new entry named dst_basename.
If dst_basename already exists in dst_parent, return error. copy_perms will be passed through to svn_io_copy_file() when any files are copied. src, dst_parent, and dst_basename are all utf8-encoded.
If cancel_func is non-NULL, invoke it with cancel_baton at various points during the operation. If it returns any error (typically SVN_ERR_CANCELLED), return that error immediately.
svn_error_t* svn_io_copy_file | ( | const char * | src, |
const char * | dst, | ||
svn_boolean_t | copy_perms, | ||
apr_pool_t * | pool | ||
) |
Copy src to dst atomically, in a "byte-for-byte" manner.
Overwrite dst if it exists, else create it. Both src and dst are utf8-encoded filenames. If copy_perms is TRUE, set dst's permissions to match those of src.
svn_error_t* svn_io_copy_link | ( | const char * | src, |
const char * | dst, | ||
apr_pool_t * | pool | ||
) |
Copy symbolic link src to dst atomically.
Overwrite dst if it exists, else create it. Both src and dst are utf8-encoded filenames. After copying, the dst link will point to the same thing src does.
svn_error_t* svn_io_copy_perms | ( | const char * | src, |
const char * | dst, | ||
apr_pool_t * | pool | ||
) |
Copy permission flags from src onto the file at dst.
Both filenames are utf8-encoded filenames.
svn_error_t* svn_io_create_unique_link | ( | const char ** | unique_name_p, |
const char * | path, | ||
const char * | dest, | ||
const char * | suffix, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_open_unique_file(), except that instead of creating a file, a symlink is generated that references the path dest.
svn_error_t* svn_io_detect_mimetype | ( | const char ** | mimetype, |
const char * | file, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_detect_mimetype2, but with mimetypes_map set to NULL
.
svn_error_t* svn_io_detect_mimetype2 | ( | const char ** | mimetype, |
const char * | file, | ||
apr_hash_t * | mimetype_map, | ||
apr_pool_t * | pool | ||
) |
Examine utf8-encoded file to determine if it can be described by a known (as in, known by this function) Multipurpose Internet Mail Extension (MIME) type.
If so, set *mimetype to a character string describing the MIME type, else set it to NULL
.
If not NULL
, mimetype_map is a hash mapping const char *
filename extensions to const char *
MIME types, and is the first source consulted regarding file's MIME type.
Use pool for any necessary allocations.
svn_error_t* svn_io_dir_close | ( | apr_dir_t * | thedir | ) |
Wrapper for apr_dir_close().
svn_error_t* svn_io_dir_empty | ( | svn_boolean_t * | is_empty_p, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Set *is_empty_p to TRUE
if directory path is empty, else to FALSE
if it is not empty.
path must be a directory, and is utf8-encoded. Use pool for temporary allocation.
svn_error_t* svn_io_dir_file_copy | ( | const char * | src_path, |
const char * | dest_path, | ||
const char * | file, | ||
apr_pool_t * | pool | ||
) |
Copy the file whose basename (or relative path) is file within directory src_path to the same basename (or relative path) within directory dest_path.
Overwrite the destination file if it already exists. The destination directory (including any directory components in name) must already exist. Set the destination file's permissions to match those of the source. Use pool for memory allocations.
svn_error_t* svn_io_dir_make | ( | const char * | path, |
apr_fileperms_t | perm, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_dir_make().
path is utf8-encoded.
svn_error_t* svn_io_dir_make_sgid | ( | const char * | path, |
apr_fileperms_t | perm, | ||
apr_pool_t * | pool | ||
) |
Same as svn_io_dir_make(), but attempts to set the sgid on the directory on systems that support it.
Does not return an error if the attempt to set the sgid bit fails. On Unix filesystems, setting the sgid bit on a directory ensures that files and subdirectories created within inherit group ownership from the parent instead of from the primary gid.
svn_error_t* svn_io_dir_open | ( | apr_dir_t ** | new_dir, |
const char * | dirname, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_dir_open().
dirname is utf8-encoded.
svn_error_t* svn_io_dir_read | ( | apr_finfo_t * | finfo, |
apr_int32_t | wanted, | ||
apr_dir_t * | thedir, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_dir_read().
Ensures that finfo->name is utf8-encoded, which means allocating finfo->name in pool, which may or may not be the same as finfo's pool. Use pool for error allocation as well.
svn_error_t* svn_io_dir_remove_nonrecursive | ( | const char * | dirname, |
apr_pool_t * | pool | ||
) |
Wrapper for apr_dir_remove().
dirname is utf8-encoded.
svn_error_t* svn_io_dir_walk | ( | const char * | dirname, |
apr_int32_t | wanted, | ||
svn_io_walk_func_t | walk_func, | ||
void * | walk_baton, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_dir_walk(), but only calls walk_func for files of type APR_DIR (directory) and APR_REG (regular file).
svn_error_t* svn_io_dir_walk2 | ( | const char * | dirname, |
apr_int32_t | wanted, | ||
svn_io_walk_func_t | walk_func, | ||
void * | walk_baton, | ||
apr_pool_t * | pool | ||
) |
Recursively walk the directory rooted at dirname, a utf8-encoded path, invoking walk_func (with walk_baton) for each item in the tree.
For a given directory, invoke walk_func on the directory itself before invoking it on any children thereof.
Deliver to walk_func the information specified by wanted, which is a combination of APR_FINFO_*
flags, plus the information specified by APR_FINFO_TYPE
and APR_FINFO_NAME
.
Use pool for all allocations.
svn_io_dirent2_t* svn_io_dirent2_create | ( | apr_pool_t * | result_pool | ) |
Creates a new svn_io_dirent2_t structure.
svn_io_dirent2_t* svn_io_dirent2_dup | ( | const svn_io_dirent2_t * | item, |
apr_pool_t * | result_pool | ||
) |
Duplicates a svn_io_dirent2_t
structure into result_pool.
svn_error_t* svn_io_file_affected_time | ( | apr_time_t * | apr_time, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Set *apr_time to the time of last modification of the contents of the file path.
path is utf8-encoded.
svn_error_t* svn_io_file_aligned_seek | ( | apr_file_t * | file, |
apr_off_t | block_size, | ||
apr_off_t * | buffer_start, | ||
apr_off_t | offset, | ||
apr_pool_t * | scratch_pool | ||
) |
Set the file pointer of the #APR_BUFFERED file to offset.
In contrast to svn_io_file_seek, this function will attempt to resize the internal data buffer to block_size bytes and to read data aligned to multiples of that value. The beginning of the block will be returned in buffer_start, if that is not NULL. Uses scratch_pool for temporary allocations.
svn_error_t* svn_io_file_checksum | ( | unsigned char | digest[], |
const char * | file, | ||
apr_pool_t * | pool | ||
) |
Put the md5 checksum of file into digest.
digest points to APR_MD5_DIGESTSIZE
bytes of storage. Use pool only for temporary allocations.
svn_error_t* svn_io_file_checksum2 | ( | svn_checksum_t ** | checksum, |
const char * | file, | ||
svn_checksum_kind_t | kind, | ||
apr_pool_t * | pool | ||
) |
Return in *checksum the checksum of type kind of file Use pool for temporary allocations and to allocate *checksum.
svn_error_t* svn_io_file_create | ( | const char * | file, |
const char * | contents, | ||
apr_pool_t * | pool | ||
) |
Create a file at utf8-encoded path file with the contents given by the null-terminated string contents.
file must not already exist. If an error occurs while writing or closing the file, attempt to delete the file before returning the error.
Write the data in 'binary' mode (#APR_FOPEN_BINARY). If contents is NULL
, create an empty file.
Use pool for memory allocations.
svn_error_t* svn_io_file_create_bytes | ( | const char * | file, |
const void * | contents, | ||
apr_size_t | length, | ||
apr_pool_t * | scratch_pool | ||
) |
Create a file at utf8-encoded path file with the contents given by contents of length bytes.
file must not already exist. If an error occurs while writing or closing the file, attempt to delete the file before returning the error.
Write the data in 'binary' mode (#APR_FOPEN_BINARY). If length is zero, create an empty file; in this case contents may be NULL
.
Use scratch_pool for temporary allocations.
svn_error_t* svn_io_file_create_empty | ( | const char * | file, |
apr_pool_t * | scratch_pool | ||
) |
Create an empty file at utf8-encoded path file.
file must not already exist. If an error occurs while closing the file, attempt to delete the file before returning the error.
Use scratch_pool for temporary allocations.
svn_error_t* svn_io_file_flush | ( | apr_file_t * | file, |
apr_pool_t * | scratch_pool | ||
) |
Wrapper for apr_file_flush().
svn_error_t* svn_io_file_flush_to_disk | ( | apr_file_t * | file, |
apr_pool_t * | pool | ||
) |
Flush any unwritten data from file to disk.
Use pool for memory allocations.
svn_error_t* svn_io_file_get_offset | ( | apr_off_t * | offset_p, |
apr_file_t * | file, | ||
apr_pool_t * | pool | ||
) |
Fetch the current offset of file into *offset_p.
Use pool for temporary allocations.
svn_error_t* svn_io_file_lock | ( | const char * | lock_file, |
svn_boolean_t | exclusive, | ||
apr_pool_t * | pool | ||
) |
Lock file at lock_file.
If exclusive is TRUE, obtain exclusive lock, otherwise obtain shared lock. Lock will be automatically released when pool is cleared or destroyed. Use pool for memory allocations.
svn_error_t* svn_io_file_lock2 | ( | const char * | lock_file, |
svn_boolean_t | exclusive, | ||
svn_boolean_t | nonblocking, | ||
apr_pool_t * | pool | ||
) |
Lock file at lock_file.
If exclusive is TRUE, obtain exclusive lock, otherwise obtain shared lock.
If nonblocking is TRUE, do not wait for the lock if it is not available: throw an error instead.
Lock will be automatically released when pool is cleared or destroyed. Use pool for memory allocations.
svn_error_t* svn_io_file_move | ( | const char * | from_path, |
const char * | to_path, | ||
apr_pool_t * | pool | ||
) |
Move the file from from_path to to_path, even across device boundaries.
Overwrite to_path if it exists.
svn_error_t* svn_io_file_name_get | ( | const char ** | filename, |
apr_file_t * | file, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_file_name_get().
*filename is utf8-encoded.
svn_error_t* svn_io_file_open | ( | apr_file_t ** | new_file, |
const char * | fname, | ||
apr_int32_t | flag, | ||
apr_fileperms_t | perm, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_file_open().
fname is utf8-encoded. Always passed flag | APR_BINARY to apr.
svn_error_t* svn_io_file_putc | ( | char | ch, |
apr_file_t * | file, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_file_putc().
svn_error_t* svn_io_file_read_full | ( | apr_file_t * | file, |
void * | buf, | ||
apr_size_t | nbytes, | ||
apr_size_t * | bytes_read, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_file_read_full2 with hit_eof being set to NULL
.
svn_error_t* svn_io_file_read_full2 | ( | apr_file_t * | file, |
void * | buf, | ||
apr_size_t | nbytes, | ||
apr_size_t * | bytes_read, | ||
svn_boolean_t * | hit_eof, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_file_read_full().
If hit_eof is not NULL, EOF will be indicated there and no svn_error_t error object will be created upon EOF.
svn_error_t* svn_io_file_rename | ( | const char * | from_path, |
const char * | to_path, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_file_rename2(), but with flush_to_disk set to FALSE
.
svn_error_t* svn_io_file_rename2 | ( | const char * | from_path, |
const char * | to_path, | ||
svn_boolean_t | flush_to_disk, | ||
apr_pool_t * | pool | ||
) |
Rename and/or move the node (not necessarily a regular file) at from_path to a new path to_path within the same filesystem.
In some cases, an existing node at to_path will be overwritten.
from_path and to_path are utf8-encoded. If flush_to_disk is non-zero, do not return until the node has actually been moved on the disk.
svn_error_t* svn_io_file_size_get | ( | svn_filesize_t * | filesize_p, |
apr_file_t * | file, | ||
apr_pool_t * | pool | ||
) |
Set *filesize_p to the size of file.
Use pool for temporary allocations.
svn_error_t* svn_io_file_trunc | ( | apr_file_t * | file, |
apr_off_t | offset, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_file_trunc().
svn_error_t* svn_io_files_contents_same_p | ( | svn_boolean_t * | same, |
const char * | file1, | ||
const char * | file2, | ||
apr_pool_t * | pool | ||
) |
Set *same to TRUE if file1 and file2 have the same contents, else set it to FALSE.
Use pool for temporary allocations.
svn_error_t* svn_io_files_contents_three_same_p | ( | svn_boolean_t * | same12, |
svn_boolean_t * | same23, | ||
svn_boolean_t * | same13, | ||
const char * | file1, | ||
const char * | file2, | ||
const char * | file3, | ||
apr_pool_t * | scratch_pool | ||
) |
Set *same12 to TRUE if file1 and file2 have the same contents, else set it to FALSE.
Do the similar for *same23 with file2 and file3, and *same13 for file1 and file3. The filenames file1, file2 and file3 are utf8-encoded. Use scratch_pool for temporary allocations.
svn_error_t* svn_io_filesizes_different_p | ( | svn_boolean_t * | different_p, |
const char * | file1, | ||
const char * | file2, | ||
apr_pool_t * | pool | ||
) |
Set *different_p to TRUE if file1 and file2 have different sizes, else set to FALSE.
Both file1 and file2 are utf8-encoded.
Setting *different_p to zero does not mean the files definitely have the same size, it merely means that the sizes are not definitely different. That is, if the size of one or both files cannot be determined, then the sizes are not known to be different, so *different_p is set to FALSE.
svn_error_t* svn_io_filesizes_three_different_p | ( | svn_boolean_t * | different_p12, |
svn_boolean_t * | different_p23, | ||
svn_boolean_t * | different_p13, | ||
const char * | file1, | ||
const char * | file2, | ||
const char * | file3, | ||
apr_pool_t * | scratch_pool | ||
) |
Set *different_p12 to non-zero if file1 and file2 have different sizes, else set to zero.
Do the similar for *different_p23 with file2 and file3, and *different_p13 for file1 and file3. The filenames file1, file2 and file3 are utf8-encoded.
Setting *different_p12 to zero does not mean the files definitely have the same size, it merely means that the sizes are not definitely different. That is, if the size of one or both files cannot be determined (due to stat() returning an error), then the sizes are not known to be different, so *different_p12 is set to 0.
svn_error_t* svn_io_get_dir_filenames | ( | apr_hash_t ** | dirents, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Read all of the disk entries in directory path, a utf8-encoded path.
Set *dirents to a hash mapping dirent names (char *
) to undefined non-NULL values, allocated in pool.
svn_error_t* svn_io_get_dirents | ( | apr_hash_t ** | dirents, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_get_dirents2(), but *dirents is a hash table with svn_node_kind_t values.
svn_error_t* svn_io_get_dirents2 | ( | apr_hash_t ** | dirents, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_get_dirents3, but returns a mapping to svn_io_dirent_t structures instead of svn_io_dirent2_t and with only a single pool.
svn_error_t* svn_io_get_dirents3 | ( | apr_hash_t ** | dirents, |
const char * | path, | ||
svn_boolean_t | only_check_type, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Read all of the disk entries in directory path, a utf8-encoded path.
Set *dirents to a hash mapping dirent names (char *
) to svn_io_dirent2_t structures, allocated in pool.
If only_check_type is set to TRUE
, only the kind and special fields of the svn_io_dirent2_t are filled.
svn_boolean_t svn_io_is_binary_data | ( | const void * | buf, |
apr_size_t | len | ||
) |
Examine up to len bytes of data in buf to determine if the can be considered binary data, in which case return TRUE.
If the data can be considered plain-text data, return FALSE.
svn_error_t* svn_io_is_file_executable | ( | svn_boolean_t * | executable, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Determine whether a file is executable by the current user.
Set *executable to TRUE
if the file path is executable by the current user, otherwise set it to FALSE
.
On Windows and on platforms without userids, always returns FALSE
.
svn_error_t* svn_io_lock_open_file | ( | apr_file_t * | lockfile_handle, |
svn_boolean_t | exclusive, | ||
svn_boolean_t | nonblocking, | ||
apr_pool_t * | pool | ||
) |
Lock the file lockfile_handle.
If exclusive is TRUE, obtain exclusive lock, otherwise obtain shared lock.
If nonblocking is TRUE, do not wait for the lock if it is not available: throw an error instead.
Lock will be automatically released when pool is cleared or destroyed. You may also explicitly call svn_io_unlock_open_file(). Use pool for memory allocations. pool must be the pool that lockfile_handle has been created in or one of its sub-pools.
svn_error_t* svn_io_make_dir_recursively | ( | const char * | path, |
apr_pool_t * | pool | ||
) |
Create directory path on the file system, creating intermediate directories as required, like mkdir -p
.
Report no error if path already exists. path is utf8-encoded.
This is essentially a wrapper for apr_dir_make_recursive(), passing APR_OS_DEFAULT
as the permissions.
svn_error_t* svn_io_open_unique_file | ( | apr_file_t ** | f, |
const char ** | unique_name_p, | ||
const char * | path, | ||
const char * | suffix, | ||
svn_boolean_t | delete_on_close, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_open_unique_file2, but can't delete on pool cleanup.
svn_error_t* svn_io_open_unique_file2 | ( | apr_file_t ** | f, |
const char ** | unique_name_p, | ||
const char * | path, | ||
const char * | suffix, | ||
svn_io_file_del_t | delete_when, | ||
apr_pool_t * | pool | ||
) |
Like svn_io_open_uniquely_named(), but takes a joined dirpath and filename, and a single pool.
svn_error_t* svn_io_open_unique_file3 | ( | apr_file_t ** | file, |
const char ** | temp_path, | ||
const char * | dirpath, | ||
svn_io_file_del_t | delete_when, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Create a writable file, with an arbitrary and unique name, in the directory dirpath.
Set *temp_path to its full path, and set *file to the file handle, both allocated from result_pool. Either file or temp_path may be NULL
. If file is NULL
, the file will be created but not open.
If dirpath is NULL
, use the path returned from svn_io_temp_dir(). (Note that when using the system-provided temp directory, it may not be possible to atomically rename the resulting file due to cross-device issues.)
The file will be deleted according to delete_when. If that is svn_io_file_del_on_pool_cleanup, it refers to result_pool. If it is svn_io_file_del_on_close and file is NULL
, the file will be deleted before this function returns.
When passing svn_io_file_del_none
please don't forget to eventually remove the temporary file to avoid filling up the system temp directory. It is often appropriate to bind the lifetime of the temporary file to the lifetime of a pool by using svn_io_file_del_on_pool_cleanup
.
Temporary allocations will be performed in scratch_pool.
svn_error_t* svn_io_open_uniquely_named | ( | apr_file_t ** | file, |
const char ** | unique_name, | ||
const char * | dirpath, | ||
const char * | filename, | ||
const char * | suffix, | ||
svn_io_file_del_t | delete_when, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Open a new file (for reading and writing) with a unique name based on utf-8 encoded filename, in the directory dirpath.
The file handle is returned in *file, and the name, which ends with suffix, is returned in *unique_name, also utf8-encoded. Either file or unique_name may be NULL
. If file is NULL
, the file will be created but not open.
The file will be deleted according to delete_when. If that is svn_io_file_del_on_pool_cleanup, it refers to result_pool.
The APR_BUFFERED
flag will always be used when opening the file.
The first attempt will just append suffix. If the result is not a unique name, then subsequent attempts will append a dot, followed by an iteration number ("2", then "3", and so on), followed by the suffix. For example, successive calls to
svn_io_open_uniquely_named(&f, &u, "tests/t1/A/D/G", "pi", ".tmp", ...)
will open
tests/t1/A/D/G/pi.tmp tests/t1/A/D/G/pi.2.tmp tests/t1/A/D/G/pi.3.tmp tests/t1/A/D/G/pi.4.tmp tests/t1/A/D/G/pi.5.tmp ...
Assuming suffix is non-empty, *unique_name will never be exactly the same as filename, even if filename does not exist.
If dirpath is NULL, then the directory returned by svn_io_temp_dir() will be used.
If filename is NULL, then "tempfile" will be used.
If suffix is NULL, then ".tmp" will be used.
Allocates *file and *unique_name in result_pool. All intermediate allocations will be performed in scratch_pool.
If no unique name can be found, SVN_ERR_IO_UNIQUE_NAMES_EXHAUSTED is the error returned.
Claim of Historical Inevitability: this function was written because
svn_error_t* svn_io_parse_mimetypes_file | ( | apr_hash_t ** | type_map, |
const char * | mimetypes_file, | ||
apr_pool_t * | pool | ||
) |
Parse utf8-encoded mimetypes_file as a MIME types file (such as is provided with Apache HTTP Server), and set *type_map to a hash mapping const char *
filename extensions to const char *
MIME types.
svn_error_t* svn_io_read_length_line | ( | apr_file_t * | file, |
char * | buf, | ||
apr_size_t * | limit, | ||
apr_pool_t * | pool | ||
) |
Read a line from file into buf, but not exceeding *limit bytes.
Does not include newline, instead '\0' is put there. Length (as in strlen) is returned in *limit. buf should be pre-allocated. file should be already opened.
When the file is out of lines, APR_EOF
will be returned.
svn_error_t* svn_io_read_link | ( | svn_string_t ** | dest, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Set *dest to the path that the symlink at path references.
Allocate the string from pool.
svn_error_t* svn_io_remove_dir | ( | const char * | path, |
apr_pool_t * | pool | ||
) |
Similar to svn_io_remove_dir2(), but with ignore_enoent set to FALSE
and cancel_func and cancel_baton set to NULL
.
svn_error_t* svn_io_remove_dir2 | ( | const char * | path, |
svn_boolean_t | ignore_enoent, | ||
svn_cancel_func_t | cancel_func, | ||
void * | cancel_baton, | ||
apr_pool_t * | pool | ||
) |
Recursively remove directory path.
path is utf8-encoded. If ignore_enoent is TRUE
, don't fail if the target directory doesn't exist. Use pool for temporary allocations.
Because recursive delete of a directory tree can be a lengthy operation, provide cancel_func and cancel_baton for interruptibility.
svn_error_t* svn_io_remove_file | ( | const char * | path, |
apr_pool_t * | pool | ||
) |
Similar to svn_io_remove_file2(), except with ignore_enoent set to FALSE.
svn_error_t* svn_io_remove_file2 | ( | const char * | path, |
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | scratch_pool | ||
) |
Remove file path, a utf8-encoded path.
This wraps apr_file_remove(), converting any error to a Subversion error. If ignore_enoent is TRUE, and the file is not present (APR_STATUS_IS_ENOENT returns TRUE), then no error will be returned.
The file will be removed even if it is not writable. (On Windows and OS/2, this function first clears the file's read-only bit.)
svn_error_t* svn_io_run_cmd | ( | const char * | path, |
const char * | cmd, | ||
const char *const * | args, | ||
int * | exitcode, | ||
apr_exit_why_e * | exitwhy, | ||
svn_boolean_t | inherit, | ||
apr_file_t * | infile, | ||
apr_file_t * | outfile, | ||
apr_file_t * | errfile, | ||
apr_pool_t * | pool | ||
) |
Run a command to completion, by first calling svn_io_start_cmd() and then calling svn_io_wait_for_cmd().
The parameters correspond to the same-named parameters of those two functions.
svn_error_t* svn_io_run_diff | ( | const char * | dir, |
const char *const * | user_args, | ||
int | num_user_args, | ||
const char * | label1, | ||
const char * | label2, | ||
const char * | from, | ||
const char * | to, | ||
int * | exitcode, | ||
apr_file_t * | outfile, | ||
apr_file_t * | errfile, | ||
const char * | diff_cmd, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_run_diff2() but with diff_cmd encoded in internal encoding used by APR.
svn_error_t* svn_io_run_diff2 | ( | const char * | dir, |
const char *const * | user_args, | ||
int | num_user_args, | ||
const char * | label1, | ||
const char * | label2, | ||
const char * | from, | ||
const char * | to, | ||
int * | exitcode, | ||
apr_file_t * | outfile, | ||
apr_file_t * | errfile, | ||
const char * | diff_cmd, | ||
apr_pool_t * | pool | ||
) |
Invoke the configured diff
program, with user_args (an array of utf8-encoded num_user_args arguments) if they are specified (that is, if user_args is non-NULL), or "-u" if they are not.
If user_args is NULL, the value of num_user_args is ignored.
Diff runs in utf8-encoded dir, and its exit status is stored in exitcode, if it is not NULL
.
If label1 and/or label2 are not NULL they will be passed to the diff process as the arguments of "-L" options. label1 and label2 are also in utf8, and will be converted to native charset along with the other args.
from is the first file passed to diff, and to is the second. The stdout of diff will be sent to outfile, and the stderr to errfile.
diff_cmd must be non-NULL.
Do all allocation in pool.
svn_error_t* svn_io_run_diff3 | ( | const char * | dir, |
const char * | mine, | ||
const char * | older, | ||
const char * | yours, | ||
const char * | mine_label, | ||
const char * | older_label, | ||
const char * | yours_label, | ||
apr_file_t * | merged, | ||
int * | exitcode, | ||
const char * | diff3_cmd, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_run_diff3_2(), but with user_args set to NULL
.
svn_error_t* svn_io_run_diff3_2 | ( | int * | exitcode, |
const char * | dir, | ||
const char * | mine, | ||
const char * | older, | ||
const char * | yours, | ||
const char * | mine_label, | ||
const char * | older_label, | ||
const char * | yours_label, | ||
apr_file_t * | merged, | ||
const char * | diff3_cmd, | ||
const apr_array_header_t * | user_args, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_run_diff3_3(), but with diff3_cmd encoded in internal encoding used by APR.
svn_error_t* svn_io_run_diff3_3 | ( | int * | exitcode, |
const char * | dir, | ||
const char * | mine, | ||
const char * | older, | ||
const char * | yours, | ||
const char * | mine_label, | ||
const char * | older_label, | ||
const char * | yours_label, | ||
apr_file_t * | merged, | ||
const char * | diff3_cmd, | ||
const apr_array_header_t * | user_args, | ||
apr_pool_t * | pool | ||
) |
Invoke the configured diff3
program, in utf8-encoded dir like this:
diff3 -E -m @a mine @a older @a yours > @a merged
(See the diff3 documentation for details.)
If user_args is non-NULL, replace "-E" with the const char*
elements that user_args contains.
mine, older and yours are utf8-encoded paths (relative to dir or absolute) to three files that already exist.
merged is an open file handle, and is left open after the merge result is written to it. (merged should not be the same file as mine, or nondeterministic things may happen!)
mine_label, older_label, yours_label are utf8-encoded label parameters for diff3's -L option. Any of them may be NULL
, in which case the corresponding mine, older, or yours parameter is used instead.
Set *exitcode to diff3's exit status. If *exitcode is anything other than 0 or 1, then return SVN_ERR_EXTERNAL_PROGRAM. (Note the following from the diff3 info pages: "An exit status of 0 means ‘diff3’ was successful, 1 means some conflicts were found, and 2 means trouble.")
diff3_cmd must be non-NULL.
Do all allocation in pool.
svn_error_t* svn_io_set_file_affected_time | ( | apr_time_t | apr_time, |
const char * | path, | ||
apr_pool_t * | pool | ||
) |
Set the timestamp of file path to apr_time.
path is utf8-encoded.
svn_error_t* svn_io_set_file_executable | ( | const char * | path, |
svn_boolean_t | executable, | ||
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | pool | ||
) |
Set path's "executability" (but do nothing if it is a symlink).
path is the utf8-encoded path to the file. If executable is TRUE
, then make the file executable. If FALSE
, make it non-executable. If ignore_enoent is TRUE
, don't fail if the target file doesn't exist.
When making the file executable on operating systems with unix style permissions, never add an execute permission where there is not already a read permission: that is, only make the file executable for the user, group or world if the corresponding read permission is already set for user, group or world.
When making the file non-executable on operating systems with unix style permissions, remove all execute permissions.
On other operating systems, toggle the file's "executability" as much as the operating system allows.
svn_error_t* svn_io_set_file_read_only | ( | const char * | path, |
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | pool | ||
) |
Make a file as read-only as the operating system allows.
path is the utf8-encoded path to the file. If ignore_enoent is TRUE
, don't fail if the target file doesn't exist.
If path is a symlink, do nothing.
svn_error_t* svn_io_set_file_read_write | ( | const char * | path, |
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | pool | ||
) |
Make a file as writable as the operating system allows.
path is the utf8-encoded path to the file. If ignore_enoent is TRUE
, don't fail if the target file doesn't exist.
If path is a symlink, do nothing.
svn_error_t* svn_io_set_file_read_write_carefully | ( | const char * | path, |
svn_boolean_t | enable_write, | ||
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_set_file_read_* functions.
Change the read-write permissions of a file.
When making path read-write on operating systems with unix style permissions, set the permissions on path to the permissions that are set when a new file is created (effectively honoring the user's umask).
When making the file read-only on operating systems with unix style permissions, remove all write permissions.
On other operating systems, toggle the file's "writability" as much as the operating system allows.
path is the utf8-encoded path to the file. If enable_write is TRUE
, then make the file read-write. If FALSE
, make it read-only. If ignore_enoent is TRUE
, don't fail if the target file doesn't exist.
void svn_io_sleep_for_timestamps | ( | const char * | path, |
apr_pool_t * | pool | ||
) |
Sleep to ensure that any files modified after we exit have a different timestamp than the one we recorded.
If path is not NULL, check if we can determine how long we should wait for a new timestamp on the filesystem containing path, an existing file or directory. If path is NULL or we can't determine the timestamp resolution, sleep until the next second.
Use pool for any necessary allocations. pool can be null if path is NULL.
Errors while retrieving the timestamp resolution will result in sleeping to the next second, to keep the working copy stable in error conditions.
svn_error_t* svn_io_start_cmd | ( | apr_proc_t * | cmd_proc, |
const char * | path, | ||
const char * | cmd, | ||
const char *const * | args, | ||
svn_boolean_t | inherit, | ||
apr_file_t * | infile, | ||
apr_file_t * | outfile, | ||
apr_file_t * | errfile, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_start_cmd2() but with infile_pipe, outfile_pipe, and errfile_pipe always FALSE.
svn_error_t* svn_io_start_cmd2 | ( | apr_proc_t * | cmd_proc, |
const char * | path, | ||
const char * | cmd, | ||
const char *const * | args, | ||
svn_boolean_t | inherit, | ||
svn_boolean_t | infile_pipe, | ||
apr_file_t * | infile, | ||
svn_boolean_t | outfile_pipe, | ||
apr_file_t * | outfile, | ||
svn_boolean_t | errfile_pipe, | ||
apr_file_t * | errfile, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_io_start_cmd3() but with env always set to NULL.
svn_error_t* svn_io_start_cmd3 | ( | apr_proc_t * | cmd_proc, |
const char * | path, | ||
const char * | cmd, | ||
const char *const * | args, | ||
const char *const * | env, | ||
svn_boolean_t | inherit, | ||
svn_boolean_t | infile_pipe, | ||
apr_file_t * | infile, | ||
svn_boolean_t | outfile_pipe, | ||
apr_file_t * | outfile, | ||
svn_boolean_t | errfile_pipe, | ||
apr_file_t * | errfile, | ||
apr_pool_t * | pool | ||
) |
Start cmd with args, using utf8-encoded path as working directory.
Return the process handle for the invoked program in *cmd_proc.
If infile_pipe is TRUE, connect cmd's stdin to a pipe; otherwise, connect it to infile (which may be NULL). If outfile_pipe is TRUE, connect cmd's stdout to a pipe; otherwise, connect it to outfile (which may be NULL). If errfile_pipe is TRUE, connect cmd's stderr to a pipe; otherwise, connect it to errfile (which may be NULL). (Callers must pass FALSE for each of these boolean values for which the corresponding file handle is non-NULL.)
args is a list of utf8-encoded const char *
arguments, terminated by NULL
. args[0] is the name of the program, though it need not be the same as cmd.
If inherit is TRUE, the invoked program inherits its environment from the caller and cmd, if not absolute, is searched for in PATH.
If inherit is FALSE cmd must be an absolute path and the invoked program inherits the environment defined by env or runs with an empty environment in env is NULL.
svn_error_t* svn_io_stat | ( | apr_finfo_t * | finfo, |
const char * | fname, | ||
apr_int32_t | wanted, | ||
apr_pool_t * | pool | ||
) |
Wrapper for apr_stat().
fname is utf8-encoded.
svn_error_t* svn_io_stat_dirent | ( | const svn_io_dirent2_t ** | dirent_p, |
const char * | path, | ||
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Similar to svn_io_stat_dirent2(), but always passes FALSE for verify_truename.
svn_error_t* svn_io_stat_dirent2 | ( | const svn_io_dirent2_t ** | dirent_p, |
const char * | path, | ||
svn_boolean_t | verify_truename, | ||
svn_boolean_t | ignore_enoent, | ||
apr_pool_t * | result_pool, | ||
apr_pool_t * | scratch_pool | ||
) |
Create a svn_io_dirent2_t instance for path.
Specialized variant of svn_io_stat() that directly translates node_kind and special.
If verify_truename is TRUE
, an additional check is performed to verify the truename of the last path component on case insensitive filesystems. This check is expensive compared to a just a stat, but certainly cheaper than a full truename calculation using apr_filepath_merge() which verifies all path components.
If ignore_enoent is set to TRUE
, set *dirent_p->kind to svn_node_none instead of returning an error.
svn_error_t* svn_io_unlock_open_file | ( | apr_file_t * | lockfile_handle, |
apr_pool_t * | pool | ||
) |
Unlock the file lockfile_handle.
Use pool for memory allocations. pool must be the pool that was passed to svn_io_lock_open_file().
svn_error_t* svn_io_wait_for_cmd | ( | apr_proc_t * | cmd_proc, |
const char * | cmd, | ||
int * | exitcode, | ||
apr_exit_why_e * | exitwhy, | ||
apr_pool_t * | pool | ||
) |
Wait for the process *cmd_proc to complete and optionally retrieve its exit code.
cmd is used only in error messages.
If exitcode is not NULL, set *exitcode to the exit code of the process and do not consider any exit code to be an error. If exitcode is NULL, then if the exit code of the process is non-zero then return an SVN_ERR_EXTERNAL_PROGRAM error.
If exitwhy is not NULL, set *exitwhy to indicate why the process terminated and do not consider any reason to be an error. If exitwhy is NULL, then if the termination reason is not APR_PROC_CHECK_EXIT()
then return an SVN_ERR_EXTERNAL_PROGRAM error.
svn_error_t* svn_io_write_atomic | ( | const char * | final_path, |
const void * | buf, | ||
apr_size_t | nbytes, | ||
const char * | copy_perms_path, | ||
apr_pool_t * | scratch_pool | ||
) |
Similar to svn_io_write_atomic2(), but with flush_to_disk set to TRUE
.
svn_error_t* svn_io_write_atomic2 | ( | const char * | final_path, |
const void * | buf, | ||
apr_size_t | nbytes, | ||
const char * | copy_perms_path, | ||
svn_boolean_t | flush_to_disk, | ||
apr_pool_t * | scratch_pool | ||
) |
Writes nbytes bytes from *buf to a temporary file inside the same directory as *final_path.
Then syncs the temporary file to disk and closes the file. After this rename the temporary file to final_path, possibly replacing an existing file.
If copy_perms_path is not NULL, copy the permissions applied on copy_perms_path on the temporary file before renaming.
If flush_to_disk is non-zero, do not return until the node has actually been written on the disk.
svn_error_t* svn_io_write_unique | ( | const char ** | tmp_path, |
const char * | dirpath, | ||
const void * | buf, | ||
apr_size_t | nbytes, | ||
svn_io_file_del_t | delete_when, | ||
apr_pool_t * | pool | ||
) |
Open a unique file in dirpath, and write nbytes from buf to the file before flushing it to disk and closing it.
Return the name of the newly created file in *tmp_path, allocated in pool.
If dirpath is NULL
, use the path returned from svn_io_temp_dir(). (Note that when using the system-provided temp directory, it may not be possible to atomically rename the resulting file due to cross-device issues.)
The file will be deleted according to delete_when.
svn_error_t* svn_stringbuf_from_aprfile | ( | svn_stringbuf_t ** | result, |
apr_file_t * | file, | ||
apr_pool_t * | pool | ||
) |
Sets *result to a string containing the contents of the already opened file.
Reads from the current position in file to the end. Does not close the file or reset the cursor position.
svn_error_t* svn_stringbuf_from_file | ( | svn_stringbuf_t ** | result, |
const char * | filename, | ||
apr_pool_t * | pool | ||
) |
Similar to svn_stringbuf_from_file2(), except that if filename is "-", return the error SVN_ERR_UNSUPPORTED_FEATURE and don't touch *result.
svn_error_t* svn_stringbuf_from_file2 | ( | svn_stringbuf_t ** | result, |
const char * | filename, | ||
apr_pool_t * | pool | ||
) |
Set *result to a string containing the contents of filename, which is either "-" (indicating that stdin should be read) or the utf8-encoded path of a real file.