diff options
Diffstat (limited to 'doio.c')
-rw-r--r-- | doio.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -60,9 +60,6 @@ typedef struct __s64_iobuffer { int *buffer; /* the buffer */ } S64_IOB; -static S64_IOB *_s64_get_buffer( PerlIO *f); -static S64_IOB *_s64_create_buffer( PerlIO *f); -static int _s64_malloc( S64_IOB *ptr); #endif bool @@ -2094,6 +2091,12 @@ Perl_do_shmio(pTHX_ I32 optype, SV **mark, SV **sp) static S64_IOB *s64_buffer = (S64_IOB *) NULL; +/* initialize the buffer area */ +/* required after a fork(2) call in order to remove side effects */ +void Perl_do_s64_init_buffer() { + s64_buffer = (S64_IOB *) NULL; +} + /* get a buffered stream pointer */ static S64_IOB *S_s64_get_buffer( PerlIO *fp) { S64_IOB *ptr = s64_buffer; @@ -2103,7 +2106,7 @@ static S64_IOB *S_s64_get_buffer( PerlIO *fp) { } /* create a buffered stream pointer */ -static S64_IOB *_s64_create_buffer( PerlIO *f) { +static S64_IOB *S_s64_create_buffer( PerlIO *f) { S64_IOB *ptr = malloc( sizeof( S64_IOB)); if( ptr) { ptr->fp = f; @@ -2135,7 +2138,7 @@ void Perl_do_s64_delete_buffer( PerlIO *f) { /* internal buffer management */ #define _S64_BUFFER_SIZE 32 -static int _s64_malloc( S64_IOB *ptr) { +static int S_s64_malloc( S64_IOB *ptr) { if( ptr) { if( !ptr->buffer) { ptr->buffer = (int *) calloc( _S64_BUFFER_SIZE, sizeof( int)); |