InnoDB Plugin  1.0
Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
os0file.h File Reference
#include "univ.i"
#include <dirent.h>
#include <sys/stat.h>
#include <time.h>
#include "os0file.ic"
Include dependency graph for os0file.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  os_file_stat_t

Macros

#define OS_FILE_FROM_FD(fd)   fd
#define OS_FILE_LOG_BLOCK_SIZE   512
#define OS_AIO_N_PENDING_IOS_PER_THREAD   32
#define OS_WIN31   1
#define OS_WIN95   2
#define OS_WINNT   3
#define OS_WIN2000   4
#define OS_WINXP   5
#define OS_WINVISTA   6
#define OS_WIN7   7
#define os_file_create(key, name, create, purpose, type, success)   os_file_create_func(name, create, purpose, type, success)
#define os_file_create_simple(key, name, create_mode, access, success)   os_file_create_simple_func(name, create_mode, access, success)
#define os_file_create_simple_no_error_handling(key, name, create_mode, access, success)
#define os_file_close(file)   os_file_close_func(file)
#define os_aio(type, mode, name, file, buf, offset, n, message1, message2)
#define os_file_read(file, buf, offset, n)   os_file_read_func(file, buf, offset, n)
#define os_file_read_no_error_handling(file, buf, offset, n)   os_file_read_no_error_handling_func(file, buf, offset, n)
#define os_file_write(name, file, buf, offset, n)   os_file_write_func(name, file, buf, offset, n)
#define os_file_flush(file)   os_file_flush_func(file)
#define os_file_rename(key, oldpath, newpath)   os_file_rename_func(oldpath, newpath)
#define os_file_delete(key, name)   os_file_delete_func(name)
#define os_file_delete_if_exists(key, name)   os_file_delete_if_exists_func(name)
#define OS_FILE_MAX_PATH   4000
#define OS_DATA_FILE   100
#define OS_LOG_FILE   101
#define OS_FILE_NOT_FOUND   71
#define OS_FILE_DISK_FULL   72
#define OS_FILE_ALREADY_EXISTS   73
#define OS_FILE_PATH_ERROR   74
#define OS_FILE_AIO_RESOURCES_RESERVED
#define OS_FILE_SHARING_VIOLATION   76
#define OS_FILE_ERROR_NOT_SPECIFIED   77
#define OS_FILE_INSUFFICIENT_RESOURCE   78
#define OS_FILE_AIO_INTERRUPTED   79
#define OS_FILE_OPERATION_ABORTED   80
#define OS_FILE_ACCESS_VIOLATION   81
#define OS_FILE_ERROR_MAX   100
#define OS_FILE_READ   10
#define OS_FILE_WRITE   11
#define OS_FILE_LOG   256 /* This can be ORed to type */
#define OS_AIO_NORMAL   21
#define OS_AIO_IBUF   22
#define OS_AIO_LOG   23
#define OS_AIO_SYNC   24
#define OS_AIO_SIMULATED_WAKE_LATER   512

Typedefs

typedef ib_uint64_t os_offset_t
typedef int os_file_t
typedef DIR * os_file_dir_t

Enumerations

enum  os_file_type_t {
  OS_FILE_TYPE_UNKNOWN = 0, OS_FILE_TYPE_FILE, OS_FILE_TYPE_DIR, OS_FILE_TYPE_LINK,
  OS_FILE_TYPE_BLOCK
}

Functions

