Ruby 2.7.0p0(2019-12-25revision647ee6f091eafcce70ffb75ddf7e121e192ab217)

Data Structures | Macros | Typedefs | Enumerations | Functions | Variables
file.c File Reference
`#include "id.h"`
`#include "ruby/encoding.h"`
`#include "ruby/io.h"`
`#include "ruby/util.h"`
`#include "ruby/thread.h"`
`#include "internal.h"`
`#include "dln.h"`
`#include "encindex.h"`
`#include <ctype.h>`
`#include <time.h>`
`#include <sys/types.h>`
`#include <sys/stat.h>`

Go to the source code of this file.

## Data Structures
struct | apply_filename
struct | apply_arg
struct | no_gvl_stat_data
struct | access_arg
struct | chown_args
struct | utime_args
struct | utimbuf
struct | rename_args

## Macros
#define | MAXPATHLEN 1024
#define | lstat stat
#define | STAT(p, s) stat((p), (s))
#define | USE_OSPATH 0
#define | TO_OSPATH(str) (str)
#define | NORMALIZE_UTF8PATH 0
#define | apply2args(n) (rb_check_arity(argc, n, UNLIMITED_ARGUMENTS), argc-=n)
#define | ST2UINT(val) ((val) & ~(~1UL << (sizeof(val) * CHAR_BIT - 1)))
#define | NUM2DEVT(v) NUM2UINT(v)
#define | DEVT2NUM(v) UINT2NUM(v)
#define | PRI_DEVT_PREFIX ""
#define | HAVE_STAT_BIRTHTIME
#define | rb_stat_birthtime rb_f_notimplement
#define | statx_has_birthtime(st) 0
#define | S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)
#define | S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
#define | S_ISBLK(m) (0) /* anytime false */
#define | S_ISCHR(m) (((m) & S_IFMT) == S_IFCHR)
#define | S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)
#define | S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)
#define | S_ISREG(m) (((m) & S_IFMT) == S_IFREG)
#define | rb_file_s_birthtime rb_f_notimplement
#define | rb_file_birthtime rb_f_notimplement
#define | rb_file_s_lchmod rb_f_notimplement
#define | rb_file_s_lchown rb_f_notimplement
#define | rb_file_s_lutime rb_f_notimplement
#define | syserr_fail2_in(func, e, s1, s2) syserr_fail2(e, s1, s2)
#define | sys_fail2(s1, s2) syserr_fail2(errno, s1, s2)
#define | rb_file_s_link rb_f_notimplement
#define | rb_file_s_symlink rb_f_notimplement
#define | rb_file_s_readlink rb_f_notimplement
#define | isdirsep(x) ((x) == '/')
#define | USE_NTFS 0
#define | USE_NTFS_ADS 0
#define | istrailinggarbage(x) 0
#define | isADS(x) 0
#define | Next(p, e, enc) ((p) + rb_enc_mbclen((p), (e), (enc)))
#define | Inc(p, e, enc) ((p) = Next((p), (e), (enc)))
#define | has_unc(buf) 0
#define | nextdirsep rb_enc_path_next
#define | skipprefix(path, end, enc) (path)
#define | strrdirsep rb_enc_path_last_separator
#define | BUFCHECK(cond)
#define | BUFINIT()
#define | SKIPPATHSEP(p) 1
#define | BUFCOPY(srcptr, srclen)
#define | WITH_ROOTDIFF(stmt)
#define | endpwent() ((void)0)
#define | EXPAND_PATH_BUFFER() rb_usascii_str_new(0, MAXPATHLEN + 2)
#define | expand_path(fname, dname, abs_mode, long_name, result) str_shrink(rb_file_expand_path_internal(fname, dname, abs_mode, long_name, result))
#define | check_expand_path_args(fname, dname)
#define | fncomp strncmp
#define | rb_file_s_truncate rb_f_notimplement
#define | rb_file_truncate rb_f_notimplement
#define | LOCK_SH 1
#define | LOCK_EX 2
#define | LOCK_NB 4
#define | LOCK_UN 8
#define | CHECK(n) test_check((n), argc, argv)
#define | rb_file_s_mkfifo rb_f_notimplement
#define | ENABLE_PATH_CHECK 1
#define | S_IWOTH 002
#define | fpath_check(path) path_check_0((path), FALSE)
#define | O_BINARY 0
#define | O_SHARE_DELETE 0

