Ejemplo n.º 1
0
ELK_PRECONSTRUCTOR()
{
  static int setup;
  if (setup) {
    return;
  }

  // Set up the console for interrupt serial I/O.
  sem_init(&sem_output, 0, 1);
  sem_init(&sem_input, 0, 1);
  ibuffer_in = ibuffer_out = ibuffer;
  sem_init(&sem_obuffer, 0, 0);
  obuffer_in = obuffer_out = obuffer;

  // Set up the system calls.
  SYSCALL(ioctl);
  SYSCALL(write);
  SYSCALL(writev);
  SYSCALL(read);
  SYSCALL(readv);

  // Register the interrupt handler.
  console_interrupt_register(rx_interrupt, tx_interrupt);

  // Enable the receive interrupt.
  console_enable_rx_interrupt();
  setup = 1;
}
Ejemplo n.º 2
0
void init() {
	int i;
	// Initialize kseg0 & useg3 page table (same for all processes)
	init_kernel_pt();
	init_useg3_pt();

	// Initilize all VM-I/O support level semaphores
	swap_semaphore = 1;
	memset(uproc_semaphore, 0, sizeof(int) * UPROCMAX); //Private semaphore for delay facility

	initADL();
	init_del_deamon();
	initAVSL();
	disk_init();
	initSwapPool();
	initDMA();

	// Init all the u-procs from tape and get the number of u-procs created
	uprocess_c = init_proc();
	// wait for all uprocs to terminate
	SYSCALL(SEMOP,&master_sem,-1,0);
	//Terminate Deamon
	SYSCALL(TERMINATEPROCESS,3,0,0);

	//Terminate the init process (and all his children)
	//This should HALT the system
	SYSCALL(TERMINATEPROCESS,0,0,0);
	fatal("System failed to terminate");
}
Ejemplo n.º 3
0
int
xf86WaitForInput (int fd, int timeout)
{
	fd_set readfds;
	struct timeval to;
	int r;

	FD_ZERO(&readfds);

	if (fd >= 0) {
	    FD_SET(fd, &readfds);
	}
	
	to.tv_sec = timeout / 1000000;
	to.tv_usec = timeout % 1000000;

	if (fd >= 0) {
	    SYSCALL (r = select (FD_SETSIZE, &readfds, NULL, NULL, &to));
	}
	else {
	    SYSCALL (r = select (FD_SETSIZE, NULL, NULL, NULL, &to));
	}
	xf86ErrorFVerb (9,"select returned %d\n", r);
	return r;
}
Ejemplo n.º 4
0
int
xf86SetSerialSpeed(int fd, int speed)
{
    struct termios t;
    int baud, r;

    if (fd < 0)
        return -1;

    /* Don't try to set parameters for non-tty devices. */
    if (!isatty(fd))
        return 0;

    SYSCALL(tcgetattr(fd, &t));

    if ((baud = GetBaud(speed))) {
        cfsetispeed(&t, baud);
        cfsetospeed(&t, baud);
    }
    else {
        xf86Msg(X_ERROR, "Invalid Option BaudRate value: %d\n", speed);
        return -1;
    }

    SYSCALL(r = tcsetattr(fd, TCSANOW, &t));
    return r;
}
Ejemplo n.º 5
0
_X_HIDDEN void
sunKbdSoundBell(sunKbdPrivPtr priv, int loudness, int pitch, int duration)
{
    int	kbdCmd, i;

    if (loudness && pitch)
    {
#ifdef AUDIO_BELL
	if (priv->audioDevName != NULL) {
	    if (sunKbdAudioBell(priv, loudness, pitch, duration) == 0) {
		return;
	    }
	}
#endif
	
 	kbdCmd = KBD_CMD_BELL;
		
	SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
	if (i < 0) {
	    xf86Msg(X_ERROR, "%s: Failed to activate bell: %s\n",
                priv->devName, strerror(errno));
	}
	
	usleep(duration * loudness * 20);
	
	kbdCmd = KBD_CMD_NOBELL;
	SYSCALL(i = ioctl (priv->kbdFD, KIOCCMD, &kbdCmd));
	if (i < 0) {
	     xf86Msg(X_ERROR, "%s: Failed to deactivate bell: %s\n",
                priv->devName, strerror(errno));
	}
    }
}
/*
 * Initialize and enable the mouse wheel, if present.
 *
 * Returns 1 if mouse wheel was successfully enabled.
 * Returns 0 if an error occurred or if there is no mouse wheel.
 */
