<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                企業??AI智能體構建引擎,智能編排和調試,一鍵部署,支持知識庫和私有化部署方案 廣告
                ## 6.7.?快速參考 本章介紹了下面的符號和頭文件: ~~~ #include <linux/ioctl.h> ~~~ 聲明用來定義 ioctl 命令的宏定義. 當前被 <linux/fs.h> 包含. ~~~ _IOC_NRBITS _IOC_TYPEBITS _IOC_SIZEBITS _IOC_DIRBITS ~~~ ioctl 命令的不同位段所使用的位數. 還有 4 個宏來指定 MASK 和 4 個指定 SHIFT, 但是它們主要是給內部使用. _IOC_SIZEBIT 是一個要檢查的重要的值, 因為它跨體系改變. ~~~ _IOC_NONE _IOC_READ _IOC_WRITE ~~~ "方向"位段可能的值. "read" 和 "write" 是不同的位并且可相或來指定 read/write. 這些值是基于 0 的. ~~~ _IOC(dir,type,nr,size) _IO(type,nr) _IOR(type,nr,size) _IOW(type,nr,size) _IOWR(type,nr,size) ~~~ 用來創建 ioclt 命令的宏定義. ~~~ _IOC_DIR(nr) _IOC_TYPE(nr) _IOC_NR(nr) _IOC_SIZE(nr) ~~~ 用來解碼一個命令的宏定義. 特別地, _IOC_TYPE(nr) 是 _IOC_READ 和 _IOC_WRITE 的 OR 結合. ~~~ #include <asm/uaccess.h> int access_ok(int type, const void *addr, unsigned long size); ~~~ 檢查一個用戶空間的指針是可用的. access_ok 返回一個非零值, 如果應當允許存取. ~~~ VERIFY_READ VERIFY_WRITE ~~~ access_ok 中 type 參數的可能取值. VERIFY_WRITE 是 VERIFY_READ 的超集. ~~~ #include <asm/uaccess.h> int put_user(datum,ptr); int get_user(local,ptr); int __put_user(datum,ptr); int __get_user(local,ptr); ~~~ 用來存儲或獲取一個數據到或從用戶空間的宏. 傳送的字節數依賴 sizeof(*ptr). 常規的版本調用 access_ok , 而常規版本( __put_user 和 __get_user ) 假定 access_ok 已經被調用了. ~~~ #include <linux/capability.h> ~~~ 定義各種 CAP_ 符號, 描述一個用戶空間進程可有的能力. ~~~ int capable(int capability); ~~~ 返回非零值如果進程有給定的能力. ~~~ #include <linux/wait.h> typedef struct { /* ... */ } wait_queue_head_t; void init_waitqueue_head(wait_queue_head_t *queue); DECLARE_WAIT_QUEUE_HEAD(queue); ~~~ Linux 等待隊列的定義類型. 一個 wait_queue_head_t 必須被明確在運行時使用 init_waitqueue_head 或者編譯時使用 DEVLARE_WAIT_QUEUE_HEAD 進行初始化. ~~~ void wait_event(wait_queue_head_t q, int condition); int wait_event_interruptible(wait_queue_head_t q, int condition); int wait_event_timeout(wait_queue_head_t q, int condition, int time); int wait_event_interruptible_timeout(wait_queue_head_t q, int condition,int time); ~~~ 使進程在給定隊列上睡眠, 直到給定條件值為真值. ~~~ void wake_up(struct wait_queue **q); void wake_up_interruptible(struct wait_queue **q); void wake_up_nr(struct wait_queue **q, int nr); void wake_up_interruptible_nr(struct wait_queue **q, int nr); void wake_up_all(struct wait_queue **q); void wake_up_interruptible_all(struct wait_queue **q); void wake_up_interruptible_sync(struct wait_queue **q); ~~~ 喚醒在隊列 q 上睡眠的進程. _interruptible 的形式只喚醒可中斷的進程. 正常地, 只有一個互斥等待者被喚醒, 但是這個行為可被 _nr 或者 _all 形式所改變. _sync 版本在返回之前不重新調度 CPU. ~~~ #include <linux/sched.h> set_current_state(int state); ~~~ 設置當前進程的執行狀態. TASK_RUNNING 意味著它已經運行, 而睡眠狀態是 TASK_INTERRUPTIBLE 和 TASK_UNINTERRUPTIBLE. ~~~ void schedule(void); ~~~ 選擇一個可運行的進程從運行隊列中. 被選中的進程可是當前進程或者另外一個. ~~~ typedef struct { /* ... */ } wait_queue_t; init_waitqueue_entry(wait_queue_t *entry, struct task_struct *task); ~~~ wait_queue_t 類型用來放置一個進程到一個等待隊列. ~~~ void prepare_to_wait(wait_queue_head_t *queue, wait_queue_t *wait, int state); void prepare_to_wait_exclusive(wait_queue_head_t *queue, wait_queue_t *wait, int state); void finish_wait(wait_queue_head_t *queue, wait_queue_t *wait); ~~~ 幫忙函數, 可用來編碼一個手工睡眠. ~~~ void sleep_on(wiat_queue_head_t *queue); void interruptible_sleep_on(wiat_queue_head_t *queue); ~~~ 老式的不推薦的函數, 它們無條件地使當前進程睡眠. ~~~ #include <linux/poll.h> void poll_wait(struct file *filp, wait_queue_head_t *q, poll_table *p); ~~~ 將當前進程放入一個等待隊列, 不立刻調度. 它被設計來被設備驅動的 poll 方法使用. ~~~ int fasync_helper(struct inode *inode, struct file *filp, int mode, struct fasync_struct **fa); ~~~ 一個"幫忙者", 來實現 fasync 設備方法. mode 參數是傳遞給方法的相同的值, 而 fa 指針指向一個設備特定的 fasync_struct *. ~~~ void kill_fasync(struct fasync_struct *fa, int sig, int band); ~~~ 如果這個驅動支持異步通知, 這個函數可用來發送一個信號到登記在 fa 中的進程. ~~~ int nonseekable_open(struct inode *inode, struct file *filp); loff_t no_llseek(struct file *file, loff_t offset, int whence); ~~~ nonseekable_open 應當在任何不支持移位的設備的 open 方法中被調用. 這樣的設備應當使用 no_llseek 作為它們的 llseek 方法.
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看