## Typedefs
typedef struct no_gvl_stat_data | no_gvl_stat_data

## Enumerations
enum | rb_realpath_mode { RB_REALPATH_CHECK, RB_REALPATH_DIR, RB_REALPATH_STRICT, RB_REALPATH_MODE_MAX }

## Functions
int | flock (int, int)
VALUE | rb_get_path_check_to_string (VALUE obj)
VALUE | rb_get_path_check_convert (VALUE obj)
VALUE | rb_get_path_no_checksafe (VALUE obj)
VALUE | rb_get_path (VALUE obj)
VALUE | rb_str_encode_ospath (VALUE path)
VALUE | rb_stat_new (const struct stat *st)
int | eaccess (const char *path, int mode)
VALUE | rb_file_directory_p (VALUE obj, VALUE fname)
| NORETURN (static void syserr_fail2_in(const char *, int, VALUE, VALUE))
char * | rb_enc_path_next (const char *s, const char *e, rb_encoding *enc)
char * | rb_enc_path_skip_prefix (const char *path, const char *end, rb_encoding *enc)
char * | rb_enc_path_last_separator (const char *path, const char *end, rb_encoding *enc)
char * | rb_enc_path_end (const char *path, const char *end, rb_encoding *enc)
VALUE | rb_home_dir_of (VALUE user, VALUE result)
VALUE | rb_default_home_dir (VALUE result)
VALUE | rb_file_expand_path_internal (VALUE fname, VALUE dname, int abs_mode, int long_name, VALUE result)
VALUE | rb_file_expand_path (VALUE fname, VALUE dname)
VALUE | rb_file_expand_path_fast (VALUE fname, VALUE dname)
VALUE | rb_file_s_expand_path (int argc, const VALUE *argv)
VALUE | rb_file_absolute_path (VALUE fname, VALUE dname)
VALUE | rb_file_s_absolute_path (int argc, const VALUE *argv)
VALUE | rb_realpath_internal (VALUE basedir, VALUE path, int strict)
VALUE | rb_check_realpath (VALUE basedir, VALUE path, rb_encoding *enc)
const char * | ruby_enc_find_basename (const char *name, long *baselen, long *alllen, rb_encoding *enc)
VALUE | rb_file_dirname (VALUE fname)
const char * | ruby_enc_find_extname (const char *name, long *len, rb_encoding *enc)
void | rb_file_const (const char *name, VALUE value)
int | rb_is_absolute_path (const char *path)
int | rb_path_check (const char *path)
int | ruby_is_fd_loadable (int fd)
int | rb_file_load_ok (const char *path)
int | rb_find_file_ext_safe (VALUE *filep, const char *const *ext, int _level)
int | rb_find_file_ext (VALUE *filep, const char *const *ext)
VALUE | rb_find_file_safe (VALUE path, int _level)
VALUE | rb_find_file (VALUE path)
void | Init_File (void)

## Variables
VALUE | rb_cFile
VALUE | rb_mFileTest
VALUE | rb_cStat
const char | ruby_null_device []

## Macro Definition Documentation

## ◆ apply2args

#define apply2args | ( |  | n | ) | (rb_check_arity(argc, n, UNLIMITED_ARGUMENTS), argc-=n)

Definition at line 359 of file file.c.

## ◆ BUFCHECK

#define BUFCHECK | ( |  | cond | ) |

Value:
do {\
bdiff = p - buf;\
if (cond) {\
do {buflen *= 2;} while (cond);\
rb_str_resize(result, buflen);\
buf = RSTRING_PTR(result);\
p = buf + bdiff;\
pend = buf + buflen;\
}\
} while (0)

Definition at line 3471 of file file.c.

## ◆ BUFCOPY

#define BUFCOPY | ( |  | srcptr,
|  |  | srclen
| ) |  |