static int
vuidMouseWheelInit(InputInfoPtr pInfo)
{
#ifdef HAVE_VUID_WHEEL
    wheel_state wstate;
    int nwheel = -1;
    int i;

    wstate.vers = VUID_WHEEL_STATE_VERS;
    wstate.id = 0;
    wstate.stateflags = (uint32_t) -1;

    SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELCOUNT, &nwheel));
    if (i != 0)
	return (0);

    SYSCALL(i = ioctl(pInfo->fd, VUIDGWHEELSTATE, &wstate));
    if (i != 0) {
	xf86Msg(X_WARNING, "%s: couldn't get wheel state\n", pInfo->name);
	return (0);
    }

    wstate.stateflags |= VUID_WHEEL_STATE_ENABLED;

    SYSCALL(i = ioctl(pInfo->fd, VUIDSWHEELSTATE, &wstate));
    if (i != 0) {
	xf86Msg(X_WARNING, "%s: couldn't enable wheel\n", pInfo->name);
	return (0);
    }

    return (1);
#else
    return (0);
#endif
}
Ejemplo n.º 7
0
int
xf86SetSerialModemState(int fd, int state)
{
    int ret;
    int s;

    if (fd < 0)
        return -1;

    /* Don't try to set parameters for non-tty devices. */
    if (!isatty(fd))
        return 0;

#ifndef TIOCMGET
    return -1;
#else
    if (!osStateMask)
        osStateMask = getOsStateMask();

    state = xf2osState(state);
    SYSCALL((ret = ioctl(fd, TIOCMGET, &s)));
    if (ret < 0)
        return -1;
    s &= ~osStateMask;
    s |= state;
    SYSCALL((ret = ioctl(fd, TIOCMSET, &s)));
    if (ret < 0)
        return -1;
    else
        return 0;
#endif
}
Ejemplo n.º 8
0
//Semaphore Operation SYS3
void semaphoreOperation (int *semaddr, int weight){
	
	if (weight==0){
		SYSCALL(TERMINATEPROCESS, SYSCALL(GETPID)); //vediamo se possiamo farlo
	}
	else{
		(*semaddr) += weight; //vediamo se funziona
		
		if(*semaddr <=0){
			
			pcb_t *p;
			
			p = removeBlocked((S32 *) semaddr);
			/* Se è stato sbloccato un processo da un semaforo esterno */
			if (p != NULL)
			{
				/* Viene inserito nella readyQueue e viene aggiornata la flag isOnDev a FALSE */
				insertProcQ(&readyQueue, p);
				// p->p_cursem = NULL; non serve perchè lo fa dentro l'insert
			}
			
		}
		else{
			
			/* Inserisce il processo corrente in coda al semaforo specificato */
			if(insertBlocked((S32 *) semaddr, currentProcess)) PANIC();	//currentProcess è dell'initial???
			currentProcess = NULL;
			
		}
	}
	
}
Ejemplo n.º 9
0
/******************************************************************************
* Function: tod
*
* Description:
*    Receive the time-of-day from the remote server and write it to stdout.
*
* Parameters:
*    sckt - The socket descriptor for the connection.
*
* Return Value: None.
******************************************************************************/
static void tod( int sckt )
{
   char bfr[ MAXBFRSIZE+1 ];
   int  inBytes;
   /*
   ** The client never sends anything, so shut down the write side of the
   ** connection.
   */
   if ( !SYSCALL( "shutdown",
                  __LINE__,
                  shutdown( sckt, SHUT_WR ) ) )
   {
      return;
   }
   /*
   ** Read the time-of-day from the remote host.
   */
   do
   {
      if ( !SYSCALL( "read",
                     __LINE__,
                     inBytes = read( sckt,
                                     bfr,
                                     MAXBFRSIZE ) ) )
      {
         return;
      }
      bfr[ inBytes ] = '\0';   /* Null-terminate the received string. */
      fputs( bfr, stdout );    /* Null string if EOF (inBytes == 0).  */
   } while ( inBytes > 0 );
   fflush( stdout );
}  /* End tod() */
Ejemplo n.º 10
0
int run_test(struct testcase *tc) {
	int status;
	pid_t pid;

	printf("** Testing: %s... ", tc->description);
	fflush(stdout);
	SYSCALL( pid = fork() );
	if (pid == 0) {
		/* child: init liblitmus and carry out test */
		SYSCALL( init_litmus() );
		tc->function();
		exit(0);
	} else {
		if (verbose) {
			printf("[PID=%d] ", pid);
			fflush(stdout);
		}
		/* parent: wait for completion of test */
		SYSCALL( waitpid(pid, &status, 0) );
		if (WIFEXITED(status) && WEXITSTATUS(status) == 0)
			printf("ok.\n");
		else if (WIFSIGNALED(status)) {
			printf("failed (%s)!\n", strsignal(WTERMSIG(status)));
		}
	}
	return WIFEXITED(status) && WEXITSTATUS(status) == 0;
}
Ejemplo n.º 11
0
void print4(){
	for(;;){
		SYSCALL(PASSEREN, 0, 0, 0);
		COMMON = 4;
		debug(4,COMMON);
		SYSCALL(VERHOGEN, 0, 0, 0);
	}
}
Ejemplo n.º 12
0
void print3(){
	for(;;){
		SYSCALL(PASSEREN, 0, 0, 0);
		COMMON = 3;
		debug(3,COMMON);
		SYSCALL(VERHOGEN, 0, 0, 0);
	}
}
Ejemplo n.º 13
0
void print2(){
	for(;;){
		SYSCALL(PASSEREN, 0, 0, 0);
		COMMON = 2;
		debug(2,COMMON);
		SYSCALL(VERHOGEN, 0, 0, 0);
	}
}
Ejemplo n.º 14
0
/* Questa funzione stampa una stringa usando un semaforo per garantire
 * mutua esclusione */
