posix_spawn_file_actions_destroy 或 posix_spawn_file_actions_init 子常式
用途
毀損並起始設定大量產生的檔案動作物件。
語法
#include <spawn.h>
int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *
file_actions);
int posix_spawn_file_actions_init(posix_spawn_file_actions_t *
file_actions);
說明
posix_spawn_file_actions_destroy 子常式會毀損 file_actions所參照的物件; 該物件實際上會變成未起始設定。 實作可能會導致 posix_spawn_file_actions_destroy 將 file_actions 所參照的物件設為無效值。 可以使用 posix_spawn_file_actions_init重新起始設定已毀損的衍生檔案動作物件; 未定義在毀損之後參照該物件的其他結果。
posix_spawn_file_actions_init 函數會起始設定 file_actions 所參照的物件,使其不包含 posix_spawn 或 posix_spawnp 所要執行的檔案動作。
衍生檔案動作物件如 posix_spawn_file_actions_addclose中所定義。 未定義起始設定先前已起始設定之大量產生檔案動作物件的效果。
回覆值
順利完成時, posix_spawn_file_actions_destroy 及 posix_spawn_file_actions_init 子常式會傳回 0
; 否則,會傳回錯誤碼以指出錯誤。
錯誤碼
如果符合下列條件,則 posix_spawn_file_actions_init 子常式會失敗:
項目 | 說明 |
---|---|
ENOMEM | 記憶體不足,無法起始設定大量產生檔案動作物件。 |
如果符合下列條件, posix_spawn_file_actions_destroy 子常式可能會失敗:
項目 | 說明 |
---|---|
EINVAL | file_actions 指定的值無效。 |