clogger RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: clogger@librelist.org
Subject: [PATCH] another try to fix systems without CLOCK_MONOTONIC
Date: Fri, 14 Jan 2011 17:31:37 +0000	[thread overview]
Message-ID: <20110114173137.GB914@dcvr.yhbt.net> (raw)
In-Reply-To: 20110114091438.GB30950@dcvr.yhbt.net

Eric Wong <normalperson@yhbt.net> wrote:
> Eric Wong <normalperson@yhbt.net> wrote:
> > I've just pushed this out to git://git.bogomips.org/clogger.git
> > 
> > If you're using a crazy, non-Free OS[1] favored by many Rubyists,
> > please tell me if it works or not with this patch.
> > 
> > [1] - I don't and will never endorse non-Free Software nor any
> >       for-profit organizations in my Free Software works.
> 
> Here's another one which should work better, let us know if it
> works for you or not (and which system you're running).

Yup, it was late and I fucked up a typedef.  This also accounts for
CLOCK_MONONTIC being a function call, too.

>From b48017f818e13f8c7ddb555f8fe5fa895521af7a Mon Sep 17 00:00:00 2001
From: Eric Wong <normalperson@yhbt.net>
Date: Fri, 14 Jan 2011 17:26:59 +0000
Subject: [PATCH] another try to fix systems without CLOCK_MONOTONIC

Fix a reversed typedef and also deal with the case where
CLOCK_MONOTONIC is a function call and not a constant
macro.
---
 ext/clogger_ext/broken_system_compat.h |    2 +-
 ext/clogger_ext/clogger.c              |    4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/ext/clogger_ext/broken_system_compat.h b/ext/clogger_ext/broken_system_compat.h
index ec635b1..632612b 100644
--- a/ext/clogger_ext/broken_system_compat.h
+++ b/ext/clogger_ext/broken_system_compat.h
@@ -4,7 +4,7 @@
  */
 
 #ifndef HAVE_TYPE_CLOCKID_T
-typedef clockid_t int;
+typedef int clockid_t;
 #endif
 
 #ifndef HAVE_CLOCK_GETTIME
diff --git a/ext/clogger_ext/clogger.c b/ext/clogger_ext/clogger.c
index 604b9b6..d96b046 100644
--- a/ext/clogger_ext/clogger.c
+++ b/ext/clogger_ext/clogger.c
@@ -25,12 +25,14 @@
  * since we could've been built on a different system than we're run
  * under.
  */
-static clockid_t hopefully_CLOCK_MONOTONIC = CLOCK_MONOTONIC;
+static clockid_t hopefully_CLOCK_MONOTONIC;
 
 static void check_clock(void)
 {
 	struct timespec now;
 
+	hopefully_CLOCK_MONOTONIC = CLOCK_MONOTONIC;
+
 	/* we can't check this reliably at compile time */
 	if (clock_gettime(CLOCK_MONOTONIC, &now) == 0)
 		return;
-- 
Eric Wong


      reply	other threads:[~2011-01-14 17:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-13  0:37 [PATCH] attempt to support broken/crazy systems Eric Wong
2011-01-14  9:14 ` Eric Wong
2011-01-14 17:31   ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/clogger/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110114173137.GB914@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=clogger@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/clogger.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).