From 6a3bbdf7b39cdcb59a45703a69a921c084253ffd Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sat, 23 Sep 2000 22:17:12 +0000 Subject: [PATCH] Back-patch fix to include kernel errno message in all smgr elog messages. --- src/backend/storage/smgr/smgr.c | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/backend/storage/smgr/smgr.c b/src/backend/storage/smgr/smgr.c index 3b857cd319..53fb3837e2 100644 --- a/src/backend/storage/smgr/smgr.c +++ b/src/backend/storage/smgr/smgr.c @@ -11,7 +11,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.35 2000/04/12 17:15:42 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.35.2.1 2000/09/23 22:17:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -105,7 +105,7 @@ smgrinit() if (smgrsw[i].smgr_init) { if ((*(smgrsw[i].smgr_init)) () == SM_FAIL) - elog(FATAL, "initialization failed on %s", smgrout(i)); + elog(FATAL, "initialization failed on %s: %m", smgrout(i)); } } @@ -125,7 +125,7 @@ smgrshutdown(int dummy) if (smgrsw[i].smgr_shutdown) { if ((*(smgrsw[i].smgr_shutdown)) () == SM_FAIL) - elog(FATAL, "shutdown failed on %s", smgrout(i)); + elog(FATAL, "shutdown failed on %s: %m", smgrout(i)); } } } @@ -142,7 +142,7 @@ smgrcreate(int16 which, Relation reln) int fd; if ((fd = (*(smgrsw[which].smgr_create)) (reln)) < 0) - elog(ERROR, "cannot create %s", RelationGetRelationName(reln)); + elog(ERROR, "cannot create %s: %m", RelationGetRelationName(reln)); return fd; } @@ -158,7 +158,7 @@ smgrunlink(int16 which, Relation reln) int status; if ((status = (*(smgrsw[which].smgr_unlink)) (reln)) == SM_FAIL) - elog(ERROR, "cannot unlink %s", RelationGetRelationName(reln)); + elog(ERROR, "cannot unlink %s: %m", RelationGetRelationName(reln)); return status; } @@ -177,7 +177,7 @@ smgrextend(int16 which, Relation reln, char *buffer) status = (*(smgrsw[which].smgr_extend)) (reln, buffer); if (status == SM_FAIL) - elog(ERROR, "%s: cannot extend. Check free disk space.", + elog(ERROR, "cannot extend %s: %m.\n\tCheck free disk space.", RelationGetRelationName(reln)); return status; @@ -196,7 +196,7 @@ smgropen(int16 which, Relation reln) if ((fd = (*(smgrsw[which].smgr_open)) (reln)) < 0 && !reln->rd_unlinked) - elog(ERROR, "cannot open %s", RelationGetRelationName(reln)); + elog(ERROR, "cannot open %s: %m", RelationGetRelationName(reln)); return fd; } @@ -216,7 +216,7 @@ int smgrclose(int16 which, Relation reln) { if ((*(smgrsw[which].smgr_close)) (reln) == SM_FAIL) - elog(ERROR, "cannot close %s", RelationGetRelationName(reln)); + elog(ERROR, "cannot close %s: %m", RelationGetRelationName(reln)); return SM_SUCCESS; } @@ -239,7 +239,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer) status = (*(smgrsw[which].smgr_read)) (reln, blocknum, buffer); if (status == SM_FAIL) - elog(ERROR, "cannot read block %d of %s", + elog(ERROR, "cannot read block %d of %s: %m", blocknum, RelationGetRelationName(reln)); return status; @@ -261,7 +261,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer) status = (*(smgrsw[which].smgr_write)) (reln, blocknum, buffer); if (status == SM_FAIL) - elog(ERROR, "cannot write block %d of %s", + elog(ERROR, "cannot write block %d of %s: %m", blocknum, RelationGetRelationName(reln)); return status; @@ -278,7 +278,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer) status = (*(smgrsw[which].smgr_flush)) (reln, blocknum, buffer); if (status == SM_FAIL) - elog(ERROR, "cannot flush block %d of %s to stable store", + elog(ERROR, "cannot flush block %d of %s to stable store: %m", blocknum, RelationGetRelationName(reln)); return status; @@ -319,7 +319,7 @@ smgrblindwrt(int16 which, blkno, buffer, dofsync); if (status == SM_FAIL) - elog(ERROR, "cannot write block %d of %s [%s] blind", + elog(ERROR, "cannot write block %d of %s [%s] blind: %m", blkno, relstr, dbstr); pfree(dbstr); @@ -348,7 +348,7 @@ smgrmarkdirty(int16 which, status = (*(smgrsw[which].smgr_markdirty)) (reln, blkno); if (status == SM_FAIL) - elog(ERROR, "cannot mark block %d of %s", + elog(ERROR, "cannot mark block %d of %s: %m", blkno, RelationGetRelationName(reln)); return status; @@ -380,7 +380,7 @@ smgrblindmarkdirty(int16 which, blkno); if (status == SM_FAIL) - elog(ERROR, "cannot mark block %d of %s [%s] blind", + elog(ERROR, "cannot mark block %d of %s [%s] blind: %m", blkno, relstr, dbstr); pfree(dbstr); @@ -402,7 +402,7 @@ smgrnblocks(int16 which, Relation reln) int nblocks; if ((nblocks = (*(smgrsw[which].smgr_nblocks)) (reln)) < 0) - elog(ERROR, "cannot count blocks for %s", + elog(ERROR, "cannot count blocks for %s: %m", RelationGetRelationName(reln)); return nblocks; @@ -424,7 +424,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks) if (smgrsw[which].smgr_truncate) { if ((newblks = (*(smgrsw[which].smgr_truncate)) (reln, nblocks)) < 0) - elog(ERROR, "cannot truncate %s to %d blocks", + elog(ERROR, "cannot truncate %s to %d blocks: %m", RelationGetRelationName(reln), nblocks); } @@ -445,7 +445,7 @@ smgrcommit() if (smgrsw[i].smgr_commit) { if ((*(smgrsw[i].smgr_commit)) () == SM_FAIL) - elog(FATAL, "transaction commit failed on %s", smgrout(i)); + elog(FATAL, "transaction commit failed on %s: %m", smgrout(i)); } } @@ -462,7 +462,7 @@ smgrabort() if (smgrsw[i].smgr_abort) { if ((*(smgrsw[i].smgr_abort)) () == SM_FAIL) - elog(FATAL, "transaction abort failed on %s", smgrout(i)); + elog(FATAL, "transaction abort failed on %s: %m", smgrout(i)); } }