Creates a new directory on the file system, but behaves like 'mkdir -p'. Creates intermediate directories as required. No error will be reported if PATH already exists.
Parameters:
path
the path for the directory to be created. (use / on all systems)
The full path to the source file (use / on all systems)
to_path
The full path to the destination file (use / on all systems)
perms
Access permissions for the destination file if it is created. In place of the usual or'd combination of file permissions, the value APR_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied.
pool
The pool to use.
Remarks:
The new file does not need to exist, it will be created if required.
The full path to the file (using / on all systems)
attributes
Or'd combination of
APR_FILE_ATTR_READONLY - make the file readonly
APR_FILE_ATTR_EXECUTABLE - make the file executable
APR_FILE_ATTR_HIDDEN - make the file hidden
attr_mask
Mask of valid bits in attributes.
pool
the pool to use.
Remarks:
This function should be used in preference to explicit manipulation of the file permissions, because the operations to provide these attributes are platform specific and may involve more than simply setting permission bits.
Warning:
Platforms which do not implement this feature will return APR_ENOTIMPL.
It is possible to add a buffer to previously unbuffered file handles, the APR_BUFFERED flag will be added to the file handle's flags. Likewise, with buffer=NULL and bufsize=0 arguments it is possible to make a previously buffered file handle unbuffered.
The full path to the original file (using / on all systems)
to_path
The full path to the new file (using / on all systems)
perms
Access permissions for the new file if it is created. In place of the usual or'd combination of file permissions, the value APR_FILE_SOURCE_PERMS may be given, in which case the source file's permissions are copied.
pool
The pool to use.
Remarks:
The new file does not need to exist, it will be created if required.
Warning:
If the new file already exists, its contents will be overwritten.
file (un)locking functions. Establish a lock on the specified, open file. The lock may be advisory or mandatory, at the discretion of the platform. The lock applies to the file as a whole, rather than a specific range. Locks are established on a per-thread/process basis; a second lock by the same thread will not block.
The flags to open the file with. If this is zero, the file is opened with APR_CREATE | APR_READ | APR_WRITE | APR_EXCL | APR_DELONCLOSE
p
The pool to allocate the file out of.
Remarks:
This function generates a unique temporary file name from template. The last six characters of template must be XXXXXX and these are replaced with a string that makes the filename unique. Since it will be modified, template must not be a string constant, but should be declared as a character array.
The full path to the file (using / on all systems)
flag
Or'ed value of:
APR_READ open for reading
APR_WRITE open for writing
APR_CREATE create the file if not there
APR_APPEND file ptr is set to end prior to all writes
APR_TRUNCATE set length to zero if file exists
APR_BINARY not a text file (This flag is ignored on
UNIX because it has no meaning)
APR_BUFFERED buffer the data. Default is non-buffered
APR_EXCL return error if APR_CREATE and file exists
APR_DELONCLOSE delete the file after closing.
APR_XTHREAD Platform dependent tag to open the file
for use across multiple threads
APR_SHARELOCK Platform dependent support for higher
level locked read/write access to support
writes across process/machines
APR_FILE_NOCLEANUP Do not register a cleanup with the pool
passed in on the pool argument (see below).
The apr_os_file_t handle in apr_file_t will not
be closed when the pool is destroyed.
APR_SENDFILE_ENABLED Open with appropriate platform semantics
for sendfile operations. Advisory only,
apr_socket_sendfile does not check this flag.
perm
Access permissions for file.
pool
The pool to use.
Remarks:
If perm is APR_OS_DEFAULT and the file is being created, appropriate default permissions will be used.
By default, the returned file descriptor will not be inherited by child processes created by apr_proc_create(). This can be changed using apr_file_inherit_set().
open standard error as an apr file pointer, with flags.
Parameters:
thefile
The apr file to use as stderr.
flags
The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_WRITE flag will be set unconditionally.
open standard input as an apr file pointer, with flags.
Parameters:
thefile
The apr file to use as stdin.
flags
The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_READ flag will be set unconditionally.
open standard output as an apr file pointer, with flags.
Parameters:
thefile
The apr file to use as stdout.
flags
The flags to open the file with. Only the APR_EXCL, APR_BUFFERED, APR_XTHREAD, APR_SHARELOCK, APR_SENDFILE_ENABLED and APR_LARGEFILE flags should be used. The APR_WRITE flag will be set unconditionally.
The only reason that the apr_file_open_std* functions exist is that you may not always have a stderr/out/in on Windows. This is generally a problem with newer versions of Windows and services.
The other problem is that the C library functions generally work differently on Windows and Unix. So, by using apr_file_open_std* functions, you can get a handle to an APR struct that works with the APR functions which are supposed to work identically on all platforms.
Some platforms may not be able to apply all of the available permission bits; APR_INCOMPLETE will be returned if some permissions are specified which could not be set.
Platforms which do not implement this feature will return APR_ENOTIMPL.
Some platforms cannot toggle between blocking and nonblocking, and when passing a pipe as a standard handle to an application which does not expect it, a non-blocking stream will fluxor the client app.
Some platforms cannot toggle between blocking and nonblocking, and when passing a pipe as a standard handle to an application which does not expect it, a non-blocking stream will fluxor the client app. Use this function rather than apr_file_pipe_create to create pipes where one or both ends require non-blocking semantics.
On entry, the number of bytes to read; on exit, the number of bytes read.
Remarks:
apr_file_read will read up to the specified number of bytes, but never more. If there isn't enough data to fill that number of bytes, all of the available data is read. The third argument is modified to reflect the number of bytes read. If a char was put back into the stream via ungetc, it will be the first character returned.
It is not possible for both bytes to be read and an APR_EOF or other error to be returned. APR_EINTR is never returned.
Read data from the specified file, ensuring that the buffer is filled before returning.
Parameters:
thefile
The file descriptor to read from.
buf
The buffer to store the data to.
nbytes
The number of bytes to read.
bytes_read
If non-NULL, this will contain the number of bytes read.
Remarks:
apr_file_read will read up to the specified number of bytes, but never more. If there isn't enough data to fill that number of bytes, then the process/thread will block until it is available or EOF is reached. If a char was put back into the stream via ungetc, it will be the first character returned.
It is possible for both bytes to be read and an error to be returned. And if *bytes_read is less than nbytes, an accompanying error is _always_ returned.
Unlike apr_file_dup2(), this function doesn't do an OS dup() operation on the underlying descriptor; it just moves the descriptor's apr_file_t wrapper to a new pool.
The new pool need not be an ancestor of old_file's pool.
After calling this function, old_file may not be used
On entry, the number of bytes to write; on exit, the number of bytes written.
Remarks:
apr_file_write will write up to the specified number of bytes, but never more. If the OS cannot write that many bytes, it will write as many as it can. The third argument is modified to reflect the * number of bytes written.
It is possible for both bytes to be written and an error to be returned. APR_EINTR is never returned.
Write data to the specified file, ensuring that all of the data is written before returning.
Parameters:
thefile
The file descriptor to write to.
buf
The buffer which contains the data.
nbytes
The number of bytes to write.
bytes_written
If non-NULL, set to the number of bytes written.
Remarks:
apr_file_write will write up to the specified number of bytes, but never more. If the OS cannot write that many bytes, the process/thread will block until they can be written. Exceptional error such as "out of space" or "pipe closed" will terminate with an error.
It is possible for both bytes to be written and an error to be returned. And if *bytes_written is less than nbytes, an accompanying error is _always_ returned.