*** empty log message ***

svn path=/trunk/boinc/; revision=3863
This commit is contained in:
Karl Chen 2004-07-13 13:54:09 +00:00
parent e9fe74dcd3
commit afd778de8a
114 changed files with 845 additions and 1355 deletions

View File

@ -2,24 +2,24 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
// test program for MFILE class
#include <stdlib.h>
#include <cstdlib>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif

View File

@ -2,30 +2,29 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "boinc_api.h"
int get_run_info(double& time, unsigned long int& counter);
void run_api_test(char* args);
int print_results(double time1, double time2,
int print_results(double time1, double time2,
unsigned long int counter1, unsigned long int counter2
);
int initialize_api();

View File

@ -37,9 +37,7 @@
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#include "config.h"
using namespace std;
#endif

View File

@ -20,9 +20,6 @@
#ifndef _BOINC_API_
#define _BOINC_API_
// NOTE: this is required on windows as well as unix, do not add "#ifndef
// _WIN32" -- if something is not working on a particular version of MSVC
// let's find a working solution
#include <string>
#include "app_ipc.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -28,13 +28,13 @@ extern DWORD WINAPI win_graphics_event_loop( LPVOID duff );
HANDLE graphics_threadh=NULL;
#endif
#ifndef _WIN32
#ifdef __APPLE_CC__
#include "mac_app_opengl.h"
#endif
#ndif
#include <string.h>
#include <stdarg.h>
#ifndef _WIN32
#include <cstring>
#include <cstdarg>
#ifdef HAVE_PTHREAD
#include <pthread.h>
@ -119,20 +119,20 @@ int boinc_init_graphics() {
OSErr theErr = noErr;
ThreadID graphicsThreadID = 0;
ThreadEntryUPP entry_proc;
entry_proc = NewThreadEntryUPP( mac_graphics_event_loop );
// Create the thread in a suspended state
theErr = NewThread ( kCooperativeThread, entry_proc,
(void *)(&gi), 0, kNewSuspend | kCreateIfNeeded, NULL, &graphicsThreadID
);
if (theErr != noErr) return ERR_THREAD;
// In theory we could do customized scheduling or install thread disposal routines here
// Put the graphics event loop into the ready state
SetThreadState(graphicsThreadID, kReadyThreadState, kNoThreadID);
YieldToAnyThread();
#endif
@ -145,7 +145,7 @@ int boinc_init_graphics() {
if (retval) return ERR_THREAD;
pthread_attr_destroy( &graphics_thread_attr );
#endif
graphics_inited = true;
return 0;
@ -160,7 +160,7 @@ int boinc_finish_graphics() {
}
}
#endif
return 0;
}
@ -215,4 +215,4 @@ bool throttled_app_render(int x, int y, double t) {
return true;
}
return false;
}
}

View File

