[haiku-commits] haiku: hrev51198 - src/kits/tracker src/system/kernel headers/private/fs_shell src/apps/powerstatus headers/build

  • From: waddlesplash@xxxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Tue, 6 Jun 2017 23:39:00 +0200 (CEST)

hrev51198 adds 3 changesets to branch 'master'
old head: 4b6eeb5a95ca8bb7c597bf2d142c1397e46ef3f2
new head: 9f6dbb5ff0632d2f28f26a68ebfad5f03b4b509d
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=9f6dbb5ff063+%5E4b6eeb5a95ca

----------------------------------------------------------------------------

6ad3d2521282: real_time_clock: Change _user_{get|set}_timezone argument to 
int32.
  
  Both the user-mode syscalls.h and the kernel-mode one define it
  as an int32, not a time_t, and as it's a timezone offset not
  an actual time, there's no reason it needs to be one.

39efd913c168: Switch to a 64-bit time_t everywhere except 32-bit x86.
  
  Thus, BeOS compatibility is preserved (and there is no risk of
  breaking GCC5<->GCC2 interoperation on hybrid builds.)
  
  This commit only makes the actual change, the build fixes are
  in the next commit.

9f6dbb5ff063: Fix the build following the 64-bit time_t switch.

                              [ Augustin Cavalier <waddlesplash@xxxxxxxxx> ]

----------------------------------------------------------------------------

8 files changed, 45 insertions(+), 18 deletions(-)
headers/build/HaikuBuildCompatibility.h     |  9 +++++++--
headers/os/support/SupportDefs.h            |  9 +++++++--
headers/posix/time.h                        |  7 ++++++-
headers/private/fs_shell/fssh_api_wrapper.h |  9 +++++++--
src/apps/powerstatus/PowerStatusView.cpp    |  4 ++--
src/kits/mail/MailMessage.cpp               |  2 +-
src/kits/tracker/Utilities.cpp              | 17 ++++++++++++-----
src/system/kernel/real_time_clock.cpp       |  6 +++---

############################################################################

Commit:      6ad3d252128227b52c0fbba69b64c693cb488cac
URL:         http://cgit.haiku-os.org/haiku/commit/?id=6ad3d2521282
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Jun  6 01:23:14 2017 UTC

real_time_clock: Change _user_{get|set}_timezone argument to int32.

Both the user-mode syscalls.h and the kernel-mode one define it
as an int32, not a time_t, and as it's a timezone offset not
an actual time, there's no reason it needs to be one.

----------------------------------------------------------------------------

diff --git a/src/system/kernel/real_time_clock.cpp 
b/src/system/kernel/real_time_clock.cpp
index 11f5f43..8f86578 100644
--- a/src/system/kernel/real_time_clock.cpp
+++ b/src/system/kernel/real_time_clock.cpp
@@ -233,7 +233,7 @@ _user_set_real_time_clock(bigtime_t time)
 
 
 status_t