Value:
do { \
const int skip = SKIPPATHSEP(p); \
rb_str_set_len(result, p-buf+skip); \
BUFCHECK(bdiff + ((srclen)+skip) >= buflen); \
p += skip; \
memcpy(p, (srcptr), (srclen)); \
p += (srclen); \
} while (0)

Definition at line 3493 of file file.c.

## ◆ BUFINIT

#define BUFINIT | ( |  | ) |

Value:
(\
p = buf = RSTRING_PTR(result),\
buflen = RSTRING_LEN(result),\
pend = p + buflen)

Definition at line 3482 of file file.c.

## ◆ CHECK

#define CHECK | ( |  | n | ) | test_check((n), argc, argv)

Definition at line 5189 of file file.c.

## ◆ check_expand_path_args

#define check_expand_path_args | ( |  | fname,
|  |  | dname
| ) |  |

Value:
(((fname) = rb_get_path(fname)), \
(void)(NIL_P(dname) ? (dname) : ((dname) = rb_get_path(dname))))

Definition at line 4007 of file file.c.

## ◆ DEVT2NUM

#define DEVT2NUM | ( |  | v | ) | UINT2NUM(v)

Definition at line 546 of file file.c.

## ◆ ENABLE_PATH_CHECK

#define ENABLE_PATH_CHECK 1

Definition at line 6107 of file file.c.

## ◆ endpwent

#define endpwent | ( |  | ) | ((void)0)

## ◆ expand_path

#define expand_path | ( |  | fname,
|  |  | dname,
|  |  | abs_mode,
|  |  | long_name,
|  |  | result
| ) |  | str_shrink(rb_file_expand_path_internal(fname, dname, abs_mode, long_name, result))

Definition at line 4004 of file file.c.

## ◆ EXPAND_PATH_BUFFER

#define EXPAND_PATH_BUFFER | ( |  | ) | rb_usascii_str_new(0, MAXPATHLEN + 2)

Definition at line 3995 of file file.c.

## ◆ fncomp

#define fncomp strncmp

## ◆ fpath_check

#define fpath_check | ( |  | path | ) | path_check_0((path), FALSE)

Definition at line 6162 of file file.c.

## ◆ has_unc

#define has_unc | ( |  | buf | ) | 0

Definition at line 3288 of file file.c.

## ◆ HAVE_STAT_BIRTHTIME

#define HAVE_STAT_BIRTHTIME

Definition at line 902 of file file.c.

## ◆ Inc

#define Inc | ( |  | p,
|  |  | e,
|  |  | enc
| ) |  | ((p) = Next((p), (e), (enc)))

Definition at line 3283 of file file.c.

## ◆ isADS

#define isADS | ( |  | x | ) | 0

Definition at line 3279 of file file.c.

## ◆ isdirsep

#define isdirsep | ( |  | x | ) | ((x) == '/')

Definition at line 3253 of file file.c.

## ◆ istrailinggarbage

#define istrailinggarbage | ( |  | x | ) | 0

Definition at line 3274 of file file.c.

## ◆ LOCK_EX

#define LOCK_EX 2

Definition at line 5058 of file file.c.

## ◆ LOCK_NB

#define LOCK_NB 4

Definition at line 5061 of file file.c.

## ◆ LOCK_SH

#define LOCK_SH 1

Definition at line 5055 of file file.c.

## ◆ LOCK_UN

#define LOCK_UN 8

Definition at line 5064 of file file.c.

## ◆ lstat

#define lstat stat

Definition at line 97 of file file.c.

## ◆ MAXPATHLEN

#define MAXPATHLEN 1024

Definition at line 60 of file file.c.

## ◆ Next

#define Next | ( |  | p,
|  |  | e,
|  |  | enc
| ) |  | ((p) + rb_enc_mbclen((p), (e), (enc)))

Definition at line 3282 of file file.c.

## ◆ nextdirsep

#define nextdirsep rb_enc_path_next

Definition at line 3356 of file file.c.

## ◆ NORMALIZE_UTF8PATH

#define NORMALIZE_UTF8PATH 0

