mirror of
https://github.com/troglobit/finit.git
synced 2026-11-03 13:28:27 +00:00
Coding style and whitespace fixes
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
25cc9f3b9b
commit
6448d6ccfa
3 files changed
+28
-28
No files matched your search
@@ -35,34 +35,34 @@
|
|||||||
|
|
||||||
/* Distribution specific configuration */
|
/* Distribution specific configuration */
|
||||||
#if defined EMBEDDED_SYSTEM
|
#if defined EMBEDDED_SYSTEM
|
||||||
# define CONSOLE "/dev/console"
|
# define CONSOLE "/dev/console"
|
||||||
# define SETUP_DEVFS "/sbin/mdev -s"
|
# define SETUP_DEVFS "/sbin/mdev -s"
|
||||||
# define GETTY "/sbin/getty -L 115200 %s vt100"
|
# define GETTY "/sbin/getty -L 115200 %s vt100"
|
||||||
# define RUNLEVEL 2
|
# define RUNLEVEL 2
|
||||||
#else /* Debian/Ubuntu based distributions */
|
#else /* Debian/Ubuntu based distributions */
|
||||||
# define CONSOLE "/dev/tty1"
|
# define CONSOLE "/dev/tty1"
|
||||||
# define SETUP_DEVFS "/sbin/udevd --daemon"
|
# define SETUP_DEVFS "/sbin/udevd --daemon"
|
||||||
# define GETTY "/sbin/getty -8 38400 %s"
|
# define GETTY "/sbin/getty -8 38400 %s"
|
||||||
# define RUNLEVEL 2
|
# define RUNLEVEL 2
|
||||||
# define RANDOMSEED "/var/lib/urandom/random-seed"
|
# define RANDOMSEED "/var/lib/urandom/random-seed"
|
||||||
# define REMOUNT_ROOTFS_RW
|
# define REMOUNT_ROOTFS_RW
|
||||||
# define HAVE_DBUS
|
# define HAVE_DBUS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef DEFUSER
|
#ifndef DEFUSER
|
||||||
# define DEFUSER "root"
|
# define DEFUSER "root"
|
||||||
#endif
|
#endif
|
||||||
#ifndef DEFHOST
|
#ifndef DEFHOST
|
||||||
# define DEFHOST "noname"
|
# define DEFHOST "noname"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CMD_SIZE 256
|
#define CMD_SIZE 256
|
||||||
#define LINE_SIZE 1024
|
#define LINE_SIZE 1024
|
||||||
#define BUF_SIZE 4096
|
#define BUF_SIZE 4096
|
||||||
|
|
||||||
#define INIT_MAGIC 0x03091969
|
#define INIT_MAGIC 0x03091969
|
||||||
#define INIT_CMD_RUNLVL 1
|
#define INIT_CMD_RUNLVL 1
|
||||||
#define INIT_CMD_DEBUG 2
|
#define INIT_CMD_DEBUG 2
|
||||||
|
|
||||||
struct init_request {
|
struct init_request {
|
||||||
int magic; /* Magic number */
|
int magic; /* Magic number */
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ char *pid_get_name(pid_t pid, char *name, size_t len)
|
|||||||
* Returns:
|
* Returns:
|
||||||
* Number of signals sent, i.e. number of processes who have received the signal.
|
* Number of signals sent, i.e. number of processes who have received the signal.
|
||||||
*/
|
*/
|
||||||
int procname_kill (char *name, int signo)
|
int procname_kill(char *name, int signo)
|
||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
char path[32], line[64];
|
char path[32], line[64];
|
||||||
@@ -276,17 +276,17 @@ int procname_kill (char *name, int signo)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((entry = readdir (dir)) != NULL) {
|
while ((entry = readdir(dir)) != NULL) {
|
||||||
/* Skip non-process entries in /proc */
|
/* Skip non-process entries in /proc */
|
||||||
if (!isdigit (*entry->d_name))
|
if (!isdigit(*entry->d_name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
snprintf (path, sizeof(path), "/proc/%s/status", entry->d_name);
|
snprintf(path, sizeof(path), "/proc/%s/status", entry->d_name);
|
||||||
/* Skip non-readable files (protected?) */
|
/* Skip non-readable files (protected?) */
|
||||||
if ((fp = fopen (path, "r")) == NULL)
|
if ((fp = fopen(path, "r")) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (fgets (line, sizeof (line), fp)) {
|
if (fgets(line, sizeof (line), fp)) {
|
||||||
char *pname = line + 6; /* Skip first part of line --> "Name:\t" */
|
char *pname = line + 6; /* Skip first part of line --> "Name:\t" */
|
||||||
|
|
||||||
if (strncmp(pname, name, strlen(pname) - 1) == 0) {
|
if (strncmp(pname, name, strlen(pname) - 1) == 0) {
|
||||||
|
|||||||
@@ -69,10 +69,10 @@
|
|||||||
/* Esc[?25h (lower case H) Show Cursor */
|
/* Esc[?25h (lower case H) Show Cursor */
|
||||||
#define showcursor() fputs("\e[?25h", stderr)
|
#define showcursor() fputs("\e[?25h", stderr)
|
||||||
|
|
||||||
#define echo(fmt, args...) do { fprintf(stderr, fmt "\n", ##args); } while (0)
|
#define echo(fmt, args...) do { fprintf(stderr, fmt "\n", ##args); } while (0)
|
||||||
#define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } } while (0)
|
#define _d(fmt, args...) do { if (debug) { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } } while (0)
|
||||||
#define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0)
|
#define _e(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt "\n", __FILE__, __func__, ##args); } while (0)
|
||||||
#define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0)
|
#define _pe(fmt, args...) do { fprintf(stderr, "finit:%s:%s() - " fmt ". Error %d: %s\n", __FILE__, __func__, ##args, errno, strerror(errno)); } while (0)
|
||||||
|
|
||||||
extern int debug;
|
extern int debug;
|
||||||
extern int verbose;
|
extern int verbose;
|
||||||
@@ -89,7 +89,7 @@ char *pid_get_name (pid_t pid, char *name, size_t len);
|
|||||||
void procname_set (char *name, char *args[]);
|
void procname_set (char *name, char *args[]);
|
||||||
int procname_kill (char *name, int signo);
|
int procname_kill (char *name, int signo);
|
||||||
|
|
||||||
void print_desc (char *action, char *desc);
|
void print_desc (char *action, char *desc);
|
||||||
int print_result (int fail);
|
int print_result (int fail);
|
||||||
int start_process (char *cmd, char *args[], int console);
|
int start_process (char *cmd, char *args[], int console);
|
||||||
void chomp (char *str);
|
void chomp (char *str);
|
||||||
|
|||||||
Reference in new issue
Block a user