fork() can fail: this is important ãã¼ãfork()ã®ãã¨ããããã»ã¹ããã£ã¨ããã»ã¹ä½ãããã®ãã¤ãªããããä»ã«ãããã»ã¹ä½ãæ¹æ³ã¯ãããã©ãªãã¾ãé¢ç½ã話ãããã²ã¨ã¤ããããèããã¦ãããã forkã¯å¤±æãããã ããåãã£ã¦ããï¼ããã¸ã§åãã£ã¦ããï¼ããã¸ã ããforkã¯å¤±æããããã ãmallocã¨åããã失æãããã¨ãããããããªã«é »ç¹ã«ã£ã¦ãããããªããã©ããã§ã失æããããç¡è¦ã§ãã£ããªãããã¡ã£ã¨ã¯è³ã¿ãåãããªãããªããã forkã0ãè¿ããããããã¤ã¯åããã»ã¹ã§ã親ãªãæ£æ°ãè¿ãã£ã¦ãã¨ã¯ãã¿ããªç¥ã£ã¦ãããªããã®å¤ã¯åã®pidã ãããã¤ãä¿åãã¨ãã¦ããã¨ã§ä½¿ãã£ã¦ããã ã 失æã確èªããªãå ´åã©ããªããç¥ã£ã¦ããï¼ãããã ãããåå¤åã"-1"ï¼forkã®ã¨ã©ã¼éç¥ï¼ãpidã¨ãã¦æ±ã£ã¦ããã ãã ãã¦ãåé¡ã®å§ã¾ãã ãæ¬å½
{{#tags}}- {{label}}
{{/tags}}