Definition at line 356 of file file.c.

## ◆ NUM2DEVT

#define NUM2DEVT | ( |  | v | ) | NUM2UINT(v)

Definition at line 543 of file file.c.

## ◆ O_BINARY

#define O_BINARY 0

## ◆ O_SHARE_DELETE

#define O_SHARE_DELETE 0

## ◆ PRI_DEVT_PREFIX

#define PRI_DEVT_PREFIX ""

Definition at line 549 of file file.c.

## ◆ rb_file_birthtime

#define rb_file_birthtime rb_f_notimplement

Definition at line 2493 of file file.c.

## ◆ rb_file_s_birthtime

#define rb_file_s_birthtime rb_f_notimplement

Definition at line 2464 of file file.c.

## ◆ rb_file_s_lchmod

#define rb_file_s_lchmod rb_f_notimplement

Definition at line 2624 of file file.c.

## ◆ rb_file_s_lchown

#define rb_file_s_lchown rb_f_notimplement

Definition at line 2756 of file file.c.

## ◆ rb_file_s_link

#define rb_file_s_link rb_f_notimplement

Definition at line 3009 of file file.c.

## ◆ rb_file_s_lutime

#define rb_file_s_lutime rb_f_notimplement

Definition at line 2947 of file file.c.

## ◆ rb_file_s_mkfifo

#define rb_file_s_mkfifo rb_f_notimplement

Definition at line 6077 of file file.c.

## ◆ rb_file_s_readlink

#define rb_file_s_readlink rb_f_notimplement

Definition at line 3118 of file file.c.

## ◆ rb_file_s_symlink

#define rb_file_s_symlink rb_f_notimplement

Definition at line 3039 of file file.c.

## ◆ rb_file_s_truncate

#define rb_file_s_truncate rb_f_notimplement

Definition at line 4990 of file file.c.

## ◆ rb_file_truncate

#define rb_file_truncate rb_f_notimplement

Definition at line 5051 of file file.c.

## ◆ rb_stat_birthtime

#define rb_stat_birthtime rb_f_notimplement

Definition at line 1000 of file file.c.

## ◆ S_IRUGO

#define S_IRUGO (S_IRUSR | S_IRGRP | S_IROTH)

Definition at line 1820 of file file.c.

## ◆ S_ISBLK

#define S_ISBLK | ( |  | m | ) | (0) /* anytime false */

## ◆ S_ISCHR

#define S_ISCHR | ( |  | m | ) | (((m) & S_IFMT) == S_IFCHR)

## ◆ S_ISDIR

#define S_ISDIR | ( |  | m | ) | (((m) & S_IFMT) == S_IFDIR)

## ◆ S_ISREG

#define S_ISREG | ( |  | m | ) | (((m) & S_IFMT) == S_IFREG)

Definition at line 1968 of file file.c.

## ◆ S_IWOTH

#define S_IWOTH 002

## ◆ S_IWUGO

#define S_IWUGO (S_IWUSR | S_IWGRP | S_IWOTH)

Definition at line 1824 of file file.c.

## ◆ S_IXUGO

#define S_IXUGO (S_IXUSR | S_IXGRP | S_IXOTH)

Definition at line 1451 of file file.c.

## ◆ SKIPPATHSEP

#define SKIPPATHSEP | ( |  | p | ) | 1

Definition at line 3490 of file file.c.

## ◆ skipprefix

#define skipprefix | ( |  | path,
|  |  | end,
|  |  | enc
| ) |  | (path)

Definition at line 3369 of file file.c.

## ◆ ST2UINT

#define ST2UINT | ( |  | val | ) | ((val) & ~(~1UL << (sizeof(val) * CHAR_BIT - 1)))

Definition at line 540 of file file.c.

## ◆ STAT

#define STAT | ( |  | p,
|  |  | s
| ) |  | stat((p), (s))

Definition at line 133 of file file.c.

## ◆ statx_has_birthtime

#define statx_has_birthtime | ( |  | st | ) | 0

Definition at line 1240 of file file.c.

## ◆ strrdirsep

#define strrdirsep rb_enc_path_last_separator

Definition at line 3404 of file file.c.

## ◆ sys_fail2

#define sys_fail2 | ( |  | s1,
|  |  | s2
| ) |  | syserr_fail2(errno, s1, s2)

Definition at line 2955 of file file.c.

## ◆ syserr_fail2_in

#define syserr_fail2_in | ( |  | func,
|  |  | e,
|  |  | s1,
|  |  | s2
| ) |  | syserr_fail2(e, s1, s2)

Definition at line 2953 of file file.c.

## ◆ TO_OSPATH

#define TO_OSPATH | ( |  | str | ) | (str)

Definition at line 141 of file file.c.

## ◆ USE_NTFS

#define USE_NTFS 0

Definition at line 3260 of file file.c.

## ◆ USE_NTFS_ADS

#define USE_NTFS_ADS 0

Definition at line 3267 of file file.c.

## ◆ USE_OSPATH

#define USE_OSPATH 0

Definition at line 140 of file file.c.

## ◆ WITH_ROOTDIFF

#define WITH_ROOTDIFF | ( |  | stmt | ) |

Value:
do { \
long rootdiff = root - buf; \
stmt; \
root = buf + rootdiff; \
} while (0)

Definition at line 3502 of file file.c.

## Typedef Documentation

## ◆ no_gvl_stat_data

typedef struct no_gvl_stat_data no_gvl_stat_data

## Enumeration Type Documentation

## ◆ rb_realpath_mode

enum rb_realpath_mode

Enumerator
RB_REALPATH_CHECK |
RB_REALPATH_DIR |
RB_REALPATH_STRICT |
RB_REALPATH_MODE_MAX |

Definition at line 4123 of file file.c.

## Function Documentation

## ◆ eaccess()

int eaccess | ( | const char * | path,
|  | int | mode
| ) |  |

Definition at line 1460 of file file.c.

References access(), getegid(), geteuid(), getgid(), getuid(), path, rb_uid_t, S_IXUGO, st, STAT, and X_OK.

## ◆ flock()

int flock | ( | int | ,
|  | int |
| ) |  |

Definition at line 125 of file flock.c.

## ◆ Init_File()

void Init_File | ( | void |  | ) |

Definition at line 6435 of file file.c.

References rb_cFile, rb_cIO, rb_define_class(), rb_define_module(), and rb_mFileTest.

## ◆ NORETURN()

NORETURN | ( | static void | syserr_fail2_inconst char *, int, VALUE, VALUE | ) |

## ◆ rb_check_realpath()

VALUE rb_check_realpath | ( | VALUE | basedir,
|  | VALUE | path,
|  | rb_encoding * | enc
| ) |  |

Definition at line 4417 of file file.c.

## ◆ rb_default_home_dir()

VALUE rb_default_home_dir | ( | VALUE | result | ) |

Definition at line 3576 of file file.c.

## ◆ rb_enc_path_end()

char* rb_enc_path_end | ( | const char * | path,
|  | const char * | end,
|  | rb_encoding * | enc
| ) |  |

Definition at line 3440 of file file.c.

References isdirsep, and path.

## ◆ rb_enc_path_last_separator()

char* rb_enc_path_last_separator | ( | const char * | path,
|  | const char * | end,
|  | rb_encoding * | enc
| ) |  |

Definition at line 3406 of file file.c.

References Inc, isdirsep, last, NULL, and path.

Referenced by ruby_init_loadpath().

## ◆ rb_enc_path_next()

char* rb_enc_path_next | ( | const char * | s,
|  | const char * | e,
|  | rb_encoding * | enc
| ) |  |

Definition at line 3358 of file file.c.

References Inc, and isdirsep.

Referenced by rb_enc_path_skip_prefix().

## ◆ rb_enc_path_skip_prefix()

char* rb_enc_path_skip_prefix | ( | const char * | path,
|  | const char * | end,
|  | rb_encoding * | enc
| ) |  |

Definition at line 3372 of file file.c.

References isdirsep, path, and rb_enc_path_next().

## ◆ rb_file_absolute_path()

