1111 *
1212 *
1313 * IDENTIFICATION
14- * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.36 2000/06/05 07:28:47 tgl Exp $
14+ * $Header: /cvsroot/pgsql/src/backend/storage/smgr/smgr.c,v 1.37 2000/06/19 23:37:08 tgl Exp $
1515 *
1616 *-------------------------------------------------------------------------
1717 */
@@ -105,7 +105,7 @@ smgrinit()
105105if (smgrsw [i ].smgr_init )
106106{
107107if ((* (smgrsw [i ].smgr_init )) ()== SM_FAIL )
108- elog (FATAL ,"initialization failed on %s" ,
108+ elog (FATAL ,"initialization failed on %s: %m " ,
109109DatumGetCString (DirectFunctionCall1 (smgrout ,
110110Int16GetDatum (i ))));
111111}
@@ -127,7 +127,7 @@ smgrshutdown(int dummy)
127127if (smgrsw [i ].smgr_shutdown )
128128{
129129if ((* (smgrsw [i ].smgr_shutdown )) ()== SM_FAIL )
130- elog (FATAL ,"shutdown failed on %s" ,
130+ elog (FATAL ,"shutdown failed on %s: %m " ,
131131DatumGetCString (DirectFunctionCall1 (smgrout ,
132132Int16GetDatum (i ))));
133133}
@@ -146,7 +146,7 @@ smgrcreate(int16 which, Relation reln)
146146int fd ;
147147
148148if ((fd = (* (smgrsw [which ].smgr_create )) (reln ))< 0 )
149- elog (ERROR ,"cannot create %s" ,RelationGetRelationName (reln ));
149+ elog (ERROR ,"cannot create %s: %m " ,RelationGetRelationName (reln ));
150150
151151return fd ;
152152}
@@ -162,7 +162,7 @@ smgrunlink(int16 which, Relation reln)
162162int status ;
163163
164164if ((status = (* (smgrsw [which ].smgr_unlink )) (reln ))== SM_FAIL )
165- elog (ERROR ,"cannot unlink %s" ,RelationGetRelationName (reln ));
165+ elog (ERROR ,"cannot unlink %s: %m " ,RelationGetRelationName (reln ));
166166
167167return status ;
168168}
@@ -181,7 +181,7 @@ smgrextend(int16 which, Relation reln, char *buffer)
181181status = (* (smgrsw [which ].smgr_extend )) (reln ,buffer );
182182
183183if (status == SM_FAIL )
184- elog (ERROR ,"%s: cannot extend. Check free disk space." ,
184+ elog (ERROR ,"cannot extend %s: %m.\n\tCheck free disk space." ,
185185RelationGetRelationName (reln ));
186186
187187return status ;
@@ -200,7 +200,7 @@ smgropen(int16 which, Relation reln)
200200
201201if ((fd = (* (smgrsw [which ].smgr_open )) (reln ))< 0 &&
202202!reln -> rd_unlinked )
203- elog (ERROR ,"cannot open %s" ,RelationGetRelationName (reln ));
203+ elog (ERROR ,"cannot open %s: %m " ,RelationGetRelationName (reln ));
204204
205205return fd ;
206206}
220220smgrclose (int16 which ,Relation reln )
221221{
222222if ((* (smgrsw [which ].smgr_close )) (reln )== SM_FAIL )
223- elog (ERROR ,"cannot close %s" ,RelationGetRelationName (reln ));
223+ elog (ERROR ,"cannot close %s: %m " ,RelationGetRelationName (reln ));
224224
225225return SM_SUCCESS ;
226226}
@@ -243,7 +243,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
243243status = (* (smgrsw [which ].smgr_read )) (reln ,blocknum ,buffer );
244244
245245if (status == SM_FAIL )
246- elog (ERROR ,"cannot read block %d of %s" ,
246+ elog (ERROR ,"cannot read block %d of %s: %m " ,
247247blocknum ,RelationGetRelationName (reln ));
248248
249249return status ;
@@ -265,7 +265,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
265265status = (* (smgrsw [which ].smgr_write )) (reln ,blocknum ,buffer );
266266
267267if (status == SM_FAIL )
268- elog (ERROR ,"cannot write block %d of %s" ,
268+ elog (ERROR ,"cannot write block %d of %s: %m " ,
269269blocknum ,RelationGetRelationName (reln ));
270270
271271return status ;
@@ -282,7 +282,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
282282status = (* (smgrsw [which ].smgr_flush )) (reln ,blocknum ,buffer );
283283
284284if (status == SM_FAIL )
285- elog (ERROR ,"cannot flush block %d of %s to stable store" ,
285+ elog (ERROR ,"cannot flush block %d of %s to stable store: %m " ,
286286blocknum ,RelationGetRelationName (reln ));
287287
288288return status ;
@@ -323,7 +323,7 @@ smgrblindwrt(int16 which,
323323blkno ,buffer ,dofsync );
324324
325325if (status == SM_FAIL )
326- elog (ERROR ,"cannot write block %d of %s [%s] blind" ,
326+ elog (ERROR ,"cannot write block %d of %s [%s] blind: %m " ,
327327blkno ,relstr ,dbstr );
328328
329329pfree (dbstr );
@@ -352,7 +352,7 @@ smgrmarkdirty(int16 which,
352352status = (* (smgrsw [which ].smgr_markdirty )) (reln ,blkno );
353353
354354if (status == SM_FAIL )
355- elog (ERROR ,"cannot mark block %d of %s" ,
355+ elog (ERROR ,"cannot mark block %d of %s: %m " ,
356356blkno ,RelationGetRelationName (reln ));
357357
358358return status ;
@@ -384,7 +384,7 @@ smgrblindmarkdirty(int16 which,
384384blkno );
385385
386386if (status == SM_FAIL )
387- elog (ERROR ,"cannot mark block %d of %s [%s] blind" ,
387+ elog (ERROR ,"cannot mark block %d of %s [%s] blind: %m " ,
388388blkno ,relstr ,dbstr );
389389
390390pfree (dbstr );
@@ -406,7 +406,7 @@ smgrnblocks(int16 which, Relation reln)
406406int nblocks ;
407407
408408if ((nblocks = (* (smgrsw [which ].smgr_nblocks )) (reln ))< 0 )
409- elog (ERROR ,"cannot count blocks for %s" ,
409+ elog (ERROR ,"cannot count blocks for %s: %m " ,
410410RelationGetRelationName (reln ));
411411
412412return nblocks ;
@@ -428,7 +428,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
428428if (smgrsw [which ].smgr_truncate )
429429{
430430if ((newblks = (* (smgrsw [which ].smgr_truncate )) (reln ,nblocks ))< 0 )
431- elog (ERROR ,"cannot truncate %s to %d blocks" ,
431+ elog (ERROR ,"cannot truncate %s to %d blocks: %m " ,
432432RelationGetRelationName (reln ),nblocks );
433433}
434434
@@ -449,7 +449,7 @@ smgrcommit()
449449if (smgrsw [i ].smgr_commit )
450450{
451451if ((* (smgrsw [i ].smgr_commit )) ()== SM_FAIL )
452- elog (FATAL ,"transaction commit failed on %s" ,
452+ elog (FATAL ,"transaction commit failed on %s: %m " ,
453453DatumGetCString (DirectFunctionCall1 (smgrout ,
454454Int16GetDatum (i ))));
455455}
@@ -468,7 +468,7 @@ smgrabort()
468468if (smgrsw [i ].smgr_abort )
469469{
470470if ((* (smgrsw [i ].smgr_abort )) ()== SM_FAIL )
471- elog (FATAL ,"transaction abort failed on %s" ,
471+ elog (FATAL ,"transaction abort failed on %s: %m " ,
472472DatumGetCString (DirectFunctionCall1 (smgrout ,
473473Int16GetDatum (i ))));
474474}