Apply by doing cd /sys patch -p0 < apm.patch *** arch/i386/i386/apm.c.orig Wed Dec 10 20:11:23 1997 --- arch/i386/i386/apm.c Wed Dec 10 20:12:14 1997 *************** *** 746,757 **** int flag, mode; struct proc *p; { ! struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)]; /* apm0 only */ ! if (APMUNIT(dev) != 0 || sc == NULL) return ENXIO; switch (APMDEV(dev)) { case APMDEV_CTL: if (!(flag & FWRITE)) --- 746,759 ---- int flag, mode; struct proc *p; { ! struct apm_softc *sc; /* apm0 only */ ! if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) return ENXIO; + sc = apm_cd.cd_devs[APMUNIT(dev)]; + switch (APMDEV(dev)) { case APMDEV_CTL: if (!(flag & FWRITE)) *************** *** 778,789 **** int flag, mode; struct proc *p; { ! struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)]; /* apm0 only */ ! if (APMUNIT(dev) != 0 || sc == NULL) return ENXIO; DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode)); switch (APMDEV(dev)) { --- 780,793 ---- int flag, mode; struct proc *p; { ! struct apm_softc *sc; /* apm0 only */ ! if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) return ENXIO; + sc = apm_cd.cd_devs[APMUNIT(dev)]; + DPRINTF(("apmclose: pid %d flag %x mode %x\n", p->p_pid, flag, mode)); switch (APMDEV(dev)) { *************** *** 809,815 **** int flag; struct proc *p; { ! struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)]; struct apm_power_info *powerp; struct apm_event_info *evp; struct apmregs regs; --- 813,819 ---- int flag; struct proc *p; { ! struct apm_softc *sc; struct apm_power_info *powerp; struct apm_event_info *evp; struct apmregs regs; *************** *** 817,825 **** struct apm_ctl *actl; /* apm0 only */ ! if (APMUNIT(dev) != 0 || sc == NULL) return ENXIO; switch (cmd) { /* some ioctl names from linux */ case APM_IOC_STANDBY: --- 821,831 ---- struct apm_ctl *actl; /* apm0 only */ ! if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) return ENXIO; + sc = apm_cd.cd_devs[APMUNIT(dev)]; + switch (cmd) { /* some ioctl names from linux */ case APM_IOC_STANDBY: *************** *** 901,912 **** int rw; struct proc *p; { ! struct apm_softc *sc = apm_cd.cd_devs[APMUNIT(dev)]; /* apm0 only */ ! if (APMUNIT(dev) != 0 || sc == NULL) return ENXIO; switch (rw) { case FREAD: if (sc->event_count) --- 907,920 ---- int rw; struct proc *p; { ! struct apm_softc *sc; /* apm0 only */ ! if (!apm_cd.cd_ndevs || APMUNIT(dev) != 0 || sc == NULL) return ENXIO; + sc = apm_cd.cd_devs[APMUNIT(dev)]; + switch (rw) { case FREAD: if (sc->event_count)