-_user_set_timezone(time_t timezoneOffset, const char *name, size_t nameLength)
+_user_set_timezone(int32 timezoneOffset, const char *name, size_t nameLength)
 {
        bigtime_t offset = (bigtime_t)timezoneOffset * 1000000LL;
 
@@ -270,9 +270,9 @@ _user_set_timezone(time_t timezoneOffset, const char *name, 
size_t nameLength)
 
 
 status_t
-_user_get_timezone(time_t *_timezoneOffset, char *userName, size_t nameLength)
+_user_get_timezone(int32 *_timezoneOffset, char *userName, size_t nameLength)
 {
-       time_t offset = (time_t)(sTimezoneOffset / 1000000LL);
+       int32 offset = (int32)(sTimezoneOffset / 1000000LL);
 
        if (_timezoneOffset != NULL
                && (!IS_USER_ADDRESS(_timezoneOffset)

############################################################################

Commit:      39efd913c168a60db420f2f8dc2590a6a86eb5d7
URL:         http://cgit.haiku-os.org/haiku/commit/?id=39efd913c168
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Jun  6 01:25:06 2017 UTC

Switch to a 64-bit time_t everywhere except 32-bit x86.

Thus, BeOS compatibility is preserved (and there is no risk of
breaking GCC5<->GCC2 interoperation on hybrid builds.)

This commit only makes the actual change, the build fixes are
in the next commit.

----------------------------------------------------------------------------

diff --git a/headers/build/HaikuBuildCompatibility.h 
b/headers/build/HaikuBuildCompatibility.h
index 7a852d4..1eeaf7a 100644
--- a/headers/build/HaikuBuildCompatibility.h
+++ b/headers/build/HaikuBuildCompatibility.h
@@ -300,8 +300,13 @@ typedef struct {
 #      define B_PRIdINO                B_PRId64
 #      define B_PRIiINO                B_PRIi64
        /* time_t */
-#      define B_PRIdTIME               B_PRId32
-#      define B_PRIiTIME               B_PRIi32
+#      if defined(__i386__) && !defined(__x86_64__)
+#              define B_PRIdTIME               B_PRId32
+#              define B_PRIiTIME               B_PRIi32
+#      else
+#              define B_PRIdTIME               B_PRId64
+#              define B_PRIiTIME               B_PRIi64
+#      endif
 #endif // !B_PRId8
 
 
diff --git a/headers/os/support/SupportDefs.h b/headers/os/support/SupportDefs.h
index db1ce57..f2533bb 100644
--- a/headers/os/support/SupportDefs.h
+++ b/headers/os/support/SupportDefs.h
@@ -176,8 +176,13 @@ typedef    generic_addr_t                  generic_size_t;
 #define B_PRIiINO              B_PRIi64
 
 /* time_t */
-#define B_PRIdTIME             B_PRId32
-#define B_PRIiTIME             B_PRIi32
+#if defined(__i386__) && !defined(__x86_64__)
+#      define B_PRIdTIME       B_PRId32
+#      define B_PRIiTIME       B_PRIi32
+#else
+#      define B_PRIdTIME       B_PRId64
+#      define B_PRIiTIME       B_PRIi64
+#endif
 
 /* bigtime_t */
 #define B_PRIdBIGTIME  B_PRId64
diff --git a/headers/posix/time.h b/headers/posix/time.h
index 08abda2..8ee6a61 100644
--- a/headers/posix/time.h
+++ b/headers/posix/time.h
@@ -13,10 +13,15 @@ struct sigevent;    /* defined in <signal.h> */
 
 
 typedef __haiku_int32 clock_t;
-typedef __haiku_int32 time_t;
 typedef __haiku_int32 suseconds_t;
 typedef __haiku_uint32 useconds_t;
 
+#if defined(__i386__) && !defined(__x86_64__)
+typedef __haiku_int32 time_t;
+#else
+typedef __haiku_int64 time_t;
+#endif
+
 
 #define CLOCKS_PER_SEC 1000000
 #define CLK_TCK                        CLOCKS_PER_SEC
diff --git a/headers/private/fs_shell/fssh_api_wrapper.h 
b/headers/private/fs_shell/fssh_api_wrapper.h
index b7dbcfa..233f8b4 100644
--- a/headers/private/fs_shell/fssh_api_wrapper.h
+++ b/headers/private/fs_shell/fssh_api_wrapper.h
@@ -1615,8 +1615,13 @@
 #define B_PRIdINO              FSSH_B_PRIdINO
 #define B_PRIiINO              FSSH_B_PRIiINO
 /* time_t */
-#define B_PRIdTIME             FSSH_B_PRId32
-#define B_PRIiTIME             FSSH_B_PRIi32
+#if defined(__i386__) && !defined(__x86_64__)
+#      define B_PRIdTIME               FSSH_B_PRId32
+#      define B_PRIiTIME               FSSH_B_PRIi32
+#else
+#      define B_PRIdTIME               FSSH_B_PRId64
+#      define B_PRIiTIME               FSSH_B_PRIi64
+#endif
 
 
 
////////////////////////////////////////////////////////////////////////////////

############################################################################

Revision:    hrev51198
Commit:      9f6dbb5ff0632d2f28f26a68ebfad5f03b4b509d
URL:         http://cgit.haiku-os.org/haiku/commit/?id=9f6dbb5ff063
Author:      Augustin Cavalier <waddlesplash@xxxxxxxxx>
Date:        Tue Jun  6 01:29:11 2017 UTC

Fix the build following the 64-bit time_t switch.

----------------------------------------------------------------------------

diff --git a/src/apps/powerstatus/PowerStatusView.cpp 
b/src/apps/powerstatus/PowerStatusView.cpp
index 8e8dc34..8539a24 100644
--- a/src/apps/powerstatus/PowerStatusView.cpp
+++ b/src/apps/powerstatus/PowerStatusView.cpp
@@ -357,7 +357,7 @@ PowerStatusView::_SetLabel(char* buffer, size_t 
bufferLength)
                snprintf(buffer, bufferLength, "%s%" B_PRId32 "%%%s", open, 
fPercent,
                        close);
        } else if (fShowTime && fTimeLeft >= 0) {
-               snprintf(buffer, bufferLength, "%s%" B_PRId32 ":%02" B_PRId32 
"%s",
+               snprintf(buffer, bufferLength, "%s%" B_PRIdTIME ":%02" 
B_PRIdTIME "%s",
                        open, fTimeLeft / 3600, (fTimeLeft / 60) % 60, close);
        }
 }
@@ -417,7 +417,7 @@ PowerStatusView::Update(bool force)
                                        "%%%s", open, fPercent, close);
                                if (fTimeLeft >= 0) {
                                        length += snprintf(text + length, 
sizeof(text) - length,
-                                               "\n%" B_PRId32 ":%02" B_PRId32, 
fTimeLeft / 3600,
+                                               "\n%" B_PRIdTIME ":%02" 
B_PRIdTIME, fTimeLeft / 3600,
                                                (fTimeLeft / 60) % 60);
                                }
 
diff --git a/src/kits/mail/MailMessage.cpp b/src/kits/mail/MailMessage.cpp
index a70386d..a43a84e 100644
--- a/src/kits/mail/MailMessage.cpp
+++ b/src/kits/mail/MailMessage.cpp
@@ -753,7 +753,7 @@ BEmailMessage::RenderToRFC822(BPositionIO* file)
        }
 
        // add the date field
-       int32 creationTime = time(NULL);
+       time_t creationTime = time(NULL);
        {
                char date[128];
                struct tm tm;
diff --git a/src/kits/tracker/Utilities.cpp b/src/kits/tracker/Utilities.cpp
index e2ad9dc..faa5299 100644
--- a/src/kits/tracker/Utilities.cpp
+++ b/src/kits/tracker/Utilities.cpp
@@ -984,7 +984,7 @@ EmbedUniqueVolumeInfo(BMessage* message, const BVolume* 
volume)
        if (volume->GetRootDirectory(&rootDirectory) == B_OK
                && rootDirectory.GetCreationTime(&created) == B_OK
                && fs_stat_dev(volume->Device(), &info) == 0) {
-               message->AddInt32("creationDate", created);
+               message->AddInt64("creationDate", created);
                message->AddInt64("capacity", volume->Capacity());
                message->AddString("deviceName", info.device_name);
                message->AddString("volumeName", info.volume_name);
@@ -996,14 +996,21 @@ EmbedUniqueVolumeInfo(BMessage* message, const BVolume* 
volume)
 status_t
 MatchArchivedVolume(BVolume* volume, const BMessage* message, int32 index)
 {
-       time_t created;
+       int64 created64;
        off_t capacity;
 
-       if (message->FindInt32("creationDate", index, &created) != B_OK
-               || message->FindInt64("capacity", index, &capacity) != B_OK) {
-               return B_ERROR;
+       if (message->FindInt64("creationDate", index, &created64) != B_OK) {
+               int32 created32;
+               if (message->FindInt32("creationDate", index, &created32) != 
B_OK)
+                       return B_ERROR;
+               created64 = created32;
        }
 
+       time_t created = created64;
+
+       if (message->FindInt64("capacity", index, &capacity) != B_OK)
+               return B_ERROR;
+
        BVolumeRoster roster;
        BVolume tempVolume;
        BString deviceName;


Other related posts: