@@ -55,7 +55,7 @@ int backends_handle(size_t nfds, managed_fd* fds){
55
55
DBGPF ("Notifying backend %s of %" PRIsize_t " waiting FDs" , registry .backends [u ].name , n );
56
56
rv |= registry .backends [u ].process (n , fds );
57
57
if (rv ){
58
- fprintf ( stderr , "Backend %s failed to handle input\n " , registry .backends [u ].name );
58
+ LOGPF ( "Backend %s failed to handle input" , registry .backends [u ].name );
59
59
}
60
60
}
61
61
}
@@ -100,7 +100,7 @@ MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create){
100
100
DBGPF ("\tBucket %" PRIsize_t " entry %" PRIsize_t " inst %" PRIu64 " ident %" PRIu64 , bucket , u , (uint64_t ) channels .entry [bucket ][u ]-> instance , channels .entry [bucket ][u ]-> ident );
101
101
if (channels .entry [bucket ][u ]-> instance == inst
102
102
&& channels .entry [bucket ][u ]-> ident == ident ){
103
- DBGPF ("Requested channel %" PRIu64 " on instance %s already exists, reusing (bucket %" PRIsize_t ", %" PRIsize_t " search steps)\n " , ident , inst -> name , bucket , u );
103
+ DBGPF ("Requested channel %" PRIu64 " on instance %s already exists, reusing (bucket %" PRIsize_t ", %" PRIsize_t " search steps)" , ident , inst -> name , bucket , u );
104
104
return channels .entry [bucket ][u ];
105
105
}
106
106
}
@@ -113,14 +113,14 @@ MM_API channel* mm_channel(instance* inst, uint64_t ident, uint8_t create){
113
113
DBGPF ("Creating previously unknown channel %" PRIu64 " on instance %s, bucket %" PRIsize_t , ident , inst -> name , bucket );
114
114
channels .entry [bucket ] = realloc (channels .entry [bucket ], (channels .n [bucket ] + 1 ) * sizeof (channel * ));
115
115
if (!channels .entry [bucket ]){
116
- fprintf ( stderr , "Failed to allocate memory\n " );
116
+ LOG ( "Failed to allocate memory" );
117
117
channels .n [bucket ] = 0 ;
118
118
return NULL ;
119
119
}
120
120
121
121
channels .entry [bucket ][channels .n [bucket ]] = calloc (1 , sizeof (channel ));
122
122
if (!channels .entry [bucket ][channels .n [bucket ]]){
123
- fprintf ( stderr , "Failed to allocate memory\n " );
123
+ LOG ( "Failed to allocate memory" );
124
124
return NULL ;
125
125
}
126
126
@@ -161,7 +161,7 @@ MM_API void mm_channel_update(channel* chan, uint64_t ident){
161
161
//add to new bucket
162
162
channels .entry [new_bucket ] = realloc (channels .entry [new_bucket ], (channels .n [new_bucket ] + 1 ) * sizeof (channel * ));
163
163
if (!channels .entry [new_bucket ]){
164
- fprintf ( stderr , "Failed to allocate memory\n " );
164
+ LOG ( "Failed to allocate memory" );
165
165
channels .n [new_bucket ] = 0 ;
166
166
return ;
167
167
}
@@ -184,14 +184,14 @@ instance* mm_instance(backend* b){
184
184
//extend
185
185
registry .instances [u ] = realloc (registry .instances [u ], (n + 2 ) * sizeof (instance * ));
186
186
if (!registry .instances [u ]){
187
- fprintf ( stderr , "Failed to allocate memory\n " );
187
+ LOG ( "Failed to allocate memory" );
188
188
return NULL ;
189
189
}
190
190
//sentinel
191
191
registry .instances [u ][n + 1 ] = NULL ;
192
192
registry .instances [u ][n ] = calloc (1 , sizeof (instance ));
193
193
if (!registry .instances [u ][n ]){
194
- fprintf ( stderr , "Failed to allocate memory\n " );
194
+ LOG ( "Failed to allocate memory" );
195
195
}
196
196
registry .instances [u ][n ]-> backend = b ;
197
197
return registry .instances [u ][n ];
@@ -238,7 +238,7 @@ MM_API int mm_backend_instances(char* name, size_t* ninst, instance*** inst){
238
238
239
239
* inst = calloc (i , sizeof (instance * ));
240
240
if (!* inst ){
241
- fprintf ( stderr , "Failed to allocate memory\n " );
241
+ LOG ( "Failed to allocate memory" );
242
242
return 1 ;
243
243
}
244
244
@@ -304,15 +304,15 @@ MM_API int mm_backend_register(backend b){
304
304
registry .backends = realloc (registry .backends , (registry .n + 1 ) * sizeof (backend ));
305
305
registry .instances = realloc (registry .instances , (registry .n + 1 ) * sizeof (instance * * ));
306
306
if (!registry .backends || !registry .instances ){
307
- fprintf ( stderr , "Failed to allocate memory\n " );
307
+ LOG ( "Failed to allocate memory" );
308
308
registry .n = 0 ;
309
309
return 1 ;
310
310
}
311
311
registry .backends [registry .n ] = b ;
312
312
registry .instances [registry .n ] = NULL ;
313
313
registry .n ++ ;
314
314
315
- fprintf ( stderr , "Registered backend %s\n " , b .name );
315
+ LOGPF ( "Registered backend %s" , b .name );
316
316
return 0 ;
317
317
}
318
318
return 1 ;
@@ -331,14 +331,14 @@ int backends_start(){
331
331
332
332
//fetch list of instances
333
333
if (mm_backend_instances (registry .backends [u ].name , & n , & inst )){
334
- fprintf ( stderr , "Failed to fetch instance list for initialization of backend %s\n " , registry .backends [u ].name );
334
+ LOGPF ( "Failed to fetch instance list for initialization of backend %s" , registry .backends [u ].name );
335
335
return 1 ;
336
336
}
337
337
338
338
//start the backend
339
339
current = registry .backends [u ].start (n , inst );
340
340
if (current ){
341
- fprintf ( stderr , "Failed to start backend %s\n " , registry .backends [u ].name );
341
+ LOGPF ( "Failed to start backend %s" , registry .backends [u ].name );
342
342
}
343
343
344
344
//clean up
@@ -378,7 +378,7 @@ int backends_stop(){
378
378
for (u = 0 ; u < registry .n ; u ++ ){
379
379
//fetch list of instances
380
380
if (mm_backend_instances (registry .backends [u ].name , & n , & inst )){
381
- fprintf ( stderr , "Failed to fetch instance list for shutdown of backend %s\n " , registry .backends [u ].name );
381
+ LOGPF ( "Failed to fetch instance list for shutdown of backend %s" , registry .backends [u ].name );
382
382
inst = NULL ;
383
383
n = 0 ;
384
384
}
0 commit comments