diff options
author | nork <nork@FreeBSD.org> | 2003-03-23 20:36:58 +0800 |
---|---|---|
committer | nork <nork@FreeBSD.org> | 2003-03-23 20:36:58 +0800 |
commit | 0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016 (patch) | |
tree | 257cfa8c3e632c05c8e9b6b4ee1d41e6adced222 /emulators/rtc | |
parent | 041f9fdf82a8c6586111555eca817393a7129def (diff) | |
download | freebsd-ports-gnome-0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016.tar.gz freebsd-ports-gnome-0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016.tar.zst freebsd-ports-gnome-0f2cce2cf75f37ac561ddd0fa6ba59a3fa512016.zip |
Support post-500104-current.
Submitted by: Marcin Cielak <saper@sgh.waw.pl>
Tested by: freebsd-emulation
Diffstat (limited to 'emulators/rtc')
-rw-r--r-- | emulators/rtc/Makefile | 2 | ||||
-rw-r--r-- | emulators/rtc/files/rtc.c | 24 | ||||
-rw-r--r-- | emulators/rtc/files/rtc.sh | 4 |
3 files changed, 22 insertions, 8 deletions
diff --git a/emulators/rtc/Makefile b/emulators/rtc/Makefile index 52b3868fcf2d..1c126189a703 100644 --- a/emulators/rtc/Makefile +++ b/emulators/rtc/Makefile @@ -6,7 +6,7 @@ # PORTNAME= rtc -PORTVERSION= 2001.09.16.1 +PORTVERSION= 2002.03.05.2 CATEGORIES= emulators linux MASTER_SITES= # none DISTFILES= # none 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 |