system-calls

    0熱度

    2回答

    我在我的程序中執行一些物理計算,其中輸出需要存儲到臨時緩衝區並通過管道。 緩衝區需要共享不同的數據類型:首先,我需要存儲我研究這一課題的名稱;其次是我的計算結果(全部爲float數字)。 的代碼看起來是這樣的: initialdata.dat Aston Martin Vantage V12|07.7|090 Ferrari LaFerrari |09.6|111 Lamborghini A

    0熱度

    2回答

    在UML狀態機中狀態之間的轉換中,您可以具有觸發器,警戒和效果。 如果我進行阻塞系統調用(例如,在Posix系統上選擇()或在Raspberry Pi上執行wait_for_edge()),這是一個呼叫事件,因爲狀態機被阻塞,我無法繼續進行此操作? 我可以用這種方式建模這個狀態機嗎還是必須使用不同的機制? 感謝

    -2熱度

    2回答

    我試圖從exit()systemcall打印出返回碼。但是由於程序退出,它沒有機會打印出將被殺死的東西。我的問題是,如何在程序中打印返回代碼。 y = syscall(NR_mycall); //makes an exit in this second printf("%s\n", strerror(y)); 正如預期的那樣沒有輸出! :U(

    0熱度

    1回答

    我必須製作簡單的shell來讀取命令並按順序執行它們。條件不改變主函數的形式,並且執行函數應該是遞歸的。 主要問題是,它似乎waitpid不起作用。但我知道,我的代碼中存在很多問題。請讓我知道我應該從哪裏開始.. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <

    -1熱度

    1回答

    我想遍歷所有可能的進程ID,但爲此,我需要知道進程表的限制。我怎樣才能找到這個? 我的想法是做類似 while (counter < table size) { do something }

    1熱度

    1回答

    我有以下幾點: /* execute_py.c */ #include <stdio.h> #include <stdlib.h> #include "postgres.h" #include "fmgr.h" #ifdef PG_MODULE_MAGIC PG_MODULE_MAGIC; #endif int call_py() { printf("Execu

    0熱度

    2回答

    我想知道,如果一個文件是目錄或統計常規文件: #define _DEFAULT_SOURCE #include <sys/types.h> #include <sys/stat.h> #include <unistd.h> int is_regular_file(const char *path) { struct stat path_stat; stat(pat

    2熱度

    1回答

    在linux下可以使用系統調用號4打印的東西: mov eax,4 ;system call number mov ebx,0 ;file descriptor mov ecx,msg ;adress of message in data segment mov edx,length ;length of message 但是,你如何打印從堆棧段的東西嗎? 我嘗試這樣做: push

    1熱度

    1回答

    我得到macOS的場景,我不能關閉內存映射文件沒有 解除它首先(使用munmap syscall),雖然關閉系統調用返回成功結果(= 0)我仍然可以在lsof -n中看到文件記錄。 在linux中,它明確提到,closing the file doesn't unmap the file,根據MMAP手冊頁。 是它確實是2和操作系統之間的不同的行爲? 對這種不同的行爲有任何解釋嗎? 編輯:閱讀下面

    0熱度

    1回答

    /*我想這樣做,但它是無效的。 所以任何幫助將不勝感激。 */ #include <cstdlib> #include <iostream> #include <string> using namespace std; int main() { string name = "Karma"; string greet = "How was your day?";