timezone code and other places.
Remove elog() calls from find_my_exec; do fprintf(stderr) instead. We
can then remove the exec.c handling in the makefile because it doesn't
have to be built to suppress elog calls.
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.77 2004/04/19 17:42:57 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/main/main.c,v 1.78 2004/05/18 20:18:57 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#endif /* !WIN32 */
}
+ if (find_my_exec(argv[0], my_exec_path) < 0)
+ {
+ fprintf(stderr,
+ gettext("%s: could not locate my own executable path"),
+ argv[0]);
+ exit(1);
+ }
+
/*
* Now dispatch to one of PostmasterMain, PostgresMain, GucInfoMain,
* SubPostmasterMain, pgstat_main, pgstat_mainChild or BootstrapMain
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.388 2004/05/17 14:35:29 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/postmaster/postmaster.c,v 1.389 2004/05/18 20:18:57 momjian Exp $
*
* NOTES
*
#ifdef EXEC_BACKEND
-static char postgres_exec_path[MAXPGPATH];
-
#ifdef WIN32
pid_t win32_forkexec(const char* path, char *argv[]);
(errmsg_internal("-----------------------------------------")));
}
- /*
- * On some systems our dynloader code needs the executable's pathname.
- */
- if (find_my_exec(argv[0], my_exec_path) < 0)
- ereport(FATAL,
- (errmsg("%s: could not locate my own executable path",
- progname)));
if (strlen(pkglib_path) == 0)
get_pkglib_path(my_exec_path, pkglib_path);
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.407 2004/05/17 14:35:31 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/tcop/postgres.c,v 1.408 2004/05/18 20:18:58 momjian Exp $
*
* NOTES
* this is the "main" module of the postgres backend and
}
Assert(DataDir);
+ if (strlen(pkglib_path) == 0)
+ get_pkglib_path(my_exec_path, pkglib_path);
+
/* Acquire configuration parameters */
if (IsUnderPostmaster)
{
argv[0])));
}
- /*
- * On some systems our dynloader code needs the executable's pathname.
- */
- if (strlen(my_exec_path) == 0 && find_my_exec(argv[0], my_exec_path) < 0)
- ereport(FATAL,
- (errmsg("%s: could not locate postgres executable",
- argv[0])));
- if (strlen(pkglib_path) == 0)
- get_pkglib_path(my_exec_path, pkglib_path);
-
/*
* Validate we have been given a reasonable-looking DataDir (if
* under postmaster, assume postmaster did this already).
# Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.38 2004/05/17 14:35:33 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/initdb/Makefile,v 1.39 2004/05/18 20:18:58 momjian Exp $
#
#-------------------------------------------------------------------------
override CPPFLAGS := -DFRONTEND -I$(libpq_srcdir) $(CPPFLAGS)
-OBJS= initdb.o \
- $(filter exec.o, $(LIBOBJS))
+OBJS= initdb.o
all: submake-libpq submake-libpgport initdb
initdb: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
-exec.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
install: all installdirs
$(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X)
rm -f $(DESTDIR)$(bindir)/initdb$(X)
clean distclean maintainer-clean:
- rm -f initdb$(X) $(OBJS) exec.c
+ rm -f initdb$(X) $(OBJS)
# ensure that changes in datadir propagate into object file
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.47 2004/05/11 21:57:14 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/pg_dump/Makefile,v 1.48 2004/05/18 20:18:58 momjian Exp $
#
#-------------------------------------------------------------------------
OBJS= pg_backup_archiver.o pg_backup_db.o pg_backup_custom.o \
pg_backup_files.o pg_backup_null.o pg_backup_tar.o \
dumputils.o
-PG_DUMPALL_OBJS = $(filter exec.o, $(LIBOBJS))
EXTRA_OBJS = $(top_builddir)/src/backend/parser/keywords.o
pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
-pg_dumpall: pg_dumpall.o dumputils.o $(PG_DUMPALL_OBJS) $(libpq_builddir)/libpq.a
- $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(PG_DUMPALL_OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
-
-exec.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
+pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a
+ $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
.PHONY: submake-backend
submake-backend:
rm -f $(addprefix $(DESTDIR)$(bindir)/, pg_dump$(X) pg_restore$(X) pg_dumpall$(X))
clean distclean maintainer-clean:
- rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o exec.c
+ rm -f pg_dump$(X) pg_restore$(X) pg_dumpall$(X) $(OBJS) pg_dump.o common.o pg_dump_sort.o pg_restore.o pg_dumpall.o
# Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
# Portions Copyright (c) 1994, Regents of the University of California
#
-# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.44 2004/05/17 14:35:33 momjian Exp $
+# $PostgreSQL: pgsql/src/bin/psql/Makefile,v 1.45 2004/05/18 20:18:58 momjian Exp $
#
#-------------------------------------------------------------------------
OBJS= command.o common.o help.o input.o stringutils.o mainloop.o copy.o \
startup.o prompt.o variables.o large_obj.o print.o describe.o \
- psqlscan.o tab-complete.o mbprint.o \
- $(filter exec.o, $(LIBOBJS))
+ psqlscan.o tab-complete.o mbprint.o
FLEXFLAGS = -Cfe
psql: $(OBJS) $(libpq_builddir)/libpq.a
$(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@$(X)
-exec.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
help.o: $(srcdir)/sql_help.h
ifdef PERL
# psqlscan.c is in the distribution tarball, so is not cleaned here
clean distclean:
- rm -f psql$(X) $(OBJS) exec.c
+ rm -f psql$(X) $(OBJS)
maintainer-clean: distclean
rm -f $(srcdir)/sql_help.h $(srcdir)/psqlscan.c
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.46 2004/01/24 20:43:26 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/print.c,v 1.47 2004/05/18 20:18:58 momjian Exp $
*/
#include "postgres_fe.h"
#include "common.h"
for (ptr = footers; *ptr; ptr++)
fprintf(fout, "%s\n", *ptr);
+#ifndef __MINGW32__
+ /* for some reason MinGW outputs an extra newline, so this supresses it */
fputc('\n', fout);
+#endif
/* clean up */
free(cell_w);
-# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.104 2004/05/17 14:35:34 momjian Exp $
+# $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/Makefile,v 1.105 2004/05/18 20:18:58 momjian Exp $
subdir = src/interfaces/ecpg/preproc
top_builddir = ../../../..
override CFLAGS += $(PTHREAD_CFLAGS)
OBJS= preproc.o type.o ecpg.o ecpg_keywords.o output.o\
- keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o \
- $(filter exec.o, $(LIBOBJS))
+ keywords.o c_keywords.o ../ecpglib/typename.o descriptor.o variable.o
all: submake-libpgport ecpg
ecpg: $(OBJS)
$(CC) $(CFLAGS) $(LDFLAGS) $^ $(LIBS) $(PTHREAD_LIBS) -o $@$(X)
-exec.c: % : $(top_srcdir)/src/port/%
- rm -f $@ && $(LN_S) $< .
-
# pgc is compiled as part of preproc
preproc.o: $(srcdir)/pgc.c
rm -f $(DESTDIR)$(bindir)/ecpg$(X)
clean distclean:
- rm -f *.o ecpg$(X) exec.c
+ rm -f *.o ecpg$(X)
# garbage from partial builds
@rm -f y.tab.c y.tab.h
# garbage from development
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/exec.c,v 1.7 2004/05/18 03:36:45 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/exec.c,v 1.8 2004/05/18 20:18:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include <sys/stat.h>
#include <unistd.h>
+#include <sys/wait.h>
+
+#define _(x) gettext((x))
+
#include "miscadmin.h"
/* $PATH (or %PATH%) path separator */
#define S_IXOTH ((S_IXUSR)>>6)
#endif
-#ifndef FRONTEND
-/* We use only 3-parameter elog calls in this file, for simplicity */
-#define log_debug(str, param) elog(DEBUG2, str, param)
-#else
-#define log_debug(str, param) {} /* do nothing */
-#endif
-
static void win32_make_absolute(char *path);
/*
*/
if (stat(path, &buf) < 0)
{
- log_debug("could not stat \"%s\": %m", path);
+ fprintf(stderr, "could not stat \"%s\": %m", path);
return -1;
}
if ((buf.st_mode & S_IFMT) != S_IFREG)
{
- log_debug("\"%s\" is not a regular file", path);
+ fprintf(stderr, "\"%s\" is not a regular file", path);
return -1;
}
is_r = buf.st_mode & S_IRUSR;
is_x = buf.st_mode & S_IXUSR;
if (!(is_r && is_x))
- log_debug("\"%s\" is not user read/execute", path);
+ fprintf(stderr, "\"%s\" is not user read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
}
is_r = buf.st_mode & S_IRGRP;
is_x = buf.st_mode & S_IXGRP;
if (!(is_r && is_x))
- log_debug("\"%s\" is not group read/execute", path);
+ fprintf(stderr, "\"%s\" is not group read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
}
}
is_r = buf.st_mode & S_IROTH;
is_x = buf.st_mode & S_IXOTH;
if (!(is_r && is_x))
- log_debug("\"%s\" is not other read/execute", path);
+ fprintf(stderr, "\"%s\" is not other read/execute", path);
return is_x ? (is_r ? 0 : -2) : -1;
#endif
{
if (*++p == '\0')
{
- log_debug("argv[0] ends with a path separator \"%s\"", argv0);
+ fprintf(stderr, "argv[0] ends with a path separator \"%s\"", argv0);
return -1;
}
if (is_absolute_path(argv0) || !getcwd(buf, MAXPGPATH))
{
strncpy(full_path, buf, MAXPGPATH);
win32_make_absolute(full_path);
- log_debug("found \"%s\" using argv[0]", full_path);
return 0;
}
- log_debug("invalid binary \"%s\"", buf);
- return -1;
+ else
+ {
+ fprintf(stderr, "invalid binary \"%s\"", buf);
+ return -1;
+ }
}
/*
*/
if ((p = getenv("PATH")) && *p)
{
- log_debug("searching PATH for executable%s", "");
path = strdup(p); /* make a modifiable copy */
for (startp = path, endp = strchr(path, PATHSEP);
startp && *startp;
case 0: /* found ok */
strncpy(full_path, buf, MAXPGPATH);
win32_make_absolute(full_path);
- log_debug("found \"%s\" using PATH", full_path);
free(path);
return 0;
case -1: /* wasn't even a candidate, keep looking */
break;
case -2: /* found but disqualified */
- log_debug("could not read binary \"%s\"", buf);
+ fprintf(stderr, "could not read binary \"%s\"", buf);
free(path);
return -1;
}
free(path);
}
- log_debug("could not find a \"%s\" to execute", argv0);
+ fprintf(stderr, "could not find a \"%s\" to execute", argv0);
return -1;
#if 0
}
+/*
+ * pclose() plus useful error reporting
+ * Is this necessary? bjm 2004-05-11
+ * It is better here because pipe.c has win32 backend linkage.
+ */
+int
+pclose_check(FILE *stream)
+{
+ int exitstatus;
+
+ exitstatus = pclose(stream);
+
+ if (exitstatus == 0)
+ return 0; /* all is well */
+
+ if (exitstatus == -1)
+ {
+ /* pclose() itself failed, and hopefully set errno */
+ perror("pclose failed");
+ }
+ else if (WIFEXITED(exitstatus))
+ {
+ fprintf(stderr, _("child process exited with exit code %d\n"),
+ WEXITSTATUS(exitstatus));
+ }
+ else if (WIFSIGNALED(exitstatus))
+ {
+ fprintf(stderr, _("child process was terminated by signal %d\n"),
+ WTERMSIG(exitstatus));
+ }
+ else
+ {
+ fprintf(stderr, _("child process exited with unrecognized status %d\n"),
+ exitstatus);
+ }
+
+ return -1;
+}
+
+
/*
* Windows doesn't like relative paths to executables (other things work fine)
* so we call its builtin function to expand them. Elsewhere this is a NOOP
if (_fullpath(abspath, path, MAXPGPATH) == NULL)
{
- log_debug("Win32 path expansion failed: %s", strerror(errno));
+ fprintf(stderr, "Win32 path expansion failed: %s", strerror(errno));
StrNCpy(abspath, path, MAXPGPATH);
}
canonicalize_path(abspath);
return;
}
+
* must be replaced with recv/send.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/port/pipe.c,v 1.3 2004/05/11 21:57:15 momjian Exp $
+ * $PostgreSQL: pgsql/src/port/pipe.c,v 1.4 2004/05/18 20:18:59 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
-#include <sys/wait.h>
-
-#define _(x) gettext((x))
-
#ifdef WIN32
int
pgpipe(int handles[2])
}
#endif
-/*
- * pclose() plus useful error reporting
- * Is this necessary? bjm 2004-05-11
- */
-int
-pclose_check(FILE *stream)
-{
- int exitstatus;
-
- exitstatus = pclose(stream);
-
- if (exitstatus == 0)
- return 0; /* all is well */
-
- if (exitstatus == -1)
- {
- /* pclose() itself failed, and hopefully set errno */
- perror("pclose failed");
- }
- else if (WIFEXITED(exitstatus))
- {
- fprintf(stderr, _("child process exited with exit code %d\n"),
- WEXITSTATUS(exitstatus));
- }
- else if (WIFSIGNALED(exitstatus))
- {
- fprintf(stderr, _("child process was terminated by signal %d\n"),
- WTERMSIG(exitstatus));
- }
- else
- {
- fprintf(stderr, _("child process exited with unrecognized status %d\n"),
- exitstatus);
- }
-
- return -1;
-}