Repository: dotnet/runtime
File: src/native/libs/System.Native/pal_io.h (C/C++)

Code before:
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 *
 * NOTE: Some platforms do not support this operation and will always fail with errno = ENOTSUP.
 */
PALEXPORT int32_t SystemNative_FcntlSetPipeSz(intptr_t fd, int32_t size);

/**
 * Sets whether or not a file descriptor is non-blocking.
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_FcntlSetIsNonBlocking(intptr_t fd, int32_t isNonBlocking);

/**
 * Gets whether or not a file descriptor is non-blocking.
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_FcntlGetIsNonBlocking(intptr_t fd, int32_t* isNonBlocking);

/**
 * Checks if a file descriptor is valid and opened with the specified access mode.
 *
 * Returns 1 if valid and has the required access, 0 otherwise.
 */
PALEXPORT int32_t SystemNative_FcntlCanGetSetAccess(intptr_t fd, int32_t mode);

/**
 * Create a directory. Implemented as a shim to mkdir(2).
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_MkDir(const char* path, int32_t mode);

/**
 * Change permissions of a file. Implemented as a shim to chmod(2).
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_ChMod(const char* path, int32_t mode);

/**
* Change permissions of a file. Implemented as a shim to fchmod(2).
*
* Returns 0 for success, -1 for failure. Sets errno for failure.
*/
PALEXPORT int32_t SystemNative_FChMod(intptr_t fd, int32_t mode);

/**
 * Flushes all modified data and attribtues of the specified File Descriptor to the storage medium.
 *

Review comment (suggestion):
The comment shows precisely what this method does. The name does not. We need a better name. Please rename it to `SystemNative_FcntlCheckAccess`.

Code after:
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 *
 * NOTE: Some platforms do not support this operation and will always fail with errno = ENOTSUP.
 */
PALEXPORT int32_t SystemNative_FcntlSetPipeSz(intptr_t fd, int32_t size);

/**
 * Sets whether or not a file descriptor is non-blocking.
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_FcntlSetIsNonBlocking(intptr_t fd, int32_t isNonBlocking);

/**
 * Gets whether or not a file descriptor is non-blocking.
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_FcntlGetIsNonBlocking(intptr_t fd, int32_t* isNonBlocking);

/**
 * Create a directory. Implemented as a shim to mkdir(2).
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_MkDir(const char* path, int32_t mode);

/**
 * Change permissions of a file. Implemented as a shim to chmod(2).
 *
 * Returns 0 for success, -1 for failure. Sets errno for failure.
 */
PALEXPORT int32_t SystemNative_ChMod(const char* path, int32_t mode);

/**
* Change permissions of a file. Implemented as a shim to fchmod(2).
*
* Returns 0 for success, -1 for failure. Sets errno for failure.
*/
PALEXPORT int32_t SystemNative_FChMod(intptr_t fd, int32_t mode);

/**
 * Flushes all modified data and attribtues of the specified File Descriptor to the storage medium.
 *
 * Returns 0 for success; on fail, -1 is returned and errno is set.
 */
PALEXPORT int32_t SystemNative_FSync(intptr_t fd);

/**
 * Changes the advisory lock status on a given File Descriptor
 *