Tag Info

Hot answers tagged

20

Session: dbus-send --session \ --dest=org.freedesktop.DBus \ --type=method_call \ --print-reply \ /org/freedesktop/DBus \ org.freedesktop.DBus.ListNames System: dbus-send --system \ --dest=org.freedesktop.DBus \ --type=method_call \ --print-reply \ ...


18

This depends a lot on the communication mechanism. At the most transparent end of the spectrum, processes can communicate using internet sockets (i.e. IP). Then wireshark or tcpdump can show all traffic by pointing it at the loopback interface. At an intermediate level, traffic on pipes and unix sockets can be observed with truss/strace/trace/..., the ...


7

UNIX domain sockets and FIFO may share some part of their implementation but they are conceptually very different. FIFO functions at a very low level. One process writes bytes into the pipe and another one reads from it. A UNIX domain socket has the same behaviour than a TCP/IP socket. A socket is bidirectionnal and can be used by a lot of processes ...


6

Historically, Unix had only these two signals, but modern systems have the real-time signals SIGRTMIN...SIGRTMAX. Due to the wacky and unportable semantics of the signal APIs, there is almost no use case where signals would be preferrable over other communication mechanisms like pipes. Therefore, allocating a new signal number has never been seen as ...


5

If you read the manpage for semget, in the Notes section you'll notice: System wide maximum number of semaphore sets: policy dependent (on Linux, this limit can be read and modified via the fourth field of /proc/sys/kernel/sem). On my system, cat /proc/sys/kernel/sem reports: 250 32000 32 128 So do that on your system, and then echo it back after ...


4

Yes, a pipe made with pipe() has two file descriptors. fd[0] for reading and fd[1] for writing. No, you do not have to close either end of the pipe, it can be used for bidirectional communication. Edit: in the comments you want to know how this relates to ls | less, so I'll explain that too: Your shell has three open file descriptors: 0 (stdin), 1 ...


4

Finding the transport Try using netstat -ln | grep 'mysql' and you can see how it is connected by the output. if you have access to shell On Unix, MySQL programs treat the host name localhost specially, in a way that is likely different from what you expect compared to other network-based programs. For connections to localhost, MySQL programs attempt to ...


3

There's quite a good discussion of this here: http://www.slideshare.net/divyekapoor/linux-kernel-implementation-of-pipes-and-fifos So far as I can see, both from the presentation slides, and the source @ http://lxr.free-electrons.com/source/fs/pipe.c - fifo's are implemented as a wrapper around pipe's, and pipe's themselves are implemented via the pipefs ...


3

This will show what a process reads and writes: strace -ewrite -p $PID It's not clean output (shows lines like: write(#,) ), but works! (and is single-line :D ) You might also dislike the fact, that arguments are abbreviated. To control that use -s parameter that sets the maxlength of strings displayed. It catches all streams, so You might want to filter ...


2

Just some pointers on how to (possibly) talk with the power daemon. Have a look into the Chromium OS sources (no idea on how much this differs from Chrome OS), there you'll find the power_managers sources which might be helpful: README explains what one can find there, among others: powerd (powerd.cc) Upper power manager. Adjusts device status ...


2

ls will output what it has to output on its standard output. To do that, it calls the write system call, something like: write(1, "file1 file2...\n", 16) (or more likely it calls libc functions like printf or fwrite that eventually do the write() system call) It assumes that the file descriptor 1 (stdout by convention) was already opened and points to ...


2

Typically the parent process waits until the child process ends by calling waitpid. The parent process gets the PID of the process from fork. This means the child never signals the parent process in any way that it exited or what happened. This is done by the system and not the child process. If you are talking about the output of the program, the parent ...


2

Signals only provide a primitive means of communication. In particular, there's no way to attach any information to them. The recipient only knows the signal number, not the identity of the sender. Multiple signals can be conflated into one. Given all these restrictions, there aren't that many useful purposes for signals. For more complex purposes, use more ...


2

That's probably how pty device files get created, but you don't want to do that whenever you want a pty. Any given machine usually has a complement of pty device files already created. Pseudo TTYs are fairly OS specific and you don't mention what you want to do this on. For a modern linux, I'd take a look at openpty(3). You can find working example code in ...


1

System V is fully supported on all Linux kernels, POSIX IPC since kernel 2.6. So Ubuntu 12.04 supports both. Others have described it better than I can: System V IPC vs POSIX IPC Comparing Unix/Linux IPC ipcs is an interesting command for poking around your SysV IPC facilities (shm segments, semaphores and message queues).


1

A "FIFO" and a "named pipe" is the same thing - though it's quite different from how a shell handles a "pipe" (|) between two commands on the command-line. A named pipe (FIFO) is a single "file" shared by two programs, where one writes to it and the other read from it... A socket on the other hand is a "connection" between two "files" - which may use a ...


1

If you're lucky enough to use HP-UX, the command pipcs (PDF) performs the POSIX equivalent to the SysV IPC ipcs command. Sadly, it has never appeared for other OS's. The current (March 2013) util-linux package which provides ipcs barely mentions POSIX mqueues. If you have mqueue mounted on /dev/mqueue, what is supported is simply reading the queue as a ...


1

There is no command I know of but there exists a libc function call which can get the statistics: man 3 mq_getattr mq_getattr() returns an mq_attr structure in the buffer pointed by attr. This structure is defined as: struct mq_attr { long mq_flags; /* Flags: 0 or O_NONBLOCK */ long mq_maxmsg; /* Max. # ...


1

The only way you could handle this would be to have some kind of heartbeat system between the processes. For instance the first process could share its PID in shared memory. Subsequent processes could announce themselves by sending a signal such as SIGUSR1. Then they could keep sending SIGUSR2 at intervals as a heartbeat. Two missing SIGUSR2 signals in a ...



Only top voted, non community-wiki answers of a minimum length are eligible