Considerations for working with file systems

The functionality for working with file systems is available to applications via POSIX functions and other functions of the standard C library.

The support limitations and special considerations for POSIX implementation are described in the following sections:

In KasperskyOS, the implementation of certain functions of the standard C library for file system management differs from the implementation of these functions in Linux and other UNIX-like operating systems. Information about these functions is provided in the table below.

Description and implementation details of the functions of the standard C library for file system management

Function

Purpose

Implementation specifics

Header file

mount()

Mount a file system.

When starting the VFS system program, RAMFS is automatically mounted as the '/' root file system. After startup of VFS, a single remounting of the root file system to any other file system is allowed if there are no open files in RAMFS. If this remounting occurs, the contents of RAMFS will be freed.

Due to the fact that initialization of the block level occurs asynchronously with VFS operation, prior to mounting a block device you must verify its readiness. When attempting to mount a block device that has not yet been registered in the block device driver, the mount() function returns the ENODEV error.

You can use the virtual file system devfs to get a list of devices that are available to be mounted. To do so, you must mount devfs to the /dev directory and print the list of available devices by using readdir() in the devfs mount directory.

For more details, refer to File system mounting functions

sys/mount.h

umount()

Unmount the file system.

When executing the umount() function, VFS verifies that there are no open files (file handles) in the subtree of the file system being unmounted.

File closing events may reach VFS asynchronously. Therefore, when there are open files in the file system being unmounted, the VFS performs repeated unmount attempts during the timeout for attempts (1 second by default), after which it returns the EBUSY error to the calling process.

For more details, refer to File system mounting functions

sys/mount.h

sync()

Write the file system caches to disk.

The function was not implemented. When calling sync(), nothing happens because POSIX does not allow a sync() call to return an error.

unistd.h

fsync()

Synchronize changes in the file with the disk device.

It works if the call is supported in the file system in which the file is open, otherwise it returns the ENOSYS error.

unistd.h

fdatasync()

Synchronize changes in the file with the disk device.

It works if the call is supported in the file system in which the file is open, otherwise it returns the ENOSYS error.

unistd.h

open()

Open a file.

It is not permissible to use the O_CREAT flag without explicitly specifying the mode parameter.

fcntl.h

Page top