Hot answers tagged

36

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 \ ...


21

qdbusviewer is your best friend, allow your to send dbus messages as well:


19

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 ...


17

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 ...


10

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 ...


9

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 ...


9

ksh93 has disciplines which are typically used for this kind of thing. With zsh, you could hijack the dynamic named directory feature: Define for instance: zsh_directory_name() { case $1 in (n) case $2 in (incr) reply=($((++incr))) esac esac } And then you can use ~[incr] to get an incremented $incr each time: $ echo ~[incr] ...


8

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 ...


7

The python way is the beautiful way. System services: import dbus for service in dbus.SystemBus().list_names(): print(service) Session services: import dbus for service in dbus.SessionBus().list_names(): print(service)


5

I have a solution that uses lsof. It is not installed on BSD by default so if anyone want to use it on BSD, it is required to install it. Make a shell script: #!/bin/sh lsof -p $1 | grep cwd | awk '{print $9}' Copy it to a directory in your path. It prints the working directory of PID given in the first argument, I.E. $ script 1987 /home/enedil


5

Is RabbitMQ, for inter process communication, like pipes and named pipes? No. That's not the best way to comprehend RabbitMQ, or indeed message-passing broker-based middlewares in general. If you are looking for a paradigm to hang your metaphorical hat on in order to start understanding RabbitMQ and its ilk, don't think of low-level IPC at all. ...


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

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 ...


4

POSIX doesn't offer much in terms of getting information about unrelated processes. There's only ps, really, and it doesn't give any information about the current directory. The C-level APIs aren't any better (in fact most of the information retrieved by ps can only be retrieved by parsing its outputĀ¹). Funnily enough POSIX does offer a portable way to go ...


4

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 ...


4

By system clock I mean the clock that tells the time down right of the panel "System clock" generally refers to the clock maintained by the kernel; applications such as date and GUI clocks such as the one you refer to make calls to it like this. Why, out of all the processes that the system runs, does the clock need a shared memory segment? ...


4

As per the official docs (under standard interfaces): There are some standard interfaces that may be useful across various D-Bus applications. org.freedesktop.DBus.Introspectable This interface has one method: org.freedesktop.DBus.Introspectable.Introspect (out STRING xml_data) Objects instances may implement Introspect which returns ...


4

You also use ipcs, but add extra options: wouter@gangtai:~$ ipcs ------ Message Queues -------- key msqid owner perms used-bytes messages ------ Shared Memory Segments -------- key shmid owner perms bytes nattch status 0x0052e2c1 32768 postgres 600 56 20 ...


4

read and write don't take a reference; they take a pointer. Prefix-& is the address-of operator, which returns a pointer. It's postfix-& which indicates a reference. Passing data to another program in this manner can work, but only under the following circumstances: The class does not use pointers, but stores everything inside the class itself The ...


4

If you want to execute code whenever the value of a variable is read, you can't do that inside zsh itself. The RANDOM variable (like other similar special variables) is hard-coded in the zsh source code. You can however define similar special variables by writing a module in C. Many of the standard modules define special variables. You can use a coprocess ...


3

$ ipcs -q will provide message queue stats from the command line. $ ipcs -m will provide shared memory stats from the command line. $ ipcs will provide all ipc mechanism stats.


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

I don't believe there are any commands that allow you to monitor POSIX message queues specifically. As you mentioned, all of the details are exposed via a pseudo filesystem, usually mounted under /dev/mqueue. Once you've done that, you can then use file management commands like ls, rm, cat, etc. to inspect and manage the queue details.


3

bash-4.3$ ps -j | cat PID PGID SID TTY TIME CMD 4586 4586 4586 pts/1 00:00:00 bash 4600 4600 4586 pts/1 00:00:00 ps 4601 4600 4586 pts/1 00:00:00 cat bash-4.3$ ps -j; ps -j PID PGID SID TTY TIME CMD 4586 4586 4586 pts/1 00:00:00 bash 4602 4602 4586 pts/1 00:00:00 ps PID PGID SID TTY TIME ...


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

My parent process had died for some reason. This caused the issue. I took care of that and the problem got solved.


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

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 ...


2

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 ...



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