mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
new macros for statfs_t
* file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for statfs_t. * file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto. * file.c (rb_io_statfs): check FSTATFS macro only instead of HAVE_FSTATFS and HAVE_FSTATVFS. * file.c (statfs_type): use new macro. * file.c (statfs_fstypename): ditto. * file.c (statfs_inspect): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c521d87f68
commit
7973883c3a
2 changed files with 33 additions and 8 deletions
13
ChangeLog
13
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
Tue Apr 29 04:29:05 2014 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
|
* file.c (HAVE_STRUCT_STATFS_T_F_FSTYPENAME): Add new macro for
|
||||||
|
statfs_t.
|
||||||
|
* file.c (HAVE_STRUCT_STATFS_T_F_TYPE): ditto.
|
||||||
|
|
||||||
|
* file.c (rb_io_statfs): check FSTATFS macro only instead of
|
||||||
|
HAVE_FSTATFS and HAVE_FSTATVFS.
|
||||||
|
|
||||||
|
* file.c (statfs_type): use new macro.
|
||||||
|
* file.c (statfs_fstypename): ditto.
|
||||||
|
* file.c (statfs_inspect): ditto.
|
||||||
|
|
||||||
Tue Apr 29 00:20:26 2014 Rajarshi Das <rajarshid@cybage.com>
|
Tue Apr 29 00:20:26 2014 Rajarshi Das <rajarshid@cybage.com>
|
||||||
|
|
||||||
* bootstraptest/test_literal.rb: fix typo of "dynamic". [ci skip]
|
* bootstraptest/test_literal.rb: fix typo of "dynamic". [ci skip]
|
||||||
|
|
28
file.c
28
file.c
|
@ -72,9 +72,21 @@ int flock(int, int);
|
||||||
#ifdef HAVE_STRUCT_STATFS
|
#ifdef HAVE_STRUCT_STATFS
|
||||||
typedef struct statfs statfs_t;
|
typedef struct statfs statfs_t;
|
||||||
#define STATFS(f, s) statfs((f), (s))
|
#define STATFS(f, s) statfs((f), (s))
|
||||||
|
#ifdef HAVE_STRUCT_STATFS_F_FSTYPENAME
|
||||||
|
#define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRUCT_STATFS_F_TYPE
|
||||||
|
#define HAVE_STRUCT_STATFS_T_F_TYPE 1
|
||||||
|
#endif
|
||||||
#elif defined(HAVE_STRUCT_STATVFS)
|
#elif defined(HAVE_STRUCT_STATVFS)
|
||||||
typedef struct statvfs statfs_t;
|
typedef struct statvfs statfs_t;
|
||||||
#define STATFS(f, s) statvfs((f), (s))
|
#define STATFS(f, s) statvfs((f), (s))
|
||||||
|
#ifdef HAVE_STRUCT_STATVFS_F_FSTYPENAME
|
||||||
|
#define HAVE_STRUCT_STATFS_T_F_FSTYPENAME 1
|
||||||
|
#endif
|
||||||
|
#ifdef HAVE_STRUCT_STATVFS_F_TYPE
|
||||||
|
#define HAVE_STRUCT_STATFS_T_F_TYPE 1
|
||||||
|
#endif
|
||||||
#else
|
#else
|
||||||
# define WITHOUT_STATFS
|
# define WITHOUT_STATFS
|
||||||
#endif
|
#endif
|
||||||
|
@ -1135,13 +1147,13 @@ rb_io_statfs(VALUE obj)
|
||||||
{
|
{
|
||||||
rb_io_t *fptr;
|
rb_io_t *fptr;
|
||||||
statfs_t st;
|
statfs_t st;
|
||||||
#if !defined(HAVE_FSTATFS) && !defined(HAVE_FSTATVFS)
|
#ifndef FSTATFS
|
||||||
VALUE path;
|
VALUE path;
|
||||||
#endif
|
#endif
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
GetOpenFile(obj, fptr);
|
GetOpenFile(obj, fptr);
|
||||||
#if defined(HAVE_FSTATFS) || defined(HAVE_FSTATVFS)
|
#ifdef FSTATFS
|
||||||
ret = FSTATFS(fptr->fd, &st);
|
ret = FSTATFS(fptr->fd, &st);
|
||||||
#else
|
#else
|
||||||
path = rb_str_encode_ospath(fptr->pathv);
|
path = rb_str_encode_ospath(fptr->pathv);
|
||||||
|
@ -5443,7 +5455,7 @@ rb_statfs_init_copy(VALUE copy, VALUE orig)
|
||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_STRUCT_STATFS_F_TYPE
|
#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* st.type -> fixnum
|
* st.type -> fixnum
|
||||||
|
@ -5549,7 +5561,7 @@ statfs_ffree(VALUE self)
|
||||||
return LL2NUM(get_statfs(self)->f_ffree);
|
return LL2NUM(get_statfs(self)->f_ffree);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
|
#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
|
||||||
/*
|
/*
|
||||||
* call-seq:
|
* call-seq:
|
||||||
* st.fstypename -> string
|
* st.fstypename -> string
|
||||||
|
@ -5591,10 +5603,10 @@ statfs_inspect(VALUE self)
|
||||||
{
|
{
|
||||||
statfs_t *st = get_statfs(self);
|
statfs_t *st = get_statfs(self);
|
||||||
return rb_sprintf("#<%"PRIsVALUE" "
|
return rb_sprintf("#<%"PRIsVALUE" "
|
||||||
#ifdef HAVE_STRUCT_STATFS_F_TYPE
|
#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
|
||||||
"type=%ld"
|
"type=%ld"
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
|
#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
|
||||||
"(%s)"
|
"(%s)"
|
||||||
#endif
|
#endif
|
||||||
", bsize=%ld"
|
", bsize=%ld"
|
||||||
|
@ -5602,10 +5614,10 @@ statfs_inspect(VALUE self)
|
||||||
", files=%"PRI_LL_PREFIX"d/%"PRI_LL_PREFIX"d"
|
", files=%"PRI_LL_PREFIX"d/%"PRI_LL_PREFIX"d"
|
||||||
">",
|
">",
|
||||||
rb_obj_class(self),
|
rb_obj_class(self),
|
||||||
#ifdef HAVE_STRUCT_STATFS_F_TYPE
|
#ifdef HAVE_STRUCT_STATFS_T_F_TYPE
|
||||||
(long)st->f_type,
|
(long)st->f_type,
|
||||||
#endif
|
#endif
|
||||||
#if defined(HAVE_STRUCT_STATFS_F_FSTYPENAME) || defined(HAVE_STRUCT_STATVFS_F_FSTYPENAME)
|
#ifdef HAVE_STRUCT_STATFS_T_F_FSTYPENAME
|
||||||
st->f_fstypename,
|
st->f_fstypename,
|
||||||
#endif
|
#endif
|
||||||
(long)st->f_bsize,
|
(long)st->f_bsize,
|
||||||
|
|
Loading…
Add table
Reference in a new issue