@@ -92,7 +92,7 @@ static FAR struct devinfo_s *parse_devinfo(FAR size_t *index)
92
92
93
93
* index = 0 ;
94
94
p = strtok_r (table , ";" , & save_once );
95
- while (p != NULL )
95
+ while (p != NULL )
96
96
{
97
97
p = strtok_r (p , "," , & save );
98
98
if (p == NULL )
@@ -144,7 +144,7 @@ static FAR struct devinfo_s *parse_devinfo(FAR size_t *index)
144
144
devinfo [* index ].pos = devinfo [* index ].base ;
145
145
p = strtok_r (NULL , ";" , & save_once );
146
146
(* index )++ ;
147
- }
147
+ }
148
148
149
149
return devinfo ;
150
150
@@ -291,7 +291,7 @@ static ssize_t handle(FAR struct ofloader_msg *msg,
291
291
292
292
static pthread_addr_t fake_idle (pthread_addr_t arg )
293
293
{
294
- for (;; )
294
+ for (; ; )
295
295
{
296
296
}
297
297
@@ -310,12 +310,17 @@ int main(int argc, FAR char *argv[])
310
310
{
311
311
FAR struct devinfo_s * devinfo ;
312
312
FAR struct ofloader_msg * msg ;
313
+ struct mq_attr mqattr ;
313
314
pthread_attr_t attr ;
314
315
pthread_t thread ;
315
316
size_t count ;
316
317
size_t i ;
317
318
mqd_t mq ;
318
319
320
+ memset (& mqattr , 0 , sizeof (struct mq_attr ));
321
+ mqattr .mq_msgsize = sizeof (msg );
322
+ mqattr .mq_maxmsg = 10 ;
323
+
319
324
if (g_create_idle )
320
325
{
321
326
pthread_attr_init (& attr );
@@ -324,7 +329,7 @@ int main(int argc, FAR char *argv[])
324
329
pthread_attr_destroy (& attr );
325
330
}
326
331
327
- mq = mq_open (OFLOADER_QNAME , O_CREAT | O_RDWR , 0660 , NULL );
332
+ mq = mq_open (OFLOADER_QNAME , O_CREAT | O_RDWR , 0660 , & mqattr );
328
333
if (mq < 0 )
329
334
{
330
335
OFLOADER_DEBUG ("mq_open error:%d\n" , errno );
@@ -347,13 +352,13 @@ int main(int argc, FAR char *argv[])
347
352
348
353
while (1 )
349
354
{
350
- if (mq_receive (mq , (FAR void * )& msg , sizeof (msg ), NULL ) < 0 )
355
+ if (mq_receive (mq , (FAR char * )& msg , sizeof (msg ), NULL ) < 0 )
351
356
{
352
357
OFLOADER_DEBUG (" mq_receive error %d\n" , - errno );
353
358
continue ;
354
359
}
355
360
356
- if (handle (msg , devinfo , count ) < 0 )
361
+ if (handle (msg , devinfo , count ) < 0 )
357
362
{
358
363
msg -> atcion = OFLOADER_ERROR ;
359
364
}
0 commit comments