/libuv/test/ |
H A D | test-pipe-getsockname.c | 50 char buf[1024]; in pipe_client_connect_cb() local 57 len = sizeof buf; in pipe_client_connect_cb() 70 len = sizeof buf; in pipe_client_connect_cb() 95 char buf[16]; in pipe_client_autobind_connect_cb() local 125 char buf[1024]; in TEST_IMPL() local 142 len = sizeof buf; in TEST_IMPL() 146 len = sizeof buf; in TEST_IMPL() 228 char buf[256]; in TEST_IMPL() local 232 memset(buf, 0, sizeof(buf)); in TEST_IMPL() 276 char buf[256]; in TEST_IMPL() local [all …]
|
H A D | test-random.c | 31 static void random_cb(uv_random_t* req, int status, void* buf, size_t buflen) { in random_cb() argument 37 ASSERT_PTR_EQ(buf, (void*) scratch); in random_cb() 80 char buf[256]; in TEST_IMPL() local 82 ASSERT_EQ(UV_EINVAL, uv_random(NULL, NULL, buf, sizeof(buf), -1, NULL)); in TEST_IMPL() 83 ASSERT_EQ(UV_E2BIG, uv_random(NULL, NULL, buf, -1, -1, NULL)); in TEST_IMPL() 85 memset(buf, 0, sizeof(buf)); in TEST_IMPL() 86 ASSERT_OK(uv_random(NULL, NULL, buf, sizeof(buf), 0, NULL)); in TEST_IMPL() 90 ASSERT_NE(0, memcmp(buf, zero, sizeof(zero))); in TEST_IMPL()
|
H A D | test-gethostname.c | 27 char buf[UV_MAXHOSTNAMESIZE]; in TEST_IMPL() local 36 r = uv_os_gethostname(buf, NULL); in TEST_IMPL() 39 r = uv_os_gethostname(buf, &size); in TEST_IMPL() 44 buf[0] = '\0'; in TEST_IMPL() 45 r = uv_os_gethostname(buf, &enobufs_size); in TEST_IMPL() 47 ASSERT_EQ(buf[0], '\0'); in TEST_IMPL() 52 r = uv_os_gethostname(buf, &size); in TEST_IMPL() 54 ASSERT(size > 0 && size == strlen(buf)); in TEST_IMPL()
|
H A D | test-uname.c | 32 struct utsname buf; in TEST_IMPL() local 49 ASSERT_NE(uname(&buf), -1); in TEST_IMPL() 50 ASSERT_OK(strcmp(buffer.sysname, buf.sysname)); in TEST_IMPL() 51 ASSERT_OK(strcmp(buffer.version, buf.version)); in TEST_IMPL() 54 snprintf(temp, sizeof(temp), "%s.%s", buf.version, buf.release); in TEST_IMPL() 57 ASSERT_OK(strcmp(buffer.release, buf.release)); in TEST_IMPL() 63 ASSERT_OK(strcmp(buffer.machine, buf.machine)); in TEST_IMPL()
|
H A D | test-ipc.c | 155 free(buf->base); in on_read() 209 free(buf->base); in on_read() 276 free(buf->base); in on_read_listen_after_bound_twice() 341 free(buf->base); in on_tcp_read() 405 free(buf->base); in on_read_connection() 413 free(buf->base); in on_read_send_zero() 589 free(buf->base); in on_tcp_child_process_read() 611 uv_buf_t buf; in ipc_on_connection() local 646 uv_buf_t buf; in ipc_on_connection_tcp_conn() local 683 uv_buf_t buf; in ipc_helper() local [all …]
|
H A D | benchmark-ping-udp.c | 52 static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) { in buf_alloc() argument 54 buf->base = slab; in buf_alloc() 55 buf->len = sizeof(slab); in buf_alloc() 59 static void buf_free(const uv_buf_t* buf) { in buf_free() argument 78 uv_buf_t buf; in pinger_write_ping() local 81 buf = uv_buf_init(PING, sizeof(PING) - 1); in pinger_write_ping() 82 r = uv_udp_try_send(&pinger->udp, &buf, 1, in pinger_write_ping() 90 const uv_buf_t* buf, in pinger_read_cb() argument 102 ASSERT_EQ(buf->base[i], PING[pinger->state]); in pinger_read_cb() 114 if (buf && !(flags & UV_UDP_MMSG_CHUNK)) in pinger_read_cb() [all …]
|
H A D | test-udp-connect.c | 34 static uv_buf_t buf; variable 45 uv_buf_t* buf) { in alloc_cb() argument 49 buf->base = slab; in alloc_cb() 50 buf->len = sizeof(slab); in alloc_cb() 69 r = uv_udp_send(req, &client, &buf, 1, NULL, cl_send_cb); in cl_send_cb() 73 &buf, in cl_send_cb() 124 buf = uv_buf_init("EXIT", 4); in TEST_IMPL() 152 r = uv_udp_try_send(&client, &buf, 1, NULL); in TEST_IMPL() 169 r = uv_udp_try_send(&client, &buf, 1, NULL); in TEST_IMPL() 177 &buf, in TEST_IMPL() [all …]
|
H A D | test-udp-connect6.c | 34 static uv_buf_t buf; variable 45 uv_buf_t* buf) { in alloc_cb() argument 49 buf->base = slab; in alloc_cb() 50 buf->len = sizeof(slab); in alloc_cb() 69 r = uv_udp_send(req, &client, &buf, 1, NULL, cl_send_cb); in cl_send_cb() 73 &buf, in cl_send_cb() 127 buf = uv_buf_init("EXIT", 4); in TEST_IMPL() 155 r = uv_udp_try_send(&client, &buf, 1, NULL); in TEST_IMPL() 172 r = uv_udp_try_send(&client, &buf, 1, NULL); in TEST_IMPL() 180 &buf, in TEST_IMPL() [all …]
|
H A D | echo-server.c | 29 uv_buf_t buf; member 54 free(wr->buf.base); in after_write() 92 free(buf->base); in after_read() 102 free(buf->base); in after_read() 113 if (buf->base[i] == 'Q') { in after_read() 126 free(buf->base); in after_read() 137 wr->buf = uv_buf_init(buf->base, nread); in after_read() 156 buf->base = malloc(suggested_size); in echo_alloc() 157 buf->len = suggested_size; in echo_alloc() 165 buf->base = slab; in slab_alloc() [all …]
|
H A D | test-tcp-read-stop-start.c | 33 static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); 50 uv_buf_t buf; in do_write() local 51 buf.base = "1234578"; in do_write() 52 buf.len = 8; in do_write() 53 ASSERT_OK(uv_write(req, stream, &buf, 1, cb)); in do_write() 58 uv_buf_t* buf) { in on_alloc() argument 60 buf->base = slab; in on_alloc() 61 buf->len = sizeof(slab); in on_alloc() 64 static void on_read1(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in on_read1() argument 79 static void on_read2(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in on_read2() argument
|
H A D | test-tcp-try-write.c | 48 uv_buf_t buf; in connect_cb() local 53 buf = uv_buf_init("PING", 4); in connect_cb() 54 r = uv_try_write((uv_stream_t*) &client, &buf, 1); in connect_cb() 63 buf = uv_buf_init("", 0); in connect_cb() 64 r = uv_try_write((uv_stream_t*) &client, &buf, 1); in connect_cb() 70 static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { in alloc_cb() argument 73 buf->base = base; in alloc_cb() 74 buf->len = sizeof(base); in alloc_cb() 78 static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument
|
H A D | test-error.c | 43 char buf[32]; in TEST_IMPL() local 57 ASSERT_NULL(strstr(uv_strerror_r(UV_EINVAL, buf, sizeof(buf)), "Success")); in TEST_IMPL() 58 ASSERT_NOT_NULL(strstr(uv_strerror_r(1337, buf, sizeof(buf)), "1337")); in TEST_IMPL() 59 ASSERT_NOT_NULL(strstr(uv_strerror_r(-1337, buf, sizeof(buf)), "-1337")); in TEST_IMPL()
|
H A D | benchmark-ping-pongs.c | 56 static void buf_alloc(uv_handle_t* tcp, size_t size, uv_buf_t* buf) { in buf_alloc() argument 68 *buf = ab->uv_buf_t; in buf_alloc() 72 static void buf_free(const uv_buf_t* buf) { in buf_free() argument 73 buf_t* ab = (buf_t*) buf->base - 1; in buf_free() 101 uv_buf_t buf; in pinger_write_ping() local 103 buf = uv_buf_init(PING, sizeof(PING) - 1); in pinger_write_ping() 126 const uv_buf_t* buf) { in pinger_read_cb() argument 135 if (buf->base) { in pinger_read_cb() 136 buf_free(buf); in pinger_read_cb() 147 ASSERT_EQ(buf->base[i], PING[pinger->state]); in pinger_read_cb() [all …]
|
H A D | test-udp-send-unreachable.c | 50 buf->base = slab; in alloc_cb() 51 buf->len = sizeof(slab); in alloc_cb() 111 uv_buf_t buf; in TEST_IMPL() local 138 buf = uv_buf_init("PING", 4); in TEST_IMPL() 142 &buf, in TEST_IMPL() 148 buf = uv_buf_init("PANG", 4); in TEST_IMPL() 152 &buf, in TEST_IMPL() 171 buf = uv_buf_init("PING", 4); in TEST_IMPL() 175 &buf, in TEST_IMPL() 181 buf = uv_buf_init("PANG", 4); in TEST_IMPL() [all …]
|
H A D | test-env-vars.c | 31 char buf[BUF_SIZE]; in TEST_IMPL() local 51 r = uv_os_getenv(NULL, buf, &size); in TEST_IMPL() 55 r = uv_os_getenv(name, buf, NULL); in TEST_IMPL() 58 r = uv_os_getenv(name, buf, &size); in TEST_IMPL() 71 buf[0] = '\0'; in TEST_IMPL() 72 r = uv_os_getenv(name, buf, &size); in TEST_IMPL() 79 buf[0] = '\0'; in TEST_IMPL() 80 r = uv_os_getenv(name, buf, &size); in TEST_IMPL() 89 r = uv_os_getenv(name, buf, &size); in TEST_IMPL() 100 r = uv_os_getenv(name, buf, &size); in TEST_IMPL() [all …]
|
H A D | test-tcp-write-to-half-open-connection.c | 32 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf); 33 static void alloc_cb(uv_handle_t* handle, size_t suggested_size, uv_buf_t* buf); 46 uv_buf_t buf; in connection_cb() local 60 buf.base = "hello\n"; in connection_cb() 61 buf.len = 6; in connection_cb() 63 r = uv_write(&write_req, (uv_stream_t*)&tcp_peer, &buf, 1, write_cb); in connection_cb() 70 uv_buf_t* buf) { in alloc_cb() argument 72 buf->base = slab; in alloc_cb() 73 buf->len = sizeof(slab); in alloc_cb() 77 static void read_cb(uv_stream_t* stream, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument
|
H A D | test-callback-stack.c | 48 static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { in alloc_cb() argument 49 buf->len = size; in alloc_cb() 50 buf->base = malloc(size); in alloc_cb() 51 ASSERT_NOT_NULL(buf->base); in alloc_cb() 70 static void read_cb(uv_stream_t* tcp, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 74 free(buf->base); in read_cb() 149 uv_buf_t buf; in connect_cb() local 158 buf.base = (char*) &MESSAGE; in connect_cb() 159 buf.len = sizeof MESSAGE; in connect_cb() 161 if (uv_write(&write_req, (uv_stream_t*)req->handle, &buf, 1, write_cb)) { in connect_cb()
|
H A D | test-shutdown-simultaneous.c | 38 static void alloc_cb(uv_handle_t* handle, size_t size, uv_buf_t* buf) { in alloc_cb() argument 39 buf->base = malloc(size); in alloc_cb() 40 buf->len = size; in alloc_cb() 52 static void read_cb(uv_stream_t* t, ssize_t nread, const uv_buf_t* buf) { in read_cb() argument 56 free(buf->base); in read_cb() 63 ASSERT_MEM_EQ(buf->base, "QQSS", 4); in read_cb() 64 free(buf->base); in read_cb() 72 if (buf->base) { in read_cb() 73 free(buf->base); in read_cb()
|
/libuv/src/ |
H A D | random.c | 40 rc = uv__random_getentropy(buf, buflen); in uv__random() 42 rc = uv__random_devurandom(buf, buflen); in uv__random() 44 rc = uv__random_sysctl(buf, buflen); in uv__random() 46 rc = uv__random_getrandom(buf, buflen); in uv__random() 48 rc = uv__random_devurandom(buf, buflen); in uv__random() 58 rc = uv__random_sysctl(buf, buflen); in uv__random() 64 rc = uv__random_rtlgenrandom(buf, buflen); in uv__random() 66 rc = uv__random_devurandom(buf, buflen); in uv__random() 96 void *buf, in uv_random() argument 107 return uv__random(buf, buflen); in uv_random() [all …]
|
/libuv/docs/code/uvtee/ |
H A D | main.c | 10 uv_buf_t buf; member 18 void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { in alloc_buffer() argument 19 *buf = uv_buf_init((char*) malloc(suggested_size), suggested_size); in alloc_buffer() 24 free(wr->buf.base); in free_write_req() 38 req->buf = uv_buf_init((char*) malloc(size), size); in write_data() 39 memcpy(req->buf.base, buf.base, size); in write_data() 40 uv_write((uv_write_t*) req, (uv_stream_t*)dest, &req->buf, 1, cb); in write_data() 43 void read_stdin(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) { in read_stdin() argument 53 write_data((uv_stream_t *)&file_pipe, nread, *buf, on_file_write); in read_stdin() 57 if (buf->base) in read_stdin() [all …]
|
/libuv/docs/code/multi-echo-server/ |
H A D | worker.c | 13 uv_buf_t buf; member 18 free(wr->buf.base); in free_write_req() 22 void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { in alloc_buffer() argument 23 buf->base = malloc(suggested_size); in alloc_buffer() 24 buf->len = suggested_size; in alloc_buffer() 34 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 37 req->buf = uv_buf_init(buf->base, nread); in echo_read() 38 uv_write((uv_write_t*) req, client, &req->buf, 1, echo_write); in echo_read() 48 free(buf->base); in echo_read() 51 void on_new_connection(uv_stream_t *q, ssize_t nread, const uv_buf_t *buf) { in on_new_connection() argument
|
/libuv/docs/code/pipe-echo-server/ |
H A D | main.c | 16 uv_buf_t buf; member 21 free(wr->buf.base); in free_write_req() 25 void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { in alloc_buffer() argument 26 buf->base = malloc(suggested_size); in alloc_buffer() 27 buf->len = suggested_size; in alloc_buffer() 37 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 40 req->buf = uv_buf_init(buf->base, nread); in echo_read() 41 uv_write((uv_write_t*) req, client, &req->buf, 1, echo_write); in echo_read() 51 free(buf->base); in echo_read()
|
/libuv/docs/code/tcp-echo-server/ |
H A D | main.c | 14 uv_buf_t buf; member 19 free(wr->buf.base); in free_write_req() 23 void alloc_buffer(uv_handle_t *handle, size_t suggested_size, uv_buf_t *buf) { in alloc_buffer() argument 24 buf->base = (char*) malloc(suggested_size); in alloc_buffer() 25 buf->len = suggested_size; in alloc_buffer() 39 void echo_read(uv_stream_t *client, ssize_t nread, const uv_buf_t *buf) { in echo_read() argument 42 req->buf = uv_buf_init(buf->base, nread); in echo_read() 43 uv_write((uv_write_t*) req, client, &req->buf, 1, echo_write); in echo_read() 52 free(buf->base); in echo_read()
|
/libuv/docs/code/interfaces/ |
H A D | main.c | 5 char buf[512]; in main() local 20 uv_ip4_name(&interface_a.address.address4, buf, sizeof(buf)); in main() 21 printf("IPv4 address: %s\n", buf); in main() 24 uv_ip6_name(&interface_a.address.address6, buf, sizeof(buf)); in main() 25 printf("IPv6 address: %s\n", buf); in main()
|
/libuv/src/unix/ |
H A D | linux.c | 1788 if (NULL == fgets(buf, sizeof(buf), fp)) in uv_cpu_info() 1800 if (NULL == fgets(buf, sizeof(buf), fp)) in uv_cpu_info() 1825 while (!found && fgets(buf, sizeof(buf), fp)) in uv_cpu_info() 1858 while (fgets(buf, sizeof(buf), fp)) in uv_cpu_info() 1874 snprintf(buf, sizeof(buf), in uv_cpu_info() 2102 if (0 == uv__slurp(filename, buf, sizeof(buf))) in uv__read_uint64() 2309 if (uv__slurp(path, buf, sizeof(buf)) < 0) in uv__get_cgroupv2_constrained_cpu() 2325 if (uv__slurp(path, buf, sizeof(buf)) < 0) in uv__get_cgroupv2_constrained_cpu() 2368 if (uv__slurp(path, buf, sizeof(buf)) < 0) in uv__get_cgroupv1_constrained_cpu() 2379 if (uv__slurp(path, buf, sizeof(buf)) < 0) in uv__get_cgroupv1_constrained_cpu() [all …]
|