Name

SPVM::Sys::IO::Stat - struct stat in the C language

Description

Sys::IO::Stat class in SPVM represents struct stat in the C language, and has utility methods for the structure.

Usage

use Sys::IO::Stat;

my $file = "foo.txt";
my $stat = Sys::IO::Stat->new;

Sys::IO::Stat->stat($file, $stat);

Sys::IO::Stat->lstat($file, $stat);

my $st_mode = $stat->st_mode;
my $st_size = $stat->st_size;

Details

This class is a pointer class. The pointer the instance has is set to a struct stat object.

Class Methods

new

static method new : Sys::IO::Stat ();

Creates a new Sys::IO::Stat object.

stat

static method stat : int ($path : string, $stat : Sys::IO::Stat);

Calls the stat function and returns its return value.

Exceptions:

$path must be defined. Otherwise an exception is thrown.

$stat must be defined. Otherwise an exception is thrown.

If the stat function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

lstat

static method lstat : int ($path : string, $stat : Sys::IO::Stat);

Calls the lstat function and returns its return value.

Exceptions:

$path must be defined. Otherwise an exception is thrown.

$stat must be defined. Otherwise an exception is thrown.

If the lstat function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

fstat

static method fstat : int ($fd : int, $stat : Sys::IO::Stat);

Calls the fstat function and returns its return value.

Exceptions:

The $stat is a Sys::IO::Stat object.

$stat must be defined. Otherwise an exception is thrown.

If the stat function failed, an exception is thrown with eval_error_id set to the basic type ID of the Error::System class.

Instance Methods

DESTROY

method DESTROY : void ();

The destructor.

st_dev

method st_dev : int ();

Returns st_dev.

st_ino

method st_ino : int ();

Returns st_ino.

st_mode

method st_mode : int ();

Returns st_mode.

method st_nlink : int ();

Returns st_nlink.

st_uid

method st_uid : int ();

Returns st_uid.

st_gid

method st_gid : int ();

Returns st_gid.

st_rdev

method st_rdev : int ();

Returns st_rdev.

st_size

method st_size : long ();

Returns st_size.

st_blksize

method st_blksize : long ();

Returns st_blksize.

st_blocks

method st_blocks : long ();

Returns st_blocks.

st_mtime

method st_mtime : long ();

Returns st_mtime.

st_atime

method st_atime : long ();

Returns st_atime.

st_ctime

method st_ctime : long ();

Returns st_ctime.

st_mtim_tv_nsec

method st_mtim_tv_nsec : long ();

Returns st_mtim.tv_nsec.

st_atim_tv_nsec

method st_atim_tv_nsec : long ();

Returns st_atim.tv_nsec.

st_ctim_tv_nsec

method st_ctim_tv_nsec : long ();

Returns st_ctim.tv_nsec.

A

method A : double ();

The implementation of Sys#A method.

C

method C : double ();

The implementation of Sys#C method.

M

method M : double ();

The implementation of Sys#M method.

O

method O : int ();

The implementation of Sys#O method.

S

method S : int ();

The implementation of Sys#S method.

b

method b : int ();

The implementation of Sys#b method.

c

method c : int ();

The implementation of Sys#c method.

d

method d : int ();

The implementation of Sys#d method.

e

method e : int ();

The implementation of Sys#e method.

f

method f : int ();

The implementation of Sys#f method.

g

method g : int ();

The implementation of Sys#g method.

k

method k : int ();

The implementation of Sys#k method.

l

method l : int ();

The implementation of Sys#l method.

o

method o : int ();

The implementation of Sys#o method.

p

method p : int ();

The implementation of Sys#p method.

s

method s : long ();

The implementation of Sys#s method.

u

method u : int ();

The implementation of Sys#u method.

z

method z : int ();

The implementation of Sys#z method.

r

method r : int ();

The implementation of Sys#r method.

w

method w : int ();

The implementation of the Sys#w method.

x

method x : int ();

The implementation of Sys#x method.

R

method R : int ();

The implementation of Sys#R method.

W

method W : int ();

The implementation of Sys#W method.

X

method X : int ();

The implementation of Sys#X method.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License