The beginnings of a launch_daemon for Haiku.

* This will be heavily inspired by Apple's launchd, as well as
  systemd -- for now it really doesn't do a whole lot, though.
* What works so far: the configuration files are read, parsed, and
  the jobs created.
* The jobs are even initialized, and their message ports created.
* BApplication now retrieves a previously created port from the
  launch_daemon for use with BServer.
* Only the registrar actually uses this for now.
This commit is contained in:
Axel Dörfler
2015-07-22 20:39:47 +02:00
parent 5f83ad89eb
commit 1480e5da6f
16 changed files with 816 additions and 27 deletions
+2 -1
View File
@@ -101,7 +101,7 @@ private:
friend class BServer;
BApplication(const char* signature,
const char* looperName,
const char* looperName, port_id port,
bool initGUI, status_t* error);
BApplication(uint32 signature);
BApplication(const BApplication&);
@@ -121,6 +121,7 @@ private:
const char* property);
void _InitData(const char* signature, bool initGUI,
status_t* error);
port_id _GetPort(const char* signature);
void BeginRectTracking(BRect r, bool trackWhole);
void EndRectTracking();
status_t _SetupServerAllocator();
+6 -4
View File
@@ -1,5 +1,5 @@
/*
* Copyright 2001-2014 Haiku, Inc. All rights reserved.
* Copyright 2001-2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
@@ -135,14 +135,16 @@ private:
static status_t _LockComplete(BLooper* loop, int32 old,
thread_id this_tid, sem_id sem,
bigtime_t timeout);
void _InitData(const char* name, int32 priority, int32 capacity);
void _InitData(const char* name, int32 priority,
port_id port, int32 capacity);
void AddMessage(BMessage* msg);
void _AddMessagePriv(BMessage* msg);
static status_t _task0_(void* arg);
void* ReadRawFromPort(int32* code,
bigtime_t tout = B_INFINITE_TIMEOUT);
BMessage* ReadMessageFromPort(bigtime_t tout = B_INFINITE_TIMEOUT);
bigtime_t timeout = B_INFINITE_TIMEOUT);
BMessage* ReadMessageFromPort(
bigtime_t timeout = B_INFINITE_TIMEOUT);
virtual BMessage* ConvertToMessage(void* raw, int32 code);
virtual void task_looper();
void _QuitRequested(BMessage* msg);
+35
View File
@@ -0,0 +1,35 @@
/*
* Copyright 2015, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Axel Dörfler, [email protected]
*/
#ifndef LAUNCH_DAEMON_DEFS_H
#define LAUNCH_DAEMON_DEFS_H
//! launch_daemon interface
#include <Errors.h>
#include <Roster.h>
namespace BPrivate {
#define kLaunchDaemonSignature "application/x-vnd.Haiku-launch_daemon"
#define B_LAUNCH_DAEMON_PORT_NAME "system:launch_daemon"
// message constants
enum {
B_GET_LAUNCH_CONNECTIONS = 'lncc',
};
} // namespace BPrivate
#endif // LAUNCH_DAEMON_DEFS_H
+33
View File
@@ -0,0 +1,33 @@
/*
* Copyright 2015 Haiku, Inc. All rights reserved.
* Distributed under the terms of the MIT License.
*/
#ifndef _LAUNCH_ROSTER_H
#define _LAUNCH_ROSTER_H
#include <Messenger.h>
class BLaunchRoster {
public:
BLaunchRoster();
~BLaunchRoster();
status_t InitCheck() const;
status_t GetData(const char* signature, BMessage& data);
private:
void _InitMessenger();
private:
BMessenger fMessenger;
uint32 _reserved[5];
};
// global BLaunchRoster instance
extern const BLaunchRoster* be_launch_roster;
#endif // _LAUNCH_ROSTER_H
+2 -1
View File
@@ -17,7 +17,8 @@ public:
BServer(const char* signature, bool initGUI,
status_t *error);
BServer(const char* signature, const char*
looperName, bool initGUI, status_t *error);
looperName, port_id port, bool initGUI,
status_t *error);
status_t InitGUIContext();