~ubuntu-branches/ubuntu/jaunty/nspr/jaunty-security

« back to all changes in this revision

Viewing changes to mozilla/nsprpub/pr/tests/ranfile.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson
  • Date: 2010-05-10 18:40:10 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100510184010-boghfzlm551mtoag
Tags: 4.8-0ubuntu0.9.04.1
* New upstream release: 4.8
  - Support updating NSS to 3.12.6 and fix CVE-2009-3555 aka 
    US-CERT VU#120541
* adjust patches to changed upstream codebase
  - update debian/patches/30_config_64bits.patch
  - update debian/patches/99_configure.patch
* update shlibs symbols to include new API elements
  - update debian/libnspr4-0d.symbols

Show diffs side-by-side

added added

removed removed

Lines of Context:
97
97
static const char* baseName = "./";
98
98
static const char *programName = "Random File";
99
99
 
100
 
#ifdef XP_MAC
101
 
#include "prlog.h"
102
 
#define printf PR_LogPrint
103
 
extern void SetupMacPrintfLog(char *logFile);
104
 
#endif
105
 
 
106
100
/***********************************************************************
107
 
** PRIVATE FUNCTION:    Random
 
101
** PRIVATE FUNCTION:    RandomNum
108
102
** DESCRIPTION:
109
103
**   Generate a pseudo-random number
110
104
** INPUTS:      None
122
116
**      of the product. Seed is then updated with the return value
123
117
**      promoted to a float-64.
124
118
***********************************************************************/
125
 
static PRUint32 Random(void)
 
119
static PRUint32 RandomNum(void)
126
120
{
127
121
    PRUint32 rv;
128
122
    PRUint64 shift;
132
126
    LL_L2UI(rv, shift);
133
127
    seed = (PRFloat64)rv;
134
128
    return rv;
135
 
}  /* Random */
 
129
}  /* RandomNum */
136
130
 
137
131
/***********************************************************************
138
132
** PRIVATE FUNCTION:    Thread
175
169
    while (PR_TRUE)
176
170
    {
177
171
        PRUint32 bytes;
178
 
        PRUint32 minor = (Random() % cd->limit) + 1;
179
 
        PRUint32 random = (Random() % cd->limit) + 1;
180
 
        PRUint32 pages = (Random() % cd->limit) + 10;
 
172
        PRUint32 minor = (RandomNum() % cd->limit) + 1;
 
173
        PRUint32 random = (RandomNum() % cd->limit) + 1;
 
174
        PRUint32 pages = (RandomNum() % cd->limit) + 10;
181
175
        while (minor-- > 0)
182
176
        {
183
177
            cd->problem = sg_okay;
275
269
**          Random File: Using loops = 2, threads = 10, limit = 57
276
270
**          Random File: [min [avg] max] writes/sec average
277
271
***********************************************************************/
278
 
int main (int argc,      char   *argv[])
 
272
int main(int argc, char **argv)
279
273
{
280
274
    PRLock *ml;
281
275
    PRUint32 id = 0;
328
322
 
329
323
    interleave = PR_SecondsToInterval(10);
330
324
 
331
 
#ifdef XP_MAC
332
 
        SetupMacPrintfLog("ranfile.log");
333
 
        debug_mode = 1;
334
 
#endif
335
 
 
336
325
    ml = PR_NewLock();
337
326
    cv = PR_NewCondVar(ml);
338
327
 
357
346
            hammer[active].writes = 0;
358
347
            hammer[active].action = sg_go;
359
348
            hammer[active].problem = sg_okay;
360
 
            hammer[active].limit = (Random() % limit) + 1;
 
349
            hammer[active].limit = (RandomNum() % limit) + 1;
361
350
            hammer[active].timein = PR_IntervalNow();
362
351
            hammer[active].thread = PR_CreateThread(
363
352
                PR_USER_THREAD, Thread, &hammer[active],