Don't use private BeOS syscalls.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@31044 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-06-14 11:55:24 +00:00
parent 58e784dfe6
commit 87df8902ac
10 changed files with 187 additions and 176 deletions

View File

@ -1,6 +1,6 @@
SubDir HAIKU_TOP src apps processcontroller ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateSystemHeaders ;
Application ProcessController :
AutoIcon.cpp

View File

@ -42,7 +42,5 @@ extern const char* kPCSemaphoreName;
extern thread_id id;
extern "C" int _kget_cpu_state_(int cpu);
extern "C" int _kset_cpu_state_(int cpu, int enabled);
#endif // _PCWORLD_H_

View File

@ -21,18 +21,9 @@
#include "ProcessController.h"
#include "AutoIcon.h"
#include "Colors.h"
#include "IconMenuItem.h"
#include "MemoryBarMenu.h"
#include "MemoryBarMenuItem.h"
#include "PCWorld.h"
#include "Preferences.h"
#include "QuitMenu.h"
#include "TeamBarMenu.h"
#include "TeamBarMenuItem.h"
#include "ThreadBarMenu.h"
#include "Utilities.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <Alert.h>
#include <Bitmap.h>
@ -49,9 +40,21 @@
#include <Screen.h>
#include <TextView.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <syscalls.h>
#include "AutoIcon.h"
#include "Colors.h"
#include "IconMenuItem.h"
#include "MemoryBarMenu.h"
#include "MemoryBarMenuItem.h"
#include "PCWorld.h"
#include "Preferences.h"
#include "QuitMenu.h"
#include "TeamBarMenu.h"
#include "TeamBarMenuItem.h"
#include "ThreadBarMenu.h"
#include "Utilities.h"
const char* kDeskbarItemName = "ProcessController";
const char* kClassName = "ProcessController";
@ -340,7 +343,7 @@ ProcessController::MessageReceived(BMessage *message)
if (message->FindInt32 ("cpu", &cpu) == B_OK) {
bool last = true;
for (int p = 0; p < gCPUcount; p++) {
if (p != cpu && _kget_cpu_state_(p)) {
if (p != cpu && _kern_cpu_enabled(p)) {
last = false;
break;
}
@ -350,7 +353,7 @@ ProcessController::MessageReceived(BMessage *message)
"That's no Fun!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go();
} else
_kset_cpu_state_(cpu, !_kget_cpu_state_(cpu));
_kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
}
break;
}
@ -674,7 +677,7 @@ thread_popup(void *arg)
BMessage* m = new BMessage ('CPU ');
m->AddInt32 ("cpu", i);
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
if (_kget_cpu_state_(i))
if (_kern_cpu_enabled(i))
item->SetMarked (true);
item->SetTarget(gPCView);
addtopbottom(item);

View File

