Possible problem with CONFIGURE_MAXIMUM_SEMAPHORES succeeding

Andrei Chichak groups at chichak.ca
Thu Feb 10 21:15:50 UTC 2011


Hi all,

I was adding another semaphore to my code and decided to test the semaphore create failure case first. I added the create without incrementing the maximum number of semaphores that was configured. The create succeeded rather than failed.

I created 4 semaphores with the maximum set to 3. All returned rtems_status_code == 0. I set the maximum to 2, same. I set the maximum to 1, same. I set the maximum to 0, same result.

This is running on an Axiom CML5282 using RTEMS 4.9.4 and a BSP that is heavily based on the AV5282 and UC5282 BSPs.

Any ideas?



I started stripping out code until my program generates this:


create sem1 semaphore returned with 0

create sem2 semaphore returned with 0

create sem3 semaphore returned with 0

create sem4 semaphore returned with 0


From this (only comments have been removed):


#include <rtems.h>

rtems_task Init(rtems_task_argument ignored);

#include <bsp.h>

#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_TASKS				1
#define CONFIGURE_MAXIMUM_MESSAGE_QUEUES	0

#define CONFIGURE_MAXIMUM_SEMAPHORES		0

#define CONFIGURE_MAXIMUM_TIMERS			0
#define CONFIGURE_MAXIMUM_PARTITIONS		0
#define CONFIGURE_MAXIMUM_DRIVERS			20

#define STACK_CHECKER_ON

#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20

#define CONFIGURE_RTEMS_INIT_TASKS_TABLE
#define CONFIGURE_INIT

#include <rtems/confdefs.h>

static rtems_id sem1;
static rtems_id sem2;
static rtems_id sem3;
static rtems_id sem4;

rtems_task Init(rtems_task_argument ignored) {

	rtems_status_code status;

	status = rtems_semaphore_create( rtems_build_name('S','E','M','1'),
			1,
			RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,
			0,
			&sem1);

	printk("create sem1 semaphore returned with %d\n", status);

	status = rtems_semaphore_create( rtems_build_name('S','E','M','2'),
			1,
			RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,
			0,
			&sem2);

	printk("create sem2 semaphore returned with %d\n", status);

	status = rtems_semaphore_create( rtems_build_name('S','E','M','3'),
			1,
			RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,
			0,
			&sem3);

	printk("create sem3 semaphore returned with %d\n", status);

	status = rtems_semaphore_create( rtems_build_name('S','E','M','4'),
			1,
			RTEMS_PRIORITY | RTEMS_BINARY_SEMAPHORE | RTEMS_INHERIT_PRIORITY | RTEMS_NO_PRIORITY_CEILING | RTEMS_LOCAL,
			0,
			&sem4);

	printk("create sem4 semaphore returned with %d\n", status);

	status = rtems_task_delete( RTEMS_SELF);
	exit(0);
}



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110210/0f408f02/attachment.html>


More information about the users mailing list