Exemple #1
0
int main(int argc, char *argv[])
{
	const char *src, *node, *opts;
	char *rsrc = NULL;
	char *popts = NULL;
	int flags = 0;
	int retval = 0;

	retval = parse_arguments(argc, argv, &src, &node, &opts);
	if (retval) {
		usage(argv[0]);
		exit((retval > 0) ? EXIT_SUCCESS : EXIT_FAILURE);
	}

	rsrc = mount_resolve_src(src);
	if (!rsrc) {
		printf("failed to resolve source\n");
		exit(1);
	}

	modprobe();

	popts = parse_options(opts, &flags);
	if (!popts) {
		printf("failed to parse ceph_options\n");
		exit(1);
	}

	block_signals(SIG_BLOCK);

	if (mount(rsrc, node, "ceph", flags, popts)) {
		retval = errno;
		switch (errno) {
		case ENODEV:
			printf("mount error: ceph filesystem not supported by the system\n");
			break;
		default:
			printf("mount error %d = %s\n",errno,strerror(errno));
		}
	} else {
		if (!skip_mtab_flag) {
			update_mtab_entry(rsrc, node, "ceph", popts, flags, 0, 0);
		}
	}

	block_signals(SIG_UNBLOCK);

	free(popts);
	free(rsrc);
	exit(retval);
}
static void
gdaui_entry_wrapper_set_value_default (GdauiDataEntry *iface, const GValue *value)
{
	GdauiEntryWrapper *wrapper;

	g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
	wrapper = (GdauiEntryWrapper*) iface;

	if (wrapper->priv->value_default)
		gda_value_free (wrapper->priv->value_default);

	if (value)
		wrapper->priv->value_default = gda_value_copy ((GValue *) value);
	else
		wrapper->priv->value_default = gda_value_new_null ();

	if (wrapper->priv->default_forced) {
		if (G_VALUE_TYPE (wrapper->priv->value_default) == wrapper->priv->type) {
			check_correct_init (wrapper);
			block_signals (wrapper);
			gdaui_entry_wrapper_set_value (iface, wrapper->priv->value_default);
			unblock_signals (wrapper);
			wrapper->priv->default_forced = TRUE;
		}
		else {
			check_correct_init (wrapper);
			(*wrapper->priv->real_class->real_set_value) (wrapper, NULL);
		}
		gdaui_entry_wrapper_emit_signal (wrapper);
	}
}
static void
gdaui_entry_wrapper_set_value (GdauiDataEntry *iface, const GValue *value)
{
	GdauiEntryWrapper *wrapper;

	g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
	wrapper = (GdauiEntryWrapper*) iface;
	check_correct_init (wrapper);

	block_signals (wrapper);
	if (value) {
		g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == wrapper->priv->type) ||
				  (G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL));
		(*wrapper->priv->real_class->real_set_value) (wrapper, value);
		if (G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL)
			wrapper->priv->null_forced = TRUE;
		else
			wrapper->priv->null_forced = FALSE;
	}
	else {
		(*wrapper->priv->real_class->real_set_value) (wrapper, NULL);
		wrapper->priv->null_forced = TRUE;
	}
	unblock_signals (wrapper);
	wrapper->priv->default_forced = FALSE;
	wrapper->priv->contents_has_changed = FALSE;

	gdaui_entry_wrapper_emit_signal (wrapper);
}
Exemple #4
0
void sig_handler_common_tt(int sig, void *sc_ptr)
{
	struct sigcontext *sc = sc_ptr;
	struct tt_regs save_regs, *r;
	struct signal_info *info;
	int save_errno = errno, is_user;

	unprotect_kernel_mem();

	r = &TASK_REGS(get_current())->tt;
	save_regs = *r;
	is_user = user_context(SC_SP(sc));
	r->sc = sc;
	if(sig != SIGUSR2) 
		r->syscall = -1;

	change_sig(SIGUSR1, 1);
	info = &sig_info[sig];
	if(!info->is_irq) unblock_signals();

	(*info->handler)(sig, (union uml_pt_regs *) r);

	if(is_user){
		interrupt_end();
		block_signals();
		change_sig(SIGUSR1, 0);
		set_user_mode(NULL);
	}
	*r = save_regs;
	errno = save_errno;
	if(is_user) protect_kernel_mem();
}
static gboolean
gb_color_picker_document_monitor_queue_oper_cb (gpointer data)
{
  QueuedColorize *qc = data;

  g_assert (qc != NULL);
  g_assert (GB_IS_COLOR_PICKER_DOCUMENT_MONITOR (qc->self));
  g_assert (GTK_IS_TEXT_MARK (qc->begin));
  g_assert (GTK_IS_TEXT_MARK (qc->end));
  g_assert (GTK_TEXT_BUFFER (qc->buffer));

  block_signals (qc->self, IDE_BUFFER (qc->buffer));

  if (qc->buffer != NULL)
    {
      GtkTextIter begin;
      GtkTextIter end;

      gtk_text_buffer_get_iter_at_mark (qc->buffer, &begin, qc->begin);
      gtk_text_buffer_get_iter_at_mark (qc->buffer, &end, qc->end);

      if (qc->uncolorize)
        gb_color_picker_document_monitor_uncolorize (qc->self, qc->buffer, &begin, &end);
      else
        gb_color_picker_document_monitor_colorize (qc->self, qc->buffer, &begin, &end);

      gtk_text_buffer_delete_mark (qc->buffer, qc->begin);
      gtk_text_buffer_delete_mark (qc->buffer, qc->end);
    }

  unblock_signals (qc->self, IDE_BUFFER (qc->buffer));

  return G_SOURCE_REMOVE;
}
Exemple #6
0
int main(int argc, char **argv) {
  bool debug = false;
  f18a f18a;

  for (;;) {
    int c;

    static struct option long_options[] = {
      {"help", 0, 0, 'h'},
      {"version", 0, 0, 'v'},
      {"debug-boot", 0, 0, 'd'},
      {0, 0, 0, 0},
    };

    c = getopt_long(argc, argv, "hvd", long_options, NULL);

    if (c == -1) break;

    switch (c) {
      case 'h':
        usage(argv);
        return 0;
      case 'v':
        puts("f18a" F18A_VERSION);
        return 0;
      case 'd':
        debug = true;
        break;
      default:
        usage(argv);
        return 1;
    }
  }

  if (argc - optind != 1) {
    usage(argv);
    return 1;
  }
  
  const char *image = argv[optind];

  // init term first so that image load status is visible...
  block_signals();
  f18a_init(&f18a);
  f18a_initterm();
  if (!f18a_loadcore(&f18a, image)) {
    tcsetattr(0, TCSANOW, &old_termios);
    return -1;
  }

  f18a_msg("welcome to f18a, version " F18A_VERSION "\n");
  f18a_msg("press ctrl-c or send SIGINT for debugger, ctrl-d to exit.\n");
  f18a_run(&f18a, debug);

  f18a_killterm();
  puts(" * f18a halted.");

  tcsetattr(0, TCSANOW, &old_termios);
  return 0;
}
Exemple #7
0
static void update_visibility(adapter_data *adapter)
{
	gboolean inconsistent, enabled;

	block_signals(adapter);

	/* Switch off a few widgets */
	gtk_widget_set_sensitive (adapter->button_discoverable, adapter->powered);
	gtk_widget_set_sensitive (adapter->devices_table, adapter->powered);
	gtk_widget_set_sensitive (adapter->name_vbox, adapter->powered);

	if (adapter->discoverable != FALSE && adapter->timeout_value == 0) {
		inconsistent = FALSE;
		enabled = TRUE;
	} else if (adapter->discoverable == FALSE) {
		inconsistent = enabled = FALSE;
	} else {
		inconsistent = enabled = TRUE;
	}

	gtk_toggle_button_set_inconsistent (GTK_TOGGLE_BUTTON (adapter->button_discoverable), inconsistent);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (adapter->button_discoverable), enabled);

	unblock_signals(adapter);
}
Exemple #8
0
void sig_handler(ARCH_SIGHDLR_PARAM)
{
	struct sigcontext *sc;
	int enabled;

	/* Must be the first thing that this handler does - x86_64 stores
	 * the sigcontext in %rdx, and we need to save it before it has a
	 * chance to get trashed.
	 */

	ARCH_GET_SIGCONTEXT(sc, sig);

	enabled = signals_enabled;
	if(!enabled && (sig == SIGIO)){
		pending |= SIGIO_MASK;
		return;
	}

	block_signals();

	CHOOSE_MODE_PROC(sig_handler_common_tt, sig_handler_common_skas,
			 sig, sc);

	set_signals(enabled);
}
Exemple #9
0
void mainline(void)
{
  in_critical_section = 1;

  do_normal_work();

  while (count1 != count2) {
    do_signal_work();
    count2++;
  }
  in_critical_section = 0;

  while (count1 != count2) {
    /* here we have to block signals, but we expect it almost never to
     * happen.  it will only happen if a signal arrives between the
     * end of the first while loop and the unsetting of the
     * in_critical_section flag, which should be so rare that the
     * performance hit will be tiny
     */
    block_signals();
    do_signal_work();
    count2++;
    unblock_signals();
  }
}
	widgetdock_mcl::widgetdock_mcl(control_F9S_MCL3& mcl3):
		QDockWidget(tr("MCL")),
		mcl3_(mcl3),
		joystick_(tr("Joystick")),
		reset_pos_(tr("Reset position"))
	{
		layout_.addWidget(&x_);
		layout_.addWidget(&y_);
		layout_.addWidget(&z_);
		layout_.addWidget(&joystick_);
		layout_.addWidget(&reset_pos_);
		layout_.addStretch();

		widget_.setLayout(&layout_);
		setWidget(&widget_);


		joystick_.setCheckable(true);
		timer_.setSingleShot(true);


		auto set_pos = [this](std::int64_t x, std::int64_t y, std::int64_t z){
			x_.setText(tr("X: %1 mm").arg(x / 1000.));
			y_.setText(tr("Y: %1 mm").arg(y / 1000.));
			z_.setText(tr("Z: %1 mm").arg(z / 1000.));
		};

		mcl3_.position_changed.connect(set_pos);

		mcl3_.joystick_changed.connect([this](bool on){
			exception_catcher([&]{
				auto block = block_signals(joystick_);
				joystick_.setChecked(on);
				if(on) timer_.start(500);
			});
		});

		connect(&joystick_, &QPushButton::released, [this]{
			exception_catcher([&]{
				mcl3_.activate_joystick(joystick_.isChecked());
			});
		});

		connect(&reset_pos_, &QPushButton::released, [this]{
			exception_catcher([&]{
				mcl3_.set_position(0, 0, 0);
			});
		});

		connect(&timer_, &QTimer::timeout, [this, set_pos]{
			if(!joystick_.isChecked()) return;

			exception_catcher([&]{
				auto pos = mcl3_.position();
				set_pos(pos[0], pos[1], pos[2]);
			});

			timer_.start(100);
		});
	}
