Kill off OSMAJORVERSION and OSMINORVERSION defines/cpp flags

This has meant very little for a long time as configure.ac just
hardcoded these values depending on the current OS versions at the
time.

The only place where this is really 'needed' is XlationSvc.c in DtSvc
so that differences between locale specifications on various versions
of an OS can be accounted for. So for now, we just define those when
building DtSvc.

We could probably safely remove them as well with an update to the
Xlate locale DB to remove ancient cruft we don't care about anymore.

For various other modules, like dtlogin, dtsession, etc we just use
the code that was already being used due to the hardcoded values we've
had for the last 10-ish years.
This commit is contained in:
Jon Trulson
2022-08-06 17:02:52 -06:00
parent 6fddca178f
commit 2d0c4d6d39
20 changed files with 61 additions and 120 deletions

View File

@@ -2245,8 +2245,10 @@ int _DtXlateGetXlateEnv(
809 = (int) (100.0 * atof("8.09"));
===========================*/
#if !defined(OSMAJORVERSION) || !defined(OSMINORVERSION) || OSMAJORVERSION == 0
#error OSMAJORVERSION and/or OSMINORVERSION not defined
#if !defined(OSMAJORVERSION) && !defined(OSMINORVERSION)
#warning "OSMAJORVERSION and OSMINORVERSION not defined, assuming 99.0:
#define OSMAJORVERSION 99
#define OSMINORVERSION 0
#endif
#if defined(__linux__) || defined(CSRG_BASED)

View File

@@ -19,6 +19,35 @@ if SOLARIS
libDtSvc_la_CPPFLAGS += -DNO_REGCOMP
endif
# OSVERSION hackery. This database works by comparing a number
# computed with the OS major/minor versions to determine appropriate
# entries in the Xlocale DB. These are currently hardcoded per OS in
# configure.ac. Well, no more. Now they will be hardcoded per OS
# here - the only place where they are really needed currently, until
# some time in the future when old and irrelevant entries are removed
# from the DB and we won't need this at all.
if LINUX
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=4 -DOSMINORVERSION=15
endif
if FREEBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=10 -DOSMINORVERSION=0
endif
if OPENBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=6 -DOSMINORVERSION=2
endif
if NETBSD
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=8 -DOSMINORVERSION=0
endif
if SOLARIS
libDtSvc_la_CPPFLAGS += -DOSMAJORVERSION=5 -DOSMINORVERSION=10
endif
libDtSvc_la_SOURCES = DtCodelibs/buf.C \
DtCodelibs/buf.h \
DtCodelibs/filegen.C \

View File

@@ -55,9 +55,7 @@
#endif /* sun */
#ifdef __FreeBSD__
#if OSMAJORVERSION > 8
#define UT_UTMPX
#endif
#define UT_HOST ut_host
#define UT_NO_pututline
#endif

View File

@@ -209,12 +209,7 @@ init(int init_as_source)
return(0);
}
len = sizeof(sockaddr_in);
#if defined(_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname(_sock, (sockaddr *)&_hostaddr, (size_t *)&len)
< 0) {
#else
if (getsockname(_sock, (sockaddr *)&_hostaddr, &len) < 0) {
#endif
return(0);
}
return(listen(_sock,5) == 0);
@@ -440,13 +435,9 @@ accept()
#endif
sockaddr_in saddr;
#if defined(_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
_msgsock = ::accept(_sock, (struct sockaddr *)&saddr,
(size_t *)&addrlen);
#else
_msgsock = ::accept(_sock, (struct sockaddr *)&saddr,
&addrlen);
#endif
if (_msgsock < 0) {
_tt_syslog( 0, LOG_ERR, "_Tt_stream_socket::accept(): "
"accept(): %m" );

View File

@@ -410,11 +410,7 @@ gettransient(int proto, int vers, int *sockp)
_tt_syslog(0, LOG_ERR, "bind(): %m");
return(0);
}
#if defined (_AIX) && (OSMAJORVERSION==4) && (OSMINORVERSION==2)
if (getsockname(s, (sockaddr *)&addr, (size_t *)&len) < 0) {
#else
if (getsockname(s, (sockaddr *)&addr, &len) < 0) {
#endif
_tt_syslog(0, LOG_ERR, "getsockname(): %m");
return(0);
}