Make ubase compile with musl-gcc

This commit is contained in:
sin 2013-08-19 16:27:21 +01:00
parent 5c73758bba
commit bb10563c7a
5 changed files with 40 additions and 5 deletions

View File

@ -3,7 +3,7 @@ include config.mk
.POSIX:
.SUFFIXES: .c .o
HDR = arg.h grabmntinfo.h proc.h util.h
HDR = arg.h grabmntinfo.h proc.h reboot.h util.h
LIB = \
util/agetcwd.o \
util/apathmax.o \

7
chvt.c
View File

@ -1,5 +1,3 @@
#include <linux/vt.h>
#include <linux/kd.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -9,6 +7,11 @@
#include <sys/ioctl.h>
#include "util.h"
#define KDGKBTYPE 0x4B33 /* get keyboard type */
#define VT_ACTIVATE 0x5606 /* make vt active */
#define VT_WAITACTIVE 0x5607 /* wait for vt active */
char *vts[] = {
"/proc/self/fd/0",
"/dev/console",

2
halt.c
View File

@ -1,8 +1,8 @@
/* See LICENSE file for copyright and license details. */
#include <linux/reboot.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include "reboot.h"
#include "util.h"
static void

View File

@ -1,8 +1,8 @@
/* See LICENSE file for copyright and license details. */
#include <linux/reboot.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <stdio.h>
#include "reboot.h"
#include "util.h"
static void

32
reboot.h Normal file
View File

@ -0,0 +1,32 @@
/*
* Magic values required to use _reboot() system call.
*/
#define LINUX_REBOOT_MAGIC1 0xfee1dead
#define LINUX_REBOOT_MAGIC2 672274793
#define LINUX_REBOOT_MAGIC2A 85072278
#define LINUX_REBOOT_MAGIC2B 369367448
#define LINUX_REBOOT_MAGIC2C 537993216
/*
* Commands accepted by the _reboot() system call.
*
* RESTART Restart system using default command and mode.
* HALT Stop OS and give system control to ROM monitor, if any.
* CAD_ON Ctrl-Alt-Del sequence causes RESTART command.
* CAD_OFF Ctrl-Alt-Del sequence sends SIGINT to init task.
* POWER_OFF Stop OS and remove all power from system, if possible.
* RESTART2 Restart system using given command string.
* SW_SUSPEND Suspend system using software suspend if compiled in.
* KEXEC Restart system using a previously loaded Linux kernel
*/
#define LINUX_REBOOT_CMD_RESTART 0x01234567
#define LINUX_REBOOT_CMD_HALT 0xCDEF0123
#define LINUX_REBOOT_CMD_CAD_ON 0x89ABCDEF
#define LINUX_REBOOT_CMD_CAD_OFF 0x00000000
#define LINUX_REBOOT_CMD_POWER_OFF 0x4321FEDC
#define LINUX_REBOOT_CMD_RESTART2 0xA1B2C3D4
#define LINUX_REBOOT_CMD_SW_SUSPEND 0xD000FCE2
#define LINUX_REBOOT_CMD_KEXEC 0x45584543