aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Cochran <richard.cochran@omicron.at>2011-02-01 08:50:58 -0500
committerThomas Gleixner <tglx@linutronix.de>2011-02-02 09:28:11 -0500
commit1e6d767924c74929c0cfe839ae8f37bcee9e544e (patch)
tree4ace06971e2b3519e556bea2f7e3e999e860eedd
parent7cf37e87dd2cfa17a64f28ea7f31eed4525f79e4 (diff)
time: Correct the *settime* parameters
Both settimeofday() and clock_settime() promise with a 'const' attribute not to alter the arguments passed in. This patch adds the missing 'const' attribute into the various kernel functions implementing these calls. Signed-off-by: Richard Cochran <richard.cochran@omicron.at> Acked-by: John Stultz <johnstul@us.ibm.com> LKML-Reference: <20110201134417.545698637@linutronix.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--drivers/char/mmtimer.c2
-rw-r--r--include/linux/posix-timers.h5
-rw-r--r--include/linux/security.h9
-rw-r--r--include/linux/time.h5
-rw-r--r--kernel/posix-timers.c4
-rw-r--r--kernel/time.c2
-rw-r--r--kernel/time/timekeeping.c2
-rw-r--r--security/commoncap.c2
-rw-r--r--security/security.c2
9 files changed, 18 insertions, 15 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c
index e6d75627c6c8..ecd0082502ef 100644
--- a/drivers/char/mmtimer.c
+++ b/drivers/char/mmtimer.c
@@ -487,7 +487,7 @@ static int sgi_clock_get(clockid_t clockid, struct timespec *tp)
487 return 0; 487 return 0;
488}; 488};
489 489
490static int sgi_clock_set(clockid_t clockid, struct timespec *tp) 490static int sgi_clock_set(const clockid_t clockid, const struct timespec *tp)
491{ 491{
492 492
493 u64 nsec; 493 u64 nsec;
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h
index 3e23844a6990..b2c14cbd47a6 100644
--- a/include/linux/posix-timers.h
+++ b/include/linux/posix-timers.h
@@ -69,7 +69,8 @@ struct k_itimer {
69struct k_clock { 69struct k_clock {
70 int res; /* in nanoseconds */ 70 int res; /* in nanoseconds */
71 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); 71 int (*clock_getres) (const clockid_t which_clock, struct timespec *tp);
72 int (*clock_set) (const clockid_t which_clock, struct timespec * tp); 72 int (*clock_set) (const clockid_t which_clock,
73 const struct timespec *tp);
73 int (*clock_get) (const clockid_t which_clock, struct timespec * tp); 74 int (*clock_get) (const clockid_t which_clock, struct timespec * tp);
74 int (*timer_create) (struct k_itimer *timer); 75 int (*timer_create) (struct k_itimer *timer);
75 int (*nsleep) (const clockid_t which_clock, int flags, 76 int (*nsleep) (const clockid_t which_clock, int flags,
@@ -89,7 +90,7 @@ void register_posix_clock(const clockid_t clock_id, struct k_clock *new_clock);
89/* error handlers for timer_create, nanosleep and settime */ 90/* error handlers for timer_create, nanosleep and settime */
90int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *, 91int do_posix_clock_nonanosleep(const clockid_t, int flags, struct timespec *,
91 struct timespec __user *); 92 struct timespec __user *);
92int do_posix_clock_nosettime(const clockid_t, struct timespec *tp); 93int do_posix_clock_nosettime(const clockid_t, const struct timespec *tp);
93 94
94/* function to call to trigger timer event */ 95/* function to call to trigger timer event */
95int posix_timer_event(struct k_itimer *timr, int si_private); 96int posix_timer_event(struct k_itimer *timr, int si_private);
diff --git a/include/linux/security.h b/include/linux/security.h
index c642bb8b8f5a..c096aa6fca60 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -53,7 +53,7 @@ struct audit_krule;
53 */ 53 */
54extern int cap_capable(struct task_struct *tsk, const struct cred *cred, 54extern int cap_capable(struct task_struct *tsk, const struct cred *cred,
55 int cap, int audit); 55 int cap, int audit);
56extern int cap_settime(struct timespec *ts, struct timezone *tz); 56extern int cap_settime(const struct timespec *ts, const struct timezone *tz);
57extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode); 57extern int cap_ptrace_access_check(struct task_struct *child, unsigned int mode);
58extern int cap_ptrace_traceme(struct task_struct *parent); 58extern int cap_ptrace_traceme(struct task_struct *parent);
59extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted); 59extern int cap_capget(struct task_struct *target, kernel_cap_t *effective, kernel_cap_t *inheritable, kernel_cap_t *permitted);
@@ -1387,7 +1387,7 @@ struct security_operations {
1387 int (*quotactl) (int cmds, int type, int id, struct super_block *sb); 1387 int (*quotactl) (int cmds, int type, int id, struct super_block *sb);
1388 int (*quota_on) (struct dentry *dentry); 1388 int (*quota_on) (struct dentry *dentry);
1389 int (*syslog) (int type); 1389 int (*syslog) (int type);
1390 int (*settime) (struct timespec *ts, struct timezone *tz); 1390 int (*settime) (const struct timespec *ts, const struct timezone *tz);
1391 int (*vm_enough_memory) (struct mm_struct *mm, long pages); 1391 int (*vm_enough_memory) (struct mm_struct *mm, long pages);
1392 1392
1393 int (*bprm_set_creds) (struct linux_binprm *bprm); 1393 int (*bprm_set_creds) (struct linux_binprm *bprm);
@@ -1669,7 +1669,7 @@ int security_sysctl(struct ctl_table *table, int op);
1669int security_quotactl(int cmds, int type, int id, struct super_block *sb); 1669int security_quotactl(int cmds, int type, int id, struct super_block *sb);
1670int security_quota_on(struct dentry *dentry); 1670int security_quota_on(struct dentry *dentry);
1671int security_syslog(int type); 1671int security_syslog(int type);
1672int security_settime(struct timespec *ts, struct timezone *tz); 1672int security_settime(const struct timespec *ts, const struct timezone *tz);
1673int security_vm_enough_memory(long pages); 1673int security_vm_enough_memory(long pages);
1674int security_vm_enough_memory_mm(struct mm_struct *mm, long pages); 1674int security_vm_enough_memory_mm(struct mm_struct *mm, long pages);
1675int security_vm_enough_memory_kern(long pages); 1675int security_vm_enough_memory_kern(long pages);
@@ -1904,7 +1904,8 @@ static inline int security_syslog(int type)
1904 return 0; 1904 return 0;
1905} 1905}
1906 1906
1907static inline int security_settime(struct timespec *ts, struct timezone *tz) 1907static inline int security_settime(const struct timespec *ts,
1908 const struct timezone *tz)
1908{ 1909{
1909 return cap_settime(ts, tz); 1910 return cap_settime(ts, tz);
1910} 1911}
diff --git a/include/linux/time.h b/include/linux/time.h
index 38c5206c2673..7c44e7778033 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -145,8 +145,9 @@ static inline u32 arch_gettimeoffset(void) { return 0; }
145#endif 145#endif
146 146
147extern void do_gettimeofday(struct timeval *tv); 147extern void do_gettimeofday(struct timeval *tv);
148extern int do_settimeofday(struct timespec *tv); 148extern int do_settimeofday(const struct timespec *tv);
149extern int do_sys_settimeofday(struct timespec *tv, struct timezone *tz); 149extern int do_sys_settimeofday(const struct timespec *tv,
150 const struct timezone *tz);
150#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts) 151#define do_posix_clock_monotonic_gettime(ts) ktime_get_ts(ts)
151extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags); 152extern long do_utimes(int dfd, const char __user *filename, struct timespec *times, int flags);
152struct itimerval; 153struct itimerval;
diff --git a/kernel/posix-timers.c b/kernel/posix-timers.c
index 93bd2eb2bc53..21b7ca205f38 100644
--- a/kernel/posix-timers.c
+++ b/kernel/posix-timers.c
@@ -192,7 +192,7 @@ static int common_clock_get(clockid_t which_clock, struct timespec *tp)
192} 192}
193 193
194static inline int common_clock_set(const clockid_t which_clock, 194static inline int common_clock_set(const clockid_t which_clock,
195 struct timespec *tp) 195 const struct timespec *tp)
196{ 196{
197 return do_sys_settimeofday(tp, NULL); 197 return do_sys_settimeofday(tp, NULL);
198} 198}
@@ -928,7 +928,7 @@ void exit_itimers(struct signal_struct *sig)
928} 928}
929 929
930/* Not available / possible... functions */ 930/* Not available / possible... functions */
931int do_posix_clock_nosettime(const clockid_t clockid, struct timespec *tp) 931int do_posix_clock_nosettime(const clockid_t clockid, const struct timespec *tp)
932{ 932{
933 return -EINVAL; 933 return -EINVAL;
934} 934}
diff --git a/kernel/time.c b/kernel/time.c
index a31b51220ac6..5cb80533d8b5 100644
--- a/kernel/time.c
+++ b/kernel/time.c
@@ -150,7 +150,7 @@ static inline void warp_clock(void)
150 * various programs will get confused when the clock gets warped. 150 * various programs will get confused when the clock gets warped.
151 */ 151 */
152 152
153int do_sys_settimeofday(struct timespec *tv, struct timezone *tz) 153int do_sys_settimeofday(const struct timespec *tv, const struct timezone *tz)
154{ 154{
155 static int firsttime = 1; 155 static int firsttime = 1;
156 int error = 0; 156 int error = 0;
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 02c13a313d15..4f9f65b91323 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -353,7 +353,7 @@ EXPORT_SYMBOL(do_gettimeofday);
353 * 353 *
354 * Sets the time of day to the new time and update NTP and notify hrtimers 354 * Sets the time of day to the new time and update NTP and notify hrtimers
355 */ 355 */
356int do_settimeofday(struct timespec *tv) 356int do_settimeofday(const struct timespec *tv)
357{ 357{
358 struct timespec ts_delta; 358 struct timespec ts_delta;
359 unsigned long flags; 359 unsigned long flags;
diff --git a/security/commoncap.c b/security/commoncap.c
index 64c2ed9c9015..dbfdaed4cc66 100644
--- a/security/commoncap.c
+++ b/security/commoncap.c
@@ -93,7 +93,7 @@ int cap_capable(struct task_struct *tsk, const struct cred *cred, int cap,
93 * Determine whether the current process may set the system clock and timezone 93 * Determine whether the current process may set the system clock and timezone
94 * information, returning 0 if permission granted, -ve if denied. 94 * information, returning 0 if permission granted, -ve if denied.
95 */ 95 */
96int cap_settime(struct timespec *ts, struct timezone *tz) 96int cap_settime(const struct timespec *ts, const struct timezone *tz)
97{ 97{
98 if (!capable(CAP_SYS_TIME)) 98 if (!capable(CAP_SYS_TIME))
99 return -EPERM; 99 return -EPERM;
diff --git a/security/security.c b/security/security.c
index 739e40362f44..b995428f1c96 100644
--- a/security/security.c
+++ b/security/security.c
@@ -202,7 +202,7 @@ int security_syslog(int type)
202 return security_ops->syslog(type); 202 return security_ops->syslog(type);
203} 203}
204 204
205int security_settime(struct timespec *ts, struct timezone *tz) 205int security_settime(const struct timespec *ts, const struct timezone *tz)
206{ 206{
207 return security_ops->settime(ts, tz); 207 return security_ops->settime(ts, tz);
208} 208}