XINU
Functions
getc.c File Reference
#include <xinu.h>
Include dependency graph for getc.c:

Go to the source code of this file.

Functions

syscall getc (did32 descrp)
 デバイスから1Byte読み込むgetc()のextern宣言 More...
 

Function Documentation

◆ getc()

syscall getc ( did32  descrp)

デバイスから1Byte読み込むgetc()のextern宣言

Definition at line 9 of file getc.c.

References devtab, disable(), dentry::dvgetc, isbaddev, restore(), and SYSERR.

Referenced by fgetc(), fgets(), getch(), and xsh_cat().

12 {
13  intmask mask; /* Saved interrupt mask */
14  struct dentry *devptr; /* Entry in device switch table */
15  int32 retval; /* Value to return to caller */
16 
17  mask = disable();
18  if (isbaddev(descrp)) {
19  restore(mask);
20  return SYSERR;
21  }
22  devptr = (struct dentry *) &devtab[descrp];
23  retval = (*devptr->dvgetc) (devptr);
24  restore(mask);
25  return retval;
26 }
void restore(intmask)
#define SYSERR
処理が失敗した場合
Definition: kernel.h:79
Definition: conf.h:6
struct dentry devtab[]
Definition: conf.c:11
devcall(* dvgetc)(struct dentry *)
Definition: conf.h:16
uint32 intmask
保存された割り込みマスク
Definition: kernel.h:38
int int32
符号あり32ビット整数(int)
Definition: kernel.h:11
#define isbaddev(f)
デバイスIDを検証するマクロ。
Definition: device.h:15
intmask disable(void)
割り込み禁止(intr.Sに定義がある)
Here is the call graph for this function:
Here is the caller graph for this function: