Herunterladen Inhalt Inhalt Diese Seite drucken

Sun Microsystems Netra T2000 Systemverwaltungshandbuch Seite 120

Vorschau ausblenden Andere Handbücher für Netra T2000:
Inhaltsverzeichnis

Werbung

Die zur Verwendung mit den IOCTLs LOMIOCALCTL und LOMIOCALSTATE
vorgesehene Datenstruktur ist wie folgt definiert:
CODE BEISPIEL A-4
#include
#include
#define LOM_DEVICE "/dev/lom"
#define ALARM_OFF 0
#define ALARM_ON 1
int main() {
}
102
Netra T2000-Server - Systemverwaltungshandbuch • September 2006
Datenstruktur für IOCTLs
<fcntl.h>
<lom_io.h>
int fd, ret;
lom_aldata_t ald;
ald.alarm_no = ALARM_NUM_3;
ald.state = ALARM_OFF;
fd = open(LOM_DEVICE, O_RDWR);
if (fd == -1) {
printf("Error opening device: %s\n", LOM_DEVICE);
return (1);
}
/* Set Alarm3 to on state */
ald.state = ALARM_ON;
ioctl(fd, LOMIOCALCTL, (void *)&ald);
/* Get Alarm3 state */
ioctl(fd, LOMIOCALSTATE, (char *)&ald);
printf("alarm %d state :%d:\n", ald.alarm_no, ald.state);
/* Set Alarm3 to off state */
ald.state = ALARM_OFF;
ioctl(fd, LOMIOCALCTL, (char *)&ald);
/* Get Alarm3 state */
ioctl(fd, LOMIOCALSTATE, (char *)&ald);
printf("alarm %d state :%d:\n", ald.alarm_no, ald.state);
close (fd);
return (0);
und
LOMIOCALCTL
LOMIOCALSTATE

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis