Function: file-modes
file-modes is a function defined in fileio.c.
Signature
(file-modes FILENAME &optional FLAG)
Documentation
Return mode bits of file named FILENAME, as an integer.
Return nil if FILENAME does not exist. If optional FLAG is nofollow,
do not follow FILENAME if it is a symbolic link.
Probably introduced at or before Emacs version 1.5.
Aliases
Source Code
// Defined in /usr/src/emacs/src/fileio.c
{
struct stat st;
int nofollow = symlink_nofollow_flag (flag);
Lisp_Object absname = expand_and_dir_to_file (filename);
/* If the file name has special constructs in it,
call the corresponding file name handler. */
Lisp_Object handler = Ffind_file_name_handler (absname, Qfile_modes);
if (!NILP (handler))
return call3 (handler, Qfile_modes, absname, flag);
char *fname = SSDATA (ENCODE_FILE (absname));
if (emacs_fstatat (AT_FDCWD, fname, &st, nofollow) != 0)
return file_attribute_errno (absname, errno);
return make_fixnum (st.st_mode & 07777);
}