macos: use number directly on spawn buffer size

This commit is contained in:
verycosy 2025-02-10 17:52:29 +09:00 committed by Colin Ihrig
parent 9b47f57a0b
commit 6f68433cde
3 changed files with 4 additions and 5 deletions

View File

@ -509,6 +509,4 @@ typedef struct {
#define UV_FS_O_SEQUENTIAL 0
#define UV_FS_O_TEMPORARY 0
#define UV_SPAWN_BUFFER_SIZE (64 * 1024)
#endif /* UV_UNIX_H */

View File

@ -205,7 +205,7 @@ static int uv__process_init_stdio(uv_stdio_container_t* container, int fds[2]) {
#ifdef __APPLE__
if(ret == 0) {
int size = UV_SPAWN_BUFFER_SIZE;
int size = 64 * 1024;
int options[] = {SO_RCVBUF, SO_SNDBUF};
for (int i = 0; i < 2; i++) {

View File

@ -608,15 +608,16 @@ TEST_IMPL(spawn_stdin) {
int recv_fd;
int send_buf;
int send_fd;
int size = 64 * 1024;
socklen_t optlen = sizeof(int);
ASSERT_OK(uv_fileno((uv_handle_t*) options.stdio[0].data.stream, &recv_fd));
ASSERT_OK(getsockopt(recv_fd, SOL_SOCKET, SO_RCVBUF, &recv_buf, &optlen));
ASSERT_EQ(recv_buf, UV_SPAWN_BUFFER_SIZE);
ASSERT_EQ(recv_buf, size);
ASSERT_OK(uv_fileno((uv_handle_t*) options.stdio[1].data.stream, &send_fd));
ASSERT_OK(getsockopt(send_fd, SOL_SOCKET, SO_SNDBUF, &send_buf, &optlen));
ASSERT_EQ(send_buf, UV_SPAWN_BUFFER_SIZE);
ASSERT_EQ(send_buf, size);
#endif
buf.base = buffer;