Added some defines and compile-time conditionals to make some
components of sysvinit compile on FreeBSD.
This commit is contained in:
parent
5dc965ba10
commit
be8d584161
@ -13,7 +13,8 @@ sysvinit (2.94) unreleased; urgency=low
|
|||||||
is taken.
|
is taken.
|
||||||
* Removed unnecessary malloc.h includes. Memory allocation
|
* Removed unnecessary malloc.h includes. Memory allocation
|
||||||
and freeing is now handled in stdlib.h
|
and freeing is now handled in stdlib.h
|
||||||
|
* Added defines for FreeBSD to make some components compile
|
||||||
|
on FreeBSD 11.
|
||||||
|
|
||||||
sysvinit (2.93) released; urgency=low
|
sysvinit (2.93) released; urgency=low
|
||||||
|
|
||||||
|
@ -47,7 +47,15 @@
|
|||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
#ifdef __linux__
|
||||||
#include <pty.h>
|
#include <pty.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <termios.h>
|
||||||
|
#include <libutil.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
#include <sys/mount.h>
|
#include <sys/mount.h>
|
||||||
|
20
src/init.c
20
src/init.c
@ -52,7 +52,11 @@ Version information is not placed in the top-level Makefile by default
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <termios.h>
|
#include <termios.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <utmpx.h>
|
||||||
|
#else
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
#endif
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/ttydefaults.h>
|
#include <sys/ttydefaults.h>
|
||||||
@ -62,6 +66,9 @@ Version information is not placed in the top-level Makefile by default
|
|||||||
#ifdef WITH_SELINUX
|
#ifdef WITH_SELINUX
|
||||||
# include <selinux/selinux.h>
|
# include <selinux/selinux.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
extern char **environ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __i386__
|
#ifdef __i386__
|
||||||
# ifdef __GLIBC__
|
# ifdef __GLIBC__
|
||||||
@ -521,8 +528,12 @@ int receive_state(int fd)
|
|||||||
* Set the process title.
|
* Set the process title.
|
||||||
*/
|
*/
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
#ifndef __FreeBSD__
|
||||||
__attribute__ ((format (printf, 1, 2)))
|
__attribute__ ((format (printf, 1, 2)))
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
/* This function already exists on FreeBSD. No need to delcare it. */
|
||||||
|
#ifndef __FreeBSD__
|
||||||
static int setproctitle(char *fmt, ...)
|
static int setproctitle(char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
@ -542,6 +553,7 @@ static int setproctitle(char *fmt, ...)
|
|||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set console_dev to a working console.
|
* Set console_dev to a working console.
|
||||||
@ -2160,9 +2172,11 @@ int make_pipe(int fd)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Attempt to re-exec.
|
* Attempt to re-exec.
|
||||||
|
* Renaming to my_re_exec since re_exec is now a common function name
|
||||||
|
* which conflicts.
|
||||||
*/
|
*/
|
||||||
static
|
static
|
||||||
void re_exec(void)
|
void my_re_exec(void)
|
||||||
{
|
{
|
||||||
CHILD *ch;
|
CHILD *ch;
|
||||||
sigset_t mask, oldset;
|
sigset_t mask, oldset;
|
||||||
@ -2279,7 +2293,7 @@ void fifo_new_level(int level)
|
|||||||
runlevel = read_level(level);
|
runlevel = read_level(level);
|
||||||
if (runlevel == 'U') {
|
if (runlevel == 'U') {
|
||||||
runlevel = oldlevel;
|
runlevel = oldlevel;
|
||||||
re_exec();
|
my_re_exec();
|
||||||
} else {
|
} else {
|
||||||
if (oldlevel != 'S' && runlevel == 'S') console_stty();
|
if (oldlevel != 'S' && runlevel == 'S') console_stty();
|
||||||
if (runlevel == '6' || runlevel == '0' ||
|
if (runlevel == '6' || runlevel == '0' ||
|
||||||
@ -2681,7 +2695,7 @@ void process_signals()
|
|||||||
#endif
|
#endif
|
||||||
if (runlevel == 'U') {
|
if (runlevel == 'U') {
|
||||||
runlevel = oldlevel;
|
runlevel = oldlevel;
|
||||||
re_exec();
|
my_re_exec();
|
||||||
} else {
|
} else {
|
||||||
if (oldlevel != 'S' && runlevel == 'S') console_stty();
|
if (oldlevel != 'S' && runlevel == 'S') console_stty();
|
||||||
if (runlevel == '6' || runlevel == '0' ||
|
if (runlevel == '6' || runlevel == '0' ||
|
||||||
|
@ -154,3 +154,12 @@ extern char prevlevel;
|
|||||||
#define D_WROTE_WTMP_RLEVEL -16
|
#define D_WROTE_WTMP_RLEVEL -16
|
||||||
#define D_WROTE_UTMP_RLEVEL -17
|
#define D_WROTE_UTMP_RLEVEL -17
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#define UTMP_FILE "/var/run/utmp"
|
||||||
|
#define RUN_LVL 1
|
||||||
|
struct utmp
|
||||||
|
{
|
||||||
|
char ut_id[4];
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -54,13 +54,20 @@
|
|||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <utmpx.h>
|
||||||
|
#else
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
#endif
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include "paths.h"
|
#include "paths.h"
|
||||||
#include "reboot.h"
|
#include "reboot.h"
|
||||||
#include "initreq.h"
|
#include "initreq.h"
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
|
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
extern char **environ;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MESSAGELEN 256
|
#define MESSAGELEN 256
|
||||||
|
|
||||||
|
@ -32,7 +32,11 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#ifdef __FreeBSD__
|
||||||
|
#include <utmpx.h>
|
||||||
|
#else
|
||||||
#include <utmp.h>
|
#include <utmp.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "init.h"
|
#include "init.h"
|
||||||
#include "initreq.h"
|
#include "initreq.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user