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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [userland/] [sash/] [shutdown.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/* shutdown.c:
2
 *
3
 * Copyright (C) 1998  Kenneth Albanowski <kjahds@kjahds.com>,
4
 *
5
 * This program is free software; you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation; either version 2 of the License, or
8
 * (at your option) any later version.
9
 */
10
 
11
#include "sash.h"
12
 
13
#include <linux/autoconf.h>
14
 
15
 
16
#include <string.h>
17
#include <fcntl.h>
18
#include <sys/types.h>
19
 
20
#include <sys/stat.h>
21
#include <dirent.h>
22
#include <pwd.h>
23
#include <grp.h>
24
#include <time.h>
25
#include <signal.h>
26
 
27
void
28
main(argc, argv)
29
        int argc;
30
        char    **argv;
31
{
32
        if ((argc != 3) || (strcmp(argv[1], "-h") && strcmp(argv[1], "-r")) || strcmp(argv[2], "now")) {
33
                printf("Usage: %s -h|-r now\n", argv[0]);
34
                exit(0);
35
        }
36
 
37
        kill(1, SIGTSTP);
38
        sync();
39
        signal(SIGTERM,SIG_IGN);
40
        setpgrp();
41
        kill(-1, SIGTERM);
42
        sleep(1);
43
        kill(-1, SIGHUP); /* Force PPPD's down, too */
44
        sleep(1);
45
        kill(-1, SIGKILL);
46
        sync();
47
        sleep(1);
48
 
49
        if (strcmp(argv[1], "-h")==0)
50
                reboot(0xfee1dead, 672274793, 0xCDEF0123);
51
        else
52
                reboot(0xfee1dead, 672274793, 0x01234567);
53
 
54
        exit(0); /* Shrug */
55
}
56
 

powered by: WebSVN 2.1.0

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