Exemple #11
0
Fichier : buffer.c Projet : dmt4/ne
void free_chars(buffer *const b, char *const p, const int64_t len) {
	if (!b || !p || !len) return;

	char_pool *cp = get_char_pool(b, p);

	assert_char_pool(cp);

	assert(*p);
	assert(p[len - 1]);

	block_signals();

	memset(p, 0, len);
	b->free_chars += len;

	if (p == &cp->pool[cp->first_used]) while(cp->first_used <= cp->last_used && !cp->pool[cp->first_used]) cp->first_used++;
	if (p + len - 1 == &cp->pool[cp->last_used]) while(!cp->pool[cp->last_used] && cp->first_used <= cp->last_used) cp->last_used--;

	if (cp->last_used < cp->first_used) {
		rem(&cp->cp_node);
		b->allocated_chars -= cp->size;
		b->free_chars -= cp->size;
		free_char_pool(cp);
		release_signals();
		return;
	}

	assert_char_pool(cp);
	release_signals();
}
Exemple #12
0
/* \param ptr	pointer to a valid xdffile structure
 *
 * This is the function implementing the background thread transfering data
 * from/to the underlying file. 
 * This performs the transfer of the back buffer whenever the condition is
 * signaled and order is ORDER_TRANSFER. The end of the transfer is notified
 * by clearing the order and signal the condition
 *
 * This function reports information back to the main thread using
 * xdf->reportval which is updated by read_diskrec and write_diskrec when
 * necessary
 */