@ -24,47 +24,19 @@
#include "jpeglib.h"
#include "bmplib.h"
#include "tgalib.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include <glut.h>
#endif
#ifndef _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <setjmp.h>
#ifdef HAVE_GL_H
#include "gl.h"
#elif defined(HAVE_GL_GL_H)
#include <GL/gl.h>
#elif defined(HAVE_OPENGL_GL_H)
#include <OpenGL/gl.h>
#else
#endif
#ifdef HAVE_GLU_H
#include "glu.h"
#elif defined(HAVE_GL_GLU_H)
#include <GL/glu.h>
#elif defined(HAVE_OPENGL_GLU_H)
#include <OpenGL/glu.h>
#endif
#ifdef HAVE_GLUT_H
#include "glut.h"
#elif defined(HAVE_GL_GLUT_H)
#include <GL/glut.h>
#elif defined(HAVE_OPENGL_GLUT_H)
#include <OpenGL/glut.h>
#elif defined(HAVE_GLUT_GLUT_H)
#include <GLUT/glut.h>
#endif
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <csetjmp>
#include <jpeglib.h>
#endif
#include "boinc_gl.h"
#include "gutil.h"
#include "filesys.h"
#include "util.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -21,10 +21,7 @@
#include "mac_carbon_gl.h"
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#else
#include <gl.h>
#include <Devices.h>
#include <Dialogs.h>
#include <DriverServices.h>
@ -37,8 +34,10 @@
#include <Windows.h>
#endif
#include <stdio.h>
#include <string.h>
#include "boinc_gl.h"
#include <cstdio>
#include <cstring>
// project includes ---------------------------------------------------------
@ -76,14 +75,14 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
TimerUPP boincYieldUPP;
EventLoopTimerRef boincYieldTimer;
short i,fNum;
InitCursor();
SetRect( &winRect, 100, 100, 100+xsize, 100+ysize );
err = CreateNewWindow ( kDocumentWindowClass, kWindowStandardDocumentAttributes, &winRect, &appGLWindow );
if (err != noErr) return -1;
// Application-level event handler installer
appCommandProcessor = NewEventHandlerUPP(MainAppEventHandler);
err = InstallApplicationEventHandler(appCommandProcessor, GetEventTypeCount(appEventList),
@ -107,15 +106,15 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
err = InstallEventLoopTimer(GetMainEventLoop(), 0,
kEventDurationMillisecond*refresh_period*1000,
boincYieldUPP, NULL, &boincYieldTimer);
// TODO: add an event handler for the window
ChangeWindowAttributes( appGLWindow, kWindowStandardHandlerAttribute, 0 );
SetWTitle (appGLWindow, "\pWindow");
ShowWindow(appGLWindow);
SetPortWindowPort (appGLWindow);
glInfo.fmt = 0; // output pixel format
i = 0;
glInfo.aglAttributes [i++] = AGL_RGBA;
glInfo.aglAttributes [i++] = AGL_DOUBLEBUFFER;
@ -124,13 +123,13 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
glInfo.aglAttributes [i++] = AGL_DEPTH_SIZE;
glInfo.aglAttributes [i++] = 16;
glInfo.aglAttributes [i++] = AGL_NONE;
BuildGLonWindow (appGLWindow, &boincAGLContext, &glInfo);
if (!boincAGLContext) {
DestroyGLFromWindow (&boincAGLContext, &glInfo);
} else {
Rect rectPort;
GetWindowPortBounds (appGLWindow, &rectPort);
aglSetCurrentContext (boincAGLContext);
aglReportError ();
@ -141,7 +140,7 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
aglReportError ();
ReSizeGLScene( rectPort.right - rectPort.left, rectPort.bottom - rectPort.top );
glReportError ();
InitGL();
app_init_gl();
@ -149,16 +148,16 @@ int InitGLWindow(int xsize, int ysize, int depth, double refresh_period) {
glReportError ();
aglSwapBuffers (boincAGLContext);
aglReportError ();
GetFNum("\pTimes New Roman", &fNum); // build font
main_font = BuildFontGL (boincAGLContext, fNum, normal, 9);
aglUpdateContext (boincAGLContext);
aglReportError ();
using_opengl = true;
}
return 0;
}
@ -252,10 +251,10 @@ pascal OSStatus MainAppEventHandler(EventHandlerCallRef appHandler, EventRef the
pascal void *mac_graphics_event_loop ( void *data ) {
GRAPHICS_INFO *gi = (GRAPHICS_INFO *)data;
InitGLWindow(gi->xsize, gi->ysize, 16, gi->refresh_period);
RunApplicationEventLoop();
return NULL;
}

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -50,7 +50,7 @@
#include <gl.h>
#endif
#include <stdio.h>
#include <cstdio>
// project includes ---------------------------------------------------------
@ -77,18 +77,18 @@ OSStatus BuildGLonWindow (WindowPtr pWindow, AGLContext* paglContext, pstructGLW
GrafPtr cgrafSave = NULL;
short numDevices;
OSStatus err = noErr;
GetPort (&cgrafSave);
SetPortWindowPort(pWindow);
// check renderer VRAM and acceleration
numDevices = FindGDHandleFromWindow (pWindow, &hGD);
// do agl
if ((Ptr) kUnresolvedCFragSymbolAddress == (Ptr) aglChoosePixelFormat) { // check for existance of OpenGL
ReportError ("OpenGL not installed");
return NULL;
}
}
// we successfully passed the renderer check
pcontextInfo->fmt = aglChoosePixelFormat (NULL, 0, pcontextInfo->aglAttributes); // get an appropriate pixel format
@ -104,10 +104,10 @@ OSStatus BuildGLonWindow (WindowPtr pWindow, AGLContext* paglContext, pstructGLW
ReportError ("Could not create context");
return NULL;
}
if (!aglSetDrawable (*paglContext, GetWindowPort (pWindow))) // attach the CGrafPtr to the context
return aglReportError ();
if(!aglSetCurrentContext (*paglContext)) // make the context the current context
return aglReportError ();
@ -126,7 +126,7 @@ OSStatus BuildGLonWindow (WindowPtr pWindow, AGLContext* paglContext, pstructGLW
OSStatus DestroyGLFromWindow (AGLContext* paglContext, pstructGLWindowInfo pcontextInfo) {
OSStatus err;
if ((!paglContext) || (!*paglContext))
return paramErr; // not a valid context
glFinish ();
@ -143,7 +143,7 @@ OSStatus DestroyGLFromWindow (AGLContext* paglContext, pstructGLWindowInfo pcont
err = aglReportError ();
}
pcontextInfo->fmt = 0;
return err;
}
@ -190,30 +190,30 @@ short FindGDHandleFromWindow (WindowPtr pWindow, GDHandle * phgdOnThisDevice)
long greatestArea, sectArea;
short numDevices = 0;
GDHandle hgdNthDevice;
if (!pWindow || !phgdOnThisDevice)
return NULL;
*phgdOnThisDevice = NULL;
GetPort (&pgpSave);
SetPortWindowPort (pWindow);
GetWindowPortBounds (pWindow, &rectWind);
LocalToGlobal ((Point*)& rectWind.top); // convert to global coordinates
LocalToGlobal ((Point*)& rectWind.bottom);
hgdNthDevice = GetDeviceList ();
greatestArea = 0;
// check window against all gdRects in gDevice list and remember
// check window against all gdRects in gDevice list and remember
// which gdRect contains largest area of window}
while (hgdNthDevice)
{
if (TestDeviceAttribute (hgdNthDevice, screenDevice)) {
if (TestDeviceAttribute (hgdNthDevice, screenActive))
{
// The SectRect routine calculates the intersection
// of the window rectangle and this gDevice
// rectangle and returns TRUE if the rectangles intersect,
// The SectRect routine calculates the intersection
// of the window rectangle and this gDevice
// rectangle and returns TRUE if the rectangles intersect,
// FALSE if they don't.
SectRect (&rectWind, &(**hgdNthDevice).gdRect, &rectSect);
// determine which screen holds greatest window area
@ -230,7 +230,7 @@ short FindGDHandleFromWindow (WindowPtr pWindow, GDHandle * phgdOnThisDevice)
}
}
}
SetPort (pgpSave);
return numDevices;
}
@ -267,14 +267,14 @@ void DeleteFontGL (GLuint fontList)
void ReportErrorNum (char * strError, long numError)
{
fprintf (stderr, "%s %ld (0x%lx)\n", strError, numError, numError);
fprintf (stderr, "%s %ld (0x%lx)\n", strError, numError, numError);
}
// --------------------------------------------------------------------------
void ReportError (char * strError)
{
fprintf (stderr, "%s\n", strError);
fprintf (stderr, "%s\n", strError);
}
//-----------------------------------------------------------------------------------------------------------------------
@ -382,12 +382,12 @@ void DoUpdate (AGLContext aglContext)
{
Rect portRect;
int width, height;
if (aglContext)
{
aglSetCurrentContext (aglContext);
aglUpdateContext (aglContext);
GetWindowBounds( appGLWindow, kWindowContentRgn, &portRect );
width = portRect.right - portRect.left;
height = portRect.bottom - portRect.top;
@ -427,7 +427,7 @@ OSStatus StartDSp (void)
gDSpStarted = true;
}
}
return err;
return err;
}
// --------------------------------------------------------------------------
@ -479,7 +479,7 @@ void DestroyDSpContext (DSpContextReference* pdspContext)
#pragma mark -
//-----------------------------------------------------------------------------------------------------------------------
OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks)
OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeTicks)
{
OSStatus err = noErr;
RGBColor inZeroIntensityColor;
@ -495,7 +495,7 @@ OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeT
inZeroIntensityColor.green = 0x0000;
inZeroIntensityColor.blue = 0x0000;
currTick = TickCount ();
for (x = 1; x <= fadeTicks; x++)
for (x = 1; x <= fadeTicks; x++)
{
percent = step * x / 8;
err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor);
@ -511,7 +511,7 @@ OSStatus DSpContext_CustomFadeGammaIn (DSpContextReference inContext, long fadeT
//-----------------------------------------------------------------------------------------------------------------------
OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks )
OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fadeTicks )
{
OSStatus err = noErr;
RGBColor inZeroIntensityColor;
@ -527,7 +527,7 @@ OSStatus DSpContext_CustomFadeGammaOut (DSpContextReference inContext, long fade
inZeroIntensityColor.green = 0x0000;
inZeroIntensityColor.blue = 0x0000;
currTick = TickCount ();
for (x = fadeTicks - 1; x >= 0; x--)
for (x = fadeTicks - 1; x >= 0; x--)
{
percent = step * x / 8;
err = DSpContext_FadeGamma(inContext, percent, &inZeroIntensityColor);

View File

@ -16,17 +16,17 @@
#ifdef _WIN32
#include "boinc_win.h"
#include <GL/gl.h>
#endif
#ifndef _WIN32
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include "boinc_gl.h"
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#define max(a,b) (a>b?a:b)
#define min(a,b) (a>b?b:a)
#endif
@ -286,21 +286,21 @@ void REDUCED_ARRAY::draw_row_quad(int row) {
#endif
}
void REDUCED_ARRAY::draw_row_rect_x(int row) {
void REDUCED_ARRAY::draw_row_rect_x(int row) {
float z0=0,z1=0,x0=0,x1=0,y0=0,y1=0,h=0,xm=0;
int i=0;
int i=0;
float* row0=0;
int trow=row-1;
float* trow0=0;
double hue,sat,lum;
double hue,sat,lum;
COLOR color;
switch(draw_style) {
case GRAPH_STYLE_RECTANGLES:
z0 = draw_pos[2] + (draw_size[2]*row)/rdimy;
z1 = z0+.14f;
z1 = z0+.14f;
row0 = rrow(row);
glBegin(GL_QUADS);
for (i=0; i<rdimx; i++) {
x0 = draw_pos[0] + (draw_size[0]*i)/rdimx;
@ -319,7 +319,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
glColor4f(color.r, color.g, color.b, alpha);
//front
glVertex3f(x0, y0, z0);
glVertex3f(x1, y0, z0);
glVertex3f(x1, y1, z0);
@ -351,12 +351,12 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
*/
}
glEnd();
//draw lines
/*
mode_unshaded();
glLineWidth(.5f);
mode_unshaded();
glLineWidth(.5f);
glBegin(GL_LINES);
glColor4f(0,0,0,1);
for (i=0; i<rdimx; i++) {
@ -367,7 +367,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
y1 = draw_pos[1] + draw_size[1]*h;
//front
glVertex3f(x0, y0, z0);
glVertex3f(x0, y1, z0);
@ -418,7 +418,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
glVertex3f(x1, y0, z0);
*/
// }
glEnd();
glEnd();
break;
case GRAPH_STYLE_SURFACE:
glBegin(GL_TRIANGLE_STRIP);
@ -428,7 +428,7 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
row0 = rrow(row);
trow=row-1;
if(row!=0) trow0 = rrow(trow);
for (i=0; i<rdimx; i++) {
x0 = draw_pos[0] + (draw_size[0]*i)/rdimx;
x1 = x0 + draw_deltax*.8f;
@ -441,29 +441,29 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
hue = hue0 + (dhue*i)/rdimx;
if (hue > 1) hue -= 1;
sat = 1.;
lum = .5 + h/2;
lum = .5 + h/2;
HLStoRGB(hue, lum, sat, color);
glColor4f(color.r, color.g, color.b, alpha);
glColor4f(color.r, color.g, color.b, alpha);
if(row!=0) {
float lh = (trow0[i]-rdata_min)/(rdata_max-rdata_min);
float ly = draw_pos[1] + draw_size[1]*lh;
float lz = draw_pos[2] + (draw_size[2]*trow)/rdimy + .14f;
float lh = (trow0[i]-rdata_min)/(rdata_max-rdata_min);
float ly = draw_pos[1] + draw_size[1]*lh;
float lz = draw_pos[2] + (draw_size[2]*trow)/rdimy + .14f;
glVertex3f(xm,ly,lz);
glVertex3f(xm,y1,z1);
}
}
}
glEnd();
break;
case GRAPH_STYLE_WIREFRAME:
glLineWidth(1.0f);
z0 = draw_pos[2] + (draw_size[2]*row)/rdimy;
z1 = z0+.14f;
row0 = rrow(row);
if(row!=0) trow0 = rrow(trow);
z1 = z0+.14f;
row0 = rrow(row);
if(row!=0) trow0 = rrow(trow);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
glBegin(GL_LINES);
for (i=0; i<rdimx; i++) {
x0 = draw_pos[0] + (draw_size[0]*i)/rdimx;
@ -476,29 +476,29 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
hue = hue0 + (dhue*i)/rdimx;
if (hue > 1) hue -= 1;
sat = 1.;
lum = .5 + h/2;
lum = .5 + h/2;
HLStoRGB(hue, lum, sat, color);
glColor4f(color.r, color.g, color.b, alpha);
if(i!=rdimx-1) glVertex3f(x0+((x1-x0)/2.0f), y1, z0);
glColor4f(color.r, color.g, color.b, alpha);
if(i!=rdimx-1) glVertex3f(x0+((x1-x0)/2.0f), y1, z0);
if(row!=0)
{
float h2 = (trow0[i]-rdata_min)/(rdata_max-rdata_min);
float z2 = draw_pos[2] + (draw_size[2]*trow)/rdimy;
float y2 = draw_pos[1] + draw_size[1]*h2;
glVertex3f(x0+((x1-x0)/2.0f), y1, z0);
glVertex3f(x0+((x1-x0)/2.0f), y2, z2);
glVertex3f(x0+((x1-x0)/2.0f), y1, z0);
glVertex3f(x0+((x1-x0)/2.0f), y2, z2);
}
if(i!=0) glVertex3f(x0+((x1-x0)/2.0f), y1, z0);
}
}
glEnd();
glDisable(GL_LINE_SMOOTH);
break;
case GRAPH_STYLE_PLANES:
z0 = draw_pos[2] + (draw_size[2]*row)/rdimy;
z1 = z0+.14f;
row0 = rrow(row);
i=0;
z1 = z0+.14f;
row0 = rrow(row);
i=0;
x0 = draw_pos[0] + (draw_size[0]*i)/rdimx;
x1 = x0 + draw_deltax*.8f;
@ -510,9 +510,9 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
hue = hue0 + (dhue*i)/rdimx;
if (hue > 1) hue -= 1;
sat = 1.;
lum = .5 + h/2;
lum = .5 + h/2;
HLStoRGB(hue, lum, sat, color);
glColor4f(color.r, color.g, color.b, alpha);
glColor4f(color.r, color.g, color.b, alpha);
glVertex3f(draw_pos[0],draw_pos[1],z0);
@ -538,9 +538,9 @@ void REDUCED_ARRAY::draw_row_rect_x(int row) {
glVertex3d(x1,y0,z0);
glVertex3d(x1,y1,z0);
}
glEnd();
glEnd();
break;
default:
default:
break;
}
}
@ -638,7 +638,7 @@ void REDUCED_ARRAY::draw_part(double frac) {
draw(0, nr);
}
void REDUCED_ARRAY::draw_axis_labels() {
void REDUCED_ARRAY::draw_axis_labels() {
GLfloat char_height = .5f;
GLfloat line_width = 3.0f;
GLfloat spacing = 2.0f;
@ -664,7 +664,7 @@ void REDUCED_ARRAY::draw_axis_labels() {
draw_rotated_text(x_text_pos,char_height,line_width,spacing,x_label,rotation,rotation_vector);
//draw_text_line(x_text_pos,char_height,line_width,x_label,0);
}
void REDUCED_ARRAY::draw_axes() {
@ -677,11 +677,11 @@ void REDUCED_ARRAY::draw_axes() {
float adj3=0;
// box
mode_unshaded();
glLineWidth(.5);
glBegin(GL_LINES);
glColor4d(1,1,1,.5);
glColor4d(1,1,1,.5);
//back square
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+adj);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+adj);
@ -707,7 +707,7 @@ void REDUCED_ARRAY::draw_axes() {
glVertex3f(draw_pos[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]+adj2);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]+draw_size[1], draw_pos[2]+draw_size[2]+adj2);
//connecting lines
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+adj);
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]+adj2);
@ -724,13 +724,13 @@ void REDUCED_ARRAY::draw_axes() {
mode_unshaded();
glLineWidth(1.0);
glEnable(GL_LINE_SMOOTH);
glBegin(GL_LINES);
glColor4d(1,1,1,1);
glColor4d(1,1,1,1);
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+adj);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+adj);
@ -743,22 +743,22 @@ void REDUCED_ARRAY::draw_axes() {
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1], draw_pos[2]+draw_size[2]+adj2);
glVertex3f(draw_pos[0], draw_pos[1], draw_pos[2]+draw_size[2]+adj2);
glEnd();
glEnd();
glColor4d(1,1,1,.2);
glBegin(GL_QUADS);
glVertex3f(draw_pos[0], draw_pos[1]-adj3, draw_pos[2]+draw_size[2]+adj2);
glBegin(GL_QUADS);
glVertex3f(draw_pos[0], draw_pos[1]-adj3, draw_pos[2]+draw_size[2]+adj2);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]-adj3, draw_pos[2]+draw_size[2]+adj2);
glVertex3f(draw_pos[0]+draw_size[0], draw_pos[1]-adj3, draw_pos[2]+adj);
glVertex3f(draw_pos[0], draw_pos[1]-adj3, draw_pos[2]+adj);
glVertex3f(draw_pos[0], draw_pos[1]-adj3, draw_pos[2]+adj);
glEnd();
glDisable(GL_LINE_SMOOTH);
}
void REDUCED_ARRAY::draw_labels() {
double model[16];
void REDUCED_ARRAY::draw_labels() {
double model[16];
double proj[16];
double z_pos[3];
double x_pos[3];
@ -768,7 +768,7 @@ void REDUCED_ARRAY::draw_labels() {
float arroww = .05f;
float ch = .015f;
float lw = .02f;
float lw = .02f;
float ls = 0;
float wd=.015f;
@ -798,26 +798,26 @@ void REDUCED_ARRAY::draw_labels() {
int viewport[4];
get_matrix(model);
get_projection(proj);
get_projection(proj);
get_viewport(viewport);
int w = viewport[2];
int h = viewport[3];
glPushMatrix();
//unscale modelview matrix
double aspect_ratio = 4.0/3.0;
double aspect_ratio = 4.0/3.0;
if ((double)h*aspect_ratio > (double)w) {
model[1]*=1.0f/(((double)w/aspect_ratio)/(double)h);
model[1]*=1.0f/(((double)w/aspect_ratio)/(double)h);
model[5]*=1.0f/(((double)w/aspect_ratio)/(double)h);
model[9]*=1.0f/(((double)w/aspect_ratio)/(double)h);
} else {
model[0]*=1.0f/(((double)h*aspect_ratio)/(double)w);
} else {
model[0]*=1.0f/(((double)h*aspect_ratio)/(double)w);
model[4]*=1.0f/(((double)h*aspect_ratio)/(double)w);
model[8]*=1.0f/(((double)h*aspect_ratio)/(double)w);
}
}
//project to ortho coordinates
//project to ortho coordinates
viewport[0]=0;
viewport[1]=0;
viewport[2]=1;
@ -826,7 +826,7 @@ void REDUCED_ARRAY::draw_labels() {
get_2d_positions(draw_pos[0],draw_pos[1],draw_pos[2]+(draw_size[2]/2.0f),
model, proj, viewport,z_pos
);
get_2d_positions(draw_pos[0]+draw_size[0]/2.0f,draw_pos[1],draw_pos[2]+draw_size[2],
model, proj, viewport,x_pos
);
@ -837,16 +837,16 @@ void REDUCED_ARRAY::draw_labels() {
glPopMatrix();
mode_ortho();
mode_unshaded();
glColor3d(1,1,1);
mode_unshaded();
glColor3d(1,1,1);
float zpos[3]={(float)z_pos[0],(float)z_pos[1],(float)z_pos[2]};
float xpos[3]={(float)x_pos[0],(float)x_pos[1],(float)x_pos[2]};
float ppos[3]={(float)p_pos[0],(float)p_pos[1],(float)p_pos[2]};
float ppos[3]={(float)p_pos[0],(float)p_pos[1],(float)p_pos[2]};
draw_text_right(zpos,ch,lw,ls,zlabel);
draw_text(xpos,ch,lw,ls,xlabel);
draw_text(ppos,ch,lw,ls,ylabel);
ortho_done();
}
ortho_done();
}

View File

@ -6,12 +6,10 @@
#ifdef _WIN32
#include "boinc_win.h"
#include <gl/gl.h> // Header File For The OpenGL32 Library
#include <gl/glu.h> // Header File For The GLu32 Library
#include <gl/glaux.h> // Header File For The Glaux Library
#include <glut/glut.h>
#endif
#include "boinc_gl.h"
#include "gutil.h"
#define FILENAME "background"

View File

@ -1,10 +1,8 @@
#include "x_opengl.h"
#include <stdio.h>
#include <cstdio>
#ifdef HAVE_GL
#include <GL/glx.h>
#include <GL/gl.h>
#include <GL/glu.h>
#include "boinc_gl.h"
#include "graphics_api.h"
@ -77,7 +75,7 @@ void *p_graphics_loop( void *duff ) {
fprintf(stderr, "glXMakeCurrent failed (window)!\n");
return 0;
}
InitGL();
win_open = true;
@ -90,7 +88,7 @@ void *p_graphics_loop( void *duff ) {
}
// How do we prevent broken pipes and broken connection error messages?
//
//
void process_input(Display *dpy) {
XEvent event;
@ -117,7 +115,7 @@ void process_input(Display *dpy) {
GLvoid buildFont(GLvoid)
{
XFontStruct *font;
main_font = glGenLists(256); /* storage for 256 characters */
/* load a font with a specific name in "Host Portable Character Encoding" */
/*font = XLoadQueryFont(dpy,

View File

@ -2,25 +2,25 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
// burn up to one CPU second
#include <stdio.h>
#include <time.h>
#include <cstdio>
#include <ctime>
int main() {
int now = time(0), i;

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -21,9 +21,9 @@
//
// concatenate files, write to outfile
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include "filesys.h"

View File

@ -2,25 +2,25 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
// crash and burn
#include <stdio.h>
#include <ctype.h>
#include <cstdio>
#include <cctype>
int main() {
char * hello = (char *) 100;

View File

@ -30,30 +30,17 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <signal.h>
#include <cstdio>
#include <cctype>
#include <ctime>
#include <cstring>
#include <cstdlib>
#include <csignal>
#include <unistd.h>
#endif
#ifdef BOINC_APP_GRAPHICS
#ifdef __APPLE_CC__
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include "mac_carbon_gl.h"
#elif _WIN32
#include <gl\gl.h> // Header File For The OpenGL32 Library
#include <gl\glu.h> // Header File For The GLu32 Library
#include <gl\glaux.h> // Header File For The Glaux Library
#elif HAVE_GL_LIB
#include <GL/glx.h>
#include <GL/gl.h>
#include <GL/glu.h>
#endif
#include "boinc_gl.h"
#include "graphics_api.h"
#endif

View File

@ -15145,11 +15145,27 @@ Karl 2004-07-13
- new function generic_check_set() which generalizes
generic_check_set_majority()
- rename validate_test to validate_bitwise
- Cleaned up sample validators and sample assimilator. Renames:
validate_test -> sample_bitwise_validator
validate_trivial -> sample_trivial_validator
assimilator -> sample_dummy_assimilator
sched/
Makefile.am
validate_util.C
validate_util.h
validate_test.C -> validate_bitwise.C
validate.C -> validator.C (consistent w/ assimilator.C)
validate_test.C -> sample_bitwise_validator.C
validate_trivial.C -> sample_trivial_validator.C
assimilate_handler.C -> sample_dummy_assimilator.C
Karl 2004-07-13
- updated #includes of C headers in C++ files to C++ headers
(e.g. <cstdio> instead of <stdio.h>)
- refactored HAVE_GL* preprocessing logic for OpenGL headers
api/
boinc_gl.h (new)
113 files modified

View File

@ -29,9 +29,7 @@
#ifndef _WIN32
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#include <cerrno>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -56,15 +54,13 @@
#if HAVE_FCNTL_H
#include <fcntl.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#include <ctype.h>
#include <time.h>
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <cctype>
#include <ctime>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#endif
@ -1050,7 +1046,7 @@ bool ACTIVE_TASK::read_stderr_file() {
int ACTIVE_TASK::request_reread_prefs() {
int retval;
APP_INIT_DATA aid;
link_user_files();
retval = write_app_init_file(aid);
@ -1643,7 +1639,7 @@ int ACTIVE_TASK_SET::parse(MIOFILE& fin) {
// return the next graphics-capable app
// try to choose an app from a different project
// preferences goes to pre-ss mode WINDOW, then apps with pre-ss mode HIDE
//
//
ACTIVE_TASK* ACTIVE_TASK_SET::get_next_graphics_capable_app() {
static int project_index = 0;
unsigned int i, j;

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -27,7 +27,7 @@
#endif
#ifndef _WIN32
#include <assert.h>
#include <cassert>
#endif
#include "client_state.h"

View File

@ -21,7 +21,7 @@
#include "boinc_win.h"
#endif
#ifndef _WIN32
#include <stdarg.h>
#include <cstdarg>
#include <list>
#endif

View File

@ -30,9 +30,6 @@
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#if HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
@ -40,10 +37,11 @@
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <stdarg.h>
#include <csignal>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cstdarg>
#endif
#include "parse.h"

View File

@ -22,7 +22,7 @@
#ifndef _WIN32
#include <vector>
#include <time.h>
#include <ctime>
#endif
#include "app.h"

View File

@ -22,7 +22,7 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#include <cassert>
#endif

View File

@ -27,9 +27,7 @@
#endif
#ifndef _WIN32
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#endif
#include "md5_file.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -43,9 +43,7 @@
#if HAVE_SYS_WAIT_H
#include <sys/wait.h>
#endif
#if HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#if HAVE_SYS_SIGNAL_H
#include <sys/signal.h>
#endif
@ -53,9 +51,9 @@
#include <unistd.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#endif
#include "error_numbers.h"

View File

@ -40,9 +40,9 @@
#include "boinc_win.h"
#endif
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include "boinc_api.h"
#include "cpu_benchmark.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -24,9 +24,9 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#include <sys/stat.h>
#include <ctype.h>
#include <cctype>
#endif
#include "filesys.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -25,10 +25,10 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stdio.h>
#include <cstdio>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <cstdlib>
#include <cstring>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <arpa/inet.h>

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -37,7 +37,7 @@
using std::vector;
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#endif
#include "gui_rpc_client.h"

View File

@ -22,8 +22,8 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#if HAVE_UNISTD_H
#include <unistd.h>
@ -151,7 +151,7 @@ int get_local_network_info(
sprintf(buf, "/usr/sbin/ping -s %s 1 1 > %s 2>/dev/null", hostname, TEMP_FILE_NAME);
retval = try_ping(buf, domain_name, domlen, ip_addr, iplen);
if (!retval) return 0;
msg_printf(NULL, MSG_INFO, "Couldn't get hostname and IP address");
msg_printf(NULL, MSG_INFO, "Make sure 'ping' is in your search path");

View File

@ -2,27 +2,27 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#include "cpp.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <sys/param.h>
@ -143,16 +143,16 @@ bool HOST_INFO::host_is_running_on_batteries() {
char ac_state[64];
std::string ac_name;
FILE* facpi;
// we need to find the right ac adapter first
// we need to find the right ac adapter first
DirScanner dir("/proc/acpi/ac_adapter/");
while (dir.scan(ac_name)) {
if ((ac_name.c_str()==".")||(ac_name.c_str()=="..")) continue;
// newer ACPI versions use "state" as filename
sprintf(ac_state, "/proc/acpi/ac_adapter/%s/state", ac_name.c_str());
facpi = fopen(ac_state, "r");
if (!facpi) {
if (!facpi) {
// older ACPI versions use "status" instead
sprintf(ac_state, "/proc/acpi/ac_adapter/%s/status", ac_name.c_str());
facpi = fopen(ac_state, "r");
@ -163,7 +163,7 @@ bool HOST_INFO::host_is_running_on_batteries() {
fclose(facpi);
// only valid state if it contains "state" (newer) or "Status" (older)
if ((strstr(buf, "state:") != NULL) || (strstr(buf, "Status:") != NULL)) {
if ((strstr(buf, "state:") != NULL) || (strstr(buf, "Status:") != NULL)) {
// on batteries if ac adapter is "off-line" (or maybe "offline")
retval = (strstr(buf, "off") != NULL);
break;
@ -284,7 +284,7 @@ int HOST_INFO::get_host_info() {
mib[1] = HW_MACHINE;
len = sizeof(p_vendor);
sysctl(mib, 2, &p_vendor, &len, NULL, 0);
// Get model
mib[0] = CTL_HW;
mib[1] = HW_MODEL;
@ -292,7 +292,7 @@ int HOST_INFO::get_host_info() {
sysctl(mib, 2, &p_model, &len, NULL, 0);
#endif
#endif
#if defined(_SC_NPROCESSORS_ONLN)
p_ncpus = sysconf(_SC_NPROCESSORS_ONLN);
@ -344,7 +344,7 @@ int HOST_INFO::get_host_info() {
#elif defined(HAVE_SYS_SYSCTL_H) && defined(CTL_VM) && defined(VM_METER)
// TODO: figure this out
/*vmtotal vm_info;
mib[0] = CTL_VM;
mib[1] = VM_METER;
len = sizeof(vm_info);
@ -354,7 +354,7 @@ int HOST_INFO::get_host_info() {
#else
#endif
#if defined(HAVE_SYS_SYSTEMINFO_H)
#if defined(HAVE_SYS_SYSTEMINFO_H)
#if defined(SI_HW_SERIAL)
sysinfo(SI_HW_SERIAL, serialnum, sizeof(serialnum));
#else
@ -375,7 +375,7 @@ int HOST_INFO::get_host_info() {
}
#endif
#endif
get_local_network_info(
domain_name, sizeof(domain_name), ip_addr, sizeof(ip_addr)
);
@ -391,7 +391,7 @@ int HOST_INFO::get_host_info() {
mib[1] = KERN_OSTYPE;
len = sizeof(os_name);
sysctl(mib, 2, &os_name, &len, NULL, 0);
mib[0] = CTL_KERN;
mib[1] = KERN_OSRELEASE;
len = sizeof(os_version);

View File

@ -35,9 +35,7 @@
#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif
#if HAVE_ERRNO_H
#include <errno.h>
#endif
#include <cerrno>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
@ -339,7 +337,7 @@ int HTTP_OP::init_head(const char* url) {
strcat(id_passwd,pi.http_user_passwd);
encstr = r_base64_encode(id_passwd,strlen(id_passwd));
http_head_request_header_proxy(
request_header, url_hostname, port, proxy_buf, (char*)encstr.c_str()
request_header, url_hostname, port, proxy_buf, (char*)encstr.c_str()
);
}
return 0;

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -24,8 +24,8 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#endif
#include "error_numbers.h"

View File

@ -33,9 +33,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#ifdef HAVE_SIGNAL_H
#include <signal.h>
#endif
#include <csignal>
#include "synch.h"
#endif
@ -238,7 +236,7 @@ int boinc_main_loop(int argc, char** argv) {
#endif
boinc_init_diagnostics(
BOINC_DIAG_DUMPCALLSTACKENABLED |
BOINC_DIAG_DUMPCALLSTACKENABLED |
BOINC_DIAG_HEAPCHECKENABLED |
BOINC_DIAG_TRACETOSTDERR
);

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -31,8 +31,8 @@
#endif
#ifndef _WIN32
#include <string.h>
#include <math.h>
#include <cstring>
#include <cmath>
#endif
#include "parse.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -22,7 +22,7 @@
//
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#endif
#include "net_xfer.h"
@ -49,7 +49,7 @@ public:
NET_STATS();
void poll(NET_XFER_SET&);
int write(MIOFILE&, bool to_server);
int parse(MIOFILE&);
};

View File

@ -33,8 +33,8 @@
#ifndef _WIN32
#include <stdio.h>
#include <math.h>
#include <cstdio>
#include <cmath>
#if HAVE_SYS_TIME_H
#include <sys/time.h>
@ -62,10 +62,10 @@
#endif
#include <sys/types.h>
#include <errno.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#include <cerrno>
#include <cstdlib>
#include <ctime>
#include <cstring>
#endif
@ -76,7 +76,7 @@
#include "client_state.h"
#include "client_msgs.h"
#if defined(_WIN32)
#if defined(_WIN32)
typedef int socklen_t;
#elif defined ( __APPLE__)
typedef int32_t socklen_t;

View File

@ -24,8 +24,8 @@
#endif
#ifndef _WIN32
#include <math.h>
#include <stdlib.h>
#include <cmath>
#include <cstdlib>
#endif
#include "error_numbers.h"
@ -115,7 +115,7 @@ int PERS_FILE_XFER::start_xfer() {
fip->project, MSG_INFO,
"File %s exists already, skipping download", pathname
);
return retval;
}
}

View File

@ -24,9 +24,9 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#endif
#include "parse.h"

View File

@ -2,25 +2,25 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#ifndef _PREFS_
#define _PREFS_
#include <stdio.h>
#include <cstdio>
// Global preferences are edited and stored on BOINC servers.
// The native representation of preferences is XML.

View File

@ -22,10 +22,10 @@
#endif
#ifndef _WIN32
#include <math.h>
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <cmath>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#endif
#include "util.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -39,7 +39,7 @@
#define _SS_LOGIC_
#ifndef _WIN32
#include <time.h>
#include <ctime>
#endif
class SS_LOGIC {

View File

@ -2,25 +2,25 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#include "cpp.h"
#include <stdio.h>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include <stdlib.h>
#include "http.h"
#include "file_xfer.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -23,7 +23,7 @@
#include "winsock.h"
#include "win_net.h"
#endif
#include <stdio.h>
#include <cstdio>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -22,9 +22,9 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <cstdio>
#include <ctime>
#include <cmath>
#endif
#include "parse.h"

View File

@ -24,11 +24,11 @@
#endif
#ifndef _WIN32
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <ctime>
#endif
#include "boinc_api.h"

18
configure vendored
View File

@ -1,5 +1,5 @@
#! /bin/sh
# From configure.ac Revision: 1.108 .
# From configure.ac Revision: 1.111 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.59 for BOINC 4.00.
#
@ -8579,12 +8579,6 @@ _ACEOF
fi
# by default, create static binaries on linux.
#[if [ "$target_os" = "linux-gnu" ]; then
# STATIC_FLAGS="-static"
#fi
#echo "checking static flags... ${STATIC_FLAGS:-(none)}"]
#AC_SUBST(STATIC_FLAGS)
ac_config_files="$ac_config_files Makefile RSAEuro/source/Makefile RSAEuro/Makefile api/Makefile apps/Makefile client/Makefile db/Makefile lib/Makefile sched/Makefile tools/Makefile test/Makefile test/version.inc py/Makefile py/Boinc/Makefile py/Boinc/version.py py/Boinc/boinc_path_config.py:py/Boinc/boinc_path_config.py.in py/boinc_path_config.py:py/Boinc/boinc_path_config.py.in client/win/boinc_path_config.py:py/Boinc/boinc_path_config.py.in sched/boinc_path_config.py:py/Boinc/boinc_path_config.py.in tools/boinc_path_config.py:py/Boinc/boinc_path_config.py.in test/boinc_path_config.py:py/Boinc/boinc_path_config.py.in"
@ -10105,3 +10099,13 @@ EOF
)
if test "${enable_server}" = yes ; then
cat<<EOF
We recommend you run test/test_sanity.py to make sure your host is configured
properly for building the BOINC server.
EOF
fi

View File

@ -21,7 +21,7 @@
#include <cstring>
#include <ctime>
#include <unistd.h>
#include <math.h>
#include <cmath>
#include "util.h"
#include "boinc_db.h"

View File

@ -27,7 +27,7 @@
// The parse and write functions are for use in scheduler RPC.
// They don't necessarily serialize the entire records.
#include <stdio.h>
#include <cstdio>
#include <vector>
#include "db_base.h"

View File

@ -1,6 +1,6 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include "error_numbers.h"
#include "util.h"

View File

@ -22,7 +22,7 @@
#endif
#ifndef _WIN32
#include <string.h>
#include <cstring>
#endif
#include "boinc_api.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -35,7 +35,7 @@
#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.
#define _WIN32_WINNT 0x0400 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.
#define _WIN32_WINDOWS 0x0400 // Change this to the appropriate value to target Windows Me or later.
@ -83,17 +83,24 @@
// Standard Libraries
//
// Standard Template libraries
// C headers
#include <sys/stat.h>
#include <sys/types.h>
#include <cassert>
#include <cerrno>
#include <algorithm>
#include <cctype>
#include <ctime>
#include <cerrno>
#include <cerrno>
#include <cmath>
#include <csetjmp>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <cstring>
#include <ctime>
#include <fcntl.h>
// C++ headers
#include <algorithm>
#include <string>
#include <iostream>
#include <fstream>
@ -103,14 +110,6 @@
#include <locale>
// Standard C Runtime libraries
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <fcntl.h>
#include <setjmp.h>
#define vsnprintf _vsnprintf
#define snprintf _snprintf
#define fdopen _fdopen
@ -141,17 +140,17 @@
#define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__)
// The following macros set and clear, respectively, given bits
// of the C runtime library debug flag, as specified by a bitmask.
#define SET_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#define CLEAR_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
// The following macros set and clear, respectively, given bits
// of the C runtime library debug flag, as specified by a bitmask.
#define SET_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag((a) | _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#define CLEAR_CRT_DEBUG_FIELD(a) _CrtSetDbgFlag(~(a) & _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG))
#else //_DEBUG
#define DEBUG_NEW new
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
#define SET_CRT_DEBUG_FIELD(a) ((void) 0)
#define CLEAR_CRT_DEBUG_FIELD(a) ((void) 0)
#endif //_DEBUG

View File

@ -23,8 +23,8 @@
#ifndef _WIN32
#include <cctype>
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -21,7 +21,7 @@
#define H_CRYPT
// some interface functions for RSAEuro
#include <stdio.h>
#include <cstdio>
#include "rsaeuro.h"
extern "C" {

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -31,8 +31,8 @@
// -test_crypt private_keyfile public_keyfile
// test encrypt/decrypt
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include "rsaeuro.h"

View File

@ -15,7 +15,7 @@
// University of California at Berkeley. All Rights Reserved.
//
// Purpose:
//
//
//
//
// Contributor(s):
@ -26,12 +26,9 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#ifdef HAVE_SIGNAL_H
//#include <signal.h>
#endif
#include <cstdio>
#include <cstdarg>
#include <cstdlib>
#include "config.h"
#endif
@ -67,7 +64,7 @@ int boinc_init_diagnostics(int _flags) {
boinc_copy( BOINC_DIAG_STDOUT, BOINC_DIAG_STDOUTOLD );
}
// Redirect stderr and/or stdout streams, if requested
if (flags & BOINC_DIAG_REDIRECTSTDERR ) {
lpRetVal = (void*) freopen(BOINC_DIAG_STDERR, "a", stderr);
@ -219,7 +216,7 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) {
LONG lReturnValue = NULL;
char status[256];
char substatus[256];
static long lDetectNestedException = 0;
// If we've been in this procedure before, something went wrong so we immediately exit
@ -241,73 +238,73 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) {
}
}
break;
case EXCEPTION_DATATYPE_MISALIGNMENT:
case EXCEPTION_DATATYPE_MISALIGNMENT:
safe_strncpy( status, "Data Type Misalignment", sizeof(status) );
break;
case EXCEPTION_BREAKPOINT:
case EXCEPTION_BREAKPOINT:
safe_strncpy( status, "Breakpoint Encountered", sizeof(status) );
break;
case EXCEPTION_SINGLE_STEP:
case EXCEPTION_SINGLE_STEP:
safe_strncpy( status, "Single Instruction Executed", sizeof(status) );
break;
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
case EXCEPTION_ARRAY_BOUNDS_EXCEEDED:
safe_strncpy( status, "Array Bounds Exceeded", sizeof(status) );
break;
case EXCEPTION_FLT_DENORMAL_OPERAND:
case EXCEPTION_FLT_DENORMAL_OPERAND:
safe_strncpy( status, "Float Denormal Operand", sizeof(status) );
break;
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
safe_strncpy( status, "Divide by Zero", sizeof(status) );
case EXCEPTION_FLT_DIVIDE_BY_ZERO:
safe_strncpy( status, "Divide by Zero", sizeof(status) );
break;
case EXCEPTION_FLT_INEXACT_RESULT:
safe_strncpy( status, "Float Inexact Result", sizeof(status) );
case EXCEPTION_FLT_INEXACT_RESULT:
safe_strncpy( status, "Float Inexact Result", sizeof(status) );
break;
case EXCEPTION_FLT_INVALID_OPERATION:
case EXCEPTION_FLT_INVALID_OPERATION:
safe_strncpy( status, "Float Invalid Operation", sizeof(status) );
break;
case EXCEPTION_FLT_OVERFLOW:
case EXCEPTION_FLT_OVERFLOW:
safe_strncpy( status, "Float Overflow", sizeof(status) );
break;
case EXCEPTION_FLT_STACK_CHECK:
case EXCEPTION_FLT_STACK_CHECK:
safe_strncpy( status, "Float Stack Check", sizeof(status) );
break;
case EXCEPTION_FLT_UNDERFLOW:
case EXCEPTION_FLT_UNDERFLOW:
safe_strncpy( status, "Float Underflow", sizeof(status) );
break;
case EXCEPTION_INT_DIVIDE_BY_ZERO:
case EXCEPTION_INT_DIVIDE_BY_ZERO:
safe_strncpy( status, "Integer Divide by Zero", sizeof(status) );
break;
case EXCEPTION_INT_OVERFLOW:
case EXCEPTION_INT_OVERFLOW:
safe_strncpy( status, "Integer Overflow", sizeof(status) );
break;
case EXCEPTION_PRIV_INSTRUCTION:
case EXCEPTION_PRIV_INSTRUCTION:
safe_strncpy( status, "Privileged Instruction", sizeof(status) );
break;
case EXCEPTION_IN_PAGE_ERROR:
case EXCEPTION_IN_PAGE_ERROR:
safe_strncpy( status, "In Page Error", sizeof(status) );
break;
case EXCEPTION_ILLEGAL_INSTRUCTION:
case EXCEPTION_ILLEGAL_INSTRUCTION:
safe_strncpy( status, "Illegal Instruction", sizeof(status) );
break;
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
case EXCEPTION_NONCONTINUABLE_EXCEPTION:
safe_strncpy( status, "Noncontinuable Exception", sizeof(status) );
break;
case EXCEPTION_STACK_OVERFLOW:
case EXCEPTION_STACK_OVERFLOW:
safe_strncpy( status, "Stack Overflow", sizeof(status) );
break;
case EXCEPTION_INVALID_DISPOSITION:
case EXCEPTION_INVALID_DISPOSITION:
safe_strncpy( status, "Invalid Disposition", sizeof(status) );
break;
case EXCEPTION_GUARD_PAGE:
case EXCEPTION_GUARD_PAGE:
safe_strncpy( status, "Guard Page Violation", sizeof(status) );
break;
case EXCEPTION_INVALID_HANDLE:
case EXCEPTION_INVALID_HANDLE:
safe_strncpy( status, "Invalid Handle", sizeof(status) );
break;
case CONTROL_C_EXIT:
case CONTROL_C_EXIT:
safe_strncpy( status, "Ctrl+C Exit", sizeof(status) );
break;
default:
default:
safe_strncpy( status, "Unknown exception", sizeof(status) );
break;
}
@ -340,8 +337,8 @@ LONG CALLBACK boinc_catch_signal(EXCEPTION_POINTERS *pExPtrs) {
// Trap ASSERTs and TRACEs from the CRT and spew them to stderr.
//
int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){
(*retVal) = 0;
int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){
(*retVal) = 0;
switch(reportType){
@ -349,12 +346,12 @@ int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){
case _CRT_ERROR:
OutputDebugString(szMsg); // Reports string to the debugger output window
if (flags & BOINC_DIAG_TRACETOSTDERR ) {
fprintf( stderr, szMsg );
fflush( stderr );
}
if (flags & BOINC_DIAG_TRACETOSTDOUT ) {
fprintf( stdout, szMsg );
fflush( stdout );
@ -376,7 +373,7 @@ int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){
}
return(TRUE);
}
}
// Converts the BOINCTRACE macro into a single string and report it
@ -385,7 +382,7 @@ int __cdecl boinc_message_reporting( int reportType, char *szMsg, int *retVal ){
void boinc_trace(const char *pszFormat, ...) {
static char szBuffer[1024];
// Trace messages should only be reported if running as a standalone
// Trace messages should only be reported if running as a standalone
// application or told too.
if ((flags & BOINC_DIAG_TRACETOSTDERR) ||
(flags & BOINC_DIAG_TRACETOSTDOUT) ) {

View File

@ -69,7 +69,7 @@ void boinc_info_release(const char *pszFormat, ...);
#endif // _DEBUG
#else // non-Win starts here
#include <signal.h>
#include <csignal>
extern void boinc_set_signal_handler(int sig, void(*handler)(int));
extern void boinc_set_signal_handler_force(int sig, void(*handler)(int));
#endif // _WIN32

View File

@ -22,14 +22,14 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#include <fcntl.h>
#include <errno.h>
#include <cerrno>
#include <sys/stat.h>
#include <sys/file.h>
#include <time.h>
#include <string.h>
#include <stdlib.h>
#include <ctime>
#include <cstring>
#include <cstdlib>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h>
@ -193,7 +193,7 @@ DirScanner::DirScanner(string const& path) {
bool DirScanner::scan(string& s) {
#ifdef HAVE_DIRENT_H
if (!dirp) return false;
while (1) {
dirent* dp = readdir(dirp);
if (dp) {

View File

@ -6,18 +6,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -38,7 +38,7 @@ typedef DIR_DESC *DIRREF;
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#include <string>
#ifdef HAVE_DIRENT_H

View File

@ -22,8 +22,8 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#if HAVE_UNISTD_H
#include <unistd.h>

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -22,8 +22,8 @@
#endif
#ifndef _WIN32
#include <string.h>
#include <stdlib.h>
#include <cstring>
#include <cstdlib>
#endif
#include "util.h"
@ -44,7 +44,7 @@ int LANGUAGE::read_language_file(char *file_name) {
int retval;
// TODO: put in a size limitation here?
if (language_file_contents) free(language_file_contents);
language_file_contents = NULL;

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -27,7 +27,7 @@
#define _LANGUAGE_H_
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#endif
class LANGUAGE {

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -22,7 +22,7 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <cstdio>
#endif
#include "md5.h"

View File

@ -1,4 +1,4 @@
#include <stdio.h>
#include <cstdio>
#include "md5_file.h"

View File

@ -22,12 +22,12 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <cstring>
#include <string>
#include <errno.h>
#include <cerrno>
#if HAVE_MALLOC_H
#include <malloc.h>
#endif

View File

@ -2,26 +2,26 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#ifndef _MFILE_
#define _MFILE_
#include <stdio.h>
#include <stdarg.h>
#include <cstdio>
#include <cstdarg>
// MFILE supports a primitive form of checkpointing.
// Write all your output (and restart file) to MFILEs.

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -23,8 +23,8 @@
#ifndef _WIN32
#include <string>
#include <string.h>
#include <stdarg.h>
#include <cstring>
#include <cstdarg>
#endif
#include "error_numbers.h"

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
@ -22,8 +22,8 @@
#endif
#ifndef _WIN32
#include <assert.h>
#include <string.h>
#include <cassert>
#include <cstring>
#include <string>
#endif

View File

@ -1,4 +1,4 @@
#include <stdio.h>
#include <cstdio>
#include <cstdarg>
// the __attribute((format...)) tags are GCC extensions that let the compiler

View File

@ -2,25 +2,25 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
// interfaces for accessing message queues
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include "msg_queue.h"

View File

@ -8,8 +8,8 @@
#define KEY 0xb01fcafe
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include "msg_queue.h"

View File

@ -29,8 +29,8 @@
#endif
#ifndef _WIN32
#include <string.h>
#include <stdlib.h>
#include <cstring>
#include <cstdlib>
#include <string>
#endif

View File

@ -24,8 +24,8 @@
#endif
#ifndef _WIN32
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include <sys/types.h>
#include <assert.h>
@ -61,7 +61,7 @@ HANDLE create_shmem(LPCTSTR seg_name, int size, void** pp) {
hSharedMem = CreateFileMapping(INVALID_HANDLE_VALUE, &security,
PAGE_READWRITE, 0, size, seg_name);
if (!hSharedMem) return NULL;
if (hSharedMem && (ERROR_ALREADY_EXISTS == GetLastError())) return NULL;
if (hSharedMem && (ERROR_ALREADY_EXISTS == GetLastError())) return NULL;
pMemPtr = MapViewOfFile( hSharedMem, FILE_MAP_ALL_ACCESS, 0, 0, 0 );
if (pp) *pp = pMemPtr;

View File

@ -6,8 +6,8 @@
#define KEY 0xbeefcafe
#include <string.h>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <sys/wait.h>
#include <unistd.h>

View File

@ -2,18 +2,18 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#ifndef _STD_FIXES_H_
@ -74,7 +74,7 @@ o_iterator transform(i_iterator first, i_iterator last, o_iterator res, OP op) {
#if defined(LARGEFILE_BREAKS_CXX) && (defined(_LARGE_FILES) || (_FILE_OFFSET_BITS==64))
#include <stdio.h>
#include <cstdio>
#undef fopen
#undef freopen

View File

@ -2,26 +2,26 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
// interfaces for accessing sempahores
#include <stdio.h>
#include <string.h>
#include <cstdio>
#include <cstring>
#include "error_numbers.h"
#include "synch.h"

View File

@ -3,8 +3,6 @@
// -l lock semaphore, sleep 10 secs, unlock
#include <unistd.h>
#include <strings.h>
#include <string.h>
#include "synch.h"

View File

@ -36,7 +36,6 @@
#endif
#include <fstream>
#include <cctype>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

View File

@ -276,13 +276,15 @@ def install_boinc_files(dest_dir):
map(lambda (s): install(builddir('sched',s), dir('cgi-bin',s)),
[ 'cgi', 'file_upload_handler'])
map(lambda (s): install(builddir('sched',s), dir('bin',s)),
[ 'make_work', 'feeder', 'transitioner', 'validate_test', 'validate_trivial',
'file_deleter', 'assimilator', 'update_stats', 'db_dump' ])
[ 'make_work', 'feeder', 'transitioner',
'sample_bitwise_validator', 'sample_trivial_validator',
'file_deleter', 'sample_dummy_assimilator',
'update_stats', 'db_dump' ])
map(lambda (s): install(srcdir('sched',s), dir('bin',s)),
[ 'start', 'stop', 'status' ])
map(lambda (s): install(srcdir('tools',s), dir('bin',s)),
[ 'boinc_path_config.py', 'create_work', 'add', 'xadd', 'dbcheck_files_exist',
'update_versions', 'upgrade', 'parse_config', 'grep_logs', 'db_query',
'update_versions', 'upgrade', 'parse_config', 'grep_logs', 'db_query',
'watch_tcp' ])

View File

@ -18,7 +18,7 @@
SOURCES = $(libsched_a_SOURCES) $(assimilator_SOURCES) $(cgi_SOURCES) $(db_dump_SOURCES) $(fcgi_SOURCES) $(feeder_SOURCES) $(file_deleter_SOURCES) $(file_upload_handler_SOURCES) $(make_work_SOURCES) $(message_handler_SOURCES) $(show_shmem_SOURCES) $(transitioner_SOURCES) $(update_stats_SOURCES) $(validate_test_SOURCES) $(validate_trivial_SOURCES) $(wu_check_SOURCES)
SOURCES = $(libsched_a_SOURCES) $(cgi_SOURCES) $(db_dump_SOURCES) $(fcgi_SOURCES) $(feeder_SOURCES) $(file_deleter_SOURCES) $(file_upload_handler_SOURCES) $(make_work_SOURCES) $(message_handler_SOURCES) $(sample_bitwise_validator_SOURCES) $(sample_dummy_assimilator_SOURCES) $(sample_trivial_validator_SOURCES) $(show_shmem_SOURCES) $(transitioner_SOURCES) $(update_stats_SOURCES) $(wu_check_SOURCES)
srcdir = @srcdir@
top_srcdir = @top_srcdir@
@ -46,13 +46,13 @@ target_triplet = @target@
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(top_srcdir)/Makefile.incl \
$(top_srcdir)/py/Boinc/boinc_path_config.py.in
noinst_PROGRAMS = assimilator$(EXEEXT) cgi$(EXEEXT) feeder$(EXEEXT) \
db_dump$(EXEEXT) file_deleter$(EXEEXT) \
file_upload_handler$(EXEEXT) make_work$(EXEEXT) \
show_shmem$(EXEEXT) transitioner$(EXEEXT) \
noinst_PROGRAMS = cgi$(EXEEXT) feeder$(EXEEXT) db_dump$(EXEEXT) \
file_deleter$(EXEEXT) file_upload_handler$(EXEEXT) \
make_work$(EXEEXT) show_shmem$(EXEEXT) transitioner$(EXEEXT) \
message_handler$(EXEEXT) update_stats$(EXEEXT) \
validate_test$(EXEEXT) validate_trivial$(EXEEXT) \
wu_check$(EXEEXT)
sample_dummy_assimilator$(EXEEXT) \
sample_bitwise_validator$(EXEEXT) \
sample_trivial_validator$(EXEEXT) wu_check$(EXEEXT)
EXTRA_PROGRAMS = fcgi$(EXEEXT)
subdir = sched
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -79,15 +79,11 @@ am_libsched_a_OBJECTS = sched_shmem.$(OBJEXT) sched_util.$(OBJEXT) \
backend_lib.$(OBJEXT)
libsched_a_OBJECTS = $(am_libsched_a_OBJECTS)
PROGRAMS = $(noinst_PROGRAMS)
am_assimilator_OBJECTS = assimilator.$(OBJEXT) \
assimilate_handler.$(OBJEXT)
assimilator_OBJECTS = $(am_assimilator_OBJECTS)
assimilator_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
am_cgi_OBJECTS = handle_request.$(OBJEXT) main.$(OBJEXT) \
sched_send.$(OBJEXT) server_types.$(OBJEXT) synch.$(OBJEXT)
cgi_OBJECTS = $(am_cgi_OBJECTS)
cgi_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
am_db_dump_OBJECTS = db_dump.$(OBJEXT)
db_dump_OBJECTS = $(am_db_dump_OBJECTS)
db_dump_LDADD = $(LDADD)
@ -117,6 +113,21 @@ am_make_work_OBJECTS = make_work.$(OBJEXT)
make_work_OBJECTS = $(am_make_work_OBJECTS)
am_message_handler_OBJECTS = message_handler.$(OBJEXT)
message_handler_OBJECTS = $(am_message_handler_OBJECTS)
am_sample_bitwise_validator_OBJECTS = validator.$(OBJEXT) \
sample_bitwise_validator.$(OBJEXT) validate_util.$(OBJEXT)
sample_bitwise_validator_OBJECTS = \
$(am_sample_bitwise_validator_OBJECTS)
sample_bitwise_validator_LDADD = $(LDADD)
am_sample_dummy_assimilator_OBJECTS = assimilator.$(OBJEXT) \
sample_dummy_assimilator.$(OBJEXT)
sample_dummy_assimilator_OBJECTS = \
$(am_sample_dummy_assimilator_OBJECTS)
sample_dummy_assimilator_LDADD = $(LDADD)
am_sample_trivial_validator_OBJECTS = validator.$(OBJEXT) \
sample_trivial_validator.$(OBJEXT) validate_util.$(OBJEXT)
sample_trivial_validator_OBJECTS = \
$(am_sample_trivial_validator_OBJECTS)
sample_trivial_validator_LDADD = $(LDADD)
am_show_shmem_OBJECTS = show_shmem.$(OBJEXT)
show_shmem_OBJECTS = $(am_show_shmem_OBJECTS)
show_shmem_LDADD = $(LDADD)
@ -125,14 +136,6 @@ transitioner_OBJECTS = $(am_transitioner_OBJECTS)
am_update_stats_OBJECTS = update_stats.$(OBJEXT)
update_stats_OBJECTS = $(am_update_stats_OBJECTS)
update_stats_LDADD = $(LDADD)
am_validate_test_OBJECTS = validate.$(OBJEXT) validate_test.$(OBJEXT) \
validate_util.$(OBJEXT)
validate_test_OBJECTS = $(am_validate_test_OBJECTS)
validate_test_LDADD = $(LDADD)
am_validate_trivial_OBJECTS = validate.$(OBJEXT) \
validate_trivial.$(OBJEXT) validate_util.$(OBJEXT)
validate_trivial_OBJECTS = $(am_validate_trivial_OBJECTS)
validate_trivial_LDADD = $(LDADD)
am_wu_check_OBJECTS = wu_check.$(OBJEXT)
wu_check_OBJECTS = $(am_wu_check_OBJECTS)
wu_check_LDADD = $(LDADD)
@ -142,8 +145,7 @@ SCRIPTS = $(bin_SCRIPTS)
DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/assimilate_handler.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/assimilator.Po \
@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/assimilator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/backend_lib.Po ./$(DEPDIR)/base64.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/boinc_db.Po ./$(DEPDIR)/crypt.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/db_base.Po ./$(DEPDIR)/db_dump.Po \
@ -176,6 +178,9 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/message_handler.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/msg_log.Po ./$(DEPDIR)/parse.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/process_result_template.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sample_bitwise_validator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sample_dummy_assimilator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sample_trivial_validator.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sched_config.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sched_msgs.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/sched_send.Po \
@ -185,11 +190,8 @@ am__depfiles_maybe = depfiles
@AMDEP_TRUE@ ./$(DEPDIR)/show_shmem.Po ./$(DEPDIR)/synch.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/transitioner.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/update_stats.Po ./$(DEPDIR)/util.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/validate.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/validate_test.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/validate_trivial.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/validate_util.Po \
@AMDEP_TRUE@ ./$(DEPDIR)/wu_check.Po
@AMDEP_TRUE@ ./$(DEPDIR)/validator.Po ./$(DEPDIR)/wu_check.Po
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
@ -199,20 +201,21 @@ COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libsched_a_SOURCES) $(assimilator_SOURCES) $(cgi_SOURCES) \
$(db_dump_SOURCES) $(fcgi_SOURCES) $(feeder_SOURCES) \
$(file_deleter_SOURCES) $(file_upload_handler_SOURCES) \
$(make_work_SOURCES) $(message_handler_SOURCES) \
$(show_shmem_SOURCES) $(transitioner_SOURCES) \
$(update_stats_SOURCES) $(validate_test_SOURCES) \
$(validate_trivial_SOURCES) $(wu_check_SOURCES)
DIST_SOURCES = $(libsched_a_SOURCES) $(assimilator_SOURCES) \
$(cgi_SOURCES) $(db_dump_SOURCES) $(fcgi_SOURCES) \
$(feeder_SOURCES) $(file_deleter_SOURCES) \
SOURCES = $(libsched_a_SOURCES) $(cgi_SOURCES) $(db_dump_SOURCES) \
$(fcgi_SOURCES) $(feeder_SOURCES) $(file_deleter_SOURCES) \
$(file_upload_handler_SOURCES) $(make_work_SOURCES) \
$(message_handler_SOURCES) $(show_shmem_SOURCES) \
$(message_handler_SOURCES) $(sample_bitwise_validator_SOURCES) \
$(sample_dummy_assimilator_SOURCES) \
$(sample_trivial_validator_SOURCES) $(show_shmem_SOURCES) \
$(transitioner_SOURCES) $(update_stats_SOURCES) \
$(wu_check_SOURCES)
DIST_SOURCES = $(libsched_a_SOURCES) $(cgi_SOURCES) $(db_dump_SOURCES) \
$(fcgi_SOURCES) $(feeder_SOURCES) $(file_deleter_SOURCES) \
$(file_upload_handler_SOURCES) $(make_work_SOURCES) \
$(message_handler_SOURCES) $(sample_bitwise_validator_SOURCES) \
$(sample_dummy_assimilator_SOURCES) \
$(sample_trivial_validator_SOURCES) $(show_shmem_SOURCES) \
$(transitioner_SOURCES) $(update_stats_SOURCES) \
$(validate_test_SOURCES) $(validate_trivial_SOURCES) \
$(wu_check_SOURCES)
ETAGS = etags
CTAGS = ctags
@ -392,14 +395,14 @@ wu_check_SOURCES = wu_check.C
wu_check_DEPENDENCIES = $(LIB_SCHED)
show_shmem_SOURCES = show_shmem.C
show_shmem_DEPENDENCIES = $(LIB_SCHED)
validate_test_SOURCES = validate.C validate_test.C validate_util.C validate_util.h
validate_test_DEPENDENCIES = $(LIB_SCHED)
validate_trivial_SOURCES = validate.C validate_trivial.C validate_util.C validate_util.h
validate_trivial_DEPENDENCIES = $(LIB_SCHED)
file_deleter_SOURCES = file_deleter.C
file_deleter_DEPENDENCIES = $(LIB_SCHED)
assimilator_SOURCES = assimilator.C assimilate_handler.C
assimilator_DEPENDENCIES = $(LIB_SCHED)
sample_bitwise_validator_SOURCES = validator.C sample_bitwise_validator.C validate_util.C validate_util.h
sample_bitwise_validator_DEPENDENCIES = $(LIB_SCHED)
sample_trivial_validator_SOURCES = validator.C sample_trivial_validator.C validate_util.C validate_util.h
sample_trivial_validator_DEPENDENCIES = $(LIB_SCHED)
sample_dummy_assimilator_SOURCES = assimilator.C sample_dummy_assimilator.C
sample_dummy_assimilator_DEPENDENCIES = $(LIB_SCHED)
db_dump_SOURCES = db_dump.C
db_dump_DEPENDENCIES = $(LIB_SCHED)
update_stats_SOURCES = update_stats.C
@ -488,9 +491,6 @@ libsched.a: $(libsched_a_OBJECTS) $(libsched_a_DEPENDENCIES)
clean-noinstPROGRAMS:
-test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
assimilator$(EXEEXT): $(assimilator_OBJECTS) $(assimilator_DEPENDENCIES)
@rm -f assimilator$(EXEEXT)
$(CXXLINK) $(assimilator_LDFLAGS) $(assimilator_OBJECTS) $(assimilator_LDADD) $(LIBS)
cgi$(EXEEXT): $(cgi_OBJECTS) $(cgi_DEPENDENCIES)
@rm -f cgi$(EXEEXT)
$(CXXLINK) $(cgi_LDFLAGS) $(cgi_OBJECTS) $(cgi_LDADD) $(LIBS)
@ -515,6 +515,15 @@ make_work$(EXEEXT): $(make_work_OBJECTS) $(make_work_DEPENDENCIES)
message_handler$(EXEEXT): $(message_handler_OBJECTS) $(message_handler_DEPENDENCIES)
@rm -f message_handler$(EXEEXT)
$(CXXLINK) $(message_handler_LDFLAGS) $(message_handler_OBJECTS) $(message_handler_LDADD) $(LIBS)
sample_bitwise_validator$(EXEEXT): $(sample_bitwise_validator_OBJECTS) $(sample_bitwise_validator_DEPENDENCIES)
@rm -f sample_bitwise_validator$(EXEEXT)
$(CXXLINK) $(sample_bitwise_validator_LDFLAGS) $(sample_bitwise_validator_OBJECTS) $(sample_bitwise_validator_LDADD) $(LIBS)
sample_dummy_assimilator$(EXEEXT): $(sample_dummy_assimilator_OBJECTS) $(sample_dummy_assimilator_DEPENDENCIES)
@rm -f sample_dummy_assimilator$(EXEEXT)
$(CXXLINK) $(sample_dummy_assimilator_LDFLAGS) $(sample_dummy_assimilator_OBJECTS) $(sample_dummy_assimilator_LDADD) $(LIBS)
sample_trivial_validator$(EXEEXT): $(sample_trivial_validator_OBJECTS) $(sample_trivial_validator_DEPENDENCIES)
@rm -f sample_trivial_validator$(EXEEXT)
$(CXXLINK) $(sample_trivial_validator_LDFLAGS) $(sample_trivial_validator_OBJECTS) $(sample_trivial_validator_LDADD) $(LIBS)
show_shmem$(EXEEXT): $(show_shmem_OBJECTS) $(show_shmem_DEPENDENCIES)
@rm -f show_shmem$(EXEEXT)
$(CXXLINK) $(show_shmem_LDFLAGS) $(show_shmem_OBJECTS) $(show_shmem_LDADD) $(LIBS)
@ -524,12 +533,6 @@ transitioner$(EXEEXT): $(transitioner_OBJECTS) $(transitioner_DEPENDENCIES)
update_stats$(EXEEXT): $(update_stats_OBJECTS) $(update_stats_DEPENDENCIES)
@rm -f update_stats$(EXEEXT)
$(CXXLINK) $(update_stats_LDFLAGS) $(update_stats_OBJECTS) $(update_stats_LDADD) $(LIBS)
validate_test$(EXEEXT): $(validate_test_OBJECTS) $(validate_test_DEPENDENCIES)
@rm -f validate_test$(EXEEXT)
$(CXXLINK) $(validate_test_LDFLAGS) $(validate_test_OBJECTS) $(validate_test_LDADD) $(LIBS)
validate_trivial$(EXEEXT): $(validate_trivial_OBJECTS) $(validate_trivial_DEPENDENCIES)
@rm -f validate_trivial$(EXEEXT)
$(CXXLINK) $(validate_trivial_LDFLAGS) $(validate_trivial_OBJECTS) $(validate_trivial_LDADD) $(LIBS)
wu_check$(EXEEXT): $(wu_check_OBJECTS) $(wu_check_DEPENDENCIES)
@rm -f wu_check$(EXEEXT)
$(CXXLINK) $(wu_check_LDFLAGS) $(wu_check_OBJECTS) $(wu_check_LDADD) $(LIBS)
@ -559,7 +562,6 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assimilate_handler.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/assimilator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/backend_lib.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Po@am__quote@
@ -602,6 +604,9 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/msg_log.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/process_result_template.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample_bitwise_validator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample_dummy_assimilator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sample_trivial_validator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_config.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_msgs.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sched_send.Po@am__quote@
@ -614,10 +619,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/transitioner.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/update_stats.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validate.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validate_test.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validate_trivial.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validate_util.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/validator.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wu_check.Po@am__quote@
.C.o:

View File

@ -20,10 +20,10 @@
// assimilator [ -noinsert ]
//
#include <string.h>
#include <stdlib.h>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <time.h>
#include <ctime>
#include <vector>
#include "boinc_db.h"

View File

@ -40,9 +40,9 @@
// ...
// </boinc_db_dump_spec>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
@ -570,7 +570,7 @@ int print_app(FILE* f, APP& app) {
fprintf(f, " <results_over>%d</results_over>\n", n);
}
#endif
fprintf(f, " </application>\n");
return 0;
}

View File

@ -1,4 +1,4 @@
/*
/*
* fcgi_stdio.h --
*
* FastCGI-stdio compatibility package
@ -12,7 +12,7 @@
* $Id$
*/
#include <stdio.h>
#include <cstdio>
#ifndef _FCGI_STDIO
#define _FCGI_STDIO 1

View File

@ -15,12 +15,7 @@
#ifndef _FCGIAPP_H
#define _FCGIAPP_H
/* Hack to see if we are building TCL - TCL needs varargs not stdarg */
#ifndef TCL_LIBRARY
#include <stdarg.h>
#else
#include <varargs.h>
#endif
#include <cstdarg>
#ifndef DLLAPI
#ifdef _WIN32
@ -232,7 +227,7 @@ DLLAPI void FCGX_Finish_r(FCGX_Request *request);
*
* FCGX_Free --
*
* Free the memory and, if close is true,
* Free the memory and, if close is true,
* IPC FD associated with the request (multi-thread safe).
*
*----------------------------------------------------------------------
@ -584,7 +579,7 @@ DLLAPI void FCGX_ClearError(FCGX_Stream *stream);
*
* FCGX_CreateWriter --
*
* Create a FCGX_Stream (used by cgi-fcgi). This shouldn't
* Create a FCGX_Stream (used by cgi-fcgi). This shouldn't
* be needed by a FastCGI applictaion.
*
*----------------------------------------------------------------------
@ -600,7 +595,7 @@ DLLAPI FCGX_Stream *FCGX_CreateWriter(
*
* FCGX_FreeStream --
*
* Free a FCGX_Stream (used by cgi-fcgi). This shouldn't
* Free a FCGX_Stream (used by cgi-fcgi). This shouldn't
* be needed by a FastCGI applictaion.
*
*----------------------------------------------------------------------

View File

@ -77,10 +77,10 @@
// configuration, or decrease the MAX_PLATFORMS, MAX_APPS
// MAX_APP_VERSIONS, and MAX_WU_RESULTS in sched_shmem.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif

View File

@ -20,9 +20,9 @@
// file_deleter: deletes files that are no longer needed
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <cstring>
#include <cstdlib>
#include <ctime>
#include <unistd.h>
#include "boinc_db.h"

View File

@ -20,17 +20,17 @@
// See doc/upload.html for protocol spec.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <cerrno>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#include <signal.h>
#endif
#include <csignal>
#include "crypt.h"
#include "parse.h"

View File

@ -23,12 +23,12 @@
#include <string>
using namespace std;
#include <stdio.h>
#include <cstdio>
#include <unistd.h>
#include <sys/wait.h>
#include <time.h>
#include <assert.h>
#include <math.h>
#include <ctime>
#include <cassert>
#include <cmath>
#include "boinc_db.h"
#include "backend_lib.h"

View File

@ -2,22 +2,22 @@
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
#include <stdio.h>
#include <cstdio>
#include "sched_shmem.h"
#include "server_types.h"

View File

@ -21,14 +21,13 @@
//
// command-line options:
//#include <iostream>
#include <vector>
#include <string>
using namespace std;
#include <stdio.h>
#include <cstdio>
#include <unistd.h>
#include <assert.h>
#include <cassert>
#include <sys/stat.h>
#include <sys/types.h>

View File

@ -27,11 +27,11 @@
// Clones the WU of the given name.
//
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <unistd.h>
#include <time.h>
#include <ctime>
#include "boinc_db.h"
#include "crypt.h"

View File

@ -19,7 +19,7 @@
// Parse a server configuration file
#include <string.h>
#include <cstring>
#include <unistd.h>
#include <string>

View File

@ -21,9 +21,9 @@
// the feeder (which reads from the database)
// and instances of the scheduling server
#include <stdio.h>
#include <string.h>
#include <assert.h>
#include <cstdio>
#include <cstring>
#include <cassert>
#include "boinc_db.h"
#include "error_numbers.h"

View File

@ -19,8 +19,8 @@
using namespace std;
#include <stdlib.h>
#include <signal.h>
#include <cstdlib>
#include <csignal>
#include <unistd.h>
#include "filesys.h"

View File

@ -21,8 +21,8 @@
#include <string>
using namespace std;
#include <strings.h>
#include <assert.h>
// #include <strings.h>
#include <cassert>
#include "parse.h"
#include "error_numbers.h"
@ -319,7 +319,7 @@ int SCHEDULER_REPLY::write(FILE* fout) {
MSG_TO_HOST& md = msgs_to_host[i];
fprintf(fout, "%s\n", md.xml);
}
if (config.non_cpu_intensive) {
fprintf(fout, "<non_cpu_intensive/>\n");
}

View File

@ -20,7 +20,7 @@
#ifndef _SERVER_TYPES_
#define _SERVER_TYPES_
#include <stdio.h>
#include <cstdio>
#include <vector>
#include "boinc_db.h"

View File

@ -19,8 +19,8 @@
// show_shmem: display WU part of shared-memory structure
#include <stdio.h>
#include <stdlib.h>
#include <cstdio>
#include <cstdlib>
#include <unistd.h>
#include "shmem.h"

View File

@ -32,7 +32,7 @@ using namespace std;
#include <vector>
#include <unistd.h>
#include <limits.h>
#include <climits>
#include <sys/time.h>
#include "boinc_db.h"

View File

@ -27,9 +27,9 @@
//
// usage: update_stats [-update_teams] [-update_users] [-update_hosts] [-asynch]
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <unistd.h>
#include "boinc_db.h"

View File

@ -1,457 +0,0 @@
// The contents of this file are subject to the BOINC Public License
// Version 1.0 (the "License"); you may not use this file except in
// compliance with the License. You may obtain a copy of the License at
// http://boinc.berkeley.edu/license_1.0.txt
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is the Berkeley Open Infrastructure for Network Computing.
//
// The Initial Developer of the Original Code is the SETI@home project.
// Portions created by the SETI@home project are Copyright (C) 2002
// University of California at Berkeley. All Rights Reserved.
//
// Contributor(s):
//
//
// validate - check and validate new results, and grant credit
// -app appname
// [-d debug_level]
// [-one_pass] // make one pass through WU table, then exit
// [-asynch] // fork, run in separate process
//
// This program must be linked with two project-specific functions:
//
// int check_set(vector<RESULT>, int& canonical, double& credit)
// Compare a set of results.
// If a canonical result is found, return its ID,
// and set the "validate_state" field of all the results
// according to whether they match the canonical result.
// Also return the "canonical credit" (e.g. the average or median)
//
// int pair_check(RESULT& new_result, RESULT& canonical, bool& valid);
// return valid=true iff the new result matches the canonical one
//
// Both functions return nonzero if an error occurred,
// in which case other outputs are undefined
using namespace std;
#include <unistd.h>
#include <math.h>
#include <vector>
#include "boinc_db.h"
#include "util.h"
#include "sched_config.h"
#include "sched_util.h"
#include "sched_msgs.h"
#define LOCKFILE "validate.out"
#define PIDFILE "validate.pid"
extern int check_set(vector<RESULT>&, int& canonical, double& credit);
extern int check_pair(RESULT const&, RESULT const&, bool&);
SCHED_CONFIG config;
char app_name[256];
// here when a result has been validated;
// grant credit to host, user and team
//
int grant_credit(DB_RESULT& result, double credit) {
DB_USER user;
DB_HOST host;
DB_TEAM team;
int retval;
retval = host.lookup_id(result.hostid);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of host %d failed %d\n",
result.id, result.hostid, retval
);
return retval;
}
retval = user.lookup_id(host.userid);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of user %d failed %d\n",
result.id, host.userid, retval
);
return retval;
}
user.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, user.expavg_credit, user.expavg_time);
retval = user.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of user %d failed %d\n",
result.id, host.userid, retval
);
}
host.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, host.expavg_credit, host.expavg_time);
retval = host.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of host %d failed %d\n",
result.id, result.hostid, retval
);
}
if (user.teamid) {
retval = team.lookup_id(user.teamid);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] lookup of team %d failed %d\n",
result.id, user.teamid, retval
);
return retval;
}
team.total_credit += credit;
update_average(result.sent_time, credit, CREDIT_HALF_LIFE, team.expavg_credit, team.expavg_time);
retval = team.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d] update of team %d failed %d\n",
result.id, team.id, retval
);
}
}
return 0;
}
void handle_wu(DB_WORKUNIT& wu) {
DB_RESULT result, canonical_result;
bool match, update_result, need_transition = false;
int retval, canonicalid = 0;
double credit;
unsigned int i;
char buf[256];
if (wu.canonical_resultid) {
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[WU#%d %s] handle_wu(): Already has canonical result\n",
wu.id, wu.name
);
++log_messages;
// Here if WU already has a canonical result.
// Get unchecked results and see if they match the canonical result
//
retval = canonical_result.lookup_id(wu.canonical_resultid);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[WU#%d %s] Can't read canonical result; marking as validated: %d\n",
wu.id, wu.name, retval
);
// Mark this WU as validated, otherwise we'll keep checking it
goto mark_validated;
}
// scan this WU's results, and check the unchecked ones
// TODO: do we have an index on these fields?
// maybe better just to enum on workunitid
//
sprintf(buf, "where workunitid=%d and validate_state=%d and server_state=%d and outcome=%d",
wu.id, VALIDATE_STATE_INIT, RESULT_SERVER_STATE_OVER, RESULT_OUTCOME_SUCCESS
);
while (!result.enumerate(buf)) {
need_transition = true;
// it's possible that we've deleted canonical result outputs
//
if (canonical_result.file_delete_state == FILE_DELETE_DONE) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG,
"[WU#%d]: Canonical result (%d) has been deleted\n",
wu.id, canonical_result.id
);
match = false;
retval = 0;
} else {
retval = check_pair(result, canonical_result, match);
}
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG,
"[RESULT#%d %s]: pair_check() failed for result: %d\n",
result.id, result.name, retval
);
continue;
} else {
if (match) {
result.validate_state = VALIDATE_STATE_VALID;
result.granted_credit = wu.canonical_credit;
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[RESULT#%d %s] pair_check() matched: setting result to valid; credit %f\n",
result.id, result.name, result.granted_credit
);
} else {
result.validate_state = VALIDATE_STATE_INVALID;
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[RESULT#%d %s] pair_check() didn't match: setting result to invalid\n",
result.id, result.name
);
}
}
retval = result.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d %s] Can't update result: %d\n",
result.id, result.name, retval
);
continue;
}
retval = grant_credit(result, result.granted_credit);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[RESULT#%d %s] Can't grant credit: %d\n",
result.id, result.name, retval
);
continue;
}
}
} else {
vector<RESULT> results;
// Here if WU doesn't have a canonical result yet.
// Try to get one
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[WU#%d %s] handle_wu(): No canonical result yet\n", wu.id, wu.name
);
++log_messages;
// sprintf(buf, "where workunitid=%d", wu.id);
// TODO: do we have an index on these fields?
// maybe better to enum on workunitid
// while (!result.enumerate(buf)) {
// if (result.server_state == RESULT_SERVER_STATE_OVER
// && result.outcome == RESULT_OUTCOME_SUCCESS
// ) {
sprintf(
buf, "where workunitid=%d and server_state=%d and outcome=%d",
wu.id, RESULT_SERVER_STATE_OVER, RESULT_OUTCOME_SUCCESS
);
while (!result.enumerate(buf)) {
results.push_back(result);
}
log_messages.printf(
SCHED_MSG_LOG::DEBUG, "[WU#%d %s] Found %d successful results\n",
wu.id, wu.name, (int)results.size()
);
if (results.size() >= (unsigned int)wu.min_quorum) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG,
"[WU#%d %s] Enough for quorum, checking set.\n", wu.id, wu.name
);
retval = check_set(results, canonicalid, credit);
if (!retval && canonicalid) {
need_transition = true;
log_messages.printf(
SCHED_MSG_LOG::DEBUG,
"[WU#%d %s] Found a canonical result: id=%d\n",
wu.id, wu.name, canonicalid
);
wu.canonical_resultid = canonicalid;
wu.canonical_credit = credit;
wu.assimilate_state = ASSIMILATE_READY;
for (i=0; i<results.size(); i++) {
result = results[i];
update_result = false;
// grant credit for valid results
//
if (result.validate_state == VALIDATE_STATE_VALID) {
update_result = true;
retval = grant_credit(result, credit);
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::DEBUG,
"[RESULT#%d %s] grant_credit() failed: %d\n",
result.id, result.name, retval
);
}
result.granted_credit = credit;
log_messages.printf(
SCHED_MSG_LOG::NORMAL,
"[RESULT#%d %s] Granted %f credit to valid result [HOST#%d]\n",
result.id, result.name, result.granted_credit, result.hostid
);
}
if (update_result) {
retval = result.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d %s] result.update() failed: %d\n",
result.id, result.name, retval
);
}
}
}
// don't send any unsent results
sprintf(buf, "where workunitid=%d and server_state=%d",
wu.id, RESULT_SERVER_STATE_UNSENT
);
while (!result.enumerate(buf)) {
result.server_state = RESULT_SERVER_STATE_OVER;
result.outcome = RESULT_OUTCOME_DIDNT_NEED;
retval = result.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[RESULT#%d %s] result.update() failed: %d\n",
result.id, result.name, retval
);
}
}
} else {
// here if no consensus; check if #success results is too large
//
if ((int)results.size() > wu.max_success_results) {
wu.error_mask |= WU_ERROR_TOO_MANY_SUCCESS_RESULTS;
need_transition = true;
}
}
}
}
--log_messages;
mark_validated:
if (need_transition) {
wu.transition_time = time(0);
}
// we've checked all results for this WU, so turn off flag
//
wu.need_validate = 0;
retval = wu.update();
if (retval) {
log_messages.printf(
SCHED_MSG_LOG::CRITICAL,
"[WU#%d %s] wu.update() failed: %d; exiting\n", wu.id, wu.name, retval
);
exit(1);
}
}
// make one pass through the workunits with need_validate set.
// return true if there were any
//
bool do_validate_scan(APP& app) {
DB_WORKUNIT wu;
char buf[256];
bool found=false;
sprintf(buf, "where appid=%d and need_validate > 0", app.id);
while (!wu.enumerate(buf)) {
handle_wu(wu);
found = true;
}
return found;
}
int main_loop(bool one_pass) {
int retval;
DB_APP app;
bool did_something;
char buf[256];
retval = boinc_db.open(config.db_name, config.db_host, config.db_user, config.db_passwd);
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "boinc_db.open failed: %d\n", retval);
exit(1);
}
sprintf(buf, "where name='%s'", app_name);
retval = app.lookup(buf);
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "can't find app %s\n", app.name);
exit(1);
}
while (1) {
check_stop_daemons();
did_something = do_validate_scan(app);
if (one_pass) break;
if (!did_something) {
sleep(5);
}
}
return 0;
}
int main(int argc, char** argv) {
int i, retval;
bool asynch = false, one_pass = false;
check_stop_daemons();
for (i=1; i<argc; i++) {
if (!strcmp(argv[i], "-asynch")) {
asynch = true;
} else if (!strcmp(argv[i], "-one_pass")) {
one_pass = true;
} else if (!strcmp(argv[i], "-app")) {
strcpy(app_name, argv[++i]);
} else if (!strcmp(argv[i], "-d")) {
log_messages.set_debug_level(atoi(argv[++i]));
} else {
log_messages.printf(SCHED_MSG_LOG::CRITICAL, "unrecognized arg: %s\n", argv[i]);
}
}
retval = config.parse_file("..");
if (retval) {
log_messages.printf(SCHED_MSG_LOG::CRITICAL,
"Can't parse config file: %d\n", retval
);
exit(1);
}
if (asynch) {
if (fork()) {
exit(0);
}
}
// // Call lock_file after fork(), because file locks are not always inherited
// if (lock_file(LOCKFILE)) {
// log_messages.printf(SCHED_MSG_LOG::NORMAL, "Another copy of validate is already running\n");
// exit(1);
// }
// write_pid_file(PIDFILE);
log_messages.printf(SCHED_MSG_LOG::NORMAL, "Starting validator\n");
install_stop_signal_handler();
main_loop(one_pass);
}

View File

@ -127,7 +127,7 @@ int generic_check_set(
init_result_f init_result_f,
check_pair_with_data_f check_pair_with_data_f,
cleanup_result_f cleanup_result_f,
int min_valid)
size_t min_valid)
{
assert (!results.empty());
@ -193,9 +193,10 @@ int generic_check_set_majority(
check_pair_with_data_f check_pair_with_data_f,
cleanup_result_f cleanup_result_f)
{
generic_check_set(results, canonicalid, credit,
init_result_f, check_pair_with_data_f, cleanup_result_f,
results.size() / 2);
return generic_check_set(
results, canonicalid, credit,
init_result_f, check_pair_with_data_f, cleanup_result_f,
results.size() / 2);
}
int generic_check_pair(

Some files were not shown because too many files have changed in this diff Show More