Sponsored Content
Top Forums Shell Programming and Scripting Tricky little problem, send signal to other machine without user Post 302479355 by Corona688 on Friday 10th of December 2010 11:27:04 AM
Old 12-10-2010
It might be made to work. I'm not sure how you'd manage connections though.
 

10 More Discussions You Might Find Interesting

1. AIX

User defined signal 1

Hi, I am just running a incremental back-up on one of my server. But these days It abrubtly fails with below error. ========== User defined signal 1 =========== When I rerun the back-up, It completed successfully.Earlier this was not happening. Any Idea, what could be the problem... (0 Replies)
Discussion started by: nitesh_raj
0 Replies

2. UNIX for Advanced & Expert Users

scp from user A in machine 1 to user B in machine 2

Hi all, would like to find out how can i scp a file from user A in one host to user B in another host? i know how to get it done if its from user A in machine 1 to user A in machine 2. 1)on machine 1, generate a key pair. put the private key in the .ssh directory. 2)put the public key in... (2 Replies)
Discussion started by: new2ss
2 Replies

3. Shell Programming and Scripting

How to send SIGNAL to the thread?

Hello, I have to send SIGSEGV to the thread. What is the simplest and efficient way to do that? (6 Replies)
Discussion started by: Rahulpict
6 Replies

4. UNIX for Advanced & Expert Users

need more user signal

Hi In my program I have already used both SIGUSR1 SIGUSR2 user signals. I need another one. How can I do that? Thank you Naama (1 Reply)
Discussion started by: naamabm
1 Replies

5. Shell Programming and Scripting

sed tricky problem

Hi, I have a file which contains two strings: AAAAA and BBBBB I have two variables in my script: DATE="03/21/2010" aDate="20100321" I need to replace string AAAAA with variable $DATE and BBBBB with $aDate. Here is what I do sed "s/AAAAA/$DATE/" $BASIC_TMPLT | sed "s/BBBBB/$aDate/" >... (4 Replies)
Discussion started by: axed
4 Replies

6. UNIX for Dummies Questions & Answers

Send email with attachment and body : mailx , waiting for input , signal Control D

Hi, I am trying to send email with attacment and body using "mailx" (cat body.txt; uuencode attach.txt) | mailx -s "Attachment" abc@xyz.com When i type this command, the shell is still waiting for me to enter something in standard input and press control D before it sends a mail and... (2 Replies)
Discussion started by: aliaszero
2 Replies

7. Programming

how can i make that a process child send a signal?

I'm trying to do a program that makes activate an signal (SINGALARM) when the next child of a son appears but this not works. I have to caught the next child o the other (pid), to send a singnal which inform a menssage. It's anything worng in the code? thanks. the code: #include... (2 Replies)
Discussion started by: marmaster
2 Replies

8. UNIX for Dummies Questions & Answers

How to send xterm to another machine

The scenario is like this: I don't have access permission to linux server A, but my colleague has. So I installed xwindow server (xming or cygwin), then gave him my ip address, then he sent xterm to my machine, the xterm already connected to A with his account. My question is how he did it? (2 Replies)
Discussion started by: humbug
2 Replies

9. Shell Programming and Scripting

Vi : Is it possible to send ctrl + d signal from a file made with vi and executing it.

Hi Experts, Is it possible to send ctrl + d signal from a inside a file made with vi, using Ctrl V , Esc and 004 , escape sequence. Since : 004 should exit the script if executed. Is this something possible. I am trying with vi , I put this code ^ , and trying to execute it but... (4 Replies)
Discussion started by: rveri
4 Replies

10. Shell Programming and Scripting

Send ctrl-C signal using bash script.

