[tyndur-devel] [PATCH 2/6] libc: POSIX: gethostname() nicht static inline
Kevin Wolf ·
! libc: Es wird erwartet, dass man gegen gethostname auch tatsaechlich linken kann, ohne den Header einzubinden. Ein Hoch auf configure. Signed-off-by: Kevin Wolf <kevin at tyndur.org> --- src/modules/include/unistd.h | 7 +------ src/modules/lib/posix/misc.c | 11 +++++++++++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/include/unistd.h b/src/modules/include/unistd.h index cc62037..cf74c31 100644 --- a/src/modules/include/unistd.h +++ b/src/modules/include/unistd.h @@ -164,12 +164,7 @@ gid_t getgid(void); gid_t getegid(void); /// Gibt den Hostnamen dieses Rechners zurueck -#include <string.h> -static inline int gethostname(char* buf, size_t len) -{ - strncpy(buf, "tyndur", len); - return 0; -} +int gethostname(char* buf, size_t len); #endif diff --git a/src/modules/lib/posix/misc.c b/src/modules/lib/posix/misc.c index 457b31c..5ed21ad 100644 --- a/src/modules/lib/posix/misc.c +++ b/src/modules/lib/posix/misc.c @@ -29,6 +29,7 @@ #include <unistd.h> #include <lost/config.h> #include <errno.h> +#include <string.h> #ifndef CONFIG_LIBC_NO_STUBS /** @@ -56,5 +57,15 @@ int pipe(int mode[2]) errno = ENFILE; return -1; } + +/** + * Gibt den Hostnamen dieses Rechners zurueck + */ +int gethostname(char* buf, size_t len) +{ + strncpy(buf, "tyndur", len); + return 0; +} + #endif -- 1.6.0.2
Antworten
- [tyndur-devel] [PATCH 2/6] libc: POSIX: gethostname() nicht static inline · Antoine Kaufmann