ipc

Passing a pointer to a local variable to another process works sometimes and not others

[亡魂溺海] 提交于 2019-12-08 04:42:55
问题 A while back I wrote a program that lets you pick and modify windows. It uses WindowFromPoint() to get a handle to the window under the mouse cursor and calls GetWindowText() on that to get the window’s title. This works just fine. I then added the ability to get the title of columns of a list-control. The problem is that unlike GetColumnWidth() which returns the width, there is no corresponding function to get the title. Instead, getting the title of the column header requires passing a

IPC Suggestion for lots of small data [closed]

こ雲淡風輕ζ 提交于 2019-12-08 03:38:12
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . We are going to implement a multi-process software and we are looking for a proper IPC. Facts: We are going to use Java (and C if we face something time critical) All the processes are on a single Unix machine. The processes sends each other lots (about 1000) of small (about 4k) data per second. What IPC tech do

How to implement a native code sandbox?

↘锁芯ラ 提交于 2019-12-08 03:36:49
问题 I'm writting a Windows Java application that needs to call unsafe native code, and I need to prevent this code from having access to Java objects and JVM data structures, otherwise it might crash the JVM or hack into sensitive data. Before you ask, this native code is previously verified - it can only call a few APIs and cannot have certain instructions, so we know it won't VirtualProtect itself or other memory regions to gain more access and mess around. Anyway, my first attempt was to wrap

AccountManager and signature check

只愿长相守 提交于 2019-12-08 03:05:49
问题 Security tips chapter related to AccountManager mentions that: If credentials are used only by applications that you create, you can verify the application that accesses the AccountManager using checkSignature(). Where in the code should I check the signature? I've already tried to use Binder.getCallingUid( ) to obtain the UID of the calling process inside my own implementation of the AbstractAccountAuthenticator , but it returns 1000 as the system process performs IPC. I need to obtain UID

enter pdb with kill signal

泄露秘密 提交于 2019-12-08 02:47:25
问题 In a recent project, I want to debug my program in production use state. The production environment is very complicated so I want to debug the program whenever I find a problem. This is what I want to achieve: whenever I want to debug, I will send a kill signal to the program and hopefully pdb debugger will appear. It is something like this: import pdb import signal import time def handler(signal, frame): pdb.set_trace() signal.signal(signal.SIGTERM, handler) a=1 while True: a+=1 time.sleep(1

Handling mq_open failures after mq_unlink

有些话、适合烂在心里 提交于 2019-12-08 02:14:45
问题 I'm writing a client/server process on Suse Linux using Posix message queues to communicate, similar to the accepted answer in "How do I use mqueue in a c program on a Linux based system?". When the server dies, it does an mq_close and mq_unlink . However, the client gets no notification of this, so calls to mq_send in the client will continue to work even though the queue has been unlinked. The problem is, when the server is restarted, it tries to create a queue with mq_open with O_CREAT,

perl run background job and force job to finish?

时光怂恿深爱的人放手 提交于 2019-12-08 02:04:00
问题 I've got a Perl script that starts a background job to print some logging information into a file, executes something, and then finishes. I would like to end the background process when the script is done, but as far as I know, if I use a double fork as below, then waitpid($pid,0) will wait for the background process to finish, instead of killing it, and kill(9,$pid) won't get rid of the background process. Example script: #!/usr/bin/perl use strict; # Do a first general top my $ret = `top -b

Can't do blocking read from named pipe (FIFO) in Linux

感情迁移 提交于 2019-12-08 01:18:09
问题 It is very weird that I can't seem to make this work. This is my architecture: I have a named pipe which will communicate between a always-running root reader process and multiple application writer processes. The reader process has to be blocking while the writers are nonblocking . Therefore this is what I do in the reader process which will run with root privilege. reader.c #define PIPE_ID "/dev/shm/mypipe" // This function configures named pipe void configure_pipe() { // So that others can

How do I send and receive real-time signals `sigqueue()` in Python?

那年仲夏 提交于 2019-12-07 21:52:43
问题 Python provides a signals module and os.kill ; does it have a facility for sigqueue() (real-time signals with attached data)? What are the alternatives? 回答1: You could do it with ctypes >>> from ctypes import * >>> c = cdll.LoadLibrary("libc.so.6") >>> c.sigqueue <_FuncPtr object at 0xb7dbd77c> >>> c.sigqueue(100, 10, 0) -1 >>> You'll have to look up how to make a union in ctypes which I've never done before but I think is possible. 回答2: One alternative, if no one has done it yet, would be to

Communicating between a parent and its children

倾然丶 夕夏残阳落幕 提交于 2019-12-07 20:43:20
问题 Newbie question: On Unix, in a program with a parent and some children: - How can the parent alert the children efficiently to do some work.. ? - Or how can the children wait for parent signal to start doing some work? EDIT: This program tries to do a complex computation in parallel, I have already used shared memory as a common workspaces for all children to update results and for data transfer. What I need now is the parent say "start" efficiently to all its children...(called many times)