Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=52bfb36050c8529d9031d2c2513b281a360922ec
Commit:     52bfb36050c8529d9031d2c2513b281a360922ec
Parent:     8232fd625217dc641ed05dd238a8bb5c82828082
Author:     John Stultz <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 20:42:19 2007 +0100
Committer:  Ingo Molnar <[EMAIL PROTECTED]>
CommitDate: Mon Nov 26 20:42:19 2007 +0100

    time: add ADJ_OFFSET_SS_READ
    
    Michael Kerrisk reported that a long standing bug in the adjtimex()
    system call causes glibc's adjtime(3) function to deliver the wrong
    results if 'delta' is NULL.
    
    add the ADJ_OFFSET_SS_READ API detail, which will be used by glibc
    to fix this API compatibility bug.
    
    Also see: http://bugzilla.kernel.org/show_bug.cgi?id=6761
    
    [ [EMAIL PROTECTED]: added patch description and made it backwards 
compatible ]
    
    NOTE: the new flag is defined 0xa001 so that it returns -EINVAL on
    older kernels - this way glibc can use it safely. Suggested by Ulrich
    Drepper.
    
    Acked-by: Ulrich Drepper <[EMAIL PROTECTED]>
    Signed-off-by: Ingo Molnar <[EMAIL PROTECTED]>
    Signed-off-by: Thomas Gleixner <[EMAIL PROTECTED]>
---
 include/linux/timex.h |    1 +
 kernel/time/ntp.c     |    9 ++++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/timex.h b/include/linux/timex.h
index 37ac3ff..24c6a2b 100644
--- a/include/linux/timex.h
+++ b/include/linux/timex.h
@@ -137,6 +137,7 @@ struct timex {
 #define ADJ_TIMECONST          0x0020  /* pll time constant */
 #define ADJ_TICK               0x4000  /* tick value */
 #define ADJ_OFFSET_SINGLESHOT  0x8001  /* old-fashioned adjtime */
+#define ADJ_OFFSET_SS_READ     0xa001  /* read-only adjtime */
 
 /* xntp 3.4 compatibility names */
 #define MOD_OFFSET     ADJ_OFFSET
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c
index 14a2ecf..e64efaf 100644
--- a/kernel/time/ntp.c
+++ b/kernel/time/ntp.c
@@ -249,10 +249,12 @@ int do_adjtimex(struct timex *txc)
 
        /* Now we validate the data before disabling interrupts */
 
-       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) {
          /* singleshot must not be used with any other mode bits */
-               if (txc->modes != ADJ_OFFSET_SINGLESHOT)
+               if (txc->modes != ADJ_OFFSET_SINGLESHOT &&
+                                       txc->modes != ADJ_OFFSET_SS_READ)
                        return -EINVAL;
+       }
 
        if (txc->modes != ADJ_OFFSET_SINGLESHOT && (txc->modes & ADJ_OFFSET))
          /* adjustment Offset limited to +- .512 seconds */
@@ -372,7 +374,8 @@ int do_adjtimex(struct timex *txc)
 leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0)
                result = TIME_ERROR;
 
-       if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT)
+       if ((txc->modes == ADJ_OFFSET_SINGLESHOT) ||
+                       (txc->modes == ADJ_OFFSET_SS_READ))
                txc->offset = save_adjust;
        else
                txc->offset = ((long)shift_right(time_offset, SHIFT_UPDATE)) *
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to