@ -10,11 +10,16 @@
#include "CPUButton.h"
#include <stdlib.h>
#include <Alert.h>
#include <syscalls.h>
#include "PulseApp.h"
#include "PulseView.h"
#include "Common.h"
#include <interface/Alert.h>
#include <stdlib.h>
CPUButton::CPUButton(BRect rect, const char *name, const char *label, BMessage *message)
@ -173,7 +178,7 @@ status_t
CPUButton::Invoke(BMessage *message)
{
if (!LastEnabledCPU(fCPU)) {
_kset_cpu_state_(fCPU, Value());
_kern_set_cpu_enabled(fCPU, Value());
} else {
BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK");
alert->Go(NULL);
@ -216,7 +221,7 @@ CPUButton::MessageReceived(BMessage *message)
}
case PV_REPLICANT_PULSE: {
// Make sure we're consistent with our CPU
if (_kget_cpu_state_(fCPU) != Value() && !IsTracking())
if (_kern_cpu_enabled(fCPU) != Value() && !IsTracking())
SetValue(!Value());
break;
}

View File

@ -1,7 +1,6 @@
SubDir HAIKU_TOP src apps pulse ;
SetSubDirSupportedPlatformsBeOSCompatible ;
UsePrivateSystemHeaders ;
UsePrivateHeaders shared ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
UseHeaders [ FDirName $(HAIKU_TOP) headers os kernel ] : true ;

View File

@ -12,19 +12,22 @@
#include "PulseApp.h"
#include "Common.h"
#include "PulseWindow.h"
#include "DeskbarPulseView.h"
#include <Alert.h>
#include <Rect.h>
#include <Deskbar.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <getopt.h>
#include <Alert.h>
#include <Rect.h>
#include <Deskbar.h>
#include <syscalls.h>
#include "Common.h"
#include "PulseWindow.h"
#include "DeskbarPulseView.h"
PulseApp::PulseApp(int argc, char **argv)
: BApplication(APP_SIGNATURE)
@ -171,7 +174,7 @@ LastEnabledCPU(int my_cpu)
for (int x = 0; x < sys_info.cpu_count; x++) {
if (x == my_cpu)
continue;
if (_kget_cpu_state_(x) == 1)
if (_kern_cpu_enabled(x) == 1)
return false;
}
return true;

View File

@ -9,13 +9,19 @@
//****************************************************************************************
#include "PulseView.h"
#include "Common.h"
#include "PulseApp.h"
#include <interface/Alert.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <Alert.h>
#include <syscalls.h>
#include "Common.h"
#include "PulseApp.h"
PulseView::PulseView(BRect rect, const char *name) :
BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS) {
@ -100,9 +106,9 @@ void PulseView::Update() {
cpu_times[x] = cpu_time;
if (sys_info.cpu_count >= 2) {
if (!_kget_cpu_state_(x) && cpu_menu_items[x]->IsMarked())
if (!_kern_cpu_enabled(x) && cpu_menu_items[x]->IsMarked())
cpu_menu_items[x]->SetMarked(false);
if (_kget_cpu_state_(x) && !cpu_menu_items[x]->IsMarked())
if (_kern_cpu_enabled(x) && !cpu_menu_items[x]->IsMarked())
cpu_menu_items[x]->SetMarked(true);
}
}
@ -113,7 +119,7 @@ void PulseView::ChangeCPUState(BMessage *message) {
int which = message->FindInt32("which");
if (!LastEnabledCPU(which)) {
_kset_cpu_state_(which, (int)!cpu_menu_items[which]->IsMarked());
_kern_set_cpu_enabled(which, (int)!cpu_menu_items[which]->IsMarked());
} else {
BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK");
alert->Go(NULL);

View File

@ -15,8 +15,6 @@
#include <interface/PopUpMenu.h>
#include <interface/MenuItem.h>
extern "C" int _kget_cpu_state_(int cpu);
extern "C" int _kset_cpu_state_(int cpu, int enabled);
class PulseView : public BView {
public:

View File

@ -15,9 +15,9 @@
#include <Debug.h>
#include <Screen.h>
#include "Filter.h"
#include <syscalls.h>
extern "C" int _kget_cpu_state_(int cpu);
#include "Filter.h"
// Implementation of FilterThread
@ -238,7 +238,7 @@ Filter::NumberOfActiveCPUs() const
count = info.cpu_count;
int32 cpuCount = 0;
for (int i = 0; i < count; i ++) {
if (_kget_cpu_state_(i))
if (_kern_cpu_enabled(i))
cpuCount++;
}
if (cpuCount == 0)

View File

@ -1,10 +1,9 @@
SubDir HAIKU_TOP src apps showimage ;
UsePrivateSystemHeaders ;
UsePrivateHeaders tracker shared ;
UsePublicHeaders [ FDirName be_apps Tracker ] ;
SetSubDirSupportedPlatformsBeOSCompatible ;
Application ShowImage :
ShowImageApp.cpp
ShowImageSettings.cpp