Pull up following revision(s) (requested by martin in ticket #216):

share/man/man9/todr.9: revision 1.17
	sys/arch/sh3/dev/rtc.c: revision 1.9
	sys/dev/clock_subr.c: revision 1.17-1.22
	sys/dev/clock_subr.h: revision 1.22
	sys/fs/msdosfs/msdosfs_conv.c: revision 1.10
	tools/compat/compat_defs.h: revision 1.98
	tools/compat/dev/clock_subr.h: revision 1.1-1.2
	usr.sbin/makefs/msdos/Makefile.inc: revision 1.6
clock_secs_to_ymdhms(9) takes seconds as a time_t, not int.
--
Make this compile- and usable from userland as well.
--
Add a slightly stripped down version of sys/dev/clock/clock_subr.h to make
this code available for tools.
--
Reformulate an overflow test so it can be used in tool builds (i.e. does
not depend on netbsd specific macros).
--
Make msdosfs time conversion use the y/m/d/h/m/s conversion functions
from clock_subr.c and compile that into the userland (and tools)
makefs as well.
--
Copy definitions of __type_min(t), __type_max(t), and some related macros,
from <sys/cdefs.h>, for use when building tools.
--
Revert previous; test secs > __type_max(time_t) again, now
that __type_max is available in tools/compat/compat_defs.h.
--
If HAVE_NBTOOL_CONFIG_H is set, then include "nbtool_config.h",
because this file is compiled as part of tools/makefs.
--
Counting leap years was fine while we had 32bit time_t - but now it
is not a good idea for dates far away in the future.
For dates in the year 2000 or later, use arithmetic instead (since the
repeating periods are well aligned). Should fix PR 49144.
--
Avoid overflowing the "year" value by making the field uint64_t. Adapt
arguments and local variables accordingly.
This now fixes PR 49144 for real.
--
Adapt formats for debug printfs to clock_subr type changes.
This commit is contained in:
snj 2014-11-12 18:50:55 +00:00
parent a0a093e0ce
commit f161d0b7b8
8 changed files with 249 additions and 159 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: todr.9,v 1.16 2010/03/22 18:58:33 joerg Exp $
.\" $NetBSD: todr.9,v 1.16.26.1 2014/11/12 18:50:55 snj Exp $
.\"
.\" Copyright (c) 2000, 2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
@ -46,7 +46,7 @@
.Ft int
.Fn todr_settime "todr_chip_handle_t" "struct timeval *"
.Ft void
.Fn clock_secs_to_ymdhms "int" "struct clock_ymdhms *"
.Fn clock_secs_to_ymdhms "time_t" "struct clock_ymdhms *"
.Ft time_t
.Fn clock_ymdhms_to_secs "struct clock_ymdhms *"
.Sh DESCRIPTION

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtc.c,v 1.8 2010/05/22 15:51:32 tsutsui Exp $ */
/* $NetBSD: rtc.c,v 1.8.34.1 2014/11/12 18:50:55 snj Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.8 2010/05/22 15:51:32 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtc.c,v 1.8.34.1 2014/11/12 18:50:55 snj Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
@ -208,8 +208,8 @@ rtc_gettime_ymdhms(todr_chip_handle_t h, struct clock_ymdhms *dt)
#ifdef RTC_DEBUG
aprint_debug_dev(sc->sc_dev,
"gettime: %04d-%02d-%02d %02d:%02d:%02d\n",
dt->dt_year, dt->dt_mon, dt->dt_day,
"gettime: %04lu-%02d-%02d %02d:%02d:%02d\n",
(unsigned long)dt->dt_year, dt->dt_mon, dt->dt_day,
dt->dt_hour, dt->dt_min, dt->dt_sec);
if (!sc->sc_valid)
@ -262,8 +262,8 @@ rtc_settime_ymdhms(todr_chip_handle_t h, struct clock_ymdhms *dt)
#ifdef RTC_DEBUG
aprint_debug_dev(sc->sc_dev,
"settime: %04d-%02d-%02d %02d:%02d:%02d\n",
dt->dt_year, dt->dt_mon, dt->dt_day,
"settime: %04lu-%02d-%02d %02d:%02d:%02d\n",
(unsigned long)dt->dt_year, dt->dt_mon, dt->dt_day,
dt->dt_hour, dt->dt_min, dt->dt_sec);
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock_subr.c,v 1.16 2011/02/08 20:20:26 rmind Exp $ */
/* $NetBSD: clock_subr.c,v 1.16.30.1 2014/11/12 18:50:55 snj Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -44,19 +44,43 @@
* Derived from arch/hp300/hp300/clock.c
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif /* HAVE_NBTOOL_CONFIG_H */
#ifdef _KERNEL
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: clock_subr.c,v 1.16 2011/02/08 20:20:26 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: clock_subr.c,v 1.16.30.1 2014/11/12 18:50:55 snj Exp $");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/errno.h>
#else /* ! _KERNEL */
#include <string.h>
#include <time.h>
#include <errno.h>
#endif /* ! _KERNEL */
#include <dev/clock_subr.h>
static inline int leapyear(int year);
static inline int leapyear(uint64_t year);
#define FEBRUARY 2
#define days_in_year(a) (leapyear(a) ? 366 : 365)
#define days_in_month(a) (month_days[(a) - 1])
/* for easier alignment:
* time from the epoch to 2000 (there were 7 leap years): */
#define DAYSTO2000 (365*30+7)
/* 4 year intervals include 1 leap year */
#define DAYS4YEARS (365*4+1)
/* 100 year intervals include 24 leap years */
#define DAYS100YEARS (365*100+24)
/* 400 year intervals include 97 leap years */
#define DAYS400YEARS (365*400+97)
static const int month_days[12] = {
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};
@ -70,10 +94,13 @@ static const int month_days[12] = {
* It is otherwise equivalent.
*/
static inline int
leapyear(int year)
leapyear(uint64_t year)
{
int rv = 0;
if (year < 1969)
return EINVAL;
if ((year & 3) == 0) {
rv = 1;
if ((year % 100) == 0) {
@ -88,8 +115,7 @@ leapyear(int year)
time_t
clock_ymdhms_to_secs(struct clock_ymdhms *dt)
{
uint64_t secs;
int i, year, days;
uint64_t secs, i, year, days;
year = dt->dt_year;
@ -100,11 +126,35 @@ clock_ymdhms_to_secs(struct clock_ymdhms *dt)
if (year < POSIX_BASE_YEAR)
return -1;
days = 0;
for (i = POSIX_BASE_YEAR; i < year; i++)
days += days_in_year(i);
if (leapyear(year) && dt->dt_mon > FEBRUARY)
days++;
if (year < 2000) {
/* simple way for early years */
for (i = POSIX_BASE_YEAR; i < year; i++)
days += days_in_year(i);
} else {
/* years are properly aligned */
days += DAYSTO2000;
year -= 2000;
i = year / 400;
days += i * DAYS400YEARS;
year -= i * 400;
i = year / 100;
days += i * DAYS100YEARS;
year -= i * 100;
i = year / 4;
days += i * DAYS4YEARS;
year -= i * 4;
for (i = dt->dt_year-year; i < dt->dt_year; i++)
days += days_in_year(i);
}
/* Months */
for (i = 1; i < dt->dt_mon; i++)
days += days_in_month(i);
@ -116,26 +166,21 @@ clock_ymdhms_to_secs(struct clock_ymdhms *dt)
* 60 + dt->dt_min)
* 60 + dt->dt_sec;
if ((time_t)secs != secs)
if ((time_t)secs < 0 || secs > __type_max(time_t))
return -1;
return secs;
}
void
int
clock_secs_to_ymdhms(time_t secs, struct clock_ymdhms *dt)
{
int mthdays[12];
int i;
int leap;
uint64_t i;
time_t days;
time_t rsec; /* remainder seconds */
/*
* This function uses a local copy of month_days[]
* so the copy can be modified (and thread-safe).
* See the definition of days_in_month() above.
*/
memcpy(mthdays, month_days, sizeof(mthdays));
#define month_days mthdays
if (secs < 0)
return EINVAL;
days = secs / SECDAY;
rsec = secs % SECDAY;
@ -143,16 +188,40 @@ clock_secs_to_ymdhms(time_t secs, struct clock_ymdhms *dt)
/* Day of week (Note: 1/1/1970 was a Thursday) */
dt->dt_wday = (days + 4) % 7;
/* Subtract out whole years, counting them in i. */
for (i = POSIX_BASE_YEAR; days >= days_in_year(i); i++)
days -= days_in_year(i);
dt->dt_year = i;
if (days >= DAYSTO2000) {
days -= DAYSTO2000;
dt->dt_year = 2000;
i = days / DAYS400YEARS;
days -= i*DAYS400YEARS;
dt->dt_year += i*400;
i = days / DAYS100YEARS;
days -= i*DAYS100YEARS;
dt->dt_year += i*100;
i = days / DAYS4YEARS;
days -= i*DAYS4YEARS;
dt->dt_year += i*4;
for (i = dt->dt_year; days >= days_in_year(i); i++)
days -= days_in_year(i);
dt->dt_year = i;
} else {
/* Subtract out whole years, counting them in i. */
for (i = POSIX_BASE_YEAR; days >= days_in_year(i); i++)
days -= days_in_year(i);
dt->dt_year = i;
}
/* Subtract out whole months, counting them in i. */
if (leapyear(i))
days_in_month(FEBRUARY) = 29;
for (i = 1; days >= days_in_month(i); i++)
days -= days_in_month(i);
for (leap = 0, i = 1; days >= days_in_month(i)+leap; i++) {
days -= days_in_month(i)+leap;
if (i == 1 && leapyear(dt->dt_year))
leap = 1;
else
leap = 0;
}
dt->dt_mon = i;
/* Days are what is left over (+1) from all that. */
@ -164,5 +233,6 @@ clock_secs_to_ymdhms(time_t secs, struct clock_ymdhms *dt)
dt->dt_min = rsec / 60;
rsec = rsec % 60;
dt->dt_sec = rsec;
#undef month_days
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock_subr.h,v 1.21 2009/12/12 15:10:34 tsutsui Exp $ */
/* $NetBSD: clock_subr.h,v 1.21.38.1 2014/11/12 18:50:55 snj Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@ -36,7 +36,7 @@
* "POSIX time" to/from "YY/MM/DD/hh/mm/ss"
*/
struct clock_ymdhms {
u_short dt_year;
uint64_t dt_year;
u_char dt_mon;
u_char dt_day;
u_char dt_wday; /* Day of week */
@ -46,7 +46,7 @@ struct clock_ymdhms {
};
time_t clock_ymdhms_to_secs(struct clock_ymdhms *);
void clock_secs_to_ymdhms(time_t, struct clock_ymdhms *);
int clock_secs_to_ymdhms(time_t, struct clock_ymdhms *);
/*
* BCD to binary and binary to BCD.

View File

@ -1,4 +1,4 @@
/* $NetBSD: msdosfs_conv.c,v 1.9 2013/01/26 16:51:51 christos Exp $ */
/* $NetBSD: msdosfs_conv.c,v 1.9.12.1 2014/11/12 18:50:55 snj Exp $ */
/*-
* Copyright (C) 1995, 1997 Wolfgang Solfrank.
@ -52,7 +52,7 @@
#endif
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.9 2013/01/26 16:51:51 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.9.12.1 2014/11/12 18:50:55 snj Exp $");
/*
* System include files.
@ -66,9 +66,11 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.9 2013/01/26 16:51:51 christos Ex
#include <sys/vnode.h>
#else
#include <stdio.h>
#include <string.h>
#include <dirent.h>
#include <sys/queue.h>
#endif
#include <dev/clock_subr.h>
/*
* MSDOSFS include files.
@ -77,29 +79,15 @@ __KERNEL_RCSID(0, "$NetBSD: msdosfs_conv.c,v 1.9 2013/01/26 16:51:51 christos Ex
#include <fs/msdosfs/denode.h>
/*
* Days in each month in a regular year.
* The number of seconds between Jan 1, 1970 and Jan 1, 1980. In that
* interval there were 8 regular years and 2 leap years.
*/
u_short const regyear[] = {
31, 28, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
#define DOSBIASYEAR 1980
#define SECONDSTO1980 (((8 * 365) + (2 * 366)) * (24 * 60 * 60))
/*
* Days in each month in a leap year.
* msdos fs can not store dates beyound the year 2234
*/
u_short const leapyear[] = {
31, 29, 31, 30, 31, 30,
31, 31, 30, 31, 30, 31
};
/*
* Variables used to remember parts of the last time conversion. Maybe we
* can avoid a full conversion.
*/
u_long lasttime;
u_long lastday;
u_short lastddate;
u_short lastdtime;
#define DOSMAXYEAR ((DD_YEAR_MASK >> DD_YEAR_SHIFT) + DOSBIASYEAR)
/*
* Convert the unix version of time to dos's idea of time to be used in
@ -109,73 +97,50 @@ void
unix2dostime(const struct timespec *tsp, int gmtoff, u_int16_t *ddp, u_int16_t *dtp, u_int8_t *dhp)
{
u_long t;
u_long days;
u_long inc;
u_long year;
u_long month;
const u_short *months;
struct clock_ymdhms ymd;
t = tsp->tv_sec + gmtoff; /* time zone correction */
/*
* If the time from the last conversion is the same as now, then
* skip the computations and use the saved result.
* DOS timestamps can not represent dates before 1980.
*/
t = tsp->tv_sec + gmtoff; /* time zone correction */
t &= ~1;
if (lasttime != t) {
lasttime = t;
lastdtime = (((t / 2) % 30) << DT_2SECONDS_SHIFT)
+ (((t / 60) % 60) << DT_MINUTES_SHIFT)
+ (((t / 3600) % 24) << DT_HOURS_SHIFT);
if (t < SECONDSTO1980)
goto invalid_dos_date;
/*
* If the number of days since 1970 is the same as the last
* time we did the computation then skip all this leap year
* and month stuff.
*/
days = t / (24 * 60 * 60);
if (days != lastday) {
lastday = days;
for (year = 1970;; year++) {
inc = year & 0x03 ? 365 : 366;
if (days < inc)
break;
days -= inc;
}
months = year & 0x03 ? regyear : leapyear;
for (month = 0; month < 12; month++) {
if (days < months[month])
break;
days -= months[month];
}
lastddate = ((days + 1) << DD_DAY_SHIFT)
+ ((month + 1) << DD_MONTH_SHIFT);
/*
* Remember dos's idea of time is relative to 1980.
* unix's is relative to 1970. If somehow we get a
* time before 1980 then don't give totally crazy
* results.
*/
if (year > 1980)
lastddate += (year - 1980) << DD_YEAR_SHIFT;
}
}
if (dtp)
*dtp = lastdtime;
/*
* DOS granularity is 2 seconds
*/
t &= ~1;
/*
* Convert to year/month/day/.. format
*/
clock_secs_to_ymdhms(t, &ymd);
if (ymd.dt_year > DOSMAXYEAR)
goto invalid_dos_date;
/*
* Now transform to DOS format
*/
*ddp = (ymd.dt_day << DD_DAY_SHIFT)
+ (ymd.dt_mon << DD_MONTH_SHIFT)
+ ((ymd.dt_year - DOSBIASYEAR) << DD_YEAR_SHIFT);
if (dhp)
*dhp = (tsp->tv_sec & 1) * 100 + tsp->tv_nsec / 10000000;
if (dtp)
*dtp = (((t / 2) % 30) << DT_2SECONDS_SHIFT)
+ (((t / 60) % 60) << DT_MINUTES_SHIFT)
+ (((t / 3600) % 24) << DT_HOURS_SHIFT);
return;
*ddp = lastddate;
invalid_dos_date:
*ddp = 0;
if (dtp)
*dtp = 0;
if (dhp)
*dhp = 0;
}
/*
* The number of seconds between Jan 1, 1970 and Jan 1, 1980. In that
* interval there were 8 regular years and 2 leap years.
*/
#define SECONDSTO1980 (((8 * 365) + (2 * 366)) * (24 * 60 * 60))
u_short lastdosdate;
u_long lastseconds;
/*
* Convert from dos' idea of time to unix'. This will probably only be
* called from the stat(), and fstat() system calls and so probably need
@ -184,11 +149,8 @@ u_long lastseconds;
void
dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, struct timespec *tsp)
{
u_long seconds;
u_long m, month;
u_long y, year;
u_long days;
const u_short *months;
time_t seconds;
struct clock_ymdhms ymd;
if (dd == 0) {
/*
@ -198,37 +160,18 @@ dos2unixtime(u_int dd, u_int dt, u_int dh, int gmtoff, struct timespec *tsp)
tsp->tv_nsec = 0;
return;
}
seconds = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) * 2
+ ((dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT) * 60
+ ((dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT) * 3600
+ dh / 100;
/*
* If the year, month, and day from the last conversion are the
* same then use the saved value.
*/
if (lastdosdate != dd) {
lastdosdate = dd;
days = 0;
year = (dd & DD_YEAR_MASK) >> DD_YEAR_SHIFT;
for (y = 0; y < year; y++)
days += y & 0x03 ? 365 : 366;
months = year & 0x03 ? regyear : leapyear;
/*
* Prevent going from 0 to 0xffffffff in the following
* loop.
*/
month = (dd & DD_MONTH_MASK) >> DD_MONTH_SHIFT;
if (month == 0) {
printf("%s: month value out of range (%ld)\n",
__func__, month);
month = 1;
}
for (m = 0; m < month - 1; m++)
days += months[m];
days += ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT) - 1;
lastseconds = (days * 24 * 60 * 60) + SECONDSTO1980;
}
tsp->tv_sec = seconds + lastseconds;
memset(&ymd, 0, sizeof(ymd));
ymd.dt_year = ((dd & DD_YEAR_MASK) >> DD_YEAR_SHIFT) + 1980 ;
ymd.dt_mon = ((dd & DD_MONTH_MASK) >> DD_MONTH_SHIFT);
ymd.dt_day = ((dd & DD_DAY_MASK) >> DD_DAY_SHIFT);
ymd.dt_hour = (dt & DT_HOURS_MASK) >> DT_HOURS_SHIFT;
ymd.dt_min = (dt & DT_MINUTES_MASK) >> DT_MINUTES_SHIFT;
ymd.dt_sec = ((dt & DT_2SECONDS_MASK) >> DT_2SECONDS_SHIFT) * 2;
seconds = clock_ymdhms_to_secs(&ymd);
tsp->tv_sec = seconds;
tsp->tv_sec -= gmtoff; /* time zone correction */
tsp->tv_nsec = (dh % 100) * 10000000;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: compat_defs.h,v 1.97 2014/06/06 01:40:40 christos Exp $ */
/* $NetBSD: compat_defs.h,v 1.97.2.1 2014/11/12 18:50:55 snj Exp $ */
#ifndef __NETBSD_COMPAT_DEFS_H__
#define __NETBSD_COMPAT_DEFS_H__
@ -101,7 +101,7 @@ struct group;
#define __END_DECLS
#endif
/* Some things usually in BSD <sys/cdefs.h>. */
/* Some things in NetBSD <sys/cdefs.h>. */
#ifndef __CONCAT
#define __CONCAT(x,y) x ## y
@ -137,6 +137,20 @@ struct group;
#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
#undef __USE
#define __USE(a) ((void)(a))
#undef __type_min_s
#define __type_min_s(t) ((t)((1ULL << (sizeof(t) * NBBY - 1))))
#undef __type_max_s
#define __type_max_s(t) ((t)~((1ULL << (sizeof(t) * NBBY - 1))))
#undef __type_min_u
#define __type_min_u(t) ((t)0ULL)
#undef __type_max_u
#define __type_max_u(t) ((t)~0ULL)
#undef __type_is_signed
#define __type_is_signed(t) (/*LINTED*/__type_min_s(t) + (t)1 < (t)1)
#undef __type_min
#define __type_min(t) (__type_is_signed(t) ? __type_min_s(t) : __type_min_u(t))
#undef __type_max
#define __type_max(t) (__type_is_signed(t) ? __type_max_s(t) : __type_max_u(t))
/* Dirent support. */

View File

@ -0,0 +1,62 @@
/* $NetBSD: clock_subr.h,v 1.2.2.2 2014/11/12 18:50:55 snj Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
* by Gordon W. Ross
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _DEV_CLOCK_SUBR_H_
#define _DEV_CLOCK_SUBR_H_
/*
* This is a slightly stripped down version of src/sys/dev/clock_subr.h
*/
/*
* "POSIX time" to/from "YY/MM/DD/hh/mm/ss"
*/
struct clock_ymdhms {
uint64_t dt_year;
u_char dt_mon;
u_char dt_day;
u_char dt_wday; /* Day of week */
u_char dt_hour;
u_char dt_min;
u_char dt_sec;
};
time_t clock_ymdhms_to_secs(struct clock_ymdhms *);
int clock_secs_to_ymdhms(time_t, struct clock_ymdhms *);
/* Some handy constants. */
#define SECDAY (24 * 60 * 60)
#define SECYR (SECDAY * 365)
/* Traditional POSIX base year */
#define POSIX_BASE_YEAR 1970
#endif /* _DEV_CLOCK_SUBR_H_ */

View File

@ -1,10 +1,10 @@
# $NetBSD: Makefile.inc,v 1.5 2013/01/26 16:50:46 christos Exp $
# $NetBSD: Makefile.inc,v 1.5.12.1 2014/11/12 18:50:55 snj Exp $
#
MSDOS= ${NETBSDSRCDIR}/sys/fs/msdosfs
MSDOS_NEWFS= ${NETBSDSRCDIR}/sbin/newfs_msdos
.PATH: ${.CURDIR}/msdos ${MSDOS} ${MSDOS_NEWFS}
.PATH: ${.CURDIR}/msdos ${MSDOS} ${MSDOS_NEWFS} ${NETBSDSRCDIR}/sys/dev
CPPFLAGS+= -DMSDOS_EI -I${MSDOS} -I${MSDOS_NEWFS}
.if !defined(HOSTPROGNAME)
@ -13,3 +13,4 @@ CPPFLAGS+= -I${NETBSDSRCDIR}/sys
SRCS+= mkfs_msdos.c msdosfs_fat.c msdosfs_conv.c msdosfs_vfsops.c
SRCS+= msdosfs_lookup.c msdosfs_denode.c msdosfs_vnops.c
SRCS+= clock_subr.c