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
+1 -1
View File
@@ -1,6 +1,6 @@
SubDir HAIKU_TOP src apps processcontroller ; SubDir HAIKU_TOP src apps processcontroller ;
SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateSystemHeaders ;
Application ProcessController : Application ProcessController :
AutoIcon.cpp AutoIcon.cpp
-2
View File
@@ -42,7 +42,5 @@ extern const char* kPCSemaphoreName;
extern thread_id id; 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_ #endif // _PCWORLD_H_
@@ -21,18 +21,9 @@
#include "ProcessController.h" #include "ProcessController.h"
#include "AutoIcon.h" #include <stdio.h>
#include "Colors.h" #include <stdlib.h>
#include "IconMenuItem.h" #include <string.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 <Alert.h> #include <Alert.h>
#include <Bitmap.h> #include <Bitmap.h>
@@ -49,9 +40,21 @@
#include <Screen.h> #include <Screen.h>
#include <TextView.h> #include <TextView.h>
#include <stdio.h> #include <syscalls.h>
#include <stdlib.h>
#include <string.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* kDeskbarItemName = "ProcessController";
const char* kClassName = "ProcessController"; const char* kClassName = "ProcessController";
@@ -340,7 +343,7 @@ ProcessController::MessageReceived(BMessage *message)
if (message->FindInt32 ("cpu", &cpu) == B_OK) { if (message->FindInt32 ("cpu", &cpu) == B_OK) {
bool last = true; bool last = true;
for (int p = 0; p < gCPUcount; p++) { for (int p = 0; p < gCPUcount; p++) {
if (p != cpu && _kget_cpu_state_(p)) { if (p != cpu && _kern_cpu_enabled(p)) {
last = false; last = false;
break; break;
} }
@@ -350,7 +353,7 @@ ProcessController::MessageReceived(BMessage *message)
"That's no Fun!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT); "That's no Fun!", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
alert->Go(); alert->Go();
} else } else
_kset_cpu_state_(cpu, !_kget_cpu_state_(cpu)); _kern_set_cpu_enabled(cpu, !_kern_cpu_enabled(cpu));
} }
break; break;
} }
@@ -674,7 +677,7 @@ thread_popup(void *arg)
BMessage* m = new BMessage ('CPU '); BMessage* m = new BMessage ('CPU ');
m->AddInt32 ("cpu", i); m->AddInt32 ("cpu", i);
item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m); item = new IconMenuItem (gPCView->fProcessorIcon, item_name, m);
if (_kget_cpu_state_(i)) if (_kern_cpu_enabled(i))
item->SetMarked (true); item->SetMarked (true);
item->SetTarget(gPCView); item->SetTarget(gPCView);
addtopbottom(item); addtopbottom(item);
+9 -4
View File
@@ -10,11 +10,16 @@
#include "CPUButton.h" #include "CPUButton.h"
#include <stdlib.h>
#include <Alert.h>
#include <syscalls.h>
#include "PulseApp.h" #include "PulseApp.h"
#include "PulseView.h" #include "PulseView.h"
#include "Common.h" #include "Common.h"
#include <interface/Alert.h>
#include <stdlib.h>
CPUButton::CPUButton(BRect rect, const char *name, const char *label, BMessage *message) CPUButton::CPUButton(BRect rect, const char *name, const char *label, BMessage *message)
@@ -173,7 +178,7 @@ status_t
CPUButton::Invoke(BMessage *message) CPUButton::Invoke(BMessage *message)
{ {
if (!LastEnabledCPU(fCPU)) { if (!LastEnabledCPU(fCPU)) {
_kset_cpu_state_(fCPU, Value()); _kern_set_cpu_enabled(fCPU, Value());
} else { } else {
BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK");
alert->Go(NULL); alert->Go(NULL);
@@ -216,7 +221,7 @@ CPUButton::MessageReceived(BMessage *message)
} }
case PV_REPLICANT_PULSE: { case PV_REPLICANT_PULSE: {
// Make sure we're consistent with our CPU // Make sure we're consistent with our CPU
if (_kget_cpu_state_(fCPU) != Value() && !IsTracking()) if (_kern_cpu_enabled(fCPU) != Value() && !IsTracking())
SetValue(!Value()); SetValue(!Value());
break; break;
} }
+1 -2
View File
@@ -1,7 +1,6 @@
SubDir HAIKU_TOP src apps pulse ; SubDir HAIKU_TOP src apps pulse ;
SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateSystemHeaders ;
UsePrivateHeaders shared ; UsePrivateHeaders shared ;
if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) {
UseHeaders [ FDirName $(HAIKU_TOP) headers os kernel ] : true ; UseHeaders [ FDirName $(HAIKU_TOP) headers os kernel ] : true ;
+11 -8
View File
@@ -12,19 +12,22 @@
#include "PulseApp.h" #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 <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <getopt.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) PulseApp::PulseApp(int argc, char **argv)
: BApplication(APP_SIGNATURE) : BApplication(APP_SIGNATURE)
@@ -171,7 +174,7 @@ LastEnabledCPU(int my_cpu)
for (int x = 0; x < sys_info.cpu_count; x++) { for (int x = 0; x < sys_info.cpu_count; x++) {
if (x == my_cpu) if (x == my_cpu)
continue; continue;
if (_kget_cpu_state_(x) == 1) if (_kern_cpu_enabled(x) == 1)
return false; return false;
} }
return true; return true;
+12 -6
View File
@@ -9,13 +9,19 @@
//**************************************************************************************** //****************************************************************************************
#include "PulseView.h" #include "PulseView.h"
#include "Common.h"
#include "PulseApp.h"
#include <interface/Alert.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <Alert.h>
#include <syscalls.h>
#include "Common.h"
#include "PulseApp.h"
PulseView::PulseView(BRect rect, const char *name) : PulseView::PulseView(BRect rect, const char *name) :
BView(rect, name, B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_PULSE_NEEDED | B_FRAME_EVENTS) { 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; cpu_times[x] = cpu_time;
if (sys_info.cpu_count >= 2) { 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); 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); cpu_menu_items[x]->SetMarked(true);
} }
} }
@@ -113,7 +119,7 @@ void PulseView::ChangeCPUState(BMessage *message) {
int which = message->FindInt32("which"); int which = message->FindInt32("which");
if (!LastEnabledCPU(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 { } else {
BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK"); BAlert *alert = new BAlert(NULL, "You can't disable the last active CPU.", "OK");
alert->Go(NULL); alert->Go(NULL);
-2
View File
@@ -15,8 +15,6 @@
#include <interface/PopUpMenu.h> #include <interface/PopUpMenu.h>
#include <interface/MenuItem.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 { class PulseView : public BView {
public: public:
+3 -3
View File
@@ -15,9 +15,9 @@
#include <Debug.h> #include <Debug.h>
#include <Screen.h> #include <Screen.h>
#include "Filter.h" #include <syscalls.h>
extern "C" int _kget_cpu_state_(int cpu); #include "Filter.h"
// Implementation of FilterThread // Implementation of FilterThread
@@ -238,7 +238,7 @@ Filter::NumberOfActiveCPUs() const
count = info.cpu_count; count = info.cpu_count;
int32 cpuCount = 0; int32 cpuCount = 0;
for (int i = 0; i < count; i ++) { for (int i = 0; i < count; i ++) {
if (_kget_cpu_state_(i)) if (_kern_cpu_enabled(i))
cpuCount++; cpuCount++;
} }
if (cpuCount == 0) if (cpuCount == 0)
+1 -2
View File
@@ -1,10 +1,9 @@
SubDir HAIKU_TOP src apps showimage ; SubDir HAIKU_TOP src apps showimage ;
UsePrivateSystemHeaders ;
UsePrivateHeaders tracker shared ; UsePrivateHeaders tracker shared ;
UsePublicHeaders [ FDirName be_apps Tracker ] ; UsePublicHeaders [ FDirName be_apps Tracker ] ;
SetSubDirSupportedPlatformsBeOSCompatible ;
Application ShowImage : Application ShowImage :
ShowImageApp.cpp ShowImageApp.cpp
ShowImageSettings.cpp ShowImageSettings.cpp