src/pmc/os.pmc - Files and Directories PMC
OS is a PMC type which provides access to the filesystem files and directories.
From PIR code:
$P0 = new 'OS'
my $os := pir::new__ps("OS");
var os = new 'OS';
static PMC * stat_buf_to_array(PARROT_INTERP, const Parrot_Stat_Buf *buf)
Converts a stat buffer to a Perl-like array.
Returns the current working directory.
void chdir(STRING *path)
Changes the current working directory to the one specified by
void unlink(STRING *file)
void rmdir(STRING *path)
void rm(STRING *path)
void mkdir(STRING *path, STRING *mode)
Creates a directory specified by
fixedpmcarray *stat(STRING *path)
Stats a file, and returns a 13 position array as in Perl:
fixedpmcarray *lstat(STRING *path)
Lstats a file, and returns a 13 position array as in Perl. See
void symlink(STRING *from, STRING *to)
Creates a symlink
void link(STRING *from, STRING *to)
Creates a hard link
INTVAL umask(INTVAL mask)
umask sets the process's file mode creation mask (and returns the previous one).
INTVAL chroot(STRING *path)
it makes the named directory the new root directory for all further pathnames that begin with a "/" by your process and all its children.NOTE: perl restricts this operation to superusers. It might be a good idea to do the same with parrot.
PMC *readdir(STRING *path)
Reads entries from a directory.
rename(STRING *oldpath, STRING *newpath)
This method is a wrapper for rename(2). On error a SystemError exception is thrown.
chmod(STRING *path, INTVAL mode)
Returns the ID number of the current user. This is platform-dependent.
Determine if the file exists. Return
filefrom the file system.
pathfrom the file system, if it is empty.
removeto remove the file or empty directory specified by
0 dev device number of filesystem 1 ino inode number 2 mode file mode (type and permissions) 3 nlink number of (hard) links to the file 4 uid numeric user ID of file's owner 5 gid numeric group ID of file's owner 6 rdev the device identifier (special files only) 7 size total size of file, in bytes 8 atime last access time in seconds since the epoch 9 mtime last modify time in seconds since the epoch 10 ctime inode change time in seconds since the epoch (*) 11 blksize preferred block size for file system I/O 12 blocks actual number of blocks allocated11 and 12 are not available under Windows.
1if it exists. Return
chdir(2), getcwd(3), unlink(2), mkdir(2), stat(2), lstat(2), symlink(2), link(2), umask(2), chroot(2)