static void* transfer_thread_fn(void* ptr)
{
	struct xdf* xdf = ptr;
	int wmode = (xdf->mode == XDF_WRITE) ? 1 : 0;

	block_signals(NULL);
	
 	// While a transfer is performed, this routine holds the mutex
	// preventing from any early buffer swap
 	pthread_mutex_lock(&(xdf->mtx));
	while (1) {
		// The transfer ready to be performed
		// => clear the previous order and notify the main thread
		xdf->order = 0;
		pthread_cond_signal(&(xdf->cond));

		// Wait for an order of transfer
		while (!xdf->order)
			pthread_cond_wait(&(xdf->cond), &(xdf->mtx));
	
		// break the transfer loop if the quit order has been sent
		if (xdf->order == ORDER_QUIT)
			break;

		// Write/Read a record
		if (wmode)
			write_diskrec(xdf);
		else
			read_diskrec(xdf);

	}
	pthread_mutex_unlock(&(xdf->mtx));
	return NULL;
}
Exemple #13
0
Fichier : buffer.c Projet : dmt4/ne
void free_buffer_contents(buffer * const b) {

	if (!b) return;

	block_signals();

	free_list(&b->line_desc_pool_list, free_line_desc_pool);
	free_list(&b->char_pool_list, free_char_pool);
	new_list(&b->line_desc_list);
	b->cur_line_desc = b->top_line_desc = NULL;

	b->allocated_chars = b->free_chars = 0;
	b->is_CRLF = false;
	b->encoding = ENC_ASCII;
	b->bookmark_mask = 0;
	b->mtime = 0;

	free_char_stream(b->last_deleted);
	b->last_deleted = NULL;

	free(b->filename);
	b->filename = NULL;

	reset_undo_buffer(&b->undo);
	b->is_modified = b->marking = b->recording = b->x_wanted = 0;

	release_signals();
}
Exemple #14
0
void new_thread(void *stack, void **switch_buf_ptr, void **fork_buf_ptr,
		void (*handler)(int))
{
	unsigned long flags;
	sigjmp_buf switch_buf, fork_buf;

	*switch_buf_ptr = &switch_buf;
	*fork_buf_ptr = &fork_buf;

	/* Somewhat subtle - siglongjmp restores the signal mask before doing
	 * the longjmp.  This means that when jumping from one stack to another
	 * when the target stack has interrupts enabled, an interrupt may occur
	 * on the source stack.  This is bad when starting up a process because
	 * it's not supposed to get timer ticks until it has been scheduled.
	 * So, we disable interrupts around the sigsetjmp to ensure that
	 * they can't happen until we get back here where they are safe.
	 */
	flags = get_signals();
	block_signals();
	if(sigsetjmp(fork_buf, 1) == 0)
		new_thread_proc(stack, handler);

	remove_sigstack();

	set_signals(flags);
}
Exemple #15
0
int
main(int argc, char **argv)
{
	int status;
	timer_t timer;
	unsigned long count = 0;
	int stop_test = 0;

	block_signals();
	setup_timer(&timer);
	printf("Press Ctrl-C to stop\n");
	while (stop_test == 0) {
		if (start_timer(timer, 0, 500000000)) {
			stop_test = 1;
			continue;
		}
		status = wait_for_signal();
		if (status == SIGINT) {
			fputs("\033[1B", stdout);
			stop_test = 1;
		}
		else if (status == TIMER_SIGNAL) {
			printf("count: %lu\n", ++count);
			fputs("\033[1A", stdout);
		}
		else {
			fprintf(stderr, "WTF?\n");
			return -1;
		}
	}
	return 0;
}	
Exemple #16
0
void run(void) {
	int err;
	while(!interrupted) {
		pthread_t thread;
		struct message msg;

		if(-1 == msgrcv(request_queue_id, &msg, MSG_SIZE, CHANNEL_REQUEST_CHANNEL, 0))
			serv_msg_error("Unable to receive a message");

		if(CHANNEL_REQUEST != msg.type)
			serv_error("Invalid message type");

		bool allowed = true;
		if(msg.channel_request.id > 0) {
			if(!stations[msg.channel_request.id - 1])
				stations[msg.channel_request.id - 1] = true;
			else { // Another connection from the same polling station
				allowed = false;
			}
		}

		// Get a new thread slot
		lock_mutex(&counter_mutex);
		while(MAX_THREADS == alive_threads) {
			if(-1 == (err = pthread_cond_wait(&slot_cond, &counter_mutex)))
				serv_error("Unable to wait on slot_cond: %d", err);
		}

		// Mask signals while creating a new thread (as it will inherit the mask)
		block_signals(true);
		struct thread_param *param = malloc(sizeof(struct thread_param));
		if(NULL == param)
			serv_error("Unable to allocate memory");
		param->allowed = allowed;
		param->msg = msg;
		err = pthread_create(&thread, &attr, &thread_start, param);
		if(-1 != err)
			++alive_threads;
		unlock_mutex(&counter_mutex);
		block_signals(false);

		if(-1 == err)
			serv_error("Unable to spawn worker thread: %d", err);
	}
}
Exemple #17
0
static void
record_signal_delivery (int signo)
{
  block_signals ();
  (*signal_history_pointer++) = signo;
  if (signal_history_pointer >= (& (signal_history [sizeof (signal_history)])))
    signal_history_pointer = (&signal_history[0]);
  unblock_signals ();
}
Exemple #18
0
int main(void)
{
	signal(SIGTERM, &try_it_again);

	printf("I'm %d, kill me if you can!\n", (int)getpid());
	block_signals();
	while (1);

	return 0;
}
Exemple #19
0
VALUE furnsh(int argc, VALUE *argv, VALUE self) {
  sigset_t old_mask = block_signals();

  furnsh_c(StringValuePtr(argv[0]));

  restore_signals(old_mask);
  
  if(spice_error(SHORT)) return Qfalse;

  return Qtrue;
}
Exemple #20
0
static int __init start_kernel_proc(void *unused)
{
	int pid;

	block_signals();
	pid = os_getpid();

	cpu_tasks[0].pid = pid;
	cpu_tasks[0].task = current;
#ifdef CONFIG_SMP
<<<<<<< HEAD
Exemple #21
0
static VALUE unload(VALUE self, VALUE kernel) {
  sigset_t old_mask = block_signals();

  unload_c(StringValuePtr(kernel));
  
  restore_signals(old_mask);
  
  if(spice_error(SPICE_ERROR_SHORT)) return Qfalse;

  return Qtrue;
}
Exemple #22
0
/* Execute a compiler backend, capturing all output to the given paths the full
 * path to the compiler to run is in argv[0]. */
int
execute(char **argv, int fd_out, int fd_err, pid_t *pid)
{
	int status;

	cc_log_argv("Executing ", argv);

	block_signals();
	*pid = fork();
	unblock_signals();

	if (*pid == -1) {
		fatal("Failed to fork: %s", strerror(errno));
	}

	if (*pid == 0) {
		/* Child. */
		dup2(fd_out, 1);
		close(fd_out);
		dup2(fd_err, 2);
		close(fd_err);
		x_exit(execv(argv[0], argv));
	}

	close(fd_out);
	close(fd_err);

	if (waitpid(*pid, &status, 0) != *pid) {
		fatal("waitpid failed: %s", strerror(errno));
	}

	block_signals();
	*pid = 0;
	unblock_signals();

	if (WEXITSTATUS(status) == 0 && WIFSIGNALED(status)) {
		return -1;
	}

	return WEXITSTATUS(status);
}
Exemple #23
0
/* \param xdf	pointer of a valid xdf file with mode XDF_WRITE
 *
 * Write the header of the file format
 */
static int init_file_content(struct xdf* xdf)
{
	int retval = 0;
	sigset_t oldmask;

	block_signals(&oldmask);
	if (xdf->ops->write_header(xdf) || fsync(xdf->fd))
		retval = -1;
	
	unblock_signals(&oldmask);
	return retval;
}
Exemple #24
0
/* \param xdf 	pointer to a valid xdffile with mode XDF_WRITE 
 *
 * Finish the file
 */
static int complete_file_content(struct xdf* xdf)
{
	int retval = 0;
	sigset_t oldmask;

	block_signals(&oldmask);
	if (xdf->ops->complete_file(xdf) || fsync(xdf->fd))
		retval = -1;
	unblock_signals(&oldmask);

	return retval;
}
Exemple #25
0
void __stack_smash_handler(char func[], int damaged)
{
	static const char message[] = ": stack smashing attack in function ";

	block_signals();

	ssp_write(STDERR_FILENO, __uclibc_progname, message, func);

	/* The loop is added only to keep gcc happy. */
	while(1)
		terminate();
}
Exemple #26
0
/** Initializes all ncurses' related stuff (windows, colors...).
 *  There's no need to call 'engine_exit' */
bool engine_init()
{
    /* signals during initialization */
    block_signals();

    engine_screen_init(80, 24);
    engine_windows_init();
    engine_keymap(NULL);

    restore_signals();
    register_signal_handler();
    return true;
}
Exemple #27
0
void
pcl::OpenNIGrabber::start ()
{
  try
  {
    // check if we need to start/stop any stream
    if (image_required_ && !device_->isImageStreamRunning ())
    {
      block_signals ();
      device_->startImageStream ();
      //startSynchronization ();
    }

    if (depth_required_ && !device_->isDepthStreamRunning ())
    {
      block_signals ();
      if (device_->hasImageStream () && !device_->isDepthRegistered () && device_->isDepthRegistrationSupported ())
      {
        device_->setDepthRegistration (true);
      }
      device_->startDepthStream ();
      //startSynchronization ();
    }

    if (ir_required_ && !device_->isIRStreamRunning ())
    {
      block_signals ();
      device_->startIRStream ();
    }
    running_ = true;
  }
  catch (openni_wrapper::OpenNIException& ex)
  {
    PCL_THROW_EXCEPTION (pcl::IOException, "Could not start streams. Reason: " << ex.what ());
  }
  // workaround, since the first frame is corrupted
  boost::this_thread::sleep (boost::posix_time::seconds (1));
  unblock_signals ();
}
Exemple #28
0
void __stack_chk_fail(void)
{
	static const char msg1[] = "stack smashing detected: ";
	static const char msg3[] = " terminated";

	block_signals();

	ssp_write(STDERR_FILENO, msg1, __uclibc_progname, msg3);

	/* The loop is added only to keep gcc happy. */
	while(1)
		terminate();
}
Exemple #29
0
/*
 * VG locking is by VG name.
 * FIXME This should become VG uuid.
 */
static int _lock_vol(struct cmd_context *cmd, const char *resource,
		     uint32_t flags, lv_operation_t lv_op, struct logical_volume *lv)
{
	uint32_t lck_type = flags & LCK_TYPE_MASK;
	uint32_t lck_scope = flags & LCK_SCOPE_MASK;
	int ret = 0;

	block_signals(flags);
	_lock_memory(cmd, lv_op);

	assert(resource);

	if (!*resource) {
		log_error(INTERNAL_ERROR "Use of P_orphans is deprecated.");
		goto out;
	}

	if ((is_orphan_vg(resource) || is_global_vg(resource)) && (flags & LCK_CACHE)) {
		log_error(INTERNAL_ERROR "P_%s referenced", resource);
		goto out;
	}

	if (cmd->metadata_read_only && lck_type == LCK_WRITE &&
	    strcmp(resource, VG_GLOBAL)) {
		log_error("Operation prohibited while global/metadata_read_only is set.");
		goto out;
	}

	if ((ret = _locking.lock_resource(cmd, resource, flags, lv))) {
		if (lck_scope == LCK_VG && !(flags & LCK_CACHE)) {
			if (lck_type != LCK_UNLOCK)
				lvmcache_lock_vgname(resource, lck_type == LCK_READ);
			dev_reset_error_count(cmd);
		}

		_update_vg_lock_count(resource, flags);
	} else
		stack;

	/* If unlocking, always remove lock from lvmcache even if operation failed. */
	if (lck_scope == LCK_VG && !(flags & LCK_CACHE) && lck_type == LCK_UNLOCK) {
		lvmcache_unlock_vgname(resource);
		if (!ret)
			_update_vg_lock_count(resource, flags);
	}
out:
	_unlock_memory(cmd, lv_op);
	_unblock_signals();

	return ret;
}
Exemple #30
0
static void
gdaui_entry_wrapper_set_ref_value (GdauiDataEntry *iface, const GValue *value)
{
	GdauiEntryWrapper *wrapper;
	gboolean changed = TRUE;
	GValue *evalue;

	g_return_if_fail (GDAUI_IS_ENTRY_WRAPPER (iface));
	wrapper = (GdauiEntryWrapper*) iface;
	check_correct_init (wrapper);

	/* compare existing value and the one provided as argument */
	if (wrapper->priv->real_class->value_is_equal_to)
		changed = ! wrapper->priv->real_class->value_is_equal_to (wrapper, value);
	else {
		evalue = gdaui_entry_wrapper_get_value (iface);
		g_assert (evalue);
		if ((!value || (G_VALUE_TYPE (value) == GDA_TYPE_NULL)) &&
		    (G_VALUE_TYPE (evalue) == GDA_TYPE_NULL))
			changed = FALSE;
		else if (!gda_value_differ ((GValue *) value, evalue))
			changed = FALSE;
		gda_value_free (evalue);
	}

	/* get rid on any existing orig value */
	if (wrapper->priv->value_ref) {
		gda_value_free (wrapper->priv->value_ref);
		wrapper->priv->value_ref = NULL;
	}

	/* apply changes, if any */
	if (changed) {
		block_signals (wrapper);
		gdaui_entry_wrapper_set_value (iface, value);
		unblock_signals (wrapper);
	}

	if (value) {
		g_return_if_fail ((G_VALUE_TYPE ((GValue *) value) == wrapper->priv->type) ||
				  (G_VALUE_TYPE ((GValue *) value) == GDA_TYPE_NULL));
		wrapper->priv->value_ref = gda_value_copy ((GValue *) value);
	}
	else
		wrapper->priv->value_ref = gda_value_new_null ();

	/* signal changes if any */
	if (changed)
		gdaui_entry_wrapper_emit_signal (wrapper);
}