VALUE rb_file_absolute_path | ( | VALUE | fname,
|  | VALUE | dname
| ) |  |

Definition at line 4072 of file file.c.

References check_expand_path_args, expand_path, and EXPAND_PATH_BUFFER.

Referenced by rb_f_require_relative(), and rb_file_s_absolute_path().

## ◆ rb_file_const()

void rb_file_const | ( | const char * | name,
|  | VALUE | value
| ) |  |

Definition at line 6083 of file file.c.

References rb_define_const().

## ◆ rb_file_directory_p()

VALUE rb_file_directory_p | ( | VALUE | obj,
|  | VALUE | fname
| ) |  |

Definition at line 1577 of file file.c.

References st.

## ◆ rb_file_dirname()

VALUE rb_file_dirname | ( | VALUE | fname | ) |

Definition at line 4645 of file file.c.

References FilePathStringValue, name, rb_enc_get(), rb_encoding, RSTRING_LEN, and StringValueCStr.

Referenced by rb_f_require_relative().

## ◆ rb_file_expand_path()

VALUE rb_file_expand_path | ( | VALUE | fname,
|  | VALUE | dname
| ) |  |

Definition at line 4018 of file file.c.

References check_expand_path_args, expand_path, and EXPAND_PATH_BUFFER.

Referenced by rb_file_s_expand_path().

## ◆ rb_file_expand_path_fast()

VALUE rb_file_expand_path_fast | ( | VALUE | fname,
|  | VALUE | dname
| ) |  |

Definition at line 4025 of file file.c.

References expand_path, and EXPAND_PATH_BUFFER.

Referenced by rb_feature_provided().

## ◆ rb_file_expand_path_internal()

VALUE rb_file_expand_path_internal | ( | VALUE | fname,
|  | VALUE | dname,
|  | int | abs_mode,
|  | int | long_name,
|  | VALUE | result
| ) |  |

Definition at line 3646 of file file.c.

## ◆ rb_file_load_ok()

int rb_file_load_ok | ( | const char * | path | ) |

Definition at line 6222 of file file.c.

## ◆ rb_file_s_absolute_path()

VALUE rb_file_s_absolute_path | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 4079 of file file.c.

References argc, argv, Qnil, rb_check_arity, and rb_file_absolute_path().

## ◆ rb_file_s_expand_path()

VALUE rb_file_s_expand_path | ( | int | argc,
|  | const VALUE * | argv
| ) |  |

Definition at line 4031 of file file.c.

References argc, argv, Qnil, rb_check_arity, and rb_file_expand_path().

## ◆ rb_find_file()

VALUE rb_find_file | ( | VALUE | path | ) |

Definition at line 6336 of file file.c.

References f, path, and StringValueCStr.

Referenced by rb_find_file_safe(), and rb_load().

## ◆ rb_find_file_ext()

int rb_find_file_ext | ( | VALUE * | filep,
|  | const char *const * | ext
| ) |  |

Definition at line 6270 of file file.c.

References f, i, and StringValueCStr.

Referenced by rb_find_file_ext_safe().

## ◆ rb_find_file_ext_safe()

int rb_find_file_ext_safe | ( | VALUE * | filep,
|  | const char *const * | ext,
|  | int | _level
| ) |  |

Definition at line 6263 of file file.c.

References rb_find_file_ext(), and rb_warn().

## ◆ rb_find_file_safe()

VALUE rb_find_file_safe | ( | VALUE | path,
|  | int | _level
| ) |  |

Definition at line 6329 of file file.c.

References path, rb_find_file(), and rb_warn().

## ◆ rb_get_path()

VALUE rb_get_path | ( | VALUE | obj | ) |

Definition at line 230 of file file.c.

References obj, rb_get_path_check_convert(), and rb_get_path_check_to_string().

Referenced by rb_feature_provided(), rb_get_path_no_checksafe(), and rb_resolve_feature_path().

## ◆ rb_get_path_check_convert()

VALUE rb_get_path_check_convert | ( | VALUE | obj | ) |

Definition at line 211 of file file.c.

References obj.

Referenced by rb_get_path().