void print1(){
	for(;;){
		SYSCALL(PASSEREN, 0, 0, 0);
		COMMON = 1;
		debug(1,COMMON);
		SYSCALL(VERHOGEN, 0, 0, 0);
	}
}
Ejemplo n.º 15
0
/*
 ***************************************************************************
 *
 * set_serial_speed --
 *
 *      Set speed of the serial port.
 *
 ***************************************************************************
 */
static int
set_serial_speed(int fd, int speed_code)
{
    struct termios      termios_tty;
    int                 err;
#ifdef POSIX_TTY
    SYSCALL(err = tcgetattr(fd, &termios_tty));
    if (err == -1) {
        ErrorF("HyperPen tcgetattr error : %s\n", strerror(errno));
        return !Success;
    }
    termios_tty.c_iflag = IXOFF;
    termios_tty.c_oflag = 0;
    termios_tty.c_cflag = speed_code|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD;
    termios_tty.c_lflag = 0;
    termios_tty.c_cc[VINTR] = 0;
    termios_tty.c_cc[VQUIT] = 0;
    termios_tty.c_cc[VERASE] = 0;
    termios_tty.c_cc[VEOF] = 0;
#ifdef VWERASE
    termios_tty.c_cc[VWERASE] = 0;
#endif
#ifdef VREPRINT
    termios_tty.c_cc[VREPRINT] = 0;
#endif
    termios_tty.c_cc[VKILL] = 0;
    termios_tty.c_cc[VEOF] = 0;
    termios_tty.c_cc[VEOL] = 0;
#ifdef VEOL2
    termios_tty.c_cc[VEOL2] = 0;
#endif
    termios_tty.c_cc[VSUSP] = 0;
#ifdef VDSUSP
    termios_tty.c_cc[VDSUSP] = 0;
#endif
#ifdef VDISCARD
    termios_tty.c_cc[VDISCARD] = 0;
#endif
#ifdef VLNEXT
    termios_tty.c_cc[VLNEXT] = 0;
#endif
    /* minimum 1 character in one read call and timeout to 100 ms */
    termios_tty.c_cc[VMIN] = 1;
    termios_tty.c_cc[VTIME] = 10;
    SYSCALL(err = tcsetattr(fd, TCSANOW, &termios_tty));
    if (err == -1) {
        ErrorF("HyperPen tcsetattr TCSANOW error : %s\n", strerror(errno));
        return !Success;
    }
#else
    Code for OSs without POSIX tty functions
#endif
    return Success;
}
Ejemplo n.º 16
0
static void
switch_to(int vt, const char *from)
{
    int ret;

    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_ACTIVATE, vt));
    if (ret < 0)
        FatalError("%s: VT_ACTIVATE failed: %s\n", from, strerror(errno));

    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_WAITACTIVE, vt));
    if (ret < 0)
        FatalError("%s: VT_WAITACTIVE failed: %s\n", from, strerror(errno));
}
Ejemplo n.º 17
0
void
xf86CloseConsole(void)
{
    struct vt_mode VT;
    int ret;

    if (xf86Info.ShareVTs) {
        close(xf86Info.consoleFd);
        return;
    }

    /*
     * unregister the drain_console handler
     * - what to do if someone else changed it in the meantime?
     */
    xf86SetConsoleHandler(NULL, NULL);

    /* Back to text mode ... */
    SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT));
    if (ret < 0)
        xf86Msg(X_WARNING, "xf86CloseConsole: KDSETMODE failed: %s\n",
                strerror(errno));

    SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMUTE, 0));
    SYSCALL(ioctl(xf86Info.consoleFd, KDSKBMODE, tty_mode));
    tcsetattr(xf86Info.consoleFd, TCSANOW, &tty_attr);

    SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_GETMODE, &VT));
    if (ret < 0)
        xf86Msg(X_WARNING, "xf86CloseConsole: VT_GETMODE failed: %s\n",
                strerror(errno));
    else {
        /* set dflt vt handling */
        VT.mode = VT_AUTO;
        SYSCALL(ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT));
        if (ret < 0)
            xf86Msg(X_WARNING, "xf86CloseConsole: VT_SETMODE failed: %s\n",
                    strerror(errno));
    }

    if (xf86Info.autoVTSwitch) {
        /*
         * Perform a switch back to the active VT when we were started
         */
        if (activeVT >= 0) {
            switch_to(activeVT, "xf86CloseConsole");
            activeVT = -1;
        }
    }
    close(xf86Info.consoleFd);  /* make the vt-manager happy */
}
Ejemplo n.º 18
0
int			connect_to_server(t_graphic *c)
{
  c->server.sin_family = AF_INET;
  c->server.sin_port = htons(c->port);
  if (((c->socket = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1 &&
       my_perror(SYSCALL("socket"), FAILURE) == FAILURE) ||
      (inet_aton(c->ip, IN_ADDR(&c->server.sin_addr.s_addr)) == -1 &&
       my_perror(SYSCALL("inet_aton"), FAILURE) == FAILURE) ||
      (connect(c->socket, C_SOCKADDR(&c->server), sizeof(c->server)) == -1 &&
       my_perror(SYSCALL("connect"), FAILURE) == FAILURE))
    return (close_graphic(c, FAILURE));
  printf("Graphic trying to connect\n");
  return (check_fds(c));
}
Ejemplo n.º 19
0
void main() {
	print(WRITETERMINAL, "printTest is ok\n");
	
	print(WRITEPRINTER, "printTest is ok\n");
	
	SYSCALL(TERMINATE, 0, 0, 0);
}
Ejemplo n.º 20
0
/*
 * SIGIO gives no way of discovering which fd signalled, select
 * to discover
 */
static void
xf86SIGIO(int sig)
{
    int i;
    fd_set ready;
    struct timeval to;
    int save_errno = errno;     /* do not clobber the global errno */
    int r;

    inSignalContext = TRUE;

    ready = xf86SigIOMask;
    to.tv_sec = 0;
    to.tv_usec = 0;
    SYSCALL(r = select(xf86SigIOMaxFd, &ready, 0, 0, &to));
    for (i = 0; r > 0 && i < xf86SigIOMax; i++)
        if (xf86SigIOFuncs[i].f && FD_ISSET(xf86SigIOFuncs[i].fd, &ready)) {
            (*xf86SigIOFuncs[i].f) (xf86SigIOFuncs[i].fd,
                                    xf86SigIOFuncs[i].closure);
            r--;
        }
    if (r > 0) {
        xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
    }
    /* restore global errno */
    errno = save_errno;

    inSignalContext = FALSE;
}
Ejemplo n.º 21
0
Archivo: stdio.c Proyecto: giumaug/g-os
void printf(char* text,...)
{
	int index=-1;
	int param_index=0;
	int** param_val;
	int params[1];
	int sys_num=4;

	while (text[++index]!='\0')
	{
		if (text[index]=='%' && text[index+1]=='d')
		{
			index+=2;
			param_index++;
			GET_FROM_STACK(param_index,param_val);
			print_num(*param_val);

		}
		else if (text[index]=='%' && text[index+1]=='s')
		{
			index+=2;
			param_index++;
			GET_FROM_STACK(param_index,param_val);
			print_char(*param_val);

		}
		params[0]=text[index];
		SYSCALL(4,params);
	}
} 
Ejemplo n.º 22
0
static int
e1000_test_register(int sock, struct ifreq *interface)
{
	struct idiag_pro_data *diag_data;
	struct idiag_e1000_diag_reg_test_param *param;

	diag_data = (struct idiag_pro_data *)interface->ifr_data;
	param = (struct idiag_e1000_diag_reg_test_param *)diag_data->diag_param;

	diag_data->cmd = IDIAG_E1000_DIAG_REG_TEST;
	SYSCALL(ioctl(sock, IDIAG_PRO_BASE_SIOC, interface),
		interface->ifr_name);

	switch (diag_data->status) {
	case IDIAG_PRO_STAT_OK:
		printf("%s: Register test passed.\n", interface->ifr_name);
		return 0;
	case IDIAG_PRO_STAT_INVALID_STATE:
		printf("%s: Register test invalid state.\n",
		       interface->ifr_name);
		return -1;
	case IDIAG_PRO_STAT_TEST_FAILED:
		printf("%s: Register test FAILED.\n", interface->ifr_name);
		printf("%s:   Wrote %lu, read %lu at register %u\n",
		       interface->ifr_name,
		       param->write_value, param->read_value, param->reg);
		return -1;
	default:
		printf("%s: Register test FAILED.\n", interface->ifr_name);
		printf("%s:   Reason unknown.\n", interface->ifr_name);
		return -1;
	}
	return 0;
}
Ejemplo n.º 23
0
static int
e1000_test_link(int sock, struct ifreq *interface)
{
	struct idiag_pro_data *diag_data;

	diag_data = (struct idiag_pro_data *)interface->ifr_data;

	diag_data->cmd = IDIAG_E1000_DIAG_LINK_TEST;
	SYSCALL(ioctl(sock, IDIAG_PRO_BASE_SIOC, interface),
		interface->ifr_name);

	switch (diag_data->status) {
	case IDIAG_PRO_STAT_OK:
		printf("%s: Link test passed (has link).\n", 
				interface->ifr_name);
		return 0;
	case IDIAG_PRO_STAT_INVALID_STATE:
		printf("%s: Link test invalid state.\n",
		       interface->ifr_name);
		return -1;
	case IDIAG_PRO_STAT_TEST_FAILED:
		printf("%s: Link test FAILED (NO link).\n", 
				interface->ifr_name);
		return -1;
	default:
		printf("%s: Link test FAILED.\n", interface->ifr_name);
		printf("%s:   Reason unknown.\n", interface->ifr_name);
		return -1;
	}
	return 0;
}
Ejemplo n.º 24
0
/*
 * SIGIO gives no way of discovering which fd signalled, select
 * to discover
 */
static void
xf86SIGIO (int sig)
{
    int	    i;
    fd_set  ready;
    struct timeval  to;
    int	    r;

    ready = xf86SigIOMask;
    to.tv_sec = 0;
    to.tv_usec = 0;
    SYSCALL (r = select (xf86SigIOMaxFd, &ready, 0, 0, &to));
    for (i = 0; r > 0 && i < xf86SigIOMax; i++)
	if (xf86SigIOFuncs[i].f && FD_ISSET (xf86SigIOFuncs[i].fd, &ready))
	{
	    (*xf86SigIOFuncs[i].f)(xf86SigIOFuncs[i].fd,
				   xf86SigIOFuncs[i].closure);
	    r--;
	}
#ifdef XFree86Server
    if (r > 0) {
      xf86Msg(X_ERROR, "SIGIO %d descriptors not handled\n", r);
    }
#endif
}
Ejemplo n.º 25
0
int read_capabilities(struct Capabilities *cap, int fd)
{
	unsigned long evbits[nlongs(EV_MAX)];
	unsigned long absbits[nlongs(ABS_MAX)];
	unsigned long keybits[nlongs(KEY_MAX)];
	int rc, i;

	memset(cap, 0, sizeof(struct Capabilities));

	SYSCALL(rc = ioctl(fd, EVIOCGID, &cap->devid));
	if (rc < 0)
		return rc;
	SYSCALL(rc = ioctl(fd, EVIOCGNAME(sizeof(cap->devname)), cap->devname));
	if (rc < 0)
		return rc;
	SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_SYN, sizeof(evbits)), evbits));
	if (rc < 0)
		return rc;
	SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(keybits)), keybits));
	if (rc < 0)
		return rc;
	SYSCALL(rc = ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(absbits)), absbits));
	if (rc < 0)
		return rc;

	cap->has_left = getbit(keybits, BTN_LEFT);
	cap->has_middle = getbit(keybits, BTN_MIDDLE);
	cap->has_right = getbit(keybits, BTN_RIGHT);

	SETABS(cap, slot, absbits, ABS_MT_SLOT, fd);
	for (i = 0; i < MT_ABS_SIZE; i++)
		SETABS(cap, abs[i], absbits, mtdev_mt2abs(i), fd);

	cap->has_mtdata = has_mt_data(cap);
	cap->has_ibt = has_integrated_button(cap);

	default_fuzz(cap, ABS_MT_POSITION_X, SN_COORD);
	default_fuzz(cap, ABS_MT_POSITION_Y, SN_COORD);
	default_fuzz(cap, ABS_MT_TOUCH_MAJOR, SN_WIDTH);
	default_fuzz(cap, ABS_MT_TOUCH_MINOR, SN_WIDTH);
	default_fuzz(cap, ABS_MT_WIDTH_MAJOR, SN_WIDTH);
	default_fuzz(cap, ABS_MT_WIDTH_MINOR, SN_WIDTH);
	default_fuzz(cap, ABS_MT_ORIENTATION, SN_ORIENT);

	return 0;
}
Ejemplo n.º 26
0
/* find a synaptic evdev.
 */
static void
FindSynapticEvent(char** eventdev,const char* searchstring) {
	DIR* dir;
	struct dirent* entry;
	int lenght;

	char path[sizeof *"/sys/class/input/" + sizeof *"/name"+NAME_MAX];
	char *ret=NULL;
	*eventdev=NULL;

	SYSCALLPTR(dir=opendir("/sys/class/input/"));
	strcpy(path,"/sys/class/input/");
	lenght=strlen(path);


	while ((entry=FindFileStartingWith(dir,"input",strlen("input")))) {
		strcpy(&path[lenght],entry->d_name);
		strcat(path,"/name");


		if (ReadFirstLine(path,&ret))
            continue;
        if (strstr(ret,searchstring)) {
            xfree(ret);
            ret = NULL;
            break;
        }
        xfree(ret);
        ret = NULL;
	}
	if (!entry) {
		SYSCALL(closedir(dir));
		return;
	}

	strcpy(&path[lenght],entry->d_name);
	SYSCALL(closedir(dir));

	SYSCALLPTR(dir=opendir(path));
	entry=FindFileStartingWith(dir,"event",strlen("event"));
	if (entry) {
		*eventdev=xcalloc(strlen(entry->d_name)+1,sizeof(char));
		strcpy(*eventdev,entry->d_name);
	}
	SYSCALL(closedir(dir));
}
Ejemplo n.º 27
0
static Bool
setfont(int width, int height, 
	int charcount, unsigned char *data)
{
    struct console_font_op op;
    struct consolefontdesc ds;
    int result;

    op.op = KD_FONT_OP_SET;
    op.flags = 0;
    op.charcount = charcount;
    op.width = width;
    op.height = height;
    op.data = data;

    SYSCALL(result = ioctl(xf86Info.consoleFd, KDFONTOP, &op));

    if (!result) 
	return TRUE;

    if (errno != ENOSYS && errno != EINVAL)
	return FALSE;

    /* PIO_FONTX fallback */
    if (width != 8)
	return FALSE;

    ds.charcount = charcount;
    ds.chardata = (char *)data;
    ds.charheight = height;
    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONTX, &ds));
    
    if (!result)
	return TRUE;

    if (errno != ENOSYS && errno != EINVAL)
	return FALSE;

    /* PIO_FONT fallback */
    SYSCALL(result = ioctl(xf86Info.consoleFd, PIO_FONT, data));
    
    if (!result)
	return TRUE;
    
    return FALSE;
}
Ejemplo n.º 28
0
int __syscall1(int f, int x)
{
	int r;
	PUSH_PARAM(x);
	SYSCALL(f,r);
	asm volatile("add $4,%esp");
	return r;
}
Ejemplo n.º 29
0
int
xf86CloseSerial(int fd)
{
    int r;

    SYSCALL(r = close(fd));
    return r;
}
Ejemplo n.º 30
0
Archivo: stdio.c Proyecto: giumaug/g-os
int remove(const char *filename)
{
	unsigned int params[2];

	params[0]=filename;
	SYSCALL(22,params);
	return  params[1];
}