Lines Matching refs:handle
46 int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { in uv_pipe_init() argument
47 uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE); in uv_pipe_init()
48 handle->shutdown_req = NULL; in uv_pipe_init()
49 handle->connect_req = NULL; in uv_pipe_init()
50 handle->pipe_fname = NULL; in uv_pipe_init()
51 handle->ipc = ipc; in uv_pipe_init()
56 int uv_pipe_bind(uv_pipe_t* handle, const char* name) { in uv_pipe_bind() argument
57 return uv_pipe_bind2(handle, name, strlen(name), 0); in uv_pipe_bind()
61 int uv_pipe_bind2(uv_pipe_t* handle, in uv_pipe_bind2() argument
99 if (uv__stream_fd(handle) >= 0) in uv_pipe_bind2()
102 if (uv__is_closing(handle)) in uv_pipe_bind2()
140 handle->flags |= UV_HANDLE_BOUND; in uv_pipe_bind2()
141 handle->pipe_fname = pipe_fname; /* NULL or a copy of |name| */ in uv_pipe_bind2()
142 handle->io_watcher.fd = sockfd; in uv_pipe_bind2()
151 int uv__pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) { in uv__pipe_listen() argument
152 if (uv__stream_fd(handle) == -1) in uv__pipe_listen()
155 if (handle->ipc) in uv__pipe_listen()
167 if (listen(uv__stream_fd(handle), backlog)) in uv__pipe_listen()
170 handle->connection_cb = cb; in uv__pipe_listen()
171 handle->io_watcher.cb = uv__server_io; in uv__pipe_listen()
172 uv__io_start(handle->loop, &handle->io_watcher, POLLIN); in uv__pipe_listen()
177 void uv__pipe_close(uv_pipe_t* handle) { in uv__pipe_close() argument
178 if (handle->pipe_fname) { in uv__pipe_close()
185 unlink(handle->pipe_fname); in uv__pipe_close()
186 uv__free((void*)handle->pipe_fname); in uv__pipe_close()
187 handle->pipe_fname = NULL; in uv__pipe_close()
190 uv__stream_close((uv_stream_t*)handle); in uv__pipe_close()
194 int uv_pipe_open(uv_pipe_t* handle, uv_file fd) { in uv_pipe_open() argument
200 if (uv__fd_exists(handle->loop, fd)) in uv_pipe_open()
215 err = uv__stream_try_select((uv_stream_t*) handle, &fd); in uv_pipe_open()
226 return uv__stream_open((uv_stream_t*)handle, fd, flags); in uv_pipe_open()
231 uv_pipe_t* handle, in uv_pipe_connect() argument
236 err = uv_pipe_connect2(req, handle, name, strlen(name), 0, cb); in uv_pipe_connect()
239 handle->delayed_error = err; in uv_pipe_connect()
240 handle->connect_req = req; in uv_pipe_connect()
242 uv__req_init(handle->loop, req, UV_CONNECT); in uv_pipe_connect()
243 req->handle = (uv_stream_t*) handle; in uv_pipe_connect()
248 uv__io_feed(handle->loop, &handle->io_watcher); in uv_pipe_connect()
254 uv_pipe_t* handle, in uv_pipe_connect2() argument
285 new_sock = (uv__stream_fd(handle) == -1); in uv_pipe_connect2()
291 handle->io_watcher.fd = err; in uv_pipe_connect2()
304 r = connect(uv__stream_fd(handle), (struct sockaddr*)&saddr, addrlen); in uv_pipe_connect2()
323 err = uv__stream_open((uv_stream_t*)handle, in uv_pipe_connect2()
324 uv__stream_fd(handle), in uv_pipe_connect2()
329 uv__io_start(handle->loop, &handle->io_watcher, POLLOUT); in uv_pipe_connect2()
332 handle->delayed_error = err; in uv_pipe_connect2()
333 handle->connect_req = req; in uv_pipe_connect2()
335 uv__req_init(handle->loop, req, UV_CONNECT); in uv_pipe_connect2()
336 req->handle = (uv_stream_t*) handle; in uv_pipe_connect2()
342 uv__io_feed(handle->loop, &handle->io_watcher); in uv_pipe_connect2()
348 static int uv__pipe_getsockpeername(const uv_pipe_t* handle, in uv__pipe_getsockpeername() argument
365 err = uv__getsockpeername((const uv_handle_t*) handle, in uv__pipe_getsockpeername()
402 int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) { in uv_pipe_getsockname() argument
403 return uv__pipe_getsockpeername(handle, getsockname, buffer, size); in uv_pipe_getsockname()
407 int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) { in uv_pipe_getpeername() argument
408 return uv__pipe_getsockpeername(handle, getpeername, buffer, size); in uv_pipe_getpeername()
412 void uv_pipe_pending_instances(uv_pipe_t* handle, int count) { in uv_pipe_pending_instances() argument
416 int uv_pipe_pending_count(uv_pipe_t* handle) { in uv_pipe_pending_count() argument
419 if (!handle->ipc) in uv_pipe_pending_count()
422 if (handle->accepted_fd == -1) in uv_pipe_pending_count()
425 if (handle->queued_fds == NULL) in uv_pipe_pending_count()
428 queued_fds = handle->queued_fds; in uv_pipe_pending_count()
433 uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) { in uv_pipe_pending_type() argument
434 if (!handle->ipc) in uv_pipe_pending_type()
437 if (handle->accepted_fd == -1) in uv_pipe_pending_type()
440 return uv_guess_handle(handle->accepted_fd); in uv_pipe_pending_type()
444 int uv_pipe_chmod(uv_pipe_t* handle, int mode) { in uv_pipe_chmod() argument
451 if (handle == NULL || uv__stream_fd(handle) == -1) in uv_pipe_chmod()
461 r = uv_pipe_getsockname(handle, NULL, &name_len); in uv_pipe_chmod()
469 r = uv_pipe_getsockname(handle, name_buffer, &name_len); in uv_pipe_chmod()