Rizin
unix-like reverse engineering framework and cli tools
uv-data-getter-setters.c
Go to the documentation of this file.
1 /* Copyright libuv project contributors. All rights reserved.
2  *
3  * Permission is hereby granted, free of charge, to any person obtaining a copy
4  * of this software and associated documentation files (the "Software"), to
5  * deal in the Software without restriction, including without limitation the
6  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
7  * sell copies of the Software, and to permit persons to whom the Software is
8  * furnished to do so, subject to the following conditions:
9  *
10  * The above copyright notice and this permission notice shall be included in
11  * all copies or substantial portions of the Software.
12  *
13  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
18  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
19  * IN THE SOFTWARE.
20  */
21 
22 #include "uv.h"
23 
25  switch (type) {
26 #define XX(uc,lc) case UV_##uc: return #lc;
28 #undef XX
29  case UV_FILE: return "file";
30  case UV_HANDLE_TYPE_MAX:
31  case UV_UNKNOWN_HANDLE: return NULL;
32  }
33  return NULL;
34 }
35 
37  return handle->type;
38 }
39 
41  return handle->data;
42 }
43 
45  return handle->loop;
46 }
47 
49  handle->data = data;
50 }
51 
53  switch (type) {
54 #define XX(uc,lc) case UV_##uc: return #lc;
56 #undef XX
57  case UV_REQ_TYPE_MAX:
58  case UV_UNKNOWN_REQ:
59  default: /* UV_REQ_TYPE_PRIVATE */
60  break;
61  }
62  return NULL;
63 }
64 
66  return req->type;
67 }
68 
69 void* uv_req_get_data(const uv_req_t* req) {
70  return req->data;
71 }
72 
73 void uv_req_set_data(uv_req_t* req, void* data) {
74  req->data = data;
75 }
76 
78  return stream->write_queue_size;
79 }
80 
82  return handle->send_queue_size;
83 }
84 
86  return handle->send_queue_count;
87 }
88 
90  return proc->pid;
91 }
92 
94  return req->fs_type;
95 }
96 
98  return req->result;
99 }
100 
101 void* uv_fs_get_ptr(const uv_fs_t* req) {
102  return req->ptr;
103 }
104 
105 const char* uv_fs_get_path(const uv_fs_t* req) {
106  return req->path;
107 }
108 
110  return &req->statbuf;
111 }
112 
114  return loop->data;
115 }
116 
117 void uv_loop_set_data(uv_loop_t* loop, void* data) {
118  loop->data = data;
119 }
static mcore_handle handle
Definition: asm_mcore.c:8
#define NULL
Definition: cris-opc.c:27
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec req
Definition: sflib.h:128
voidpf stream
Definition: ioapi.h:138
int type
Definition: mipsasm.c:17
int ssize_t
Definition: sftypes.h:39
Definition: uv.h:1306
Definition: uv.h:1780
void * data
Definition: uv.h:1782
Definition: uv.h:407
Definition: uv.h:349
Definition: uv.h:638
uv_loop_t * loop
Definition: main.c:7
struct Proc * proc
pid_t uv_pid_t
Definition: unix.h:131
void * uv_loop_get_data(const uv_loop_t *loop)
size_t uv_udp_get_send_queue_size(const uv_udp_t *handle)
size_t uv_stream_get_write_queue_size(const uv_stream_t *stream)
void * uv_req_get_data(const uv_req_t *req)
const char * uv_handle_type_name(uv_handle_type type)
void uv_loop_set_data(uv_loop_t *loop, void *data)
size_t uv_udp_get_send_queue_count(const uv_udp_t *handle)
#define XX(uc, lc)
const char * uv_req_type_name(uv_req_type type)
ssize_t uv_fs_get_result(const uv_fs_t *req)
void * uv_fs_get_ptr(const uv_fs_t *req)
uv_fs_type uv_fs_get_type(const uv_fs_t *req)
void uv_handle_set_data(uv_handle_t *handle, void *data)
void uv_req_set_data(uv_req_t *req, void *data)
uv_pid_t uv_process_get_pid(const uv_process_t *proc)
uv_loop_t * uv_handle_get_loop(const uv_handle_t *handle)
const char * uv_fs_get_path(const uv_fs_t *req)
uv_stat_t * uv_fs_get_statbuf(uv_fs_t *req)
uv_handle_type uv_handle_get_type(const uv_handle_t *handle)
uv_req_type uv_req_get_type(const uv_req_t *req)
void * uv_handle_get_data(const uv_handle_t *handle)
uv_handle_type
Definition: uv.h:189
@ UV_FILE
Definition: uv.h:194
@ UV_HANDLE_TYPE_MAX
Definition: uv.h:195
@ UV_UNKNOWN_HANDLE
Definition: uv.h:190
uv_fs_type
Definition: uv.h:1257
#define UV_REQ_TYPE_MAP(XX)
Definition: uv.h:170
uv_req_type
Definition: uv.h:198
@ UV_REQ_TYPE_MAX
Definition: uv.h:204
@ UV_UNKNOWN_REQ
Definition: uv.h:199
#define UV_HANDLE_TYPE_MAP(XX)
Definition: uv.h:152