Commit e1d4413
committed
librc: continue migrate popen() to posix_spawn()
Added execute_get_output() new function has been created that reads commands and replaces two popen() calls.
posix_spawn() is a more lightweight and modern alternative to fork()/exec(), which are used inside popen(). The main advantage of posix_spawn is that it can create a new process without completely duplicating the address space of the parent process.
References:
- https://blog.famzah.net/2018/12/19/posix_spawn-performance-benchmarks-and-usage-examples/
- https://lobste.rs/s/smbsd5/fork_road
- https://www.reddit.com/r/C_Programming/comments/1lvdhp2/fork_vs_posix_spawn/1 parent 584444d commit e1d4413
1 file changed
+59
-18
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
174 | 176 | | |
175 | 177 | | |
176 | 178 | | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
177 | 233 | | |
178 | 234 | | |
179 | 235 | | |
| |||
891 | 947 | | |
892 | 948 | | |
893 | 949 | | |
894 | | - | |
895 | 950 | | |
896 | 951 | | |
897 | 952 | | |
898 | | - | |
899 | 953 | | |
900 | 954 | | |
901 | 955 | | |
902 | 956 | | |
903 | 957 | | |
904 | 958 | | |
905 | 959 | | |
906 | | - | |
907 | | - | |
908 | | - | |
909 | | - | |
910 | | - | |
911 | | - | |
| 960 | + | |
| 961 | + | |
912 | 962 | | |
913 | 963 | | |
914 | 964 | | |
| |||
917 | 967 | | |
918 | 968 | | |
919 | 969 | | |
920 | | - | |
921 | 970 | | |
922 | 971 | | |
923 | 972 | | |
| |||
930 | 979 | | |
931 | 980 | | |
932 | 981 | | |
933 | | - | |
934 | | - | |
935 | 982 | | |
936 | 983 | | |
937 | 984 | | |
| |||
941 | 988 | | |
942 | 989 | | |
943 | 990 | | |
944 | | - | |
945 | | - | |
946 | | - | |
947 | | - | |
948 | | - | |
949 | | - | |
950 | | - | |
| 991 | + | |
951 | 992 | | |
952 | 993 | | |
953 | 994 | | |
| |||
0 commit comments