コード例 #1
0
ファイル: mesa.c プロジェクト: unsw-corg/PTABen
int main()
{
    struct gl_api_table* table = (struct gl_api_table*)calloc(1, sizeof(struct gl_api_table));
    init_exec_pointers( table );
    check_pointers( table );
    return 0;
}
コード例 #2
0
ファイル: dbverify.c プロジェクト: MarcNo/lifelines
/*=====================================
 * check_othe -- process othe record
 *  checking and/or fixing as requested
 * Created: 2001/01/14, Perry Rapp
 *===================================*/
static BOOLEAN
check_othe (CNSTRING key, RECORD rec)
{
    static char prevkey[MAXKEYWIDTH+1];
    if (!strcmp(key, prevkey)) {
        report_error(ERR_DUPOTHE, _("Duplicate record for %s"), key);
    }
    check_pointers(key, rec);
    append_indiseq_null(seq_othes, strsave(key), NULL, TRUE, TRUE);
    return TRUE;
}
コード例 #3
0
ファイル: dbverify.c プロジェクト: MarcNo/lifelines
/*=====================================
 * check_fam -- check family record
 *  and record any records needing fixing
 *  in tofix list
 *===================================*/
static BOOLEAN
check_fam (CNSTRING key, RECORD rec)
{
    static char prevkey[MAXKEYWIDTH+1]="";
    CACHEEL fcel1=0;
    RECORD recx=0;

    if (eqstr(key, prevkey)) {
        report_error(ERR_DUPFAM, _("Duplicate family for %s"), key);
    }

    fcel1 = fam_to_cacheel(rec);
    lock_cache(fcel1);

    recx = get_record_for_cel(fcel1);
    ASSERT(todo.pass == 1);
    process_fam(recx);

    unlock_cache(fcel1);
    check_pointers(key, rec);
    append_indiseq_null(seq_fams, strsave(key), NULL, TRUE, TRUE);
    return TRUE;
}
コード例 #4
0
ファイル: dbverify.c プロジェクト: MarcNo/lifelines
/*=====================================
 * check_indi -- check indi record
 *  and record any records needing fixing
 *  in tofix list
 *===================================*/
static BOOLEAN
check_indi (CNSTRING key, RECORD rec)
{
    static char prevkey[MAXKEYWIDTH+1];
    CACHEEL icel1=0;
    RECORD recx=0;

    if (eqstr(key, prevkey)) {
        report_error(ERR_DUPINDI, _("Duplicate individual for %s"), key);
    }
    icel1 = indi_to_cacheel(rec);
    lock_cache(icel1);

    recx = get_record_for_cel(icel1);
    ASSERT(todo.pass == 1);
    process_indi(recx);

    unlock_cache(icel1);
    check_pointers(key, rec);
    append_indiseq_null(seq_indis, strsave(key), NULL, TRUE, TRUE);
    release_record(recx);
    return TRUE;
}
コード例 #5
0
int syscall_handler(volatile registers_t *regs)
{
	/* SYSCALL_NUM_AND_RET is defined to be the correct register in the syscall regs struct. */
	if(unlikely(SYSCALL_NUM_AND_RET >= num_syscalls))
		return -ENOSYS;
	if(unlikely(!syscall_table[SYSCALL_NUM_AND_RET]))
		return -ENOSYS;
	volatile long ret;
	if(!check_pointers(regs))
		return -EINVAL;
	if(kernel_state_flags & KSF_SHUTDOWN)
		for(;;);
	//if(got_signal(current_task) || (unsigned)(ticks-current_task->slice) > (unsigned)current_task->cur_ts)
	//	schedule();
	enter_system(SYSCALL_NUM_AND_RET);
	/* most syscalls are re-entrant, so we enable interrupts and
	 * expect handlers to disable them if needed */
	set_int(1);
	/* start accounting information! */
	current_task->freed = current_task->allocated=0;
	
	#ifdef SC_DEBUG
	if(current_task->tty == curcons->tty) 
		printk(SC_DEBUG, "syscall %d: enter %d\n", current_task->pid, SYSCALL_NUM_AND_RET);
	int or_t = ticks;
	#endif
	__do_syscall_jump(ret, syscall_table[SYSCALL_NUM_AND_RET], _E_, _D_, 
					  _C_, _B_, _A_);
	#ifdef SC_DEBUG
	if(current_task->tty == curcons->tty && (ticks - or_t >= 10 || 1) 
		&& (ret < 0 || 1) && (ret == -EINTR || 1))
		printk(SC_DEBUG, "syscall %d: %d ret %d, took %d ticks\n", 
			   current_task->pid, current_task->system, ret, ticks - or_t);
		#endif
		
	set_int(0);
	exit_system();
	__engage_idle();
	/* if we need to reschedule, or we have overused our timeslice
	 * then we need to reschedule. this prevents tasks that do a continuous call
	 * to write() from starving the resources of other tasks. syscall_count resets
	 * on each call to schedule() */
	if(current_task->flags & TF_SCHED 
		|| (unsigned)(ticks-current_task->slice) > (unsigned)current_task->cur_ts
		|| ++current_task->syscall_count > 2)
	{
		/* clear out the flag. Either way in the if statement, we've rescheduled. */
		lower_flag(TF_SCHED);
		schedule();
	}
	/* store the return value in the regs */
	SYSCALL_NUM_AND_RET = ret;
	/* if we're going to jump to a signal here, we need to back up our 
	 * return value so that when we return to the system we have the
	 * original systemcall returning the proper value.
	 */
	if((current_task->flags & TF_INSIG) && (current_task->flags & TF_JUMPIN)) {
#if CONFIG_ARCH == TYPE_ARCH_X86
		current_task->reg_b.eax=ret;
#elif CONFIG_ARCH == TYPE_ARCH_X86_64
		current_task->reg_b.rax=ret;
#endif
		lower_flag(TF_JUMPIN);
	}
	return ret;
}