Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
284e3031
提交
284e3031
authored
9月 17, 2010
作者:
Moises Silva
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add switch wrapping support for apr_stat
上级
1c76ca4d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
132 行增加
和
0 行删除
+132
-0
switch_apr.h
src/include/switch_apr.h
+120
-0
switch_apr.c
src/switch_apr.c
+12
-0
没有找到文件。
src/include/switch_apr.h
浏览文件 @
284e3031
...
...
@@ -647,12 +647,99 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
* @{
*/
/** File types. */
typedef
enum
{
SWITCH_NOFILE
=
0
,
/**< no file type determined */
SWITCH_REG
,
/**< a regular file */
SWITCH_DIR
,
/**< a directory */
SWITCH_CHR
,
/**< a character device */
SWITCH_BLK
,
/**< a block device */
SWITCH_PIPE
,
/**< a FIFO / pipe */
SWITCH_LNK
,
/**< a symbolic link */
SWITCH_SOCK
,
/**< a [unix domain] socket */
SWITCH_UNKFILE
=
127
/**< a file of some other unknown type */
}
switch_filetype_e
;
/** Structure for referencing files. */
typedef
struct
apr_file_t
switch_file_t
;
typedef
int32_t
switch_fileperms_t
;
typedef
int
switch_seek_where_t
;
/**
* Structure for determining user ownership.
*/
#ifdef WIN32
typedef
PSID
switch_uid_t
;
#else
typedef
uid_t
switch_uid_t
;
#endif
/**
* Structure for determining group ownership.
*/
#ifdef WIN32
typedef
PSID
switch_gid_t
;
#else
typedef
gid_t
switch_gid_t
;
#endif
#ifdef WIN32
typedef
uint32_t
switch_dev_t
;
typedef
uint64_t
switch_ino_t
;
#else
typedef
ino_t
switch_ino_t
;
typedef
dev_t
switch_dev_t
;
#endif
typedef
off_t
switch_off_t
;
/**
* Structure for referencing file information
*/
//typedef struct apr_stat_t switch_finfo_t;
typedef
struct
{
/** Allocates memory and closes lingering handles in the specified pool */
switch_memory_pool_t
*
pool
;
/** The bitmask describing valid fields of this switch_finfo_t structure
* including all available 'wanted' fields and potentially more */
int32_t
valid
;
/** The access permissions of the file. Mimics Unix access rights. */
switch_fileperms_t
protection
;
/** The type of file. One of APR_REG, APR_DIR, APR_CHR, APR_BLK, APR_PIPE,
* APR_LNK or APR_SOCK. If the type is undetermined, the value is APR_NOFILE.
* If the type cannot be determined, the value is APR_UNKFILE.
*/
switch_filetype_e
filetype
;
/** The user id that owns the file */
switch_uid_t
user
;
/** The group id that owns the file */
switch_gid_t
group
;
/** The inode of the file. */
switch_ino_t
inode
;
/** The id of the device the file is on. */
switch_dev_t
device
;
/** The number of hard links to the file. */
int32_t
nlink
;
/** The size of the file */
switch_off_t
size
;
/** The storage size consumed by the file */
switch_off_t
csize
;
/** The time the file was last accessed */
switch_time_t
atime
;
/** The time the file was last modified */
switch_time_t
mtime
;
/** The time the file was created, or the inode was last changed */
switch_time_t
ctime
;
/** The pathname of the file (possibly unrooted) */
const
char
*
fname
;
/** The file's name (no path) in filesystem case */
const
char
*
name
;
/** The file's handle, if accessed (can be submitted to apr_duphandle) */
switch_file_t
*
filehand
;
}
switch_finfo_t
;
/**
* @defgroup apr_file_seek_flags File Seek Flags
* @{
...
...
@@ -739,6 +826,37 @@ SWITCH_DECLARE(switch_status_t) switch_queue_trypush(switch_queue_t *queue, void
#define SWITCH_FOPEN_LARGEFILE 0x04000
/**< Platform dependent flag to enable large file support */
/** @} */
/**
* @defgroup switch_file_stat flags
* @ingroup switch_file_io
* @{
*/
#define SWITCH_FINFO_LINK 0x00000001
/**< Stat the link not the file itself if it is a link */
#define SWITCH_FINFO_MTIME 0x00000010
/**< Modification Time */
#define SWITCH_FINFO_CTIME 0x00000020
/**< Creation or inode-changed time */
#define SWITCH_FINFO_ATIME 0x00000040
/**< Access Time */
#define SWITCH_FINFO_SIZE 0x00000100
/**< Size of the file */
#define SWITCH_FINFO_CSIZE 0x00000200
/**< Storage size consumed by the file */
#define SWITCH_FINFO_DEV 0x00001000
/**< Device */
#define SWITCH_FINFO_INODE 0x00002000
/**< Inode */
#define SWITCH_FINFO_NLINK 0x00004000
/**< Number of links */
#define SWITCH_FINFO_TYPE 0x00008000
/**< Type */
#define SWITCH_FINFO_USER 0x00010000
/**< User */
#define SWITCH_FINFO_GROUP 0x00020000
/**< Group */
#define SWITCH_FINFO_UPROT 0x00100000
/**< User protection bits */
#define SWITCH_FINFO_GPROT 0x00200000
/**< Group protection bits */
#define SWITCH_FINFO_WPROT 0x00400000
/**< World protection bits */
#define SWITCH_FINFO_ICASE 0x01000000
/**< if dev is case insensitive */
#define SWITCH_FINFO_NAME 0x02000000
/**< ->name in proper case */
#define SWITCH_FINFO_MIN 0x00008170
/**< type, mtime, ctime, atime, size */
#define SWITCH_FINFO_IDENT 0x00003000
/**< dev and inode */
#define SWITCH_FINFO_OWNER 0x00030000
/**< user and group */
#define SWITCH_FINFO_PROT 0x00700000
/**< all protections */
#define SWITCH_FINFO_NORM 0x0073b170
/**< an atomic unix apr_stat() */
#define SWITCH_FINFO_DIRENT 0x02000000
/**< an atomic unix apr_dir_read() */
/** @} */
/**
* Open the specified file.
* @param newf The opened file descriptor.
...
...
@@ -782,6 +900,8 @@ SWITCH_DECLARE(switch_status_t) switch_file_seek(switch_file_t *thefile, switch_
SWITCH_DECLARE
(
switch_status_t
)
switch_file_copy
(
const
char
*
from_path
,
const
char
*
to_path
,
switch_fileperms_t
perms
,
switch_memory_pool_t
*
pool
);
SWITCH_DECLARE
(
switch_status_t
)
switch_file_stat
(
switch_finfo_t
*
finfo
,
const
char
*
fname
,
int32_t
wanted
,
switch_memory_pool_t
*
pool
);
/**
* Close the specified file.
* @param thefile The file descriptor to close.
...
...
src/switch_apr.c
浏览文件 @
284e3031
...
...
@@ -416,6 +416,18 @@ SWITCH_DECLARE(switch_status_t) switch_file_copy(const char *from_path, const ch
return
apr_file_copy
(
from_path
,
to_path
,
perms
,
pool
);
}
SWITCH_DECLARE
(
switch_status_t
)
switch_file_stat
(
switch_finfo_t
*
finfo
,
const
char
*
fname
,
int32_t
wanted
,
switch_memory_pool_t
*
pool
)
{
apr_status_t
status
;
apr_finfo_t
aprinfo
;
if
(
sizeof
(
*
finfo
)
!=
sizeof
(
aprinfo
))
{
return
SWITCH_STATUS_MEMERR
;
}
status
=
apr_stat
(
&
aprinfo
,
fname
,
wanted
,
pool
);
memcpy
(
finfo
,
&
aprinfo
,
sizeof
(
*
finfo
));
return
status
;
}
SWITCH_DECLARE
(
switch_status_t
)
switch_file_close
(
switch_file_t
*
thefile
)
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论