mirror of
https://github.com/apache/nuttx.git
synced 2026-06-05 07:12:54 +08:00
libs/unistd and other affected files: Hostname support no longer depends on CONFIG_NET since the host name is also useful in the non-network environment. CONFIG_NET_HOSTNAME changed to CONFIG_LIB_HOSTNAME.
This commit is contained in:
+1
-1
@@ -47,7 +47,7 @@
|
||||
"ftell","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","long","FAR FILE *"
|
||||
"fwrite","stdio.h","CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_NFILE_STREAMS > 0","size_t","FAR const void *","size_t","size_t","FAR FILE *"
|
||||
"getcwd","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_ENVIRON)","FAR char","FAR char *","size_t"
|
||||
"gethostname","unistd.h","defined(CONFIG_LIBC_NETDB)","int","FAR char*","size_t"
|
||||
"gethostname","unistd.h","","int","FAR char*","size_t"
|
||||
"getopt","unistd.h","","int","int","FAR char *const[]","FAR const char *"
|
||||
"getoptargp","unistd.h","","FAR char *"
|
||||
"getoptindp","unistd.h","","int"
|
||||
|
||||
|
@@ -99,7 +99,6 @@ int uname(FAR struct utsname *name)
|
||||
|
||||
strncpy(name->sysname, "NuttX", SYS_NAMELEN);
|
||||
|
||||
#ifdef CONFIG_LIBC_NETDB
|
||||
/* Get the hostname */
|
||||
|
||||
if (-1 == gethostname(name->nodename, HOST_NAME_MAX))
|
||||
@@ -109,10 +108,6 @@ int uname(FAR struct utsname *name)
|
||||
|
||||
name->nodename[HOST_NAME_MAX-1] = '\0';
|
||||
|
||||
#else
|
||||
strncpy(name->nodename, "", HOST_NAME_MAX);
|
||||
#endif
|
||||
|
||||
strncpy(name->release, CONFIG_VERSION_STRING, SYS_NAMELEN);
|
||||
name->release[SYS_NAMELEN-1] = '\0';
|
||||
|
||||
|
||||
@@ -99,3 +99,9 @@ config TASK_SPAWN_DEFAULT_STACKSIZE
|
||||
Default: 2048.
|
||||
|
||||
endmenu # Program Execution Options
|
||||
|
||||
config LIB_HOSTNAME
|
||||
string "Host name for this device"
|
||||
default ""
|
||||
---help---
|
||||
A unique name to identify device on the network
|
||||
|
||||
@@ -60,9 +60,7 @@ ifneq ($(CONFIG_DISABLE_SIGNALS),y)
|
||||
CSRCS += lib_sleep.c lib_usleep.c
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_NET),y)
|
||||
CSRCS += lib_gethostname.c lib_sethostname.c
|
||||
endif
|
||||
|
||||
# Add the unistd directory to the build
|
||||
|
||||
|
||||
@@ -47,10 +47,6 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/* This file is only compiled if network support is enabled */
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
@@ -59,8 +55,8 @@
|
||||
* changed via sethostname(), however.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_NET_HOSTNAME
|
||||
# define CONFIG_NET_HOSTNAME ""
|
||||
#ifndef CONFIG_LIB_HOSTNAME
|
||||
# define CONFIG_LIB_HOSTNAME ""
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
@@ -69,7 +65,7 @@
|
||||
|
||||
/* This is the system hostname */
|
||||
|
||||
char g_hostname[HOST_NAME_MAX + 1] = CONFIG_NET_HOSTNAME;
|
||||
char g_hostname[HOST_NAME_MAX + 1] = CONFIG_LIB_HOSTNAME;
|
||||
|
||||
/****************************************************************************
|
||||
* Public Functions
|
||||
@@ -145,5 +141,3 @@ int gethostname(FAR char *name, size_t namelen)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
|
||||
@@ -46,10 +46,6 @@
|
||||
|
||||
#include <nuttx/irq.h>
|
||||
|
||||
/* This file is only compiled if network support is enabled */
|
||||
|
||||
#ifdef CONFIG_NET
|
||||
|
||||
/* Further, in the protected and kernel build modes where kernel and
|
||||
* application code are separated, the hostname is a common system property
|
||||
* and must reside only in the kernel. In that case, this accessor
|
||||
@@ -128,5 +124,4 @@ int sethostname(FAR const char *name, size_t size)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif /* CONFIG_NET */
|
||||
#endif /* (!CONFIG_BUILD_PROTECTED && !CONFIG_BUILD_KERNEL) || __KERNEL__ */
|
||||
|
||||
Reference in New Issue
Block a user