diff options
author | Norikatsu Shigemura <nork@FreeBSD.org> | 2003-03-23 12:36:58 +0000 |
---|---|---|
committer | Norikatsu Shigemura <nork@FreeBSD.org> | 2003-03-23 12:36:58 +0000 |
commit | 288b6d293b1d39c41392e9e4706aef95e4878a6a (patch) | |
tree | c4b7156dea9d2e12e267165fc503e5683e61bbd3 /emulators/rtc/files | |
parent | 62d883072d13150c66a3b1e2e9b52039f0fc63fd (diff) | |
download | ports-288b6d293b1d39c41392e9e4706aef95e4878a6a.tar.gz ports-288b6d293b1d39c41392e9e4706aef95e4878a6a.zip |
Support post-500104-current.
Submitted by: Marcin Cielak <saper@sgh.waw.pl>
Tested by: freebsd-emulation
Notes
Notes:
svn path=/head/; revision=77249
Diffstat (limited to 'emulators/rtc/files')
-rw-r--r-- | emulators/rtc/files/rtc.c | 24 | ||||
-rw-r--r-- | emulators/rtc/files/rtc.sh | 4 |
2 files changed, 21 insertions, 7 deletions
diff --git a/emulators/rtc/files/rtc.c b/emulators/rtc/files/rtc.c index cedf51af2a4e..c9063adc8862 100644 --- a/emulators/rtc/files/rtc.c +++ b/emulators/rtc/files/rtc.c @@ -85,6 +85,14 @@ static d_poll_t rtc_poll; static int rtc_modeevent(module_t mod, int cmd, void *arg); static struct cdevsw rtc_cdevsw = { +#if __FreeBSD_version >= 500104 + .d_open = rtc_open, + .d_close = rtc_close, + .d_ioctl = rtc_ioctl, + .d_poll = rtc_poll, + .d_name = DEVICE_NAME, + .d_maj = CDEV_MAJOR, +#else /* open */ rtc_open, /* close */ rtc_close, /* read */ noread, @@ -104,6 +112,7 @@ static struct cdevsw rtc_cdevsw = { #if __FreeBSD_version >= 500018 || __FreeBSD_version >= 430000 /* kqfilter */ nokqfilter, #endif +#endif }; /* @@ -135,10 +144,6 @@ rtc_attach(dev_t dev) if (rtc_sc!=NULL) return NULL; - dev = make_dev(&rtc_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME); - if (dev==NULL) - return (NULL); - MALLOC(sc, struct rtc_softc*, sizeof(*sc), M_DEVBUF, M_WAITOK); if (sc==NULL) return NULL; @@ -264,11 +269,18 @@ rtc_poll(dev_t dev, int events, struct proc *p) static int init_module(void) { -int error; + int error = 0; + dev_t dev; +#if __FreeBSD_version < 500104 error = cdevsw_add(&rtc_cdevsw); if (error) return error; +#endif + + dev = make_dev(&rtc_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, DEVICE_NAME); + if (dev==NULL) + error = ENOMEM; return error; } @@ -286,7 +298,9 @@ cleanup_module(void) DLog(Lfail, "%p busy", sc); return error; } +#if __FreeBSD_version < 500104 error = cdevsw_remove(&rtc_cdevsw); +#endif DLog(Linfo, "return %d", error); return error; } diff --git a/emulators/rtc/files/rtc.sh b/emulators/rtc/files/rtc.sh index 8751f46c710d..ac92bc1b1974 100644 --- a/emulators/rtc/files/rtc.sh +++ b/emulators/rtc/files/rtc.sh @@ -7,11 +7,11 @@ case "$1" in start) if [ -x $kmoddir/$kmod ]; then echo -n ' rtc' - kldload $kmoddir/$kmod + /sbin/kldload $kmoddir/$kmod fi ;; stop) - kldunload $kmod && echo -n ' rtc' + /sbin/kldunload $kmod && echo -n ' rtc' ;; *) echo "Usage: `basename $0` {start|stop}" >&2 |