## ◆ rb_get_path_check_to_string()

VALUE rb_get_path_check_to_string | ( | VALUE | obj | ) |

Definition at line 196 of file file.c.

References CONST_ID, obj, rb_check_funcall_default(), RB_TYPE_P, StringValue(), and T_STRING.

Referenced by rb_get_path().

## ◆ rb_get_path_no_checksafe()

VALUE rb_get_path_no_checksafe | ( | VALUE | obj | ) |

Definition at line 224 of file file.c.

References obj, and rb_get_path().

## ◆ rb_home_dir_of()

VALUE rb_home_dir_of | ( | VALUE | user,
|  | VALUE | result
| ) |  |

Definition at line 3536 of file file.c.

## ◆ rb_is_absolute_path()

int rb_is_absolute_path | ( | const char * | path | ) |

Definition at line 6089 of file file.c.

References isdirsep, and path.

## ◆ rb_path_check()

int rb_path_check | ( | const char * | path | ) |

Definition at line 6168 of file file.c.

References path, PATH_SEP_CHAR, strchr(), and strlen().

## ◆ rb_realpath_internal()

VALUE rb_realpath_internal | ( | VALUE | basedir,
|  | VALUE | path,
|  | int | strict
| ) |  |

Definition at line 4409 of file file.c.

References RB_REALPATH_DIR, and RB_REALPATH_STRICT.

## ◆ rb_stat_new()

VALUE rb_stat_new | ( | const struct stat * | st | ) |

Definition at line 492 of file file.c.

## ◆ rb_str_encode_ospath()

VALUE rb_str_encode_ospath | ( | VALUE | path | ) |

Definition at line 236 of file file.c.

References gzfile::enc, ENCINDEX_ASCII, ENCINDEX_UTF_8, ENCODING_GET, path, rb_enc_from_index(), rb_encoding, rb_filesystem_encindex(), rb_str_conv_enc(), and rb_utf8_encoding().

Referenced by rb_resolve_feature_path().

## ◆ ruby_enc_find_basename()

const char* ruby_enc_find_basename | ( | const char * | name,
|  | long * | baselen,
|  | long * | alllen,
|  | rb_encoding * | enc
| ) |  |

Definition at line 4502 of file file.c.

References f, isdirsep, n, name, skipprefix, strlen(), and strrdirsep.

## ◆ ruby_enc_find_extname()

const char* ruby_enc_find_extname | ( | const char * | name,
|  | long * | len,
|  | rb_encoding * | enc
| ) |  |

Definition at line 4699 of file file.c.

References Inc, isADS, isdirsep, istrailinggarbage, last, len, long, name, strlen(), and strrdirsep.

## ◆ ruby_is_fd_loadable()

int ruby_is_fd_loadable | ( | int | fd | ) |

Definition at line 6195 of file file.c.

References EISDIR, ENXIO, errno, fstat(), S_ISCHR, S_ISDIR, S_ISFIFO, S_ISREG, and st.

Referenced by rb_file_load_ok().

## Variable Documentation

## ◆ rb_cFile

VALUE rb_cFile

Definition at line 159 of file file.c.

Referenced by Init_File(), and rb_io_fdopen().

## ◆ rb_cStat

VALUE rb_cStat

Definition at line 161 of file file.c.

## ◆ rb_mFileTest

VALUE rb_mFileTest

Definition at line 160 of file file.c.

Referenced by Init_File().

## ◆ ruby_null_device

const char ruby_null_device[]

Initial value:
=
"/dev/null"

Definition at line 6389 of file file.c.

RSTRING_PTR
#define RSTRING_PTR(str)
Definition: ruby.h:1009
rb_get_path
VALUE rb_get_path(VALUE obj)
Definition: file.c:230
SKIPPATHSEP
#define SKIPPATHSEP(p)
Definition: file.c:3490
buf
unsigned char buf[MIME_BUF_SIZE]
Definition: nkf.c:4322
NIL_P
#define NIL_P(v)
Definition: ruby.h:482
RSTRING_LEN
#define RSTRING_LEN(str)
Definition: ruby.h:1005