declare -a array=( "LLC-load-misses" "LLC-loads" "LLC-store-misses" "LLC-stores" "branch-load-misses" "branch-loads" "dTLB-load-misses" "dTLB-loads" "dTLB-store-misses" "dTLB-stores" "iTLB-load-misses" "iTLB-loads" "branch-instructions" "branch-misses" "bus-cycles" "cache-misses" "cache-references"... (2 Replies)
Discussion started by: BHASKAR JUPUDI
2 Replies
xpc_main(3)						   BSD Library Functions Manual 					       xpc_main(3)

NAME
xpc_main -- XPC service runtime SYNOPSIS
#include <xpc/xpc.h> void xpc_main(xpc_connection_handler_t handler); void xpc_transaction_begin(void); void xpc_transaction_end(void); DESCRIPTION
The xpc_main() function is called by an XPC service to initialize the runtime and start listening for incoming connections. HANDLER
The handler provided to xpc_main() will be invoked when a new connection has been established with the service. For each new connection, an xpc_connection_t will be passed as the parameter to the handler. Each connection corresponds to a call to xpc_connection_create(3) made by a client of the service. The service is responsible for setting an event handler on the new connection and resuming it in the same fashion as new connections returned by xpc_connection_create(3). Important: The new connection passed to handler() must be retained using xpc_retain(3) if it will be stored in data structures that persist beyond the scope of that function. static void new_connection_handler(xpc_connection_t peer) { xpc_connection_set_event_handler(peer, ^(xpc_object_t event) { // Handle messages and errors. }); xpc_connection_resume(peer); } int main(void) { xpc_main(new_connection_handler); exit(EXIT_FAILURE); } launchd jobs which advertise MachServices may not call xpc_main(). RUNTIME MANAGEMENT
The XPC runtime automatically keeps track of message activity to determine whether a service is busy or idle. If the service remains idle after a period of inactivity (defined by the system), xpc_main() will exit the process. Activity is tracked with a transaction count maintained by the XPC runtime. A service is deemed idle when its transaction count is zero. The transaction count is incremented immediately before the receipt and delivery of a message to a peer connection's event handler. The transaction count is correspondingly decremented when the event handler returns. The transaction count is also incremented when a reply message is created with xpc_dictionary_create_reply(3), and decremented when the reply is sent. As a result, a service with outstanding reply messages is not considered idle. Services may extend the default behavior using xpc_transaction_begin() and xpc_transaction_end(), which increment and decrement the transac- tion count respectivley. This may be necessary for services that send periodic messages to their clients, not in direct reply to a received message. If the service has a non-zero transaction count at a time when the system deems it necessary to terminate the service, all peer connections in the service will receive the XPC_ERROR_TERMINATION_IMMINENT event. This event indicates that the service should unwind all outstanding work as quickly as possible and not begin any new work, as the system will terminate the process if it does not exit in a timely fashion. After this event is received, no further messages will be delivered to the peers, and the end of the service's last outstanding transaction will automatically terminate the process. Important: xpc_transaction_begin() and xpc_transaction_end() are not safe to call before xpc_main(). In general, an XPC service's main() should have no other code in it other than a call to xpc_main() followed by a call to exit(2) as illustrated above. The XPC runtime will also automatically manage the service's priority based on where a message came from. If an app sends a message to the service, the act of sending that message will boost the destination service's priority and resource limits so that it can more quickly fill the request. If, however, a service gets a message from a background process, the service stays at a lower priority so as not to interfere with work initiated as a direct result of user interaction. The lifetime of these boosts is tied to the lifetime of the message or reply object, just like transactions. So while the service maintains a reference to a message which boosted it, the boost will remain. If a reply message is created using xpc_dictionary_create_reply(3), the boost transfers to the reply object and will remain with the process until until the reply has been sent or deallocated. Note that boosts happen as a result of a message-send operation. So even if the service isn't running when a boosting message is sent, it will be launched on-demand at the elevated priority necessary to receive the message in a timely fashion. launchd jobs which use XPC for their IPC may opt into priority boosting by specifying their ProcessType as Adaptive. This will apply priority boosting behavior only to the MachServices that are in the launchd.plist. See launchd.plist(5) for more details. DEFAULT ENVIRONMENT
The execution environment for XPC services bundled with applications is tightly controlled. By default, services are executed in a new secu- rity audit session and therefore do not have access to the current user's keychain or the ability to draw UI. This behavior may be overrid- den with the JoinExistingSession key in the service's Info.plist. By default, the xpc_main() function will call the dispatch_main(3) function to manage the service's main event loop. This behavior may be overridden with the RunLoopType key in the service's Info.plist. See xpcservice.plist(5) for more information about these keys. SEE ALSO
xpc(3), xpc_connection_create(3) Darwin 1 July, 2011 Darwin
All times are GMT -4. The time now is 12:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy