procfs: Get version info from uname instead

unify the version into one place

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I988fb40d3f460b0291114c60edb04db3aabb38f1
This commit is contained in:
Xiang Xiao 2020-07-28 22:26:04 +08:00 committed by Masayuki Ishikawa
parent 3cff139b85
commit 338244dbac
2 changed files with 5 additions and 15 deletions

View File

@ -49,9 +49,4 @@ endif
DEPPATH += --dep-path procfs
VPATH += :procfs
# To ensure version information is newest,
# add fs_procfsversion to phony target for force rebuild
.PHONY: fs_procfsversion$(OBJEXT)
endif

View File

@ -41,6 +41,7 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/utsname.h>
#include <stdint.h>
#include <stdbool.h>
@ -206,6 +207,7 @@ static ssize_t version_read(FAR struct file *filep, FAR char *buffer,
size_t buflen)
{
FAR struct version_file_s *attr;
struct utsname name;
size_t linesize;
off_t offset;
ssize_t ret;
@ -219,16 +221,9 @@ static ssize_t version_read(FAR struct file *filep, FAR char *buffer,
if (filep->f_pos == 0)
{
#if defined(__DATE__) && defined(__TIME__)
linesize = snprintf(attr->line, VERSION_LINELEN,
"NuttX version %s %s %s %s\n",
CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD,
__DATE__, __TIME__);
#else
linesize = snprintf(attr->line, VERSION_LINELEN,
"NuttX version %s %s\n",
CONFIG_VERSION_STRING, CONFIG_VERSION_BUILD);
#endif
uname(&name);
linesize = snprintf(attr->line, VERSION_LINELEN, "%s version %s %s\n",
name.sysname, name.release, name.version);
/* Save the linesize in case we are re-entered with f_pos > 0 */