Beispiel #1
0
static void
WriteISACfifo_IPAC(struct IsdnCardState *cs, u_char *data, int size)
{
	writefifo(cs->hw.diva.isac_adr, cs->hw.diva.isac, 0x80, data, size);
}
Beispiel #2
0
static void
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
	writefifo(cs->hw.ix1.isac_ale, cs->hw.ix1.isac, 0, data, size);
}
Beispiel #3
0
static void
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
	writefifo(cs->hw.ax.base, cs->hw.ax.data_adr, 0x80, data, size);
}
Beispiel #4
0
static void
WriteISACfifo(struct IsdnCardState *cs, u_char * data, int size)
{
    cs->hw.hfc.cip = 0;
    writefifo(cs->hw.hfc.addr | 1, cs->hw.hfc.addr, 0, data, size);
}
Beispiel #5
0
int main(int argc, char *argv[])
{
	const char *action = NULL;
	struct sigaction sa;

	ARGBEGIN {
	case 'l':
	case 'r':
	case 's':
		if (writefifo(fifofile, ARGC()) == -1)
			die("cannot write to fifo\n");
		exit(EXIT_SUCCESS);
	default:
		usage();
	} ARGEND;
	
	if (argc > 1)
		usage();

	if (getuid() != 0)
		die("only root can run this program\n");
	if (getlock(pidfile) == -1)
		die("cannot get exclusive lock\n");
	if (createfifo(fifofile, 0666) == -1)
		die("cannot create fifo\n");

	sa.sa_flags = SA_NOCLDSTOP;
	sa.sa_handler = catchsignal;
	sigemptyset(&sa.sa_mask);
	sigaction(SIGCHLD, &sa, NULL);

	signal(SIGINT, catchsignal);
	signal(SIGHUP, catchsignal);
	signal(SIGQUIT, catchsignal);
	signal(SIGTERM, catchsignal);
	signal(SIGKILL, catchsignal);
	signal(SIGPIPE, catchsignal);

	startserver(server, display);
	do {
		const char *user, *pass;
		char c;

		if (autologin && authenticate(autologin, NULL)) {
			autologin = NULL;
			goto login;
		}

		creategui();
		do {
			rungui(&user, &pass);
			if (!strcmp(user, "reboot"))
				action = rebootcmd;
			else if (!strcmp(user, "shutdown"))
				action = shutdowncmd;
		} while (!action && !authenticate(user, pass));
		destroygui();

		if (action)
			break;

login:		childpid = startsession(child, env);

		c = readfifo(fifofile);
		if (c == 'r')
			action = rebootcmd;
		else if (c == 's')
			action = shutdowncmd;
		else if (!c)
			while (childpid)
				sleep(10);

		stopsession();
	} while (!action);
	signal(SIGINT, SIG_IGN);
	signal(SIGHUP, SIG_IGN);
	signal(SIGQUIT, SIG_IGN);
	signal(SIGTERM, SIG_DFL);
	signal(SIGKILL, SIG_DFL);
	signal(SIGCHLD, SIG_DFL);
	signal(SIGPIPE, SIG_IGN);
	stopserver();

	removefifo(fifofile);
	removelock(pidfile);

	return system(action);
}
Beispiel #6
0
static void
isac_write_fifo(struct IsdnCardState *cs, u8 * data, int size)
{
	writefifo(cs, cs->hw.saphir.isac, 0, data, size);
}
Beispiel #7
0
static void
hscx_write_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size)
{
	writefifo(cs, cs->hw.saphir.hscx, hscx ? 0x40 : 0, data, size);
}
Beispiel #8
0
static inline void
ipac_writefifo(struct IsdnCardState *cs, u8 offset, u8 *data, int size)
{
	writefifo(cs, cs->hw.elsa.isac, offset, data, size);
}
Beispiel #9
0
static void
hscx_read_fifo(struct IsdnCardState *cs, int hscx, u8 *data, int size)
{
	writefifo(cs, cs->hw.elsa.hscx, hscx ? 0x40 : 0, data, size);
}