Lines Matching defs:handle

34 int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
35 uv__stream_init(loop, (uv_stream_t*)handle, UV_NAMED_PIPE);
36 handle->shutdown_req = NULL;
37 handle->connect_req = NULL;
38 handle->pipe_fname = NULL;
39 handle->ipc = ipc;
44 int uv_pipe_bind(uv_pipe_t* handle, const char* name) {
53 if (uv__stream_fd(handle) >= 0)
55 if (uv__is_closing(handle)) {
101 handle->flags |= UV_HANDLE_BOUND;
102 handle->pipe_fname = pipe_fname; /* Is a strdup'ed copy. */
103 handle->io_watcher.fd = sockfd;
112 int uv__pipe_listen(uv_pipe_t* handle, int backlog, uv_connection_cb cb) {
113 if (uv__stream_fd(handle) == -1)
116 if (handle->ipc)
128 if (listen(uv__stream_fd(handle), backlog))
131 handle->connection_cb = cb;
132 handle->io_watcher.cb = uv__server_io;
133 uv__io_start(handle->loop, &handle->io_watcher, POLLIN);
138 void uv__pipe_close(uv_pipe_t* handle) {
139 if (handle->pipe_fname) {
146 unlink(handle->pipe_fname);
147 uv__free((void*)handle->pipe_fname);
148 handle->pipe_fname = NULL;
151 uv__stream_close((uv_stream_t*)handle);
155 int uv_pipe_open(uv_pipe_t* handle, uv_file fd) {
161 if (uv__fd_exists(handle->loop, fd))
176 err = uv__stream_try_select((uv_stream_t*) handle, &fd);
187 return uv__stream_open((uv_stream_t*)handle, fd, flags);
192 uv_pipe_t* handle,
200 new_sock = (uv__stream_fd(handle) == -1);
206 handle->io_watcher.fd = err;
214 r = connect(uv__stream_fd(handle),
234 err = uv__stream_open((uv_stream_t*)handle,
235 uv__stream_fd(handle),
240 uv__io_start(handle->loop, &handle->io_watcher, POLLOUT);
243 handle->delayed_error = err;
244 handle->connect_req = req;
246 uv__req_init(handle->loop, req, UV_CONNECT);
247 req->handle = (uv_stream_t*)handle;
253 uv__io_feed(handle->loop, &handle->io_watcher);
258 static int uv__pipe_getsockpeername(const uv_pipe_t* handle,
268 err = uv__getsockpeername((const uv_handle_t*) handle,
302 int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) {
303 return uv__pipe_getsockpeername(handle, getsockname, buffer, size);
307 int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) {
308 return uv__pipe_getsockpeername(handle, getpeername, buffer, size);
312 void uv_pipe_pending_instances(uv_pipe_t* handle, int count) {
316 int uv_pipe_pending_count(uv_pipe_t* handle) {
319 if (!handle->ipc)
322 if (handle->accepted_fd == -1)
325 if (handle->queued_fds == NULL)
328 queued_fds = handle->queued_fds;
333 uv_handle_type uv_pipe_pending_type(uv_pipe_t* handle) {
334 if (!handle->ipc)
337 if (handle->accepted_fd == -1)
340 return uv_guess_handle(handle->accepted_fd);
344 int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
351 if (handle == NULL || uv__stream_fd(handle) == -1)
361 r = uv_pipe_getsockname(handle, NULL, &name_len);
369 r = uv_pipe_getsockname(handle, name_buffer, &name_len);