UNIV_INTERN void os_io_init_simple (void)
FILE * os_file_create_tmpfile (void)
UNIV_INTERN os_file_dir_t os_file_opendir (const char *dirname, ibool error_is_fatal)
UNIV_INTERN int os_file_closedir (os_file_dir_t dir)
UNIV_INTERN int os_file_readdir_next_file (const char *dirname, os_file_dir_t dir, os_file_stat_t *info)
UNIV_INTERN ibool os_file_create_directory (const char *pathname, ibool fail_if_exists)
UNIV_INTERN os_file_t os_file_create_simple_func (const char *name, ulint create_mode, ulint access_type, ibool *success)
UNIV_INTERN os_file_t os_file_create_simple_no_error_handling_func (const char *name, ulint create_mode, ulint access_type, ibool *success))
UNIV_INTERN void os_file_set_nocache (int fd, const char *file_name, const char *operation_name)
UNIV_INTERN os_file_t os_file_create_func (const char *name, ulint create_mode, ulint purpose, ulint type, ibool *success))
UNIV_INTERN bool os_file_delete_func (const char *name)
UNIV_INTERN bool os_file_delete_if_exists_func (const char *name)
UNIV_INTERN ibool os_file_rename_func (const char *oldpath, const char *newpath)
UNIV_INTERN ibool os_file_close_func (os_file_t file)
UNIV_INTERN os_offset_t os_file_get_size (os_file_t file))
UNIV_INTERN ibool os_file_set_size (const char *name, os_file_t file, os_offset_t size))
UNIV_INTERN ibool os_file_set_eof (FILE *file)
UNIV_INTERN ibool os_file_flush_func (os_file_t file)
UNIV_INTERN ulint os_file_get_last_error (bool report_all_errors)
UNIV_INTERN ibool os_file_read_func (os_file_t file, void *buf, os_offset_t offset, ulint n)
UNIV_INTERN void os_file_read_string (FILE *file, char *str, ulint size)
UNIV_INTERN ibool os_file_read_no_error_handling_func (os_file_t file, void *buf, os_offset_t offset, ulint n)
UNIV_INTERN ibool os_file_write_func (const char *name, os_file_t file, const void *buf, os_offset_t offset, ulint n)
UNIV_INTERN ibool os_file_status (const char *path, ibool *exists, os_file_type_t *type)
UNIV_INTERN char * os_file_dirname (const char *path)
UNIV_INTERN char * os_file_make_new_pathname (const char *old_path, const char *new_name)
UNIV_INTERN char * os_file_make_remote_pathname (const char *data_dir_path, const char *tablename, const char *extention)
UNIV_INTERN void os_file_make_data_dir_path (char *data_dir_path)
UNIV_INTERN ibool os_file_create_subdirs_if_needed (const char *path)
UNIV_INTERN ibool os_aio_init (ulint n_per_seg, ulint n_read_segs, ulint n_write_segs, ulint n_slots_sync)
UNIV_INTERN void os_aio_free (void)
UNIV_INTERN ibool os_aio_func (ulint type, ulint mode, const char *name, os_file_t file, void *buf, os_offset_t offset, ulint n, fil_node_t *message1, void *message2)
UNIV_INTERN void os_aio_wake_all_threads_at_shutdown (void)
UNIV_INTERN void os_aio_wait_until_no_pending_writes (void)
UNIV_INTERN void os_aio_simulated_wake_handler_threads (void)
UNIV_INTERN void os_aio_simulated_put_read_threads_to_sleep (void)
UNIV_INTERN ibool os_aio_simulated_handle (ulint segment, fil_node_t **message1, void **message2, ulint *type)
UNIV_INTERN ibool os_aio_validate (void)
UNIV_INTERN void os_aio_print (FILE *file)
UNIV_INTERN void os_aio_refresh_stats (void)
UNIV_INTERN ibool os_aio_all_slots_free (void)
UNIV_INTERN dberr_t os_file_get_status (const char *path, os_file_stat_t *stat_info, bool check_rw_perm)
UNIV_INTERN int innobase_mysql_tmpfile (void)

Variables

