Renamed "obos_registrar" to "haiku_registrar" - not just for fun, but because
the registrar no longer depends on the app_server to be running. Added a "run_haiku_registrar" tool that is now used in the various "run" scripts. It only start the registrar on demand, ie. if it's not yet running. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@13493 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
72fab80539
commit
7560d40290
@ -38,7 +38,7 @@ local registrar_r5_sources =
|
||||
R5Compatibility.cpp
|
||||
;
|
||||
|
||||
Server obos_registrar
|
||||
Server haiku_registrar
|
||||
:
|
||||
$(registrar_sources)
|
||||
$(registrar_r5_sources)
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/apps/BitmapDrawing
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../tests/servers/app/copy_bits/CopyBits
|
||||
|
@ -1,8 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
|
||||
sleep 1s
|
||||
#../../../../../distro/x86.R1/beos/apps/MiniTerminal
|
||||
../../../../../distro/x86.R1/beos/apps/Playground
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/apps/ResizeLimits
|
||||
|
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../tests/servers/app/scrolling/Scrolling
|
||||
|
@ -1,7 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
../../../../../tests/servers/registrar/run_haiku_registrar || exit
|
||||
../../../../../distro/x86.R1/beos/system/servers/app_server &
|
||||
sleep 1s
|
||||
../../../../../distro/x86.R1/beos/system/servers/obos_registrar &
|
||||
sleep 1s
|
||||
../../../../../tests/servers/app/windows/Window
|
||||
|
@ -27,6 +27,12 @@ CommonUnitTest RosterShell
|
||||
SimpleTest message_deliverer_test : message_deliverer_test.cpp
|
||||
: <boot!home!config!lib>libopenbeos.so ;
|
||||
|
||||
|
||||
SimpleTest run_haiku_registrar
|
||||
: run_haiku_registrar.cpp
|
||||
: be
|
||||
;
|
||||
|
||||
# a shutdown working with the emulation under R5
|
||||
if $(TARGET_PLATFORM) = r5 {
|
||||
UsePrivateHeaders app ;
|
||||
|
95
src/tests/servers/registrar/run_haiku_registrar.cpp
Normal file
95
src/tests/servers/registrar/run_haiku_registrar.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, axeld@pinc-software.de. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <image.h>
|
||||
#include <Entry.h>
|
||||
#include <Query.h>
|
||||
#include <Path.h>
|
||||
#include <Volume.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
extern const char* __progname;
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
team_info teamInfo;
|
||||
int32 cookie = 0;
|
||||
while (get_next_team_info(&cookie, &teamInfo) == B_OK) {
|
||||
if (!strncmp(teamInfo.args, "/boot/beos/", 11)) {
|
||||
// this is a system component and not worth to investigate
|
||||
continue;
|
||||
}
|
||||
|
||||
thread_info threadInfo;
|
||||
int32 threadCookie = 0;
|
||||
while (get_next_thread_info(teamInfo.team, &threadCookie, &threadInfo) == B_OK) {
|
||||
// search for the roster thread
|
||||
if (!strcmp(threadInfo.name, "_roster_thread_")) {
|
||||
port_id port = find_port("_haiku_roster_port_");
|
||||
port_info portInfo;
|
||||
if (get_port_info(port, &portInfo) == B_OK
|
||||
&& portInfo.team == teamInfo.team) {
|
||||
puts("The Haiku Registrar is already running.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// the Haiku registrar doesn't seem to run yet, change this
|
||||
|
||||
BPath currentPath(".");
|
||||
|
||||
BQuery query;
|
||||
query.SetPredicate("name==haiku_registrar");
|
||||
|
||||
// search on current volume only
|
||||
dev_t device = dev_for_path(".");
|
||||
BVolume volume(device);
|
||||
|
||||
query.SetVolume(&volume);
|
||||
query.Fetch();
|
||||
|
||||
entry_ref ref;
|
||||
while (query.GetNextRef(&ref) == B_OK) {
|
||||
BPath path(&ref);
|
||||
if (path.InitCheck() != B_OK)
|
||||
continue;
|
||||
|
||||
const char* registrarPath = path.Path();
|
||||
const char* distro = strstr(registrarPath, "distro");
|
||||
if (distro == NULL)
|
||||
continue;
|
||||
|
||||
if (!strncmp(currentPath.Path(), registrarPath, distro - registrarPath)) {
|
||||
// gotcha!
|
||||
const char* args[] = { registrarPath, NULL };
|
||||
thread_id thread = load_image(1, args, (const char**)environ);
|
||||
if (thread < B_OK) {
|
||||
fprintf(stderr, "%s: Could not start the registrar: %s\n",
|
||||
__progname, strerror(thread));
|
||||
return -1;
|
||||
}
|
||||
|
||||
resume_thread(thread);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
fprintf(stderr, "%s: Could not find the Haiku Registrar.\n"
|
||||
" (This tool only works when used in the Haiku tree, but maybe\n"
|
||||
" the registrar just needs to be built.)\n",
|
||||
__progname);
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user