|
|
4531256 |
From 0b99a31c5813a34ea3a09c067203f7802291b42e Mon Sep 17 00:00:00 2001
|
|
|
4531256 |
From: Mattias Ellert <mattias.ellert@physics.uu.se>
|
|
|
4531256 |
Date: Sat, 16 Mar 2024 21:43:38 +0100
|
|
|
4531256 |
Subject: [PATCH] Fixes for 64 bit time_t on 32 bit systems
|
|
|
4531256 |
|
|
|
4531256 |
---
|
|
|
4531256 |
src/XrdApps/Xrdadler32.cc | 2 +-
|
|
|
4531256 |
src/XrdBwm/XrdBwmLogger.cc | 5 +++--
|
|
|
4531256 |
src/XrdHttp/XrdHttpReq.cc | 2 +-
|
|
|
4531256 |
src/XrdPfc/XrdPfcConfiguration.cc | 2 +-
|
|
|
4531256 |
src/XrdPosix/XrdPosixPreload32.cc | 4 ++++
|
|
|
4531256 |
src/XrdSecsss/XrdSecsssKT.cc | 5 +++--
|
|
|
4531256 |
src/XrdXrootd/XrdXrootdPrepare.cc | 3 ++-
|
|
|
4531256 |
src/XrdXrootd/XrdXrootdProtocol.cc | 9 +++++----
|
|
|
4531256 |
8 files changed, 20 insertions(+), 12 deletions(-)
|
|
|
4531256 |
|
|
|
4531256 |
diff --git a/src/XrdApps/Xrdadler32.cc b/src/XrdApps/Xrdadler32.cc
|
|
|
4531256 |
index 4c4e0068b..ab333656e 100644
|
|
|
4531256 |
--- a/src/XrdApps/Xrdadler32.cc
|
|
|
4531256 |
+++ b/src/XrdApps/Xrdadler32.cc
|
|
|
4531256 |
@@ -88,7 +88,7 @@ int fGetXattrAdler32(int fd, const char* attr, char *value)
|
|
|
4531256 |
int rc;
|
|
|
4531256 |
|
|
|
4531256 |
if (fstat(fd, &st)) return 0;
|
|
|
4531256 |
- sprintf(mtime, "%ld", st.st_mtime);
|
|
|
4531256 |
+ sprintf(mtime, "%lld", (long long) st.st_mtime);
|
|
|
4531256 |
|
|
|
4531256 |
#if defined(__linux__) || defined(__GNU__) || (defined(__FreeBSD_kernel__) && defined(__GLIBC__))
|
|
|
4531256 |
rc = fgetxattr(fd, attr, attr_val, 25);
|
|
|
4531256 |
diff --git a/src/XrdBwm/XrdBwmLogger.cc b/src/XrdBwm/XrdBwmLogger.cc
|
|
|
4531256 |
index 0064f8b7e..ee0788396 100644
|
|
|
4531256 |
--- a/src/XrdBwm/XrdBwmLogger.cc
|
|
|
4531256 |
+++ b/src/XrdBwm/XrdBwmLogger.cc
|
|
|
4531256 |
@@ -146,11 +146,12 @@ void XrdBwmLogger::Event(Info &eInfo)
|
|
|
4531256 |
tp->Tlen = snprintf(tp->Text, XrdBwmLoggerMsg::msgSize,
|
|
|
4531256 |
"<stats id=\"bwm\"><tid>%s</tid><lfn>%s</lfn>"
|
|
|
4531256 |
"<lcl>%s</lcl><rmt>%s</rmt><flow>%c</flow>"
|
|
|
4531256 |
- "<at>%ld</at><bt>%ld</bt><ct>%ld</ct>"
|
|
|
4531256 |
+ "<at>%lld</at><bt>%lld</bt><ct>%lld</ct>"
|
|
|
4531256 |
"<iq>%d</iq><oq>%d</oq><xq>%d</xq>"
|
|
|
4531256 |
"<sz>%lld<sz><esec>%d</esec></stats>%c",
|
|
|
4531256 |
eInfo.Tident, eInfo.Lfn, eInfo.lclNode, eInfo.rmtNode,
|
|
|
4531256 |
- eInfo.Flow, eInfo.ATime, eInfo.BTime, eInfo.CTime,
|
|
|
4531256 |
+ eInfo.Flow, (long long) eInfo.ATime,
|
|
|
4531256 |
+ (long long) eInfo.BTime, (long long) eInfo.CTime,
|
|
|
4531256 |
eInfo.numqIn, eInfo.numqOut, eInfo.numqXeq, eInfo.Size,
|
|
|
4531256 |
eInfo.ESec, theEOL);
|
|
|
4531256 |
|
|
|
4531256 |
diff --git a/src/XrdHttp/XrdHttpReq.cc b/src/XrdHttp/XrdHttpReq.cc
|
|
|
4531256 |
index 9a54293b5..b61587118 100644
|
|
|
4531256 |
--- a/src/XrdHttp/XrdHttpReq.cc
|
|
|
4531256 |
+++ b/src/XrdHttp/XrdHttpReq.cc
|
|
|
4531256 |
@@ -656,7 +656,7 @@ void XrdHttpReq::appendOpaque(XrdOucString &s, XrdSecEntity *secent, char *hash,
|
|
|
4531256 |
|
|
|
4531256 |
s += "&xrdhttptime=";
|
|
|
4531256 |
char buf[256];
|
|
|
4531256 |
- sprintf(buf, "%ld", tnow);
|
|
|
4531256 |
+ sprintf(buf, "%lld", (long long) tnow);
|
|
|
4531256 |
s += buf;
|
|
|
4531256 |
|
|
|
4531256 |
if (secent) {
|
|
|
4531256 |
diff --git a/src/XrdPfc/XrdPfcConfiguration.cc b/src/XrdPfc/XrdPfcConfiguration.cc
|
|
|
4531256 |
index 8f4bcd064..2cdb58693 100644
|
|
|
4531256 |
--- a/src/XrdPfc/XrdPfcConfiguration.cc
|
|
|
4531256 |
+++ b/src/XrdPfc/XrdPfcConfiguration.cc
|
|
|
4531256 |
@@ -477,7 +477,7 @@ bool Cache::Config(const char *config_filename, const char *parameters)
|
|
|
4531256 |
if (m_configuration.m_cs_UVKeep < 0)
|
|
|
4531256 |
strcpy(uvk, "lru");
|
|
|
4531256 |
else
|
|
|
4531256 |
- sprintf(uvk, "%ld", m_configuration.m_cs_UVKeep);
|
|
|
4531256 |
+ sprintf(uvk, "%lld", (long long) m_configuration.m_cs_UVKeep);
|
|
|
4531256 |
float rg = (m_configuration.m_RamAbsAvailable) / float(1024*1024*1024);
|
|
|
4531256 |
loff = snprintf(buff, sizeof(buff), "Config effective %s pfc configuration:\n"
|
|
|
4531256 |
" pfc.cschk %s uvkeep %s\n"
|
|
|
4531256 |
diff --git a/src/XrdPosix/XrdPosixPreload32.cc b/src/XrdPosix/XrdPosixPreload32.cc
|
|
|
4531256 |
index 3d99ba9d2..28c0cacef 100644
|
|
|
4531256 |
--- a/src/XrdPosix/XrdPosixPreload32.cc
|
|
|
4531256 |
+++ b/src/XrdPosix/XrdPosixPreload32.cc
|
|
|
4531256 |
@@ -44,6 +44,10 @@
|
|
|
4531256 |
#ifdef _FILE_OFFSET_BITS
|
|
|
4531256 |
#undef _FILE_OFFSET_BITS
|
|
|
4531256 |
#endif
|
|
|
4531256 |
+
|
|
|
4531256 |
+#ifdef _TIME_BITS
|
|
|
4531256 |
+#undef _TIME_BITS
|
|
|
4531256 |
+#endif
|
|
|
4531256 |
#endif
|
|
|
4531256 |
|
|
|
4531256 |
#define XRDPOSIXPRELOAD32
|
|
|
4531256 |
diff --git a/src/XrdSecsss/XrdSecsssKT.cc b/src/XrdSecsss/XrdSecsssKT.cc
|
|
|
4531256 |
index 38b1ada15..0071b20f1 100644
|
|
|
4531256 |
--- a/src/XrdSecsss/XrdSecsssKT.cc
|
|
|
4531256 |
+++ b/src/XrdSecsss/XrdSecsssKT.cc
|
|
|
4531256 |
@@ -371,10 +371,11 @@ int XrdSecsssKT::Rewrite(int Keep, int &numKeys, int &numTot, int &numExp)
|
|
|
4531256 |
if (ktP->Data.Exp && ktP->Data.Exp <= time(0)) {numExp++; continue;}
|
|
|
4531256 |
if (!isKey(ktCurr, ktP, 0)) {ktCurr.NUG(ktP); numID = 0;}
|
|
|
4531256 |
else if (Keep && numID >= Keep) continue;
|
|
|
4531256 |
- n = sprintf(buff, "%s0 u:%s g:%s n:%s N:%lld c:%ld e:%ld f:%lld k:",
|
|
|
4531256 |
+ n = sprintf(buff, "%s0 u:%s g:%s n:%s N:%lld c:%lld e:%lld f:%lld k:",
|
|
|
4531256 |
(numKeys ? "\n" : ""),
|
|
|
4531256 |
ktP->Data.User,ktP->Data.Grup,ktP->Data.Name,ktP->Data.ID,
|
|
|
4531256 |
- ktP->Data.Crt, ktP->Data.Exp, ktP->Data.Flags);
|
|
|
4531256 |
+ (long long) ktP->Data.Crt, (long long) ktP->Data.Exp,
|
|
|
4531256 |
+ ktP->Data.Flags);
|
|
|
4531256 |
numID++; numKeys++; keyB2X(ktP, kbuff);
|
|
|
4531256 |
if (write(ktFD, buff, n) < 0
|
|
|
4531256 |
|| write(ktFD, kbuff, ktP->Data.Len*2) < 0) break;
|
|
|
4531256 |
diff --git a/src/XrdXrootd/XrdXrootdPrepare.cc b/src/XrdXrootd/XrdXrootdPrepare.cc
|
|
|
4531256 |
index 8ce494c07..947009362 100644
|
|
|
4531256 |
--- a/src/XrdXrootd/XrdXrootdPrepare.cc
|
|
|
4531256 |
+++ b/src/XrdXrootd/XrdXrootdPrepare.cc
|
|
|
4531256 |
@@ -129,7 +129,8 @@ int XrdXrootdPrepare::List(XrdXrootdPrepArgs &pargs, char *resp, int resplen)
|
|
|
4531256 |
else continue;
|
|
|
4531256 |
if ((up = (char *) index((const char *)(up+1), (int)'_'))) *up = ' ';
|
|
|
4531256 |
else continue;
|
|
|
4531256 |
- return snprintf(resp, resplen-1, "%s %ld", dp->d_name, buf.st_mtime);
|
|
|
4531256 |
+ return snprintf(resp, resplen-1, "%s %lld",
|
|
|
4531256 |
+ dp->d_name, (long long) buf.st_mtime);
|
|
|
4531256 |
}
|
|
|
4531256 |
|
|
|
4531256 |
// Completed
|
|
|
4531256 |
diff --git a/src/XrdXrootd/XrdXrootdProtocol.cc b/src/XrdXrootd/XrdXrootdProtocol.cc
|
|
|
4531256 |
index e0e50e75d..ec98d7d1e 100644
|
|
|
4531256 |
--- a/src/XrdXrootd/XrdXrootdProtocol.cc
|
|
|
4531256 |
+++ b/src/XrdXrootd/XrdXrootdProtocol.cc
|
|
|
4531256 |
@@ -798,8 +798,8 @@ int XrdXrootdProtocol::StatGen(struct stat &buf, char *xxBuff, int xxLen,
|
|
|
4531256 |
|
|
|
4531256 |
// Format the default response: <devid> <size> <flags> <mtime>
|
|
|
4531256 |
//
|
|
|
4531256 |
- m = snprintf(xxBuff, xxLen, "%lld %lld %d %ld",
|
|
|
4531256 |
- Dev.uuid, fsz, flags, buf.st_mtime);
|
|
|
4531256 |
+ m = snprintf(xxBuff, xxLen, "%lld %lld %d %lld",
|
|
|
4531256 |
+ Dev.uuid, fsz, flags, (long long) buf.st_mtime);
|
|
|
4531256 |
// if (!xtnd || m >= xxLen) return xxLen;
|
|
|
4531256 |
//
|
|
|
4531256 |
|
|
|
4531256 |
@@ -808,8 +808,9 @@ int XrdXrootdProtocol::StatGen(struct stat &buf, char *xxBuff, int xxLen,
|
|
|
4531256 |
char *origP = xxBuff;
|
|
|
4531256 |
char *nullP = xxBuff + m++;
|
|
|
4531256 |
xxBuff += m; xxLen -= m;
|
|
|
4531256 |
- n = snprintf(xxBuff, xxLen, "%ld %ld %04o ",
|
|
|
4531256 |
- buf.st_ctime, buf.st_atime, buf.st_mode&07777);
|
|
|
4531256 |
+ n = snprintf(xxBuff, xxLen, "%lld %lld %04o ",
|
|
|
4531256 |
+ (long long) buf.st_ctime, (long long) buf.st_atime,
|
|
|
4531256 |
+ buf.st_mode&07777);
|
|
|
4531256 |
if (n >= xxLen) return m;
|
|
|
4531256 |
xxBuff += n; xxLen -= n;
|
|
|
4531256 |
|
|
|
4531256 |
--
|
|
|
4531256 |
2.44.0
|
|
|
4531256 |
|