1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-13 16:22:44 +03:00

pgindent run on all C files. Java run to follow. initdb/regression

tests pass.
This commit is contained in:
Bruce Momjian
2001-10-25 05:50:21 +00:00
parent 59da2105d8
commit b81844b173
818 changed files with 21684 additions and 20491 deletions

View File

@@ -121,7 +121,6 @@ semctl(int semId, int semNum, int flag, union semun semun)
TRACEDBGP("->semctl nmbre %d", Address[0]);
for (i = 0; i < Address[0]; i++)
{
/*
* Make sure to have ownership of the semaphore (if created by
* another team)
@@ -294,7 +293,6 @@ semop(int semId, struct sembuf * sops, int nsops)
/* For each sem in the pool, check the operation to perform */
if (sops[i].sem_op < 0)
{
/*
* Try acuiring the semaphore till we are not inteerupted by a
* signal

View File

@@ -48,7 +48,6 @@ shmat(int memId, int m1, int m2)
if (ainfo.team == teinfo.team)
{
/*
* the area is already in our address space, just return the
* address
@@ -57,7 +56,6 @@ shmat(int memId, int m1, int m2)
}
else
{
/*
* the area is not in our address space, clone it before and
* return the address

View File

@@ -116,19 +116,17 @@ beos_dl_open(char *filename)
}
void
beos_dl_sym(image_id im,char* symname,void** fptr)
beos_dl_sym(image_id im, char *symname, void **fptr)
{
/* Send command '3' (get symbol) to the support server */
write_port(beos_dl_port_in, 3, symname, strlen(symname) + 1);
write_port(beos_dl_port_in, im, NULL,0);
write_port(beos_dl_port_in, im, NULL, 0);
/* Read sym address */
read_port(beos_dl_port_out, (int32*)(fptr), NULL, 0);
read_port(beos_dl_port_out, (int32 *) (fptr), NULL, 0);
if (fptr==NULL)
{
if (fptr == NULL)
elog(NOTICE, "loading symbol '%s' failed ", symname);
}
}
status_t
@@ -149,7 +147,6 @@ beos_startup(int argc, char **argv)
{
if (strlen(argv[0]) >= 10 && !strcmp(argv[0] + strlen(argv[0]) - 10, "postmaster"))
{
/*
* We are in the postmaster, create the protection semaphore for
* shared mem remapping
@@ -180,13 +177,13 @@ beos_startup(int argc, char **argv)
* server
*/
read_port(port_in, &opcode, datas, 4000);
switch (opcode)
{
image_id addon;
image_info info_im;
area_info info_ar;
void * fpt;
void *fpt;
/* Load Add-On */
case 1:
@@ -226,32 +223,32 @@ beos_startup(int argc, char **argv)
break;
/* Cleanup and exit */
case 3:
/* read image Id on the input port */
read_port(port_in, &addon,NULL,0);
read_port(port_in, &addon, NULL, 0);
/* Loading symbol */
fpt=NULL;
if (get_image_symbol(addon, datas, B_SYMBOL_TYPE_TEXT, &fpt) == B_OK);
{
fpt = NULL;
if (get_image_symbol(addon, datas, B_SYMBOL_TYPE_TEXT, &fpt) == B_OK);
{
/*
* Sometime the loader return B_OK for an inexistant function
* with an invalid address !!! Check that the return address
* is in the image range
*/
* Sometime the loader return B_OK for an
* inexistant function with an invalid address !!!
* Check that the return address is in the image
* range
*/
get_image_info(addon, &info_im);
if ((fpt < info_im.text) ||(fpt >= (info_im.text +info_im.text_size)))
fpt=NULL;
fpt = NULL;
}
/* Send back fptr of data segment */
write_port(port_out, (int32)(fpt),NULL,0);
write_port(port_out, (int32) (fpt), NULL, 0);
break;
default:
/* Free system resources */
delete_port(port_in);

View File

@@ -10,7 +10,7 @@
* - this required changing sem_info from containig an array of sem_t to an array of sem_t*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/darwin/Attic/sem.c,v 1.4 2001/09/07 00:27:29 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/port/darwin/Attic/sem.c,v 1.5 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -47,10 +47,9 @@ struct sem_set_info
key_t key;
int nsems;
sem_t *sem[SEMMAX]; /* array of POSIX semaphores */
struct sem semV[SEMMAX]; /* array of System V semaphore
* structures */
struct pending_ops pendingOps[SEMMAX]; /* array of pending
* operations */
struct sem semV[SEMMAX]; /* array of System V semaphore structures */
struct pending_ops pendingOps[SEMMAX]; /* array of pending
* operations */
};
struct sem_info
@@ -58,7 +57,7 @@ struct sem_info
sem_t *sem;
int nsets;
/* there are actually nsets of these: */
struct sem_set_info set[1]; /* VARIABLE LENGTH ARRAY */
struct sem_set_info set[1]; /* VARIABLE LENGTH ARRAY */
};
static struct sem_info *SemInfo = (struct sem_info *) - 1;
@@ -171,7 +170,7 @@ semget(key_t key, int nsems, int semflg)
shm_unlink(SHM_INFO_NAME);
/* The size may only be set once. Ignore errors. */
nsets = PROC_SEM_MAP_ENTRIES(MaxBackends);
sem_info_size = sizeof(struct sem_info) + (nsets-1) * sizeof(struct sem_set_info);
sem_info_size = sizeof(struct sem_info) + (nsets - 1) * sizeof(struct sem_set_info);
ftruncate(fd, sem_info_size);
SemInfo = mmap(NULL, sem_info_size,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
@@ -260,13 +259,13 @@ semget(key_t key, int nsems, int semflg)
/* Currently sem_init always returns -1. */
#ifdef NOT_USED
if( sem_init( &SemInfo->set[semid].sem[semnum], 1, 0 ) == -1 ) {
int semnum1;
if (sem_init(&SemInfo->set[semid].sem[semnum], 1, 0) == -1)
{
int semnum1;
for( semnum1 = 0; semnum1 < semnum; semnum1++ ) {
sem_close( SemInfo->set[semid].sem[semnum1] );
}
sem_post( SemInfo->sem );
for (semnum1 = 0; semnum1 < semnum; semnum1++)
sem_close(SemInfo->set[semid].sem[semnum1]);
sem_post(SemInfo->sem);
return -1;
}
#endif

View File

@@ -537,7 +537,6 @@ readExports(ModulePtr mp)
symname = ls->l_offset + lhp->l_stoff + ldbuf;
else
{
/*
* The l_name member is not zero terminated, we must copy the
* first SYMNMLEN chars and make sure we have a zero byte at
@@ -608,5 +607,4 @@ findMain(void)
free(buf);
return ret;
}
#endif /* HAVE_DLOPEN */

View File

@@ -1,5 +1,5 @@
/*
* $Id: aix.h,v 1.6 2001/05/14 21:45:53 petere Exp $
* $Id: aix.h,v 1.7 2001/10/25 05:49:40 momjian Exp $
*
* @(#)dlfcn.h 1.4 revision of 95/04/25 09:36:52
* This is an unpublished work copyright (c) 1992 HELIOS Software GmbH
@@ -51,9 +51,7 @@ extern "C"
#ifdef __cplusplus
}
#endif
#endif /* HAVE_DLOPEN */
#include "utils/dynamic_loader.h"
@@ -62,5 +60,4 @@ extern "C"
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.8 2001/08/07 16:56:17 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/Attic/beos.c,v 1.9 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -49,7 +49,7 @@ pg_dlsym(void *handle, char *funcname)
/* Checking that "Handle" is valid */
if ((handle) && ((*(int *) (handle)) >= 0))
{
beos_dl_sym(*((int *) (handle)),funcname,(void **) &fpt);
beos_dl_sym(*((int *) (handle)), funcname, (void **) &fpt);
return fpt;
}
elog(NOTICE, "add-on not loaded correctly");

View File

@@ -7,12 +7,11 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: beos.h,v 1.4 2001/01/24 19:43:04 momjian Exp $
* $Id: beos.h,v 1.5 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef PORT_PROTOS_H
#define PORT_PROTOS_H
#endif /* PORT_PROTOS_H */

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/bsdi.c,v 1.15 2001/05/30 18:32:29 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/bsdi.c,v 1.16 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -94,5 +94,4 @@ pg_dlerror()
{
return dld_strerror(dld_errno);
}
#endif /* not HAVE_DLOPEN */
#endif /* not HAVE_DLOPEN */

View File

@@ -24,7 +24,7 @@
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#else /* not HAVE_DLOPEN */
#else /* not HAVE_DLOPEN */
#define pg_dlsym(handle, funcname) ((PGFunction) dld_get_func((funcname)))
#define pg_dlclose(handle) \
@@ -32,7 +32,5 @@ do { \
dld_unlink_by_file(handle, 1); \
free(handle); \
} while (0)
#endif /* not HAVE_DLOPEN */
#endif /* not HAVE_DLOPEN */
#endif /* PORT_PROTOS_H */

View File

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: dgux.h,v 1.10 2001/05/14 21:45:53 petere Exp $
* $Id: dgux.h,v 1.11 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,5 +27,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -34,7 +34,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: freebsd.h,v 1.10 2001/05/15 16:55:27 petere Exp $
* $Id: freebsd.h,v 1.11 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,5 +43,4 @@ char *BSD44_derived_dlerror(void);
void *BSD44_derived_dlopen(const char *filename, int num);
void *BSD44_derived_dlsym(void *handle, const char *name);
void BSD44_derived_dlclose(void *handle);
#endif /* PORT_PROTOS_H */

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.18 2001/03/22 03:59:43 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/hpux.c,v 1.19 2001/10/25 05:49:40 momjian Exp $
*
* NOTES
* all functions are defined here -- it's impossible to trace the
@@ -28,7 +28,6 @@
void *
pg_dlopen(char *filename)
{
/*
* Use BIND_IMMEDIATE so that undefined symbols cause a failure return
* from shl_load(), rather than an abort() later on when we attempt to

View File

@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -11,7 +11,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.18 2001/01/24 19:43:04 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/dynloader/linux.c,v 1.19 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -107,5 +107,4 @@ pg_dlerror()
return dld_strerror(dld_errno);
#endif
}
#endif

View File

@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: linux.h,v 1.13 2001/10/25 01:29:37 momjian Exp $
* $Id: linux.h,v 1.14 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,16 +31,13 @@ do { \
dld_unlink_by_file(handle, 1); \
free(handle); \
} while (0)
#endif
#else /* HAVE_DLOPEN */
#else /* HAVE_DLOPEN */
#define pg_dlopen(f) dlopen((f), RTLD_LAZY | RTLD_GLOBAL)
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* HAVE_DLOPEN */
#endif /* HAVE_DLOPEN */
#endif /* PORT_PROTOS_H */

View File

@@ -34,7 +34,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: netbsd.h,v 1.5 2001/05/15 16:55:27 petere Exp $
* $Id: netbsd.h,v 1.6 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -43,5 +43,4 @@ char *BSD44_derived_dlerror(void);
void *BSD44_derived_dlopen(const char *filename, int num);
void *BSD44_derived_dlsym(void *handle, const char *name);
void BSD44_derived_dlclose(void *handle);
#endif /* PORT_PROTOS_H */

View File

@@ -22,5 +22,4 @@ char *next_dlerror(void);
#define pg_dlerror next_dlerror
/* port.c */
#endif /* PORT_PROTOS_H */

View File

@@ -34,7 +34,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)dl.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>

View File

@@ -5,7 +5,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: openbsd.h,v 1.6 2001/06/20 18:33:31 petere Exp $
* $Id: openbsd.h,v 1.7 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -41,5 +41,4 @@ char *BSD44_derived_dlerror(void);
void *BSD44_derived_dlopen(const char *filename, int num);
void *BSD44_derived_dlsym(void *handle, const char *name);
void BSD44_derived_dlclose(void *handle);
#endif /* PORT_PROTOS_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: osf.h,v 1.3 2001/05/14 21:45:53 petere Exp $
* $Id: osf.h,v 1.4 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,5 +32,4 @@
#define pg_dlsym(h, f) ((PGFunction) dlsym(h, f))
#define pg_dlclose(h) dlclose(h)
#define pg_dlerror() dlerror()
#endif /* PORT_PROTOS_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: sco.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* $Id: sco.h,v 1.9 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -32,5 +32,4 @@
#define pg_dlerror dlerror
/* port.c */
#endif /* PORT_PROTOS_H */

View File

@@ -1,4 +1,4 @@
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.4 2001/05/14 21:45:53 petere Exp $ */
/* $Header: /cvsroot/pgsql/src/backend/port/dynloader/solaris.h,v 1.5 2001/10/25 05:49:40 momjian Exp $ */
#ifndef DYNLOADER_SOLARIS_H
#define DYNLOADER_SOLARIS_H
@@ -10,5 +10,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* DYNLOADER_SOLARIS_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: sunos4.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* $Id: sunos4.h,v 1.9 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: svr4.h,v 1.8 2001/05/14 21:45:53 petere Exp $
* $Id: svr4.h,v 1.9 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* DYNLOADER_H */

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: ultrix4.h,v 1.7 2001/01/24 19:43:04 momjian Exp $
* $Id: ultrix4.h,v 1.8 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -55,9 +55,9 @@ typedef struct ScnInfo
typedef enum
{
DL_NEEDRELOC, /* still need relocation */
DL_RELOCATED, /* no relocation necessary */
DL_INPROG /* relocation in progress */
DL_NEEDRELOC, /* still need relocation */
DL_RELOCATED, /* no relocation necessary */
DL_INPROG /* relocation in progress */
} dlRStatus;
typedef struct JmpTbl
@@ -120,5 +120,4 @@ extern char *dl_error( /* void */ );
extern char **dl_undefinedSymbols( /* int *count */ );
extern void dl_printAllSymbols( /* void *handle */ );
extern void dl_setLibraries( /* char *libs */ );
#endif /* _DL_HEADER_ */

View File

@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -30,5 +30,4 @@
#define pg_dlsym dlsym
#define pg_dlclose dlclose
#define pg_dlerror dlerror
#endif /* PORT_PROTOS_H */

View File

@@ -1,4 +1,4 @@
/* $Id: inet_aton.c,v 1.19 2001/08/24 14:07:49 petere Exp $
/* $Id: inet_aton.c,v 1.20 2001/10/25 05:49:40 momjian Exp $
*
* This inet_aton() function was taken from the GNU C library and
* incorporated into Postgres for those systems which do not have this
@@ -67,7 +67,6 @@ inet_aton(const char *cp, struct in_addr * addr)
for (;;)
{
/*
* Collect number up to ``.''. Values are specified as for C:
* 0x=hex, 0=octal, other=decimal.
@@ -100,7 +99,6 @@ inet_aton(const char *cp, struct in_addr * addr)
}
if (*cp == '.')
{
/*
* Internet format: a.b.c.d a.b.c (with c treated as
* 16-bits) a.b (with b treated as 24 bits)

View File

@@ -1,4 +1,4 @@
/* $Id: isinf.c,v 1.16 2001/08/24 14:07:49 petere Exp $ */
/* $Id: isinf.c,v 1.17 2001/10/25 05:49:40 momjian Exp $ */
#include "c.h"
@@ -42,7 +42,6 @@ double x;
#else
int fpclass = fp_class_d(x);
#endif
if (fpclass == FP_POS_INF)
@@ -64,7 +63,6 @@ isinf(double x)
return -1;
return 0;
}
#endif
#endif
@@ -80,5 +78,4 @@ isinf(double x)
return -1;
return 0;
}
#endif

View File

@@ -55,5 +55,4 @@ getcwd(char *buf, size_t size)
{
return getwd(buf);
}
#endif

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/ipc.h,v 1.3 2001/03/18 18:32:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/ipc.h,v 1.4 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -27,5 +27,4 @@
/* Control Commands. */
#define IPC_RMID 0 /* remove identifier */
#define IPC_STAT 1 /* get shm status */
#endif /* _SYS_IPC_H */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/sem.c,v 1.7 2001/09/07 00:27:29 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/sem.c,v 1.8 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,10 +48,9 @@ struct sem_set_info
key_t key;
int nsems;
sem_t sem[SEMMAX]; /* array of POSIX semaphores */
struct sem semV[SEMMAX]; /* array of System V semaphore
* structures */
struct pending_ops pendingOps[SEMMAX]; /* array of pending
* operations */
struct sem semV[SEMMAX]; /* array of System V semaphore structures */
struct pending_ops pendingOps[SEMMAX]; /* array of pending
* operations */
};
struct sem_info
@@ -59,21 +58,21 @@ struct sem_info
sem_t sem;
int nsets;
/* there are actually nsets of these: */
struct sem_set_info set[1]; /* VARIABLE LENGTH ARRAY */
struct sem_set_info set[1]; /* VARIABLE LENGTH ARRAY */
};
static struct sem_info *SemInfo = (struct sem_info *) - 1;
/* ----------------------------------------------------------------
* semclean - remove the shared memory file on exit
* only called by the process which created the shm file
* only called by the process which created the shm file
* ----------------------------------------------------------------
*/
static void
semclean( void )
semclean(void)
{
remove( "/dev/shmem/" SHM_INFO_NAME );
remove("/dev/shmem/" SHM_INFO_NAME);
}
int
@@ -175,30 +174,31 @@ semget(key_t key, int nsems, int semflg)
return fd;
/* The size may only be set once. Ignore errors. */
nsets = PROC_SEM_MAP_ENTRIES(MaxBackends);
sem_info_size = sizeof(struct sem_info) + (nsets-1) * sizeof(struct sem_set_info);
sem_info_size = sizeof(struct sem_info) + (nsets - 1) * sizeof(struct sem_set_info);
ltrunc(fd, sem_info_size, SEEK_SET);
if ( fstat( fd, &statbuf ) ) /* would be strange : the only doc'ed */
{ /* error is EBADF */
close( fd );
if (fstat(fd, &statbuf))/* would be strange : the only doc'ed */
{ /* error is EBADF */
close(fd);
return -1;
}
/*
* size is rounded by proc to the next __PAGESIZE
*/
if (statbuf.st_size !=
(((sem_info_size / __PAGESIZE) + 1) * __PAGESIZE))
{
fprintf(stderr,
"Found a pre-existing shared memory block for the semaphore memory\n"
"of a different size (%ld instead %ld). Make sure that all executables\n"
"are from the same release or remove the file \"/dev/shmem/%s\"\n"
"left by a previous version.\n",
(long) statbuf.st_size,
(long) sem_info_size,
SHM_INFO_NAME);
errno = EACCES;
return -1;
}
/*
* size is rounded by proc to the next __PAGESIZE
*/
if ( statbuf.st_size !=
(((sem_info_size/__PAGESIZE)+1) * __PAGESIZE) )
{
fprintf( stderr,
"Found a pre-existing shared memory block for the semaphore memory\n"
"of a different size (%ld instead %ld). Make sure that all executables\n"
"are from the same release or remove the file \"/dev/shmem/%s\"\n"
"left by a previous version.\n",
(long) statbuf.st_size,
(long) sem_info_size,
SHM_INFO_NAME);
errno = EACCES;
return -1;
}
SemInfo = mmap(NULL, sem_info_size,
PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
if (SemInfo == MAP_FAILED)
@@ -212,7 +212,7 @@ semget(key_t key, int nsems, int semflg)
SemInfo->set[semid].key = -1;
/* create semaphore for locking */
sem_init(&SemInfo->sem, 1, 1);
on_proc_exit( semclean, 0 );
on_proc_exit(semclean, 0);
}
}
@@ -269,13 +269,13 @@ semget(key_t key, int nsems, int semflg)
sem_init(&SemInfo->set[semid].sem[semnum], 1, 0);
/* Currently sem_init always returns -1. */
#ifdef NOT_USED
if( sem_init( &SemInfo->set[semid].sem[semnum], 1, 0 ) == -1 ) {
int semnum1;
if (sem_init(&SemInfo->set[semid].sem[semnum], 1, 0) == -1)
{
int semnum1;
for( semnum1 = 0; semnum1 < semnum; semnum1++ ) {
sem_destroy( &SemInfo->set[semid].sem[semnum1] );
}
sem_post( &SemInfo->sem );
for (semnum1 = 0; semnum1 < semnum; semnum1++)
sem_destroy(&SemInfo->set[semid].sem[semnum1]);
sem_post(&SemInfo->sem);
return -1;
}
#endif

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/sem.h,v 1.3 2000/04/12 17:15:30 momjian Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/sem.h,v 1.4 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -63,7 +63,5 @@ extern "C"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SEM_H */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.6 2001/08/24 14:07:49 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.c,v 1.7 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -48,8 +48,8 @@ static int shm_getinfobyaddr(const void *addr, struct shm_info * info);
static char *
keytoname(key_t key, char *name)
{
sprintf( name,"PgShm%x", key );
return name;
sprintf(name, "PgShm%x", key);
return name;
}
static int
@@ -182,51 +182,53 @@ shmctl(int shmid, int cmd, struct shmid_ds * buf)
{
struct shm_info info;
char name[NAME_MAX + 1];
int result;
int fd;
struct stat statbuf;
int result;
int fd;
struct stat statbuf;
switch( cmd )
switch (cmd)
{
case IPC_RMID :
if (shm_getinfo(shmid, &info) == -1)
{
errno = EACCES;
return -1;
}
close( info.shmid );
keytoname(info.key, name);
return shm_unlink( name );
case IPC_STAT :
/*
* we have to open it first. stat() does no prefix tracking
* -> the call would go to fsys instead of proc
*/
keytoname(shmid, name);
fd = shm_open( name, 0, MODE );
if ( fd >= 0 )
{
result = fstat( fd, &statbuf );
/*
* if the file exists, subtract 2 from linkcount :
* one for our own open and one for the dir entry
*/
if ( ! result )
buf->shm_nattch = statbuf.st_nlink-2;
close( fd );
return result;
}
else
{
/*
* if there's no entry for this key it doesn't matter
* the next shmget() would get a different shm anyway
*/
buf->shm_nattch = 0;
return 0;
}
case IPC_RMID:
if (shm_getinfo(shmid, &info) == -1)
{
errno = EACCES;
return -1;
}
close(info.shmid);
keytoname(info.key, name);
return shm_unlink(name);
case IPC_STAT:
/*
* we have to open it first. stat() does no prefix tracking ->
* the call would go to fsys instead of proc
*/
keytoname(shmid, name);
fd = shm_open(name, 0, MODE);
if (fd >= 0)
{
result = fstat(fd, &statbuf);
/*
* if the file exists, subtract 2 from linkcount : one for
* our own open and one for the dir entry
*/
if (!result)
buf->shm_nattch = statbuf.st_nlink - 2;
close(fd);
return result;
}
else
{
/*
* if there's no entry for this key it doesn't matter the
* next shmget() would get a different shm anyway
*/
buf->shm_nattch = 0;
return 0;
}
}
errno = EINVAL;
return -1;
@@ -258,13 +260,13 @@ shmget(key_t key, size_t size, int flags)
info.key = key;
info.size = size;
info.addr = NULL;
if (shm_putinfo(&info) == -1) {
close( info.shmid );
if ( (oflag & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL) ) {
shm_unlink( name );
}
if (shm_putinfo(&info) == -1)
{
close(info.shmid);
if ((oflag & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
shm_unlink(name);
return -1;
}
}
}
/* The size may only be set once. Ignore errors. */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.h,v 1.3 2001/03/18 18:32:02 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/shm.h,v 1.4 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -38,7 +38,5 @@ extern "C"
#ifdef __cplusplus
}
#endif
#endif /* _SYS_SHM_H */

View File

@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/tstsem.c,v 1.5 2001/08/24 14:07:49 petere Exp $
* $Header: /cvsroot/pgsql/src/backend/port/qnx4/Attic/tstsem.c,v 1.6 2001/10/25 05:49:40 momjian Exp $
*
*-------------------------------------------------------------------------
*/
@@ -40,9 +40,9 @@ sig_handler(int sig_no)
printf("semval = %d\n", i);
}
void on_proc_exit( void (*function)(), Datum arg )
void on_proc_exit(void (*function) (), Datum arg)
{
atexit( function );
atexit(function);
}
int
main(int argc, char **argv)

View File

@@ -50,7 +50,6 @@ typedef unsigned long long ulong_long;
#else
typedef long long_long;
typedef unsigned long ulong_long;
#endif
/*
@@ -75,7 +74,7 @@ typedef unsigned long ulong_long;
* causing nast effects.
**************************************************************/
/*static char _id[] = "$Id: snprintf.c,v 1.30 2001/02/10 02:31:26 tgl Exp $";*/
/*static char _id[] = "$Id: snprintf.c,v 1.31 2001/10/25 05:49:40 momjian Exp $";*/
static char *end;
static int SnprfOverflow;

View File

@@ -1,4 +1,4 @@
/* $Id: strcasecmp.c,v 1.7 2001/01/24 19:43:03 momjian Exp $ */
/* $Id: strcasecmp.c,v 1.8 2001/10/25 05:49:40 momjian Exp $ */
/*
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
@@ -15,7 +15,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strcasecmp.c 5.5 (Berkeley) 11/24/87";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>

View File

@@ -34,7 +34,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strtol.c 5.4 (Berkeley) 2/23/91";
#endif /* LIBC_SCCS and not lint */
#include <limits.h>

View File

@@ -33,7 +33,6 @@
#if defined(LIBC_SCCS) && !defined(lint)
static char sccsid[] = "@(#)strtoul.c 8.1 (Berkeley) 6/4/93";
#endif /* LIBC_SCCS and not lint */
#include <limits.h>

View File

@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $Id: float.h,v 1.6 2001/01/24 19:43:04 momjian Exp $
* $Id: float.h,v 1.7 2001/10/25 05:49:40 momjian Exp $
*
* NOTES
* These come straight out of ANSI X3.159-1989 (p.18) and
@@ -27,5 +27,4 @@
#define DBL_DIG 15
#define DBL_MIN 2.2250738585072014e-308
#define DBL_MAX 1.7976931348623157e+308
#endif /* FLOAT_H */