Phasor 2.2.0
Stack VM based Programming Language
Loading...
Searching...
No Matches
file_properties.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <sys/types.h>
Include dependency graph for file_properties.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool file_set_properties (char *path, char param, int64_t epoch)
 Set file metadata time property.
int64_t file_get_properties (char *path, char param)
 Get file metadata time property.
nlink_t file_get_links_count (const char *path)
 Retrieves the number of hard links to a file.
bool file_get_owner_id (const char *path, uid_t *uid, gid_t *gid)
 Retrieves the owner identifier of a file.

Function Documentation

◆ file_get_links_count()

nlink_t file_get_links_count ( const char * path)

Retrieves the number of hard links to a file.

This function returns the count of hard links associated with the specified file. On POSIX systems, it uses stat to get st_nlink. On Windows, it uses GetFileInformationByHandle to obtain nNumberOfLinks.

Parameters
pathThe path to the file.
Returns
The number of hard links to the file. Returns 0 if the file cannot be accessed.

Definition at line 91 of file file_properties.c.

Here is the caller graph for this function:

◆ file_get_owner_id()

bool file_get_owner_id ( const char * path,
uid_t * uid,
gid_t * gid )

Retrieves the owner identifier of a file.

On POSIX systems, this sets *uid to the file owner's UID and *gid to the file owner's GID. On Windows, there is no direct UID/GID, but a numeric representation of the owner SID is assigned to *uid and *gid is set to 0.

Parameters
pathThe path to the file.
uidPointer to a variable that receives the owner's UID.
gidPointer to a variable that receives the owner's GID.
Returns
true if the owner information was successfully retrieved, false otherwise.

Definition at line 117 of file file_properties.c.

Here is the caller graph for this function:

◆ file_get_properties()

int64_t file_get_properties ( char * path,
char param )

Get file metadata time property.

Parameters
pathPath to file
paramWhat to get a=Access c=Creation m=Modified
Returns
epoch Epoch time

Definition at line 62 of file file_properties.c.

Here is the caller graph for this function:

◆ file_set_properties()

bool file_set_properties ( char * path,
char param,
int64_t epoch )

Set file metadata time property.

Parameters
pathPath to file
paramWhat to change a=Access c=Creation m=Modified
epochEpoch time to set
Returns
Status of operation

Definition at line 20 of file file_properties.c.

Here is the caller graph for this function: