From: Eric Piel <Eric.Piel@Bull.Net>
To: george anzinger <george@mvista.com>
Cc: davidm@hpl.hp.com, linux-kernel@vger.kernel.org, jim.houston@ccur.com
Subject: Re: POSIX timer syscalls
Date: Fri, 07 Mar 2003 11:09:31 +0100 [thread overview]
Message-ID: <3E686FDB.430FD684@Bull.Net> (raw)
In-Reply-To: 3E68573A.4020206@mvista.com
[-- Attachment #1: Type: text/plain, Size: 1737 bytes --]
george anzinger wrote:
>
> The patch to fix idr is attached. Cleans up the int/long confusion
> and also rearranges a couple of structures to honor the sizes involved.
>
I definitly agree with you George. However, in order to avoid hardcoding
the size of an int to 32 I used a constant called BITS_PER_INT (that's
really just for cleanness):
#endif
#define IDR_MASK ((1 << IDR_BITS)-1)
-/* Leave the possibility of an incomplete final layer */
-#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) /
IDR_BITS
-#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS)
+/* Define the size of the id's */
+#define BITS_PER_INT (sizeof(int)*8)
+
+#define MAX_ID_SHIFT (BITS_PER_INT - RESERVED_ID_BITS)
#define MAX_ID_BIT (1 << MAX_ID_SHIFT)
#define MAX_ID_MASK (MAX_ID_BIT - 1)
+/* Leave the possibility of an incomplete final layer */
+#define MAX_LEVEL (MAX_ID_SHIFT + IDR_BITS - 1) / IDR_BITS
+
/* Number of id_layer structs to leave in free list */
#define IDR_FREE_MAX MAX_LEVEL + MAX_LEVEL
> > Sure, except I don't have a test-program. ;-)
> >
> That is why you should visit the High-res-timers web site (see URL
> below) and get the "support" patch. It installs in you kernel tree at
> .../Documentation/high-res-timers/ and has test programs as well as
> man pages, readme files etc.
>
I used the test programs and they are really good to test the interface.
To have them working on IA64 I had to slightly modify the file
syscall_timer.c in the lib. This is due to the fact only a function
syscall() is used under ia64 instead of _syscall{1,2,3,4}(). I've
attached a patch that does the trick, it's a bit "raw" but it works and
that's only until glibc is upgraded to support those syscalls :-)
Eric
[-- Attachment #2: hrtimers-support-ia64.patch --]
[-- Type: text/plain, Size: 2175 bytes --]
--- high-res-timers.diff/lib/syscall_timer.c 2003-02-25 11:00:30.000000000 +0100
+++ high-res-timers/lib/syscall_timer.c 2003-03-07 10:48:34.000000000 +0100
@@ -11,69 +11,6 @@
#ifndef __set_errno
#define __set_errno(val) (errno = (val))
#endif
-#if defined(__ia64__)
-
-//#include <unistd.h>
-
-
-int timer_create(clockid_t which_clock,
- struct sigevent *timer_event_spec,
- timer_t *created_timer_id)
-{
- return syscall(__NR_timer_create, which_clock, timer_event_spec, created_timer_id);
-}
-
-int timer_gettime(timer_t timer_id, struct itimerspec *setting)
-{
- return syscall(__NR_timer_gettime, timer_id, setting);
-}
-
-int timer_settime(timer_t timer_id,
- int flags,
- const struct itimerspec *new_setting,
- struct itimerspec *old_setting)
-{
- return syscall(__NR_timer_settime, timer_id, flags, new_setting, old_setting);
-}
-
-int timer_getoverrun(timer_t timer_id)
-{
- return syscall(__NR_timer_getoverrun, timer_id);
-}
-
-int timer_delete(timer_t timer_id)
-{
- return syscall(__NR_timer_delete, timer_id);
-}
-
-int clock_gettime(clockid_t which_clock, struct timespec *ts)
-{
- return syscall(__NR_clock_gettime, which_clock, ts);
-}
-
-int clock_settime(clockid_t which_clock,
- const struct timespec *setting)
-{
- return syscall(__NR_clock_settime, which_clock, setting);
-}
-
-int clock_getres(clockid_t which_clock,
- struct timespec *resolution)
-{
- return syscall(__NR_clock_getres, which_clock, resolution);
-}
-
-int clock_nanosleep(clockid_t which_clock,
- int flags,
- const struct timespec *new_setting,
- struct timespec *old_setting)
-{
- return syscall(__NR_clock_nanosleep, which_clock, flags, new_setting, old_setting);
-}
-
-
-
-#else /*! __ia64__ */
#define __NR___timer_create __NR_timer_create
#define __NR___timer_gettime __NR_timer_gettime
@@ -161,4 +98,4 @@
int, flags,
const struct timespec *,rqtp,
struct timespec *,rmtp)
-#endif /*ia64*/
+
next prev parent reply other threads:[~2003-03-07 9:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-06 23:06 POSIX timer syscalls David Mosberger
2003-03-06 23:53 ` george anzinger
2003-03-07 1:27 ` David Mosberger
2003-03-07 1:39 ` george anzinger
2003-03-07 1:42 ` David Mosberger
2003-03-07 8:24 ` george anzinger
2003-03-07 10:09 ` Eric Piel [this message]
2003-03-07 12:14 ` Eric Piel
2003-03-07 18:16 ` george anzinger
2003-03-07 18:20 ` george anzinger
2003-03-07 0:15 ` Ulrich Drepper
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3E686FDB.430FD684@Bull.Net \
--to=eric.piel@bull.net \
--cc=davidm@hpl.hp.com \
--cc=george@mvista.com \
--cc=jim.houston@ccur.com \
--cc=linux-kernel@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox