From c19fd13291082c9f2b8ddd489b9a76933b34ad56 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 5 Jul 2015 10:41:58 -0600 Subject: [PATCH] gethostname() should not be the system call, uname() should and gethostname should get the host name from uname --- include/sys/syscall.h | 50 ++++++++++++++++++------------------ syscall/syscall.csv | 2 +- syscall/syscall_lookup.h | 2 +- syscall/syscall_stublookup.c | 6 ++--- 4 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/sys/syscall.h b/include/sys/syscall.h index 56cd097c697..3101215744b 100644 --- a/include/sys/syscall.h +++ b/include/sys/syscall.h @@ -81,24 +81,25 @@ #define SYS_sched_unlock (CONFIG_SYS_RESERVED+11) #define SYS_sched_yield (CONFIG_SYS_RESERVED+12) #define SYS_set_errno (CONFIG_SYS_RESERVED+13) +#define SYS_uname (CONFIG_SYS_RESERVED+14) /* Semaphores */ -#define SYS_sem_destroy (CONFIG_SYS_RESERVED+14) -#define SYS_sem_post (CONFIG_SYS_RESERVED+15) -#define SYS_sem_timedwait (CONFIG_SYS_RESERVED+16) -#define SYS_sem_trywait (CONFIG_SYS_RESERVED+17) -#define SYS_sem_wait (CONFIG_SYS_RESERVED+18) +#define SYS_sem_destroy (CONFIG_SYS_RESERVED+15) +#define SYS_sem_post (CONFIG_SYS_RESERVED+16) +#define SYS_sem_timedwait (CONFIG_SYS_RESERVED+17) +#define SYS_sem_trywait (CONFIG_SYS_RESERVED+18) +#define SYS_sem_wait (CONFIG_SYS_RESERVED+19) /* Named semaphores */ #ifdef CONFIG_FS_NAMED_SEMAPHORES -# define SYS_sem_open (CONFIG_SYS_RESERVED+19) -# define SYS_sem_close (CONFIG_SYS_RESERVED+20) -# define SYS_sem_unlink (CONFIG_SYS_RESERVED+21) -# define __SYS_task_create (CONFIG_SYS_RESERVED+22) +# define SYS_sem_open (CONFIG_SYS_RESERVED+20) +# define SYS_sem_close (CONFIG_SYS_RESERVED+21) +# define SYS_sem_unlink (CONFIG_SYS_RESERVED+22) +# define __SYS_task_create (CONFIG_SYS_RESERVED+23) #else -# define __SYS_task_create (CONFIG_SYS_RESERVED+19) +# define __SYS_task_create (CONFIG_SYS_RESERVED+20) #endif /* Task creation APIs based on global entry points cannot be use with @@ -409,26 +410,25 @@ /* The following are defined if networking is supported */ #ifdef CONFIG_NET -# define SYS_gethostname (__SYS_network+0) -# define SYS_sethostname (__SYS_network+1) +# define SYS_sethostname (__SYS_network+0) /* The following are defined only if networking AND sockets are supported */ #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) +# define SYS_accept (__SYS_network+1) +# define SYS_bind (__SYS_network+2) +# define SYS_connect (__SYS_network+3) +# define SYS_getsockopt (__SYS_network+4) +# define SYS_listen (__SYS_network+5) +# define SYS_recv (__SYS_network+6) +# define SYS_recvfrom (__SYS_network+7) +# define SYS_send (__SYS_network+8) +# define SYS_sendto (__SYS_network+9) +# define SYS_setsockopt (__SYS_network+10) +# define SYS_socket (__SYS_network+11) +# define SYS_nnetsocket (__SYS_network+12) #else -# define SYS_nnetsocket (__SYS_network+2) +# define SYS_nnetsocket (__SYS_network+1) #endif #else diff --git a/syscall/syscall.csv b/syscall/syscall.csv index 20440db93c5..410f691d83e 100644 --- a/syscall/syscall.csv +++ b/syscall/syscall.csv @@ -25,7 +25,6 @@ "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" @@ -149,6 +148,7 @@ "timer_gettime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","FAR struct itimerspec*" "timer_settime","time.h","!defined(CONFIG_DISABLE_POSIX_TIMERS)","int","timer_t","int","FAR const struct itimerspec*","FAR struct itimerspec*" "umount2","sys/mount.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*","unsigned int" +"uname","sys/utsname.h","","int","FAR struct utsname*" "unlink","unistd.h","CONFIG_NFILE_DESCRIPTORS > 0 && !defined(CONFIG_DISABLE_MOUNTPOINT)","int","FAR const char*" "unsetenv","stdlib.h","!defined(CONFIG_DISABLE_ENVIRON)","int","const char*" "up_assert","assert.h","","void","FAR const uint8_t*","int" diff --git a/syscall/syscall_lookup.h b/syscall/syscall_lookup.h index 83abcb7f1e4..db730a68a81 100644 --- a/syscall/syscall_lookup.h +++ b/syscall/syscall_lookup.h @@ -57,6 +57,7 @@ SYSCALL_LOOKUP(sched_setscheduler, 3, STUB_sched_setscheduler) SYSCALL_LOOKUP(sched_unlock, 0, STUB_sched_unlock) SYSCALL_LOOKUP(sched_yield, 0, STUB_sched_yield) SYSCALL_LOOKUP(set_errno, 1, STUB_set_errno) +SYSCALL_LOOKUP(uname, 1, STUB_uname) /* Semaphores */ @@ -301,7 +302,6 @@ SYSCALL_LOOKUP(up_assert, 2, STUB_up_assert) /* 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 */ diff --git a/syscall/syscall_stublookup.c b/syscall/syscall_stublookup.c index 28fe2f2dc03..d9b9e73a28d 100644 --- a/syscall/syscall_stublookup.c +++ b/syscall/syscall_stublookup.c @@ -75,6 +75,8 @@ uintptr_t STUB_sched_setscheduler(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3); uintptr_t STUB_sched_unlock(int nbr); uintptr_t STUB_sched_yield(int nbr); +uintptr_t STUB_set_errno(int nbr, uintptr_t parm1); +uintptr_t STUB_uname(int nbr, uintptr_t parm1); /* Semaphores */ @@ -87,7 +89,6 @@ uintptr_t STUB_sem_timedwait(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_sem_trywait(int nbr, uintptr_t parm1); uintptr_t STUB_sem_unlink(int nbr, uintptr_t parm1); uintptr_t STUB_sem_wait(int nbr, uintptr_t parm1); -uintptr_t STUB_set_errno(int nbr, uintptr_t parm1); uintptr_t STUB_pgalloc(int nbr, uintptr_t parm1, uintptr_t parm2); uintptr_t STUB_task_create(int nbr, uintptr_t parm1, uintptr_t parm2, uintptr_t parm3, uintptr_t parm4, uintptr_t parm5); @@ -315,9 +316,8 @@ 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 */ +/* The following are defined only if networking is supported */ -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 */