1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +03:00

Massive commit to run PGINDENT on all *.c and *.h files.

This commit is contained in:
Bruce Momjian
1997-09-07 05:04:48 +00:00
parent 8fecd4febf
commit 1ccd423235
687 changed files with 150775 additions and 136888 deletions

View File

@@ -1,17 +1,17 @@
/*-------------------------------------------------------------------------
*
* port.c--
* SunOS5-specific routines
* SunOS5-specific routines
*
* Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/port.c,v 1.4 1997/04/15 18:18:45 scrappy Exp $
* $Header: /cvsroot/pgsql/src/backend/port/sparc_solaris/Attic/port.c,v 1.5 1997/09/07 04:46:53 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <math.h> /* for pow() prototype */
#include <math.h> /* for pow() prototype */
#include <stdlib.h>
#include <errno.h>
@@ -20,55 +20,60 @@
#include "port-protos.h"
#ifndef HAVE_GETRUSAGE
#include "rusagestub.h"
#endif /* HAVE_GETRUSAGE */
#endif /* HAVE_GETRUSAGE */
long
random()
{
return(lrand48());
return (lrand48());
}
void
srandom(int seed)
{
srand48((long int) seed);
srand48((long int) seed);
}
#ifndef HAVE_GETRUSAGE
int
getrusage(int who, struct rusage *rusage)
getrusage(int who, struct rusage * rusage)
{
struct tms tms;
register int tick_rate = CLK_TCK; /* ticks per second */
clock_t u, s;
struct tms tms;
register int tick_rate = CLK_TCK; /* ticks per second */
clock_t u,
s;
if (rusage == (struct rusage *) NULL) {
errno = EFAULT;
return(-1);
}
if (times(&tms) < 0) {
/* errno set by times */
return(-1);
}
switch (who) {
case RUSAGE_SELF:
u = tms.tms_utime;
s = tms.tms_stime;
break;
case RUSAGE_CHILDREN:
u = tms.tms_cutime;
s = tms.tms_cstime;
break;
default:
errno = EINVAL;
return(-1);
}
if (rusage == (struct rusage *) NULL)
{
errno = EFAULT;
return (-1);
}
if (times(&tms) < 0)
{
/* errno set by times */
return (-1);
}
switch (who)
{
case RUSAGE_SELF:
u = tms.tms_utime;
s = tms.tms_stime;
break;
case RUSAGE_CHILDREN:
u = tms.tms_cutime;
s = tms.tms_cstime;
break;
default:
errno = EINVAL;
return (-1);
}
#define TICK_TO_SEC(T, RATE) ((T)/(RATE))
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
rusage->ru_utime.tv_sec = TICK_TO_SEC(u, tick_rate);
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate);
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate);
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
return(0);
#define TICK_TO_USEC(T,RATE) (((T)%(RATE)*1000000)/RATE)
rusage->ru_utime.tv_sec = TICK_TO_SEC(u, tick_rate);
rusage->ru_utime.tv_usec = TICK_TO_USEC(u, tick_rate);
rusage->ru_stime.tv_sec = TICK_TO_SEC(s, tick_rate);
rusage->ru_stime.tv_usec = TICK_TO_USEC(u, tick_rate);
return (0);
}
#endif /* HAVE_GETRUSAGE */
#endif /* HAVE_GETRUSAGE */