MCPcopy Create free account
hub / github.com/LemonOSProject/LemonOS / Call

Method Call

Kernel/src/objects/message.cpp:78–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78int64_t MessageEndpoint::Call(uint64_t id, uint16_t size, uint64_t data, uint64_t rID, uint16_t* rSize, uint64_t* rData, int64_t timeout){
79 if(!peer.get()){
80 return -ENOTCONN;
81 }
82
83 if(size > maxMessageSize){
84 return -EINVAL;
85 }
86
87 assert(rSize);
88 assert(rData);
89
90 Semaphore s = Semaphore(0);
91 Message m;
92
93 acquireLock(&waitingResponseLock);
94 waitingResponse.add_back({&s, {&m, rID}});
95 releaseLock(&waitingResponseLock);
96
97 Write(id, size, data); // Send message
98
99 // TODO: timeout
100 s.Wait(); // Await reponse
101
102 *rSize = m.size;
103
104 if(m.size <= 8){
105 *rData = m.data;
106 } else {
107 memcpy(rData, m.dataP, m.size);
108 }
109
110 if(m.size > 8){
111 delete[] m.dataP;
112 }
113
114 return 0;
115}
116
117int64_t MessageEndpoint::Write(uint64_t id, uint16_t size, uint64_t data){
118 if(!peer.get()){

Callers 1

SysEndpointCallFunction · 0.45

Calls 6

SemaphoreClass · 0.85
memcpyFunction · 0.85
WriteFunction · 0.50
getMethod · 0.45
add_backMethod · 0.45
WaitMethod · 0.45

Tested by

no test coverage detected