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()
105105 if (smgrsw [i ].smgr_init )
106106 {
107107 if ((* (smgrsw [i ].smgr_init )) () == SM_FAIL )
108- elog (FATAL , "initialization failed on %s" ,
108+ elog (FATAL , "initialization failed on %s: %m " ,
109109 DatumGetCString (DirectFunctionCall1 (smgrout ,
110110 Int16GetDatum (i ))));
111111 }
@@ -127,7 +127,7 @@ smgrshutdown(int dummy)
127127 if (smgrsw [i ].smgr_shutdown )
128128 {
129129 if ((* (smgrsw [i ].smgr_shutdown )) () == SM_FAIL )
130- elog (FATAL , "shutdown failed on %s" ,
130+ elog (FATAL , "shutdown failed on %s: %m " ,
131131 DatumGetCString (DirectFunctionCall1 (smgrout ,
132132 Int16GetDatum (i ))));
133133 }
@@ -146,7 +146,7 @@ smgrcreate(int16 which, Relation reln)
146146 int fd ;
147147
148148 if ((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
151151 return fd ;
152152}
@@ -162,7 +162,7 @@ smgrunlink(int16 which, Relation reln)
162162 int status ;
163163
164164 if ((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
167167 return status ;
168168}
@@ -181,7 +181,7 @@ smgrextend(int16 which, Relation reln, char *buffer)
181181 status = (* (smgrsw [which ].smgr_extend )) (reln , buffer );
182182
183183 if (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." ,
185185 RelationGetRelationName (reln ));
186186
187187 return status ;
@@ -200,7 +200,7 @@ smgropen(int16 which, Relation reln)
200200
201201 if ((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
205205 return fd ;
206206}
220220smgrclose (int16 which , Relation reln )
221221{
222222 if ((* (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
225225 return SM_SUCCESS ;
226226}
@@ -243,7 +243,7 @@ smgrread(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
243243 status = (* (smgrsw [which ].smgr_read )) (reln , blocknum , buffer );
244244
245245 if (status == SM_FAIL )
246- elog (ERROR , "cannot read block %d of %s" ,
246+ elog (ERROR , "cannot read block %d of %s: %m " ,
247247 blocknum , RelationGetRelationName (reln ));
248248
249249 return status ;
@@ -265,7 +265,7 @@ smgrwrite(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
265265 status = (* (smgrsw [which ].smgr_write )) (reln , blocknum , buffer );
266266
267267 if (status == SM_FAIL )
268- elog (ERROR , "cannot write block %d of %s" ,
268+ elog (ERROR , "cannot write block %d of %s: %m " ,
269269 blocknum , RelationGetRelationName (reln ));
270270
271271 return status ;
@@ -282,7 +282,7 @@ smgrflush(int16 which, Relation reln, BlockNumber blocknum, char *buffer)
282282 status = (* (smgrsw [which ].smgr_flush )) (reln , blocknum , buffer );
283283
284284 if (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 " ,
286286 blocknum , RelationGetRelationName (reln ));
287287
288288 return status ;
@@ -323,7 +323,7 @@ smgrblindwrt(int16 which,
323323 blkno , buffer , dofsync );
324324
325325 if (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 " ,
327327 blkno , relstr , dbstr );
328328
329329 pfree (dbstr );
@@ -352,7 +352,7 @@ smgrmarkdirty(int16 which,
352352 status = (* (smgrsw [which ].smgr_markdirty )) (reln , blkno );
353353
354354 if (status == SM_FAIL )
355- elog (ERROR , "cannot mark block %d of %s" ,
355+ elog (ERROR , "cannot mark block %d of %s: %m " ,
356356 blkno , RelationGetRelationName (reln ));
357357
358358 return status ;
@@ -384,7 +384,7 @@ smgrblindmarkdirty(int16 which,
384384 blkno );
385385
386386 if (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 " ,
388388 blkno , relstr , dbstr );
389389
390390 pfree (dbstr );
@@ -406,7 +406,7 @@ smgrnblocks(int16 which, Relation reln)
406406 int nblocks ;
407407
408408 if ((nblocks = (* (smgrsw [which ].smgr_nblocks )) (reln )) < 0 )
409- elog (ERROR , "cannot count blocks for %s" ,
409+ elog (ERROR , "cannot count blocks for %s: %m " ,
410410 RelationGetRelationName (reln ));
411411
412412 return nblocks ;
@@ -428,7 +428,7 @@ smgrtruncate(int16 which, Relation reln, int nblocks)
428428 if (smgrsw [which ].smgr_truncate )
429429 {
430430 if ((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 " ,
432432 RelationGetRelationName (reln ), nblocks );
433433 }
434434
@@ -449,7 +449,7 @@ smgrcommit()
449449 if (smgrsw [i ].smgr_commit )
450450 {
451451 if ((* (smgrsw [i ].smgr_commit )) () == SM_FAIL )
452- elog (FATAL , "transaction commit failed on %s" ,
452+ elog (FATAL , "transaction commit failed on %s: %m " ,
453453 DatumGetCString (DirectFunctionCall1 (smgrout ,
454454 Int16GetDatum (i ))));
455455 }
@@ -468,7 +468,7 @@ smgrabort()
468468 if (smgrsw [i ].smgr_abort )
469469 {
470470 if ((* (smgrsw [i ].smgr_abort )) () == SM_FAIL )
471- elog (FATAL , "transaction abort failed on %s" ,
471+ elog (FATAL , "transaction abort failed on %s: %m " ,
472472 DatumGetCString (DirectFunctionCall1 (smgrout ,
473473 Int16GetDatum (i ))));
474474 }
0 commit comments