libs/libc/misc/lib_utsname.c: Add build date and time to uname output (like Linux).
This commit is contained in:
parent
d6740a6678
commit
c40daffb5b
|
@ -109,6 +109,11 @@ ifeq ($(CONFIG_LIB_ENVPATH),y)
|
|||
CSRCS += lib_envpath.c
|
||||
endif
|
||||
|
||||
# To ensure uname information is newest,
|
||||
# add lib_utsname.o to phony target for force rebuild
|
||||
|
||||
.PHONY: lib_utsname$(OBJEXT)
|
||||
|
||||
# Add the misc directory to the build
|
||||
|
||||
DEPPATH += --dep-path misc
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <nuttx/config.h>
|
||||
|
||||
#include <sys/utsname.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <nuttx/version.h>
|
||||
|
@ -115,7 +116,12 @@ int uname(FAR struct utsname *name)
|
|||
strncpy(name->release, CONFIG_VERSION_STRING, SYS_NAMELEN);
|
||||
name->release[SYS_NAMELEN-1] = '\0';
|
||||
|
||||
#if defined(__DATE__) && defined(__TIME__)
|
||||
snprintf(name->version, VERSION_NAMELEN, "%s %s %s",
|
||||
CONFIG_VERSION_BUILD, __DATE__, __TIME__);
|
||||
#else
|
||||
strncpy(name->version, CONFIG_VERSION_BUILD, VERSION_NAMELEN);
|
||||
#endif
|
||||
name->version[VERSION_NAMELEN-1] = '\0';
|
||||
|
||||
strncpy(name->machine, CONFIG_ARCH, SYS_NAMELEN);
|
||||
|
|
Loading…
Reference in New Issue