OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [sash/] [shutdown.c] - Rev 1767

Go to most recent revision | Compare with Previous | Blame | View Log

/* shutdown.c:
 *
 * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 */
 
#include "sash.h"
 
#include <linux/autoconf.h>
 
 
#include <string.h>
#include <fcntl.h>
#include <sys/types.h>
 
#include <sys/stat.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <time.h>
#include <signal.h>
 
void
main(argc, argv)
	int argc;
	char	**argv;
{
	if ((argc != 3) || (strcmp(argv[1], "-h") && strcmp(argv[1], "-r")) || strcmp(argv[2], "now")) {
		printf("Usage: %s -h|-r now\n", argv[0]);
		exit(0);
	}
 
	kill(1, SIGTSTP);
	sync();
	signal(SIGTERM,SIG_IGN);
	setpgrp();
	kill(-1, SIGTERM);
	sleep(1);
	kill(-1, SIGHUP); /* Force PPPD's down, too */
	sleep(1);
	kill(-1, SIGKILL);
	sync();
	sleep(1);
 
	if (strcmp(argv[1], "-h")==0)
		reboot(0xfee1dead, 672274793, 0xCDEF0123);
	else
		reboot(0xfee1dead, 672274793, 0x01234567);
 
	exit(0); /* Shrug */
}
 
 

Go to most recent revision | Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.