本文整理汇总了C++中do_stat函数的典型用法代码示例。如果您正苦于以下问题:C++ do_stat函数的具体用法?C++ do_stat怎么用?C++ do_stat使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了do_stat函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ty_stat
int ty_stat(const char *path, ty_file_info *info, bool follow)
{
assert(path && path[0]);
assert(info);
return do_stat(AT_FDCWD, path, info, follow);
}
示例2: sys_stat
static int sys_stat(stat_args_t *arg)
{
stat_args_t kern_args;
struct stat buf;
char *path;
int ret;
if (copy_from_user(&kern_args, arg, sizeof(kern_args)) < 0) {
curthr->kt_errno = EFAULT;
return -1;
}
if ((path = user_strdup(&kern_args.path)) == NULL) {
curthr->kt_errno = EINVAL;
return -1;
}
ret = do_stat(path, &buf);
if (ret == 0) {
ret = copy_to_user(kern_args.buf, &buf, sizeof(struct stat));
}
if (ret != 0) {
kfree(path);
curthr->kt_errno = -ret;
return -1;
}
kfree(path);
return 0;
}
示例3: link_stat
int link_stat(const char *path, STRUCT_STAT *buffer, int follow_dirlinks)
{
#ifdef SUPPORT_LINKS
if (copy_links)
return do_stat(path, buffer);
if (do_lstat(path, buffer) < 0)
return -1;
if (follow_dirlinks && S_ISLNK(buffer->st_mode)) {
STRUCT_STAT st;
if (do_stat(path, &st) == 0 && S_ISDIR(st.st_mode))
*buffer = st;
}
return 0;
#else
return do_stat(path, buffer);
#endif
}
示例4: uffs_fstat
int uffs_fstat(int fd, struct uffs_stat *buf)
{
uffs_Object *obj = FD2OBJ(fd);
CHK_OBJ(obj, -1);
return do_stat(obj, buf);
}
示例5: size
//: File size in bytes. Only if is_file() == true
off_t FileInfo::size() const
{
struct stat s;
if (do_stat(filename_.c_str(), &s))
return s.st_size;
else
return 0;
}
示例6: created
//: Time of last status change. (creation, chmod, ...)
time_t FileInfo::created() const
{
struct stat s;
if (do_stat(filename_.c_str(), &s))
return s.st_ctime;
else
return 0;
}
示例7: accessed
//: Time of last access
time_t FileInfo::accessed() const
{
struct stat s;
if (do_stat(filename_.c_str(), &s))
return s.st_atime;
else
return 0;
}
示例8: modified
//: Time of last data modification. See 'man stat(2)'
time_t FileInfo::modified() const
{
struct stat s;
if (do_stat(filename_.c_str(), &s))
return s.st_mtime;
else
return 0;
}
示例9: is_dir
//: Returns TRUE if we are pointing to a directory or a symbolic link to
//: a directory.
bool FileInfo::is_dir() const
{
struct stat s;
if (do_stat(filename_.c_str(), &s))
return S_ISDIR(s.st_mode);
else
return false;
}
示例10: is_file
//: Returns TRUE if we are pointing to a file or a symbolic link to
//: a file.
bool FileInfo::is_file() const
{
struct stat s;
if (do_stat(filename_, &s)) {
return S_ISREG(s.st_mode);
}
return false;
}
示例11: size
//: File size in bytes. Only if is_file() == true
off_t FileInfo::size() const
{
struct stat s;
if (do_stat(filename_, &s)) {
return s.st_size;
}
return 0;
}
示例12: created
//: Time of last status change. (creation, chmod, ...)
time_t FileInfo::created() const
{
struct stat s;
if (do_stat(filename_, &s)) {
return s.st_ctime;
}
return 0;
}
示例13: modified
//: Time of last data modification. See 'man stat(2)'
time_t FileInfo::modified() const
{
struct stat s;
if (do_stat(filename_, &s)) {
return s.st_mtime;
}
return 0;
}
示例14: unix_lstat_64
CAMLprim value unix_lstat_64(value path)
{
struct _stat64 buf;
__int64 st_ino;
if (!do_stat(1, 1, String_val(path), caml_string_length(path), NULL, &st_ino, &buf)) {
uerror("lstat", path);
}
return stat_aux(1, st_ino, &buf);
}
示例15: main
int main(int argc, char *argv[])
{
int i;
for (i = 1; i < argc; i++)
do_stat(argv[i]);
return 0;
}