Add system calls for gethostname and sethostname

This commit is contained in:
Gregory Nutt
2015-07-05 08:40:56 -06:00
parent e1c306f2dd
commit f31a96cfbf
5 changed files with 45 additions and 16 deletions
+24 -14
View File
@@ -406,24 +406,34 @@
# define __SYS_network __SYS_environ
#endif
/* The following are defined if networking is supported */
#ifdef CONFIG_NET
# define SYS_gethostname (__SYS_network+0)
# define SYS_sethostname (__SYS_network+1)
/* The following are defined only if networking AND sockets are supported */
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)
# define SYS_accept (__SYS_network+0)
# define SYS_bind (__SYS_network+1)
# define SYS_connect (__SYS_network+2)
# define SYS_getsockopt (__SYS_network+3)
# define SYS_listen (__SYS_network+4)
# define SYS_recv (__SYS_network+5)
# define SYS_recvfrom (__SYS_network+6)
# define SYS_send (__SYS_network+7)
# define SYS_sendto (__SYS_network+8)
# define SYS_setsockopt (__SYS_network+9)
# define SYS_socket (__SYS_network+10)
# define SYS_nnetsocket (__SYS_network+11)
#if CONFIG_NSOCKET_DESCRIPTORS > 0
# define SYS_accept (__SYS_network+2)
# define SYS_bind (__SYS_network+3)
# define SYS_connect (__SYS_network+4)
# define SYS_getsockopt (__SYS_network+5)
# define SYS_listen (__SYS_network+6)
# define SYS_recv (__SYS_network+7)
# define SYS_recvfrom (__SYS_network+8)
# define SYS_send (__SYS_network+9)
# define SYS_sendto (__SYS_network+10)
# define SYS_setsockopt (__SYS_network+11)
# define SYS_socket (__SYS_network+12)
# define SYS_nnetsocket (__SYS_network+13)
#else
# define SYS_nnetsocket (__SYS_network+2)
#endif
#else
# define SYS_nnetsocket __SYS_network
#endif
#endif /* CONFIG_NET */
/* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */
+3 -1
View File
@@ -25,6 +25,7 @@
"fsync","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","int"
"get_errno","errno.h","","int"
"getenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","FAR char*","FAR const char*"
"gethostname","unistd.h","defined(CONFIG_NET)","int","FAR char*","size_t"
"getpid","unistd.h","","pid_t"
"getsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR void*","FAR socklen_t*"
"ioctl","sys/ioctl.h","!defined(CONFIG_LIBC_IOCTL_VARIADIC) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0)","int","int","int","unsigned long"
@@ -120,7 +121,8 @@
"sendfile","sys/sendfile.h","CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET_SENDFILE)","ssize_t","int","int","FAR off_t*","size_t"
"sendto","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","ssize_t","int","FAR const void*","size_t","int","FAR const struct sockaddr*","socklen_t"
"set_errno","errno.h","","void","int"
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*","const char*","int"
"setenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","FAR const char*","FAR const char*","int"
"sethostname","unistd.h","defined(CONFIG_NET)","int","FAR const char*","size_t"
"setsockopt","sys/socket.h","CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)","int","int","int","int","FAR const void*","socklen_t"
"shmat", "sys/shm.h", "defined(CONFIG_MM_SHM)", "FAR void *", "int", "FAR const void *", "int"
"shmctl", "sys/shm.h", "defined(CONFIG_MM_SHM)", "int", "int", "int", "FAR struct shmid_ds *"
1 _exit unistd.h void int
25 fsync unistd.h CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT) int int
26 get_errno errno.h int
27 getenv stdlib.h !defined(CONFIG_DISABLE_ENVIRON) FAR char* FAR const char*
28 gethostname unistd.h defined(CONFIG_NET) int FAR char*
29 getpid unistd.h pid_t
30 getsockopt sys/socket.h CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) int int
31 ioctl sys/ioctl.h !defined(CONFIG_LIBC_IOCTL_VARIADIC) && (CONFIG_NSOCKET_DESCRIPTORS > 0 || CONFIG_NFILE_DESCRIPTORS > 0) int int
121 sendfile sys/sendfile.h CONFIG_NFILE_DESCRIPTORS > 0 && defined(CONFIG_NET_SENDFILE) ssize_t int
122 sendto sys/socket.h CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) ssize_t int
123 set_errno errno.h void int
124 setenv stdlib.h !defined(CONFIG_DISABLE_ENVIRON) int const char* FAR const char*
125 sethostname unistd.h defined(CONFIG_NET) int FAR const char*
126 setsockopt sys/socket.h CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET) int int
127 shmat sys/shm.h defined(CONFIG_MM_SHM) FAR void * int
128 shmctl sys/shm.h defined(CONFIG_MM_SHM) int int
+8 -1
View File
@@ -298,9 +298,15 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(unsetenv, 1, STUB_unsetenv)
#endif
/* The following are defined only if networking is supported */
#ifdef CONFIG_NET
SYSCALL_LOOKUP(gethostname, 2, STUB_gethostname)
SYSCALL_LOOKUP(sethostname, 2, STUB_sethostname)
/* The following are defined only if networking AND sockets are supported */
#if CONFIG_NSOCKET_DESCRIPTORS > 0 && defined(CONFIG_NET)
#if CONFIG_NSOCKET_DESCRIPTORS > 0
SYSCALL_LOOKUP(accept, 3, STUB_accept)
SYSCALL_LOOKUP(bind, 3, STUB_bind)
SYSCALL_LOOKUP(connect, 3, STUB_connect)
@@ -313,6 +319,7 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert)
SYSCALL_LOOKUP(setsockopt, 5, STUB_setsockopt)
SYSCALL_LOOKUP(socket, 3, STUB_socket)
#endif
#endif /* CONFIG_NET */
/* The following is defined only if CONFIG_TASK_NAME_SIZE > 0 */
+5
View File
@@ -315,6 +315,11 @@ uintptr_t STUB_setenv(int nbr, uintptr_t parm1, uintptr_t parm2,
uintptr_t parm3);
uintptr_t STUB_unsetenv(int nbr, uintptr_t parm1);
/* The following are defined only if networking is upported */
uintptr_t STUB_gethostname(int nbr, uintptr_t parm1, uintptr_t parm2);
uintptr_t STUB_sethostname(int nbr, uintptr_t parm1, uintptr_t parm2);
/* The following are defined only if networking AND sockets are supported */
uintptr_t STUB_accept(int nbr, uintptr_t parm1, uintptr_t parm2,
+5
View File
@@ -611,6 +611,11 @@ testbuild.sh
configuration names depends on the underlying architecture of the
configured board.
NOTE: The environment variable APPSDIR should be set to the relative
path to the application directory when running this script like:
$ export APPSDIR=../apps
zipme.sh
--------