Seth Woolley's Man Viewer

Tcl_Stat(3) - Tcl_Access, Tcl_Stat - check file permissions and other attributes - man 3 Tcl_Stat

([section] manual, -k keyword, -K [section] search, -f whatis)
man plain no title

Tcl_Access(3)               Tcl Library Procedures               Tcl_Access(3)



______________________________________________________________________________

NAME
       Tcl_Access, Tcl_Stat - check file(1,n) permissions and other attributes

SYNOPSIS
       #include <tcl.h>

       int
       Tcl_Access(path, mode)

       int
       Tcl_Stat(path, statPtr)

ARGUMENTS
       char          *path      (in(1,8))      Native name of the file(1,n) to check the
                                          attributes of.

       int           mode       (in(1,8))      Mask consisting of one  or  more  of
                                          R_OK,  W_OK,  X_OK  and F_OK.  R_OK,
                                          W_OK  and  X_OK   request   checking
                                          whether  the  file(1,n)  exists  and  has
                                          read(2,n,1 builtins), write(1,2)  and   execute   permis-
                                          sions,   respectively.    F_OK  just
                                          requests checking for the  existence
                                          of the file.

       struct stat(1,2)   *statPtr   (out)     The   structure  that  contains  the
                                          result.
_________________________________________________________________


DESCRIPTION
       As of Tcl 8.4, the object-based APIs Tcl_FSAccess and Tcl_FSStat should
       be used in(1,8) preference to Tcl_Access and Tcl_Stat, wherever possible.

       There  are  two reasons for calling Tcl_Access and Tcl_Stat rather than
       calling system level functions access(2,5) and stat(1,2)  directly.   First,  the
       Windows  implementation of both functions fixes some bugs in(1,8) the system
       level  calls.   Second,  both  Tcl_Access  and  Tcl_Stat  (as  well  as
       Tcl_OpenFileChannelProc)  hook  into  a linked list of functions.  This
       allows the possibility to reroute file(1,n) access(2,5) to alternative  media  or
       access(2,5) methods.

       Tcl_Access  checks  whether the process would be allowed to read(2,n,1 builtins), write(1,2)
       or test for existence of the file(1,n) (or other file(1,n) system  object)  whose
       name  is  pathname.   If pathname is a symbolic link(1,2) on Unix, then per-
       missions of the file(1,n) referred by this symbolic link(1,2) are tested.

       On success (all requested permissions granted), zero is  returned.   On
       error(8,n)  (at least one bit in(1,8) mode asked for a permission that is denied,
       or some other  error(8,n) occurred), -1 is returned.

       Tcl_Stat fills the stat(1,2) structure statPtr with  information  about  the
       specified  file.   You do not need any access(2,5) rights to the file(1,n) to get
       this information but you need search rights to all directories named(5,8) in(1,8)
       the path leading to the file.  The stat(1,2) structure includes info(1,5,n) regard-
       ing device, inode (always 0 on Windows), privilege mode, nlink  (always
       1  on  Windows),  user  id (always 0 on Windows), group id (always 0 on
       Windows), rdev (same as device on Windows),  size,  last  access(2,5)  time(1,2,n),
       last modification time(1,2,n), and creation time.

       If  path  exists,  Tcl_Stat  returns 0 and the stat(1,2) structure is filled
       with data.  Otherwise, -1 is returned, and no stat(1,2) info(1,5,n) is given.


KEYWORDS
       stat(1,2), access(2,5)




Tcl                                   8.1                        Tcl_Access(3)

References for this manual (incoming links)