diff --git a/fs/proc/include/proc_fs.h b/fs/proc/include/proc_fs.h index ed1f6fcb4918c346671ee0dc22419596d74034fc..9e25bd4153f89a758908ffdaee1ff75b7f2d9060 100644 --- a/fs/proc/include/proc_fs.h +++ b/fs/proc/include/proc_fs.h @@ -53,6 +53,9 @@ extern "C" { typedef unsigned short fmode_t; #define PROC_ERROR (-1) +/* Default file mode for procfs */ +#define PROCFS_DEFAULT_MODE 0555 + /* 64bit hashes as llseek() offset (for directories) */ #define FMODE_64BITHASH ((fmode_t)0x400) /* 32bit hashes as llseek() offset (for directories) */ diff --git a/fs/proc/os_adapt/proc_init.c b/fs/proc/os_adapt/proc_init.c index ec47b2956f61826c5da4012b8df585b03731a086..e8dc2df1a78c3f686daeb0ef369ecebe2be0920f 100644 --- a/fs/proc/os_adapt/proc_init.c +++ b/fs/proc/os_adapt/proc_init.c @@ -45,7 +45,7 @@ void ProcFsInit(void) { int ret; - ret = mkdir(PROCFS_MOUNT_POINT, 0); + ret = mkdir(PROCFS_MOUNT_POINT, PROCFS_DEFAULT_MODE); if (ret < 0) { PRINT_ERR("failed to mkdir %s, errno = %d\n", PROCFS_MOUNT_POINT, get_errno()); return; diff --git a/fs/proc/os_adapt/proc_vfs.c b/fs/proc/os_adapt/proc_vfs.c index 7cabbaf9eca55130268174104c5e9a705724818c..3876967c07e33b357605802cd79b8d4a78cdf2a8 100644 --- a/fs/proc/os_adapt/proc_vfs.c +++ b/fs/proc/os_adapt/proc_vfs.c @@ -41,8 +41,6 @@ #include "los_tables.h" #include "internal.h" -#define PROCFS_DEFAULT_MODE 0555 - #ifdef LOSCFG_FS_PROC static struct VnodeOps g_procfsVops; static struct file_operations_vfs g_procfsFops; diff --git a/fs/proc/src/proc_file.c b/fs/proc/src/proc_file.c index 331be79cfae4f9e73f10342b08142e414d0f0ee7..9eebcd4633d93dee209dad2551efa852bd156aab 100644 --- a/fs/proc/src/proc_file.c +++ b/fs/proc/src/proc_file.c @@ -49,7 +49,7 @@ static struct ProcFile g_procPf = { static struct ProcDirEntry g_procRootDirEntry = { .nameLen = 5, - .mode = S_IFDIR | S_IRUSR | S_IXUSR | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH, + .mode = S_IFDIR | PROCFS_DEFAULT_MODE, .count = ATOMIC_INIT(1), .procFileOps = NULL, .parent = &g_procRootDirEntry,