=encoding utf8

=head1 NAME

POSIX::1003::FS - POSIX for the file-system

=head1 INHERITANCE

 POSIX::1003::FS
   is a POSIX::1003::Module

=head1 SYNOPSIS

  use POSIX::1003::FS ':access';
  if(access $fn, R_OK) # $fn is readible?

  use POSIX::1003::FS qw(mkfifo :stat);
  mkfifo($path, S_IRUSR|S_IWUSR) or die $!;

  # Absorbed from Unix::Mknod
  use POSIX::1003::FS qw(mknod major minor makedev);
  use File::stat
  my $st    = stat '/dev/null';
  my $major = major $st->rdev;
  my $minor = minor $st->rdev;
  mknod '/tmp/special', S_IFCHR|0600, makedev($major,$minor+1);

=head1 DESCRIPTION

You may also need L<POSIX::1003::Pathconf|POSIX::1003::Pathconf>.

See L<documentation in the base class|POSIX::1003::Module/"DESCRIPTION">.
 
=head1 METHODS

See L<documentation in the base class|POSIX::1003::Module/"METHODS">.
 
=over 4

=item POSIX::1003::FS-E<gt>B<exampleValue>(NAME)

See L<POSIX::1003::Module/"METHODS">

=item $obj-E<gt>B<import>()

See L<POSIX::1003::Module/"METHODS">

=back

=head1 FUNCTIONS

=head2 Standard POSIX

=over 4

=item B<access>(FILENAME, FLAGS)

Read C<man filetest> before you start using this function!
Use the C<*_OK> constants for FLAGS.

=item B<lchown>(UID, GID, FILENAMES)

Like C<chown()>, but does not follow symlinks when encountered. Returns
the number of files successfully changed.

B<Be Warned> that the POSIX specification uses different parameter
order. For Perl was decided to accept a list of filenames.  Passing more
than one filename, however, hinders correct error reporting.

  # POSIX specification:
  # int lchown(const char *path, uid_t owner, gid_t group);

  # Perl core implementation:
  my $successes = chown($uid, $gid, @filenames);

  use POSIX;
  POSIX::lchown($uid, $gid, $filename) or die $!;

  use POSIX::1003::FS 'lchown';
  my @successes = lchown($uid, $gid, @filenames);

=item B<mkdir>([FILENAME [MASK]])

Simple C<CORE::mkdir()>

=item B<mkfifo>(FILENAME, MODE)

=item B<mknod>(PATH, MODE, DEVICE)

Create a special device node on PATH. Useful symbols for MODE can be
collected from Fcntl (import tag C<:mode>).  The DEVICE number is
a combination from the type (I<major> number), a sequence number and
usage information (combined in a I<minor> number).

=item B<rename>(OLDNAME, NEWNAME)

[0.93] Give a file or directory a new name, the basis of the UNIX C<mv>
('move') command.  This will use C<CORE::rename()>. 

B<Be warned> that Window's C<rename> implementation will fail when
NEWNAME exists.  That behavior is not POSIX compliant.  On many platforms
(especially the older), a C<rename> between different partitions is not
allowed.

=item B<utime>(ATIME, MTIME, FILENAMES)

Simply C<CORE::utime()>

B<Be Warned> that C<POSIX.pm> uses a different parameter order than CORE.

  POSIX::utime($filename, $atime, $mtime);
  CORE::utime($atime, $mtime, @filenames);

=back

=head2 Additional

=over 4

=item B<S_ISBLK>(MODE)

=item B<S_ISCHR>(MODE)

=item B<S_ISDIR>(MODE)

example: 

  use File::stat 'stat';
  if(S_ISDIR(stat($fn)->mode)) ...

  if(S_ISDIR((lstat $fn)[2])) ...

=item B<S_ISFIFO>(MODE)

=item B<S_ISLNK>(MODE)

=item B<S_ISREG>(MODE)

=item B<S_ISSOCK>(MODE)

=item B<S_ISVTX>(MODE)

=item B<S_ISWHT>(MODE)

=item B<major>(DEVICE)

=item B<makedev>(MAJOR, MINOR)

Combine MAJOR and MINOR into a single DEVICE number.

 my $device      = (stat $filename)[6];
 my $device_type = major $device;
 my $sequence_nr = minor $device;

 my $device = makedev $major, $minor;
 mknod $specialfile, $mode, $device;

=item B<minor>(DEVICE)

=back

=head1 CONSTANTS

The following constants are exported, shown here with the values
discovered during installation of this module:

=for comment
#TABLE_FSYS_START

  F_OK          0       S_IFMT        61440   S_ISVTX       512
  FILENAME_MAX  4096    S_IFREG       32768   S_IWGRP       16
  MAX_CANON     255     S_IFSOCK      49152   S_IWOTH       2
  NAME_MAX      255     S_IRGRP       32      S_IWUSR       128
  PATH_MAX      4096    S_IROTH       4       S_IXGRP       8
  R_OK          4       S_IRUSR       256     S_IXOTH       1
  S_IFBLK       24576   S_IRWXG       56      S_IXUSR       64
  S_IFCHR       8192    S_IRWXO       7       W_OK          2
  S_IFDIR       16384   S_IRWXU       448     X_OK          1
  S_IFIFO       4096    S_ISGID       1024    
  S_IFLNK       40960   S_ISUID       2048    


=for comment
#TABLE_FSYS_END





All functions and constants which start with C<S_*> can be imported
using the C<:stat> tag, including all related C<S_IS*> functions.

The C<*_OK> tags can be imported with C<:access>

Permission flags get loaded with C<:perms>.

=head1 SEE ALSO

This module is part of POSIX-1003 distribution version 0.98,
built on December 03, 2013. Website: F<http://perl.overmeer.net>.  The code is based on L<POSIX>, which
is released with Perl itself.  See also L<POSIX::Util> for
additional functionality.

=head1 COPYRIGHTS

Copyrights 2011-2013 on the perl code and the related documentation
 by [Mark Overmeer]. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
See F<http://www.perl.com/perl/misc/Artistic.html>

