From d06b001efec627f2c287cff3ed660e1182c93cd1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Wed, 27 Sep 2017 20:25:24 -0700 Subject: [PATCH] Platform macros for QNX, & recognize the QNX-only 'Named special file' filetype --- src/core/fsservices.h | 3 ++- src/core/platform.h | 5 +++++ src/core/unixfsservices.cpp | 12 +++++++++++- src/fs/fsdatasourceiter.cpp | 3 +++ src/fs/fspropcalc.cpp | 3 +++ src/fs/fspropset.cpp | 3 ++- src/fs/fspropset.h | 1 + src/fs/fsstrings.cpp | 1 + src/fs/fsstrings.h | 1 + src/twtest/platform_t.cpp | 2 ++ 10 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/core/fsservices.h b/src/core/fsservices.h index 0175f49..aa93ba1 100644 --- a/src/core/fsservices.h +++ b/src/core/fsservices.h @@ -133,7 +133,8 @@ struct cFSStatArgs { TY_FIFO, TY_SOCK, TY_DOOR, - TY_PORT + TY_PORT, + TY_NAMED }; // attr is fs dependent? diff --git a/src/core/platform.h b/src/core/platform.h index 7667c26..1c2a849 100644 --- a/src/core/platform.h +++ b/src/core/platform.h @@ -85,6 +85,7 @@ #define OS_RTEMS 0x0509 #define OS_RISCOS 0x050A #define OS_REDOX 0x050B +#define OS_QNX 0x050C #define COMP_UNKNOWN 0 #define COMP_GCC 0x0001 @@ -241,6 +242,10 @@ #define OS OS_REDOX #define IS_REDOX 1 +#elif defined(__QNX__) + #define OS OS_QNX + #define IS_QNX 1 + #endif diff --git a/src/core/unixfsservices.cpp b/src/core/unixfsservices.cpp index c48e34f..d1ea0c0 100644 --- a/src/core/unixfsservices.cpp +++ b/src/core/unixfsservices.cpp @@ -386,7 +386,11 @@ void cUnixFSServices::Stat( const TSTRING& strNameC, cFSStatArgs& stat) const #if HAVE_PORT_CREATE else if(S_ISPORT(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_PORT; #endif - + +#ifdef S_ISNAM + else if(S_ISNAM(statbuf.st_mode)) stat.mFileType = cFSStatArgs::TY_NAMED; +#endif + else stat.mFileType = cFSStatArgs::TY_INVALID; } @@ -625,6 +629,12 @@ void cUnixFSServices::ConvertModeToString( uint64 perm, TSTRING& tstrPerm ) cons szPerm[0] = _T('P'); break; #endif + +#ifdef S_IFNAM + case S_IFNAM: + szPerm[0] = _T('n'); + break; +#endif break; } diff --git a/src/fs/fsdatasourceiter.cpp b/src/fs/fsdatasourceiter.cpp index 8d8d80f..8ebaebf 100644 --- a/src/fs/fsdatasourceiter.cpp +++ b/src/fs/fsdatasourceiter.cpp @@ -271,6 +271,9 @@ bool cFSDataSourceIter::InitializeTypeInfo(iFCO* pFCO) case cFSStatArgs::TY_PORT: propSet.SetFileType(cFSPropSet::FT_PORT); break; + case cFSStatArgs::TY_NAMED: + propSet.SetFileType(cFSPropSet::FT_NAMED); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); diff --git a/src/fs/fspropcalc.cpp b/src/fs/fspropcalc.cpp index 9c2e8de..afc1f67 100644 --- a/src/fs/fspropcalc.cpp +++ b/src/fs/fspropcalc.cpp @@ -304,6 +304,9 @@ void cFSPropCalc::HandleStatProperties( const cFCOPropVector& propsToCheck, cons case cFSStatArgs::TY_PORT: propSet.SetFileType(cFSPropSet::FT_PORT); break; + case cFSStatArgs::TY_NAMED: + propSet.SetFileType(cFSPropSet::FT_NAMED); + break; default: // set it to invalid propSet.SetFileType(cFSPropSet::FT_INVALID); diff --git a/src/fs/fspropset.cpp b/src/fs/fspropset.cpp index 8189710..d03d629 100644 --- a/src/fs/fspropset.cpp +++ b/src/fs/fspropset.cpp @@ -60,7 +60,8 @@ TSTRING cFCOPropFileType::AsString() const fs::STR_FT_FIFO, fs::STR_FT_SOCK, fs::STR_FT_DOOR, - fs::STR_FT_PORT + fs::STR_FT_PORT, + fs::STR_FT_NAMED }; int32 fileType = GetValue(); diff --git a/src/fs/fspropset.h b/src/fs/fspropset.h index b771673..57f7dc4 100644 --- a/src/fs/fspropset.h +++ b/src/fs/fspropset.h @@ -111,6 +111,7 @@ public: FT_SOCK, FT_DOOR, FT_PORT, + FT_NAMED, FT_NUMITEMS }; diff --git a/src/fs/fsstrings.cpp b/src/fs/fsstrings.cpp index e639723..97a08bf 100644 --- a/src/fs/fsstrings.cpp +++ b/src/fs/fsstrings.cpp @@ -51,6 +51,7 @@ TSS_BeginStringtable( cFS ) TSS_StringEntry( fs::STR_FT_SOCK, _T("Socket") ), TSS_StringEntry( fs::STR_FT_DOOR, _T("Door") ), TSS_StringEntry( fs::STR_FT_PORT, _T("Event Port") ), + TSS_StringEntry( fs::STR_FT_NAMED, _T("Named Special File") ), // property names TSS_StringEntry( fs::STR_PROP_DEV, _T("Device Number") ), diff --git a/src/fs/fsstrings.h b/src/fs/fsstrings.h index ad4a6dc..6607e08 100644 --- a/src/fs/fsstrings.h +++ b/src/fs/fsstrings.h @@ -55,6 +55,7 @@ TSS_BeginStringIds( fs ) STR_FT_SOCK, STR_FT_DOOR, STR_FT_PORT, + STR_FT_NAMED, // property names STR_PROP_DEV, diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index ccfd667..4cb4b21 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -297,6 +297,8 @@ const TSTRING expected_os("RTEMS"); const TSTRING expected_os("RISC OS"); #elif IS_RISCOS const TSTRING expected_os("Redox"); +#elif IS_QNX +const TSTRING expected_os("QNX"); #else const TSTRING expected_os("?!?!?"); #endif