ibool os_has_said_disk_full
ibool os_aio_print_debug
ulint os_file_n_pending_preads
ulint os_file_n_pending_pwrites
ulint os_n_pending_reads
ulint os_n_pending_writes
ulint os_innodb_umask
ulint os_n_file_reads
ulint os_n_file_writes
ulint os_n_fsyncs
#define OS_FILE_READ_ONLY   333
#define OS_FILE_READ_WRITE   444
#define OS_FILE_READ_ALLOW_DELETE   555 /* for mysqlbackup */
#define OS_FILE_AIO   61
#define OS_FILE_NORMAL   62
enum  os_file_create_t {
  OS_FILE_OPEN = 51, OS_FILE_CREATE, OS_FILE_OVERWRITE, OS_FILE_OPEN_RAW,
  OS_FILE_CREATE_PATH, OS_FILE_OPEN_RETRY, OS_FILE_ON_ERROR_NO_EXIT = 128, OS_FILE_ON_ERROR_SILENT = 256
}

Detailed Description

The interface to the operating system file io

Created 10/21/1995 Heikki Tuuri

Macro Definition Documentation

#define os_aio (   type,
  mode,
  name,
  file,
  buf,
  offset,
  n,
  message1,
  message2 
)
Value:
os_aio_func(type, mode, name, file, buf, offset, n, \
message1, message2)
#define OS_AIO_IBUF   22

Asynchronous i/o for ibuf pages or ibuf bitmap pages

#define OS_AIO_LOG   23

Asynchronous i/o for the log

#define OS_AIO_N_PENDING_IOS_PER_THREAD   32

Win NT does not allow more than 64

#define OS_AIO_NORMAL   21

Modes for aio operations Normal asynchronous i/o not for ibuf pages or ibuf bitmap pages

#define OS_AIO_SIMULATED_WAKE_LATER   512

This can be ORed to mode in the call of os_aio(...), if the caller wants to post several i/o requests in a batch, and only after that wake the i/o-handler thread; this has effect only in simulated aio

#define OS_AIO_SYNC   24

Asynchronous i/o where the calling thread will itself wait for the i/o to complete, doing also the job of the i/o-handler thread; can be used for any pages, ibuf or non-ibuf. This is used to save CPU time, as we can do with fewer thread switches. Plain synchronous i/o is not as good, because it must serialize the file seek and read or write, causing a bottleneck for parallelism.

#define OS_DATA_FILE   100

Types for file create

#define OS_FILE_AIO_RESOURCES_RESERVED
Value:
75 /* wait for OS aio resources
to become available again */
#define os_file_create_simple_no_error_handling (   key,
  name,
  create_mode,
  access,
  success 
)
Value:
name, create_mode, access, success)
#define OS_FILE_FROM_FD (   fd)    fd
Convert a C file descriptor to a native file handle
Parameters
fdfile descriptor
Returns
native file handle
#define OS_FILE_LOG_BLOCK_SIZE   512
The next value should be smaller or equal to the smallest sector size used

on any disk. A log block is required to be a portion of disk which is written so that if the start and the end of a block get written to disk, then the whole block gets written. This should be true even in most cases of a crash: if this fails for a log block, then it is equivalent to a media failure in the log.

#define OS_FILE_NOT_FOUND   71

Error codes from os_file_get_last_error

#define OS_FILE_READ   10

Types for aio operations

#define OS_WIN2000   4

Microsoft Windows 2000

#define OS_WIN31   1

Microsoft Windows 3.x

#define OS_WIN7   7

Microsoft Windows 7 or Windows Server 2008 R2

#define OS_WIN95   2

Microsoft Windows 95

#define OS_WINNT   3

Microsoft Windows NT 3.x

#define OS_WINVISTA   6

Microsoft Windows Vista or Windows Server 2008

#define OS_WINXP   5

Microsoft Windows XP or Windows Server 2003

Typedef Documentation

typedef DIR* os_file_dir_t

directory stream

typedef int os_file_t

File handle

typedef ib_uint64_t os_offset_t

File offset in bytes

Enumeration Type Documentation

Options for os_file_create_func

Enumerator:
OS_FILE_OPEN 

