]>
Commit | Line | Data |
---|---|---|
cca2da15 | 1 | /* SPDX-License-Identifier: LGPL-2.0-or-later */ |
0b7964b8 LP |
2 | /* |
3 | * initreq.h Interface to talk to init through /dev/initctl. | |
4 | * | |
5 | * Copyright (C) 1995-2004 Miquel van Smoorenburg | |
6 | * | |
7 | * This library is free software; you can redistribute it and/or | |
8 | * modify it under the terms of the GNU Lesser General Public | |
9 | * License as published by the Free Software Foundation; either | |
10 | * version 2 of the License, or (at your option) any later version. | |
11 | * | |
12 | * Version: @(#)initreq.h 1.28 31-Mar-2004 MvS | |
0b7964b8 | 13 | */ |
f330408d | 14 | |
7a3c343c | 15 | #pragma once |
0b7964b8 LP |
16 | |
17 | #include <sys/param.h> | |
18 | ||
19 | #if defined(__FreeBSD_kernel__) | |
20 | # define INIT_FIFO "/etc/.initctl" | |
21 | #else | |
22 | # define INIT_FIFO "/dev/initctl" | |
23 | #endif | |
24 | ||
25 | #define INIT_MAGIC 0x03091969 | |
26 | #define INIT_CMD_START 0 | |
27 | #define INIT_CMD_RUNLVL 1 | |
28 | #define INIT_CMD_POWERFAIL 2 | |
29 | #define INIT_CMD_POWERFAILNOW 3 | |
30 | #define INIT_CMD_POWEROK 4 | |
31 | #define INIT_CMD_BSD 5 | |
32 | #define INIT_CMD_SETENV 6 | |
33 | #define INIT_CMD_UNSETENV 7 | |
34 | ||
35 | #define INIT_CMD_CHANGECONS 12345 | |
36 | ||
37 | #ifdef MAXHOSTNAMELEN | |
38 | # define INITRQ_HLEN MAXHOSTNAMELEN | |
39 | #else | |
40 | # define INITRQ_HLEN 64 | |
41 | #endif | |
42 | ||
43 | /* | |
44 | * This is what BSD 4.4 uses when talking to init. | |
45 | * Linux doesn't use this right now. | |
46 | */ | |
47 | struct init_request_bsd { | |
baabc577 LP |
48 | char gen_id[8]; /* Beats me.. telnetd uses "fe" */ |
49 | char tty_id[16]; /* Tty name minus /dev/tty */ | |
50 | char host[INITRQ_HLEN]; /* Hostname */ | |
51 | char term_type[16]; /* Terminal type */ | |
52 | int signal; /* Signal to send */ | |
53 | int pid; /* Process to send to */ | |
54 | char exec_name[128]; /* Program to execute */ | |
55 | char reserved[128]; /* For future expansion. */ | |
0b7964b8 LP |
56 | }; |
57 | ||
0b7964b8 LP |
58 | /* |
59 | * Because of legacy interfaces, "runlevel" and "sleeptime" | |
96d4ce01 | 60 | * aren't in a separate struct in the union. |
0b7964b8 LP |
61 | * |
62 | * The weird sizes are because init expects the whole | |
63 | * struct to be 384 bytes. | |
64 | */ | |
65 | struct init_request { | |
baabc577 LP |
66 | int magic; /* Magic number */ |
67 | int cmd; /* What kind of request */ | |
68 | int runlevel; /* Runlevel to change to */ | |
69 | int sleeptime; /* Time between TERM and KILL */ | |
70 | union { | |
71 | struct init_request_bsd bsd; | |
72 | char data[368]; | |
73 | } i; | |
0b7964b8 | 74 | }; |