add platform tweaks

login: consider platforms having no domainname field in the utsname struct
include/platform.h: define IUCLC to 0 on platforms where it is not defined

Signed-off-by: Luca Favatella <slackydeb@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
Denys Vlasenko 2009-05-19 13:18:45 +02:00
parent 167cd709df
commit 5a49d284a6
2 changed files with 89 additions and 79 deletions

View File

@ -19,7 +19,7 @@
/* __restrict is known in EGCS 1.2 and above. */ /* __restrict is known in EGCS 1.2 and above. */
#if !__GNUC_PREREQ(2,92) #if !__GNUC_PREREQ(2,92)
# ifndef __restrict # ifndef __restrict
# define __restrict /* Ignore */ # define __restrict
# endif # endif
#endif #endif
@ -61,14 +61,14 @@
# define DEPRECATED __attribute__ ((__deprecated__)) # define DEPRECATED __attribute__ ((__deprecated__))
# define UNUSED_PARAM_RESULT __attribute__ ((warn_unused_result)) # define UNUSED_PARAM_RESULT __attribute__ ((warn_unused_result))
# else # else
# define DEPRECATED /* n/a */ # define DEPRECATED
# define UNUSED_PARAM_RESULT /* n/a */ # define UNUSED_PARAM_RESULT
# endif # endif
#else #else
# define ALWAYS_INLINE inline /* n/a */ # define ALWAYS_INLINE inline
# define NOINLINE /* n/a */ # define NOINLINE
# define DEPRECATED /* n/a */ # define DEPRECATED
# define UNUSED_PARAM_RESULT /* n/a */ # define UNUSED_PARAM_RESULT
#endif #endif
/* -fwhole-program makes all symbols local. The attribute externally_visible /* -fwhole-program makes all symbols local. The attribute externally_visible
@ -323,7 +323,6 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
# define PRIu32 "u" # define PRIu32 "u"
/* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */ /* use legacy setpgrp(pid_t,pid_t) for now. move to platform.c */
# define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0) # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
# if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET # if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
# define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET) # define ADJ_OFFSET_SINGLESHOT (MOD_CLKA | MOD_OFFSET)
# endif # endif
@ -358,7 +357,6 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
# ifndef MS_SILENT # ifndef MS_SILENT
# define MS_SILENT (1 << 15) # define MS_SILENT (1 << 15)
# endif # endif
/* The shared subtree stuff, which went in around 2.6.15. */ /* The shared subtree stuff, which went in around 2.6.15. */
# ifndef MS_UNBINDABLE # ifndef MS_UNBINDABLE
# define MS_UNBINDABLE (1 << 17) # define MS_UNBINDABLE (1 << 17)
@ -384,4 +382,14 @@ static ALWAYS_INLINE char* strchrnul(const char *s, char c)
# endif # endif
#endif #endif
/* The field domainname of struct utsname is Linux specific. */
#if !defined(__linux__)
# define HAVE_NO_UTSNAME_DOMAINNAME
#endif
/* If this system doesn't have IUCLC bit in struct termios::c_iflag... */
#ifndef IUCLC
# define IUCLC 0
#endif
#endif #endif

View File

@ -62,10 +62,12 @@ void FAST_FUNC print_login_issue(const char *issue_file, const char *tty)
case 'm': case 'm':
outbuf = uts.machine; outbuf = uts.machine;
break; break;
#ifndef HAVE_NO_UTSNAME_DOMAINNAME
case 'D': case 'D':
case 'o': case 'o':
outbuf = uts.domainname; outbuf = uts.domainname;
break; break;
#endif
case 'd': case 'd':
strftime(buf, sizeof(buf), fmtstr_d, localtime(&t)); strftime(buf, sizeof(buf), fmtstr_d, localtime(&t));
break; break;