/*================================================================= ** List the files in the queue ** This function is passed the command character so it can know ** if it should produce a long or short listing. =================================================================*/ void do_request_lpq(char *command) { int format; /* long or short listing */ char *queue = command + 1; /* name queue to list */ #define MAX 100 const char *list[MAX + 1]; char *p; int i = 0; /* Long or short queue format: */ if(command[0] == 3) format = 0; else format = 1; /* Find and terminate queue name: */ p = queue + strcspn(queue, RFC1179_WHITESPACE); *p = '\0'; /* Find the other parameters and build them into an array of string pointers. */ p++; p += strspn(p, RFC1179_WHITESPACE); while(*p && i < MAX) { list[i++] = p; p += strcspn(p, RFC1179_WHITESPACE); *p = '\0'; p++; } list[i] = (char*)NULL; /* ** Use the UPRINT routine to run an appropriate command. ** If uprint_lpq() returns -1 then the reason is in uprint_errno. ** Unless the error is UPE_UNDEST, it will already have called ** uprint_error_callback(). If uprint_lpq() runs a command that ** fails, it will return the (positive) exit code of that ** command. */ if(uprint_lpq(geteuid(), getegid(), "???", queue, format, list, FALSE) == -1) { if(uprint_errno == UPE_UNDEST) { printf(_("The queue \"%s\" does not exist on the print server \"%s\".\n"), queue, this_node()); } else { printf(_("Could not get a queue listing due to a problem with the print server\n" "called \"%s\". Please ask the print server's\n" "system administrator to examine the log file \"%s\"\n" "to learn the details.\n"), this_node(), LPRSRV_LOGFILE); } fflush(stdout); } } /* end of do_request_lpq() */
static void unlink_after(node_ptr prev_node) { node_ptr this_node(NodeTraits::get_next(prev_node)); NodeTraits::set_next(prev_node, NodeTraits::get_next(this_node)); }
void basp_broker_state::deliver(const node_id& src_nid, actor_id src_aid, strong_actor_ptr dest, message_id mid, std::vector<strong_actor_ptr>& stages, message& msg) { CAF_LOG_TRACE(CAF_ARG(src_nid) << CAF_ARG(src_aid) << CAF_ARG(dest) << CAF_ARG(msg) << CAF_ARG(mid)); auto src = src_nid == this_node() ? system().registry().get(src_aid) : proxies().get_or_put(src_nid, src_aid); // Intercept link messages. Forwarding actor proxies signalize linking // by sending link_atom/unlink_atom message with src = dest. if (msg.type_token() == make_type_token<atom_value, strong_actor_ptr>()) { switch (static_cast<uint64_t>(msg.get_as<atom_value>(0))) { default: break; case link_atom::value.uint_value(): { if (src_nid != this_node()) { CAF_LOG_WARNING("received link message for an other node"); return; } auto ptr = msg.get_as<strong_actor_ptr>(1); if (!ptr) { CAF_LOG_WARNING("received link message with invalid target"); return; } if (!src) { CAF_LOG_DEBUG("received link for invalid actor, report error"); anon_send(actor_cast<actor>(ptr), make_error(sec::remote_linking_failed)); return; } static_cast<actor_proxy*>(ptr->get())->local_link_to(src->get()); return; } case unlink_atom::value.uint_value(): { if (src_nid != this_node()) { CAF_LOG_WARNING("received unlink message for an other node"); return; } auto ptr = msg.get_as<strong_actor_ptr>(1); if (!ptr) { CAF_LOG_DEBUG("received unlink message with invalid target"); return; } if (!src) { CAF_LOG_DEBUG("received unlink for invalid actor, report error"); return; } static_cast<actor_proxy*>(ptr->get())->local_unlink_from(src->get()); return; } } } if (!dest) { auto rsn = exit_reason::remote_link_unreachable; CAF_LOG_INFO("cannot deliver message, destination not found"); self->parent().notify<hook::invalid_message_received>(src_nid, src, invalid_actor_id, mid, msg); if (mid.valid() && src) { detail::sync_request_bouncer srb{rsn}; srb(src, mid); } return; } self->parent().notify<hook::message_received>(src_nid, src, dest, mid, msg); dest->enqueue(make_mailbox_element(std::move(src), mid, std::move(stages), std::move(msg)), nullptr); }