to open an existing file (if doesn't exist, error)

OS_FILE_CREATE 

to create new file (if exists, error)

OS_FILE_OVERWRITE 

to create a new file, if exists the overwrite old file

OS_FILE_OPEN_RAW 

to open a raw device or disk partition

OS_FILE_CREATE_PATH 

to create the directories

OS_FILE_OPEN_RETRY 

open with retry

OS_FILE_ON_ERROR_NO_EXIT 

Flags that can be combined with the above values. Please ensure that the above values stay below 128. do not exit on unknown errors

OS_FILE_ON_ERROR_SILENT 

don't print diagnostic messages to the log unless it is a fatal error, this flag is only used if ON_ERROR_NO_EXIT is set

Function Documentation

UNIV_INTERN int innobase_mysql_tmpfile ( void  )

Creates a temporary file that will be deleted on close. This function is defined in ha_innodb.cc.

Returns
temporary file descriptor, or < 0 on error
UNIV_INTERN ibool os_aio_all_slots_free ( void  )

Checks that all slots in the system have been freed, that is, there are no pending io operations.

UNIV_INTERN ibool os_aio_func ( ulint  type,
ulint  mode,
const char *  name,
os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n,
fil_node_t *  message1,
void *  message2 
)

NOTE! Use the corresponding macro os_aio(), not directly this function! Requests an asynchronous i/o operation.

Returns
TRUE if request was queued successfully, FALSE if fail in: message for the aio handler (can be used to identify a completed aio operation); ignored if mode is OS_AIO_SYNC
Parameters
typein: OS_FILE_READ or OS_FILE_WRITE
modein: OS_AIO_NORMAL, ..., possibly ORed to OS_AIO_SIMULATED_WAKE_LATER: the last flag advises this function not to wake i/o-handler threads, but the caller will do the waking explicitly later, in this way the caller can post several requests in a batch; NOTE that the batch must not be so big that it exhausts the slots in aio arrays! NOTE that a simulated batch may introduce hidden chances of deadlocks, because i/os are not actually handled until all have been posted: use with great caution!
namein: name of the file or path as a null-terminated string
filein: handle to a file
bufin: buffer where to read or from which to write
offsetin: file offset where to read or write
nin: number of bytes to read or write
message1in: message for the aio handler (can be used to identify a completed aio operation); ignored if mode is OS_AIO_SYNC
UNIV_INTERN void os_aio_print ( FILE *  file)

Prints info of the aio arrays. in: file where to print

UNIV_INTERN void os_aio_refresh_stats ( void  )

Refreshes the statistics used to print per-second averages.

UNIV_INTERN ibool os_aio_simulated_handle ( ulint  segment,
fil_node_t **  message1,
void **  message2,
ulint *  type 
)

Does simulated aio. This function should be called by an i/o-handler thread.

Returns
TRUE if the aio operation succeeded out: OS_FILE_WRITE or ..._READ
Parameters
segmentin: the number of the segment in the aio arrays to wait for; segment 0 is the ibuf i/o thread, segment 1 the log i/o thread, then follow the non-ibuf read threads, and as the last are the non-ibuf write threads
message1out: the messages passed with the aio request; note that also in the case where the aio operation failed, these output parameters are valid and can be used to restart the operation, for example
UNIV_INTERN void os_aio_simulated_put_read_threads_to_sleep ( void  )

This function can be called if one wants to post a batch of reads and prefers an i/o-handler thread to handle them all at once later. You must call os_aio_simulated_wake_handler_threads later to ensure the threads are not left sleeping!

UNIV_INTERN void os_aio_simulated_wake_handler_threads ( void  )

Wakes up simulated aio i/o-handler threads if they have something to do.

UNIV_INTERN ibool os_aio_validate ( void  )

Validates the consistency of the aio system.

Returns
TRUE if ok
UNIV_INTERN void os_aio_wait_until_no_pending_writes ( void  )

Waits until there are no pending writes in os_aio_write_array. There can be other, synchronous, pending writes.

UNIV_INTERN void os_aio_wake_all_threads_at_shutdown ( void  )

Wakes up all async i/o threads so that they know to exit themselves in shutdown.

UNIV_INTERN ibool os_file_close_func ( os_file_t  file)

NOTE! Use the corresponding macro os_file_close(), not directly this function! Closes a file handle. In case of error, error number can be retrieved with os_file_get_last_error.

Returns
TRUE if success in, own: handle to a file
UNIV_INTERN int os_file_closedir ( os_file_dir_t  dir)

Closes a directory stream.

Returns
0 if success, -1 if failure in: directory stream
UNIV_INTERN ibool os_file_create_directory ( const char *  pathname,
ibool  fail_if_exists 
)

This function attempts to create a directory named pathname. The new directory gets default permissions. On Unix, the permissions are (0770 & ~umask). If the directory exists already, nothing is done and the call succeeds, unless the fail_if_exists arguments is true.

Returns
TRUE if call succeeds, FALSE on error in: if TRUE, pre-existing directory is treated as an error.
Parameters
pathnamein: directory name as null-terminated string
UNIV_INTERN os_file_t os_file_create_func ( const char *  name,
ulint  create_mode,
ulint  purpose,
ulint  type,
ibool success 
)

NOTE! Use the corresponding macro os_file_create(), not directly this function! Opens an existing file or creates a new.

Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error
Parameters
namein: name of the file or path as a null-terminated string
create_modein: create mode
purposein: OS_FILE_AIO, if asynchronous, non-buffered i/o is desired, OS_FILE_NORMAL, if any normal file; NOTE that it also depends on type, os_aio_.. and srv_.. variables whether we really use async i/o or unbuffered i/o: look in the function source code for the exact rules
typein: OS_DATA_FILE or OS_LOG_FILE
successout: TRUE if succeed, FALSE if error
UNIV_INTERN os_file_t os_file_create_simple_func ( const char *  name,
ulint  create_mode,
ulint  access_type,
ibool success 
)

NOTE! Use the corresponding macro os_file_create_simple(), not directly this function! A simple function to open or create a file.

Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error out: TRUE if succeed, FALSE if error
Parameters
namein: name of the file or path as a null-terminated string
create_modein: create mode
access_typein: OS_FILE_READ_ONLY or OS_FILE_READ_WRITE
UNIV_INTERN os_file_t os_file_create_simple_no_error_handling_func ( const char *  name,
ulint  create_mode,
ulint  access_type,
ibool success 
)

NOTE! Use the corresponding macro os_file_create_simple_no_error_handling(), not directly this function! A simple function to open or create a file.

Returns
own: handle to the file, not defined if error, error number can be retrieved with os_file_get_last_error
Parameters
namein: name of the file or path as a null-terminated string
create_modein: create mode
access_typein: OS_FILE_READ_ONLY, OS_FILE_READ_WRITE, or OS_FILE_READ_ALLOW_DELETE; the last option is used by a backup program reading the file
successout: TRUE if succeed, FALSE if error
UNIV_INTERN ibool os_file_create_subdirs_if_needed ( const char *  path)

Creates all missing subdirectories along the given path.

Returns
TRUE if call succeeded FALSE otherwise in: path name
FILE* os_file_create_tmpfile ( void  )

Creates a temporary file. This function is like tmpfile(3), but the temporary file is created in the MySQL temporary directory.

Returns
temporary file handle, or NULL on error
UNIV_INTERN bool os_file_delete_func ( const char *  name)

Deletes a file. The file has to be closed before calling this.

Returns
TRUE if success in: file path as a null-terminated string
UNIV_INTERN bool os_file_delete_if_exists_func ( const char *  name)

Deletes a file if it exists. The file has to be closed before calling this.

Returns
TRUE if success in: file path as a null-terminated string
UNIV_INTERN char* os_file_dirname ( const char *  path)

The function os_file_dirname returns a directory component of a null-terminated pathname string. In the usual case, dirname returns the string up to, but not including, the final '/', and basename is the component following the final '/'. Trailing '/' characters are not counted as part of the pathname.

If path does not contain a slash, dirname returns the string ".".

Concatenating the string returned by dirname, a "/", and the basename yields a complete pathname.

The return value is a copy of the directory component of the pathname. The copy is allocated from heap. It is the caller responsibility to free it after it is no longer needed.

The following list of examples (taken from SUSv2) shows the strings returned by dirname and basename for different paths:

   path           dirname        basename
   "/usr/lib"     "/usr"         "lib"
   "/usr/"        "/"            "usr"
   "usr"          "."            "usr"
   "/"            "/"            "/"
   "."            "."            "."
   ".."           "."            ".."
Returns
own: directory component of the pathname in: pathname
UNIV_INTERN ibool os_file_flush_func ( os_file_t  file)

NOTE! Use the corresponding macro os_file_flush(), not directly this function! Flushes the write buffers of a given file to the disk.

Returns
TRUE if success in, own: handle to a file
UNIV_INTERN ulint os_file_get_last_error ( bool  report_all_errors)

Retrieves the last error number if an error occurs in a file io function. The number should be retrieved before any other OS calls (because they may overwrite the error number). If the number is not known to this program, the OS error number + 100 is returned.

Returns
error number, or OS error number + 100 in: TRUE if we want an error message printed of all errors
UNIV_INTERN os_offset_t os_file_get_size ( os_file_t  file)

Gets a file size.

Returns
file size, or (os_offset_t) -1 on failure
Parameters
filein: handle to a file
UNIV_INTERN dberr_t os_file_get_status ( const char *  path,
os_file_stat_t stat_info,
bool  check_rw_perm 
)

This function returns information about the specified file

Returns
DB_SUCCESS if all OK in: for testing whether the file can be opened in RW mode
Parameters
pathin: pathname of the file
stat_infoinformation of a file in a directory
UNIV_INTERN void os_file_make_data_dir_path ( char *  data_dir_path)

This function reduces a null-terminated full remote path name into the path that is sent by MySQL for DATA DIRECTORY clause. It replaces the 'databasename/tablename.ibd' found at the end of the path with just 'tablename'.

Since the result is always smaller than the path sent in, no new memory is allocated. The caller should allocate memory for the path sent in. This function manipulates that path in place.

If the path format is not as expected, just return. The result is used to inform a SHOW CREATE TABLE command. in/out: full path/data_dir_path

UNIV_INTERN char* os_file_make_new_pathname ( const char *  old_path,
const char *  new_name 
)

This function returns a new path name after replacing the basename in an old path with a new basename. The old_path is a full path name including the extension. The tablename is in the normal form "databasename/tablename". The new base name is found after the forward slash. Both input strings are null terminated.

This function allocates memory to be returned. It is the callers responsibility to free the return value after it is no longer needed.

Returns
own: new full pathname in: new file name
Parameters
old_pathin: pathname
UNIV_INTERN char* os_file_make_remote_pathname ( const char *  data_dir_path,
const char *  tablename,
const char *  extention 
)

This function returns a remote path name by combining a data directory path provided in a DATA DIRECTORY clause with the tablename which is in the form 'database/tablename'. It strips the file basename (which is the tablename) found after the last directory in the path provided. The full filepath created will include the database name as a directory under the path provided. The filename is the tablename with the '.ibd' extension. All input and output strings are null-terminated.

This function allocates memory to be returned. It is the callers responsibility to free the return value after it is no longer needed.

Returns
own: A full pathname; data_dir_path/databasename/tablename.ibd in: file extention; ibd,cfg
Parameters
data_dir_pathin: pathname
tablenamein: tablename
UNIV_INTERN os_file_dir_t os_file_opendir ( const char *  dirname,
ibool  error_is_fatal 
)

The os_file_opendir() function opens a directory stream corresponding to the directory named by the dirname argument. The directory stream is positioned at the first entry. In both Unix and Windows we automatically skip the '.' and '..' items at the start of the directory listing.

Returns
directory stream, NULL if error in: TRUE if we should treat an error as a fatal error; if we try to open symlinks then we do not wish a fatal error if it happens not to be a directory
Parameters
dirnamein: directory name; it must not contain a trailing '\' or '/'
UNIV_INTERN ibool os_file_read_func ( os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n 
)

NOTE! Use the corresponding macro os_file_read(), not directly this function! Requests a synchronous read operation.

Returns
TRUE if request was successful, FALSE if fail in: number of bytes to read
Parameters
filein: handle to a file
bufin: buffer where to read
offsetin: file offset where to read
UNIV_INTERN ibool os_file_read_no_error_handling_func ( os_file_t  file,
void *  buf,
os_offset_t  offset,
ulint  n 
)

NOTE! Use the corresponding macro os_file_read_no_error_handling(), not directly this function! Requests a synchronous positioned read operation. This function does not do any error handling. In case of error it returns FALSE.

Returns
TRUE if request was successful, FALSE if fail in: number of bytes to read
Parameters
filein: handle to a file
bufin: buffer where to read
offsetin: file offset where to read
UNIV_INTERN void os_file_read_string ( FILE *  file,
char *  str,
ulint  size 
)

Rewind file to its start, read at most size - 1 bytes from it to str, and NUL-terminate str. All errors are silently ignored. This function is mostly meant to be used with temporary files. in: size of buffer

Parameters
filein: file to read from
strin: buffer where to read
UNIV_INTERN int os_file_readdir_next_file ( const char *  dirname,
os_file_dir_t  dir,
os_file_stat_t info 
)

This function returns information of the next file in the directory. We jump over the '.' and '..' entries in the directory.

Returns
0 if ok, -1 if error, 1 if at the end of the directory in/out: buffer where the info is returned
Parameters
dirnamein: directory name or path
dirin: directory stream
UNIV_INTERN ibool os_file_rename_func ( const char *  oldpath,
const char *  newpath 
)

NOTE! Use the corresponding macro os_file_rename(), not directly this function! Renames a file (can also move it to another directory). It is safest that the file is closed before calling this function.

Returns
TRUE if success in: new file path
Parameters
oldpathin: old file path as a null-terminated string
UNIV_INTERN ibool os_file_set_eof ( FILE *  file)

Truncates a file at its current position.

Returns
TRUE if success in: file to be truncated
UNIV_INTERN void os_file_set_nocache ( int  fd,
const char *  file_name,
const char *  operation_name 
)

Tries to disable OS caching on an opened file descriptor. in: "open" or "create"; used in the diagnostic message

Parameters
fdin: file descriptor to alter
file_namein: file name, used in the diagnostic message
UNIV_INTERN ibool os_file_set_size ( const char *  name,
os_file_t  file,
os_offset_t  size 
)

Write the specified number of zeros to a newly created file.

Returns
TRUE if success
Parameters
namein: name of the file or path as a null-terminated string
filein: handle to a file
sizein: file size
UNIV_INTERN ibool os_file_status ( const char *  path,
ibool exists,
os_file_type_t *  type 
)

Check the existence and type of the given file.

Returns
TRUE if call succeeded out: type of the file (if it exists)
Parameters
pathin: pathname of the file
existsout: TRUE if file exists
UNIV_INTERN ibool os_file_write_func ( const char *  name,
os_file_t  file,
const void *  buf,
os_offset_t  offset,
ulint  n 
)

NOTE! Use the corresponding macro os_file_write(), not directly this function! Requests a synchronous write operation.

Returns
TRUE if request was successful, FALSE if fail in: number of bytes to write
Parameters
namein: name of the file or path as a null-terminated string
filein: handle to a file
bufin: buffer from which to write
offsetin: file offset where to write
UNIV_INTERN void os_io_init_simple ( void  )

Creates the seek mutexes used in positioned reads and writes.

Variable Documentation

ibool os_aio_print_debug

Flag: enable debug printout for asynchronous i/o

ulint os_file_n_pending_preads

Number of pending os_file_pread() operations

ulint os_file_n_pending_pwrites

Number of pending os_file_pwrite() operations

ulint os_innodb_umask

Umask for creating files

ulint os_n_pending_reads

Number of pending read operations

ulint os_n_pending_writes

Number of pending write operations