[BusyBox-cvs] busybox/util-linux hwclock.c,1.3,1.4

Erik Andersen andersen at codepoet.org
Thu Jan 2 07:33:27 UTC 2003


On Thu Jan 02, 2003 at 12:16:57AM -0700, Robert Griebl wrote:
> Doing this wrong should be punished even harder :)
>  - Robert 
> 
> 
> Index: hwclock.c
> ===================================================================
> RCS file: /var/cvs/busybox/util-linux/hwclock.c,v
> retrieving revision 1.3
> retrieving revision 1.4
> diff -u -d -r1.3 -r1.4
> --- hwclock.c	11 Dec 2002 03:41:28 -0000	1.3
> +++ hwclock.c	2 Jan 2003 07:16:53 -0000	1.4
> @@ -35,8 +35,21 @@
>  
>  
>  /* Copied from linux/rtc.h to eliminate the kernel dependancy */
> -#define RTC_SET_TIME	_IOW('p', 0x0a, struct tm) /* Set RTC time    */
> -#define RTC_RD_TIME	_IOR('p', 0x09, struct tm) /* Read RTC time   */
> +struct linux_rtc_time {
> +	int tm_sec;
> +	int tm_min;
> +	int tm_hour;
> +	int tm_mday;
> +	int tm_mon;
> +	int tm_year;
> +	int tm_wday;
> +	int tm_yday;
> +	int tm_isdst;
> +};
> +                                    
> +
> +#define RTC_SET_TIME   _IOW('p', 0x0a, struct linux_rtc_time) /* Set RTC time    */
> +#define RTC_RD_TIME    _IOR('p', 0x09, struct linux_rtc_time) /* Read RTC time   */

Interesting.  The structs are identical up to the sizeof(struct
linux_rtc_time).  At least for x86, the kernel copy_from_user and
copy_to_user simply ignore the surplus tm_gmtoff, tm_zone, etc
fields.  I guess the powerpc version tries to worry about the
extra fields and complains.  I had initially added that struct
but decided it was unnecessary.  Guess I was wrong...

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the busybox-cvs mailing list