Loading include/norns/norns.h +3 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,9 @@ ssize_t norns_progress(struct norns_iotd* iotdp, struct norns_iotst* statp) __TH /* Retrieve error status associated with iotdp */ int norns_error(struct norns_iotd* iotdp) __THROW; /* Check if the urd daemon is running */ int norns_ping() __THROW; /**************************************************************************/ /* Administrative API */ Loading lib/daemon-communication.c +27 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,15 @@ send_request(norns_rpc_type_t type, norns_response_t* resp, ...) { break; } case NORNS_PING: { if((res = pack_to_buffer(type, &req_buf)) != NORNS_SUCCESS) { return res; } break; } default: return NORNS_ESNAFU; Loading Loading @@ -299,6 +308,24 @@ send_process_request(norns_rpc_type_t type, struct norns_cred* auth, return resp.r_status; } int send_ping_request() { int res; norns_response_t resp; if((res = send_request(NORNS_PING, &resp)) != NORNS_SUCCESS) { return res; } if(resp.r_type != NORNS_PING) { return NORNS_ESNAFU; } return resp.r_status; } static int connect_to_daemon(void) { struct sockaddr_un server; Loading lib/daemon-communication.h +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ int send_job_request(norns_rpc_type_t type, struct norns_cred* auth, uint32_t jobid, struct norns_job* job); int send_process_request(norns_rpc_type_t type, struct norns_cred* auth, uint32_t jobid, uid_t uid, gid_t gid, pid_t pid); int send_ping_request(); #pragma GCC visibility pop Loading lib/norns.c +6 −0 Original line number Diff line number Diff line Loading @@ -114,3 +114,9 @@ norns_remove_process(struct norns_cred* auth, uint32_t jobid, uid_t uid, return send_process_request(NORNS_REMOVE_PROCESS, auth, jobid, uid, gid, pid); } int norns_ping() { return send_ping_request(); } lib/requests.c +14 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ remap_request(norns_rpc_type_t type) { return NORNS__RPC__REQUEST__TYPE__ADD_PROCESS; case NORNS_REMOVE_PROCESS: return NORNS__RPC__REQUEST__TYPE__REMOVE_PROCESS; case NORNS_PING: return NORNS__RPC__REQUEST__TYPE__PING; default: return -1; } Loading @@ -73,6 +75,8 @@ remap_response(int norns_rpc_type) { return NORNS_ADD_PROCESS; case NORNS__RPC__RESPONSE__TYPE__REMOVE_PROCESS: return NORNS_REMOVE_PROCESS; case NORNS__RPC__RESPONSE__TYPE__PING: return NORNS_PING; case NORNS__RPC__RESPONSE__TYPE__BAD_REQUEST: // intentionally fall through default: Loading @@ -91,7 +95,7 @@ build_request_msg(norns_rpc_type_t type, va_list ap) { norns__rpc__request__init(req_msg); req_msg->type = type; //req_msg->type = type; switch(type) { case NORNS_SUBMIT_IOTASK: Loading Loading @@ -166,6 +170,15 @@ build_request_msg(norns_rpc_type_t type, va_list ap) { break; } case NORNS_PING: { if((req_msg->type = remap_request(type)) < 0) { goto cleanup_on_error; } break; } } return req_msg; Loading Loading
include/norns/norns.h +3 −0 Original line number Diff line number Diff line Loading @@ -237,6 +237,9 @@ ssize_t norns_progress(struct norns_iotd* iotdp, struct norns_iotst* statp) __TH /* Retrieve error status associated with iotdp */ int norns_error(struct norns_iotd* iotdp) __THROW; /* Check if the urd daemon is running */ int norns_ping() __THROW; /**************************************************************************/ /* Administrative API */ Loading
lib/daemon-communication.c +27 −0 Original line number Diff line number Diff line Loading @@ -115,6 +115,15 @@ send_request(norns_rpc_type_t type, norns_response_t* resp, ...) { break; } case NORNS_PING: { if((res = pack_to_buffer(type, &req_buf)) != NORNS_SUCCESS) { return res; } break; } default: return NORNS_ESNAFU; Loading Loading @@ -299,6 +308,24 @@ send_process_request(norns_rpc_type_t type, struct norns_cred* auth, return resp.r_status; } int send_ping_request() { int res; norns_response_t resp; if((res = send_request(NORNS_PING, &resp)) != NORNS_SUCCESS) { return res; } if(resp.r_type != NORNS_PING) { return NORNS_ESNAFU; } return resp.r_status; } static int connect_to_daemon(void) { struct sockaddr_un server; Loading
lib/daemon-communication.h +1 −0 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ int send_job_request(norns_rpc_type_t type, struct norns_cred* auth, uint32_t jobid, struct norns_job* job); int send_process_request(norns_rpc_type_t type, struct norns_cred* auth, uint32_t jobid, uid_t uid, gid_t gid, pid_t pid); int send_ping_request(); #pragma GCC visibility pop Loading
lib/norns.c +6 −0 Original line number Diff line number Diff line Loading @@ -114,3 +114,9 @@ norns_remove_process(struct norns_cred* auth, uint32_t jobid, uid_t uid, return send_process_request(NORNS_REMOVE_PROCESS, auth, jobid, uid, gid, pid); } int norns_ping() { return send_ping_request(); }
lib/requests.c +14 −1 Original line number Diff line number Diff line Loading @@ -53,6 +53,8 @@ remap_request(norns_rpc_type_t type) { return NORNS__RPC__REQUEST__TYPE__ADD_PROCESS; case NORNS_REMOVE_PROCESS: return NORNS__RPC__REQUEST__TYPE__REMOVE_PROCESS; case NORNS_PING: return NORNS__RPC__REQUEST__TYPE__PING; default: return -1; } Loading @@ -73,6 +75,8 @@ remap_response(int norns_rpc_type) { return NORNS_ADD_PROCESS; case NORNS__RPC__RESPONSE__TYPE__REMOVE_PROCESS: return NORNS_REMOVE_PROCESS; case NORNS__RPC__RESPONSE__TYPE__PING: return NORNS_PING; case NORNS__RPC__RESPONSE__TYPE__BAD_REQUEST: // intentionally fall through default: Loading @@ -91,7 +95,7 @@ build_request_msg(norns_rpc_type_t type, va_list ap) { norns__rpc__request__init(req_msg); req_msg->type = type; //req_msg->type = type; switch(type) { case NORNS_SUBMIT_IOTASK: Loading Loading @@ -166,6 +170,15 @@ build_request_msg(norns_rpc_type_t type, va_list ap) { break; } case NORNS_PING: { if((req_msg->type = remap_request(type)) < 0) { goto cleanup_on_error; } break; } } return req_msg; Loading