参照元†
- const char *name
- mode_t mode
- struct proc_dir_entry *parent
返り値†
- struct proc_dir_entry *
- 成功時は proc ファイルシステムエントリへのポインタが返ります。
失敗時は NULL が返ります。
CONFIG_PROC_FS が有効な場合: fs/proc/generic.c†
struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
struct proc_dir_entry *parent)
{
struct proc_dir_entry *ent;
nlink_t nlink;
if (S_ISDIR(mode)) {
if ((mode & S_IALLUGO) == 0)
mode |= S_IRUGO | S_IXUGO;
nlink = 2;
} else {
if ((mode & S_IFMT) == 0)
mode |= S_IFREG;
if ((mode & S_IALLUGO) == 0)
mode |= S_IRUGO;
nlink = 1;
}
ent = __proc_create(&parent, name, mode, nlink);
if (ent) {
if (proc_register(parent, ent) < 0) {
kfree(ent);
ent = NULL;
}
}
return ent;
}
CONFIG_PROC_FS が無効な場合: include/linux/proc_fs.h†
#ifdef CONFIG_PROC_FS
(... 略 ...)
struct proc_dir_entry *proc_create_data(const char *name, mode_t mode,
struct proc_dir_entry *parent,
const struct file_operations *proc_fops,
void *data);
#else
(... 略 ...)
static inline struct proc_dir_entry *create_proc_entry(const char *name,
mode_t mode, struct proc_dir_entry *parent) { return NULL; }
(... 略 ...)
#endif
コメント†