this repo has no description
1/*
2This file is part of Darling.
3
4Copyright (C) 2016 Lubos Dolezel
5
6Darling is free software: you can redistribute it and/or modify
7it under the terms of the GNU General Public License as published by
8the Free Software Foundation, either version 3 of the License, or
9(at your option) any later version.
10
11Darling is distributed in the hope that it will be useful,
12but WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with Darling. If not, see <http://www.gnu.org/licenses/>.
18*/
19
20#include <sys/types.h>
21
22#ifndef _DARLING_H_
23#define _DARLING_H_
24
25void showHelp(const char* argv0);
26void showVersion(const char* argv0);
27
28// Reports that this executable is not setuid root
29void missingSetuidRoot(void);
30
31// Returns ~/.darling with ~ expanded
32char* defaultPrefixPath(void);
33
34void setupWorkdir(void);
35
36void setupPrefix(void);
37
38int checkPrefixDir(void);
39
40// Creates the given directory, exit()ing if not possible
41void createDir(const char* path);
42
43int connectToShellspawn(void);
44void setupShellspawnEnv(int shellspawnFD);
45void setupWorkingDir(int shellspawnFD);
46void setupIDs(int shellspawnFD);
47void setupFDs(int fds[3], int* master);
48void spawnGo(int shellspawnFD, int fds[3], int master);
49void spawnShell(const char** argv);
50void spawnBinary(const char* binary, const char** argv);
51
52// Set up some environment variables
53// As well as the working directory
54// Called in the child process
55void setupChild(const char *curPath);
56
57// Returns the PID of the init process in prefix (in our namespace)
58// Returns 0 if no init is running
59pid_t getInitProcess(void);
60
61pid_t spawnInitProcess(void);
62
63void putInitPid(pid_t pidInit);
64void mapUids(pid_t pid);
65
66void spawnLaunchd(void);
67void darlingPreInit(void);
68
69void checkPrefixOwner(void);
70
71int isModuleLoaded(void);
72
73void loadKernelModule(void);
74void joinNamespace(pid_t pid, int type, const char* typeName);
75
76void setupCoredumpPattern(void);
77void setupUserHome(void);
78
79#endif