diff options
author | nork <nork@FreeBSD.org> | 2003-03-23 12:36:58 +0000 |
---|---|---|
committer | nork <nork@FreeBSD.org> | 2003-03-23 12:36:58 +0000 |
commit | 0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016 (patch) | |
tree | 257cfa8c3e632c05c8e9b6b4ee1d41e6adced222 /emulators/rtc/files | |
parent | 041f9fdf82a8c6586111555eca817393a7129def (diff) | |
download | FreeBSD-ports-0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016.zip FreeBSD-ports-0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016.tar.gz |
Support post-500104-current.
Submitted by: Marcin Cielak <saper@sgh.waw.pl>
Tested by: freebsd-emulation
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 cedf51a..c9063ad 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 8751f46..ac92bc1 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 |