Programming :: Closing / Unlinking POSIX Message Queues?

Apr 15, 2011

I have a pthread waiting forever on a POSIX message queue and then call mq_close and mq_unlink on the POSIX message queue. I've found that the pthread never wakes up from it's call to mq_receive and remains blocked indefinitely. Is there a way to wakeup all pthreads blocked on a POSIX message queue after calling mq_close/mq_unlink? The goal is to include error handling during message queue deletion to avoid leaving any pthreads blocked forever.

View 2 Replies


ADVERTISEMENT

Programming :: Posix Message Queues - Communicate Between Two Threads?

Jan 3, 2011

I want to communicate between two threads, each belonging to a different process. Iam using message queues for this. I use mq_open()call. I created the queues with the same queue name starting with a '/'. But when I open the queue, the queue ID is different in both the process. What should I do so that both the process have the same queue ID?

View 1 Replies View Related

Programming :: Listening Message Queues

Jan 26, 2011

I am implementing an IPC mechanism using message queues (Sys V).I can receive the messages using msgrcv() function. I am wondering how can I listen on the new messages. I would like to implement a mechanism that would notify me when there is a new message in the queue for me and I will call the msgrcv() function to retrieve the message.

View 4 Replies View Related

Programming :: Python: Simple Message Queues / IPC?

Mar 10, 2010

I have this daemon I'm writing in Python, but I still a Python n00b. I've coded the part of the daemon that does the work, but not the part that receives messages. I need a simple system so that other processes on the same (Linux) computer can occasionally send text-string messages to the daemon (without needing to stay running all the time themselves). Once in the past we did something similar by (mis)using pyliblo to listen for OSC messages coming in on a certain port. That option isn't as workable here because the pyliblo interface (as near as I can tell) requires you to know in advance specifically what messages you are expecting, and forward them to specified functions, rather than just allowing you to generically process incoming messages as you see fit.

View 1 Replies View Related

Programming :: Difference Between Message Queues And Named Pipes

Mar 1, 2011

recently I had been to interview where I had a question to be answered, that what are advantages and disadvantages when desiging an application in linux.

View 1 Replies View Related

Programming :: Program Hang Stuck There Signal Handling On POSIX Message Queue UNIX C Pr

Jun 14, 2011

In a single main() function,so need signal handling. Use Posix Message Queue IPC mechanism , can ignore the priority and other linked list message,to implement the scenario:

View 1 Replies View Related

Kernel :: Use Message Queues For Sending Message?

Apr 16, 2010

I was trying to use Message Queues for sending message from aninserted kernel module to user space. The function sys_msgsnd failedgiving the obvious error -EFAULT.However, I was able to send the message from kernel to user space when I had made the same driver part of kernel (and not inserting it).How is that possible?I am using linux.2.6.19.x (arch=ppc)I now use Netlink socket to communicate from kernel to user, but the aboveproblem seemed strange to me.

View 2 Replies View Related

General :: Close/remove Message Queues Without Software Or Mq_close / Mq_unlink Command?

Jan 17, 2011

i am working on a project that uses message queues. i am able to successfully create them and they are working fine. now the problem is to close/remove message queues without software or mq_close / mq_unlink command. earlier when i worked on rh9, there is ipcs utility. we use ipcs to see all the existing message queues and ipcrm to remove them. however ipcs is not working for message queues in RHEL 5.3. Neither ipcs shows the exisiting message queues and neither we are able to use ipcrm. Plz guide to close/remove the queues with ipcs or any other command/utility from shell itself.

View 1 Replies View Related

Programming :: Synchronize 2 Posix Threads ?

Mar 15, 2011

I have 2 threads and both of them are deleting memory at the end nedded by both.

My problem is that maybe it can happen that a thread start and finish before the other one starts and so it deletes the memory nedded by the other thread. How can I synchronize them so that this can't happend.

As a design my threads look like this:

Code:

The other thread looks the same, but this isn't unoff to stop thread1 to finish before thread2 starts.

View 4 Replies View Related

Programming :: Proper Implementation Of POSIX Threads

Apr 6, 2011

I've implemented a program URL... which reads digital IF data from a radio receiver through a named pipe, measures power levels, and sends the result to stdout. The program is interactive; there is a thread that reads from stdin to watch for commands, a thread that constantly either reads data from the named pipe or throws data away, and an array of processing threads. The program uses GTK+extra to plot the signals. The IF data stream bandwidth exists at the limits of today's technology (is very very fast).

Problem Statement:The program works fine with a few bugs. I've learned since I've made it that using global state variables to coordinate threads isn't a good way of doing it. I also only had knowledge of mutexes and polled the state variable instead of using other methods.My reimplementation will use the following:

- One "Stdin Command Monitoring" thread
- One "Get data from named pipe" thread
- One post-processor thread
- N Processing threads

All threads are alive during the life of main()There are N buffers. Data will come in from the named pipe, and the "Get data" thread will write the data to an "available" buffer. When the buffer is full it will be marked as "full". There will be N processing threads, one for each buffer. When a processing threads' buffer is full, it will process the buffer and save the result to a final buffer. At the end of a number of averages, the post-processor thread will perform a final process on the final buffer and send the results to stdout.

View 2 Replies View Related

Programming :: Find Number Of Child Processes (C / POSIX)?

May 26, 2010

I'm in the process of writing a program that is a server- it will accept connections and stuff, and spawn a child process for each. However, i've run into a small problem. I do NOT want to bother with keeping track of the processes unless i need to. So, i set SA_NOCLDWAIT (#ifdef) on a SIG_IGN to the SIGCHLD handler through sigaction interface. The standard says that it the kernel will then keep track of reaping zombie processes for me (a HUGE plus). However, upon receiving a SIGINT signal, i want to stop the server from accepting new connections (done), and then wait for there to be no new connections. I was thinking of just putting a loop like so:

Code:

while((wait(NULL) != (pid_t)-1) && errno != ECHILD);

However, I'm not *sure* that this will work, especially with SIGCHLD still ignored. So how can i tell if there are still child processes? I can't find any call like int getnumchld(pid_t proc); (i wish). Plus it would be inefficient to spin on that function anyway. OTOH, i would rather *NOT* have to do the same thing in a loop with a system("ps |...>file"); read(file); etc. either. Is there a way i can portably implement this feature (I was hoping i could run it on linux and the major BSDs, at least).

TO SUM IT UP:

How can i tell if a process has no child processes if i've SIG_IGN'd SA_NOCLDWAIT'd the SIGCHLD? Is there a _reasonably_ portable way to do so? I *don't* want to manually wait for EVERY process. Maybe only those still active at the time of SIGTERM, but that requires keeping track of the number of connections and whether those have terminated...

EDIT: Does anyone know if the above code *would* work, even with SIGCHLD ignored and the kernel cleaning up zombies *for* me? I checked the manpage and it doesn't say much.

EDIT1: Note that all of the processes are in the same process group and session. SO i can find them through this as well. Perhaps even setting the uid/gid and finding all processes run by that group?

EDIT2: i have an idea if the above isn't feasible. If there is no "elegant" way to do it, i could reduce the complexity by sending a SIGUSR1 to the whole process group. Each process would then set a flag telling it to send a SIGUSR1 in reply and send a SIGUSR2 when it is done executing. Then i could keep a count of signals. Maybe that would be *easier*. Or perhaps a count of all child processes and just a termination signal to decrement the counter.

View 2 Replies View Related

Programming :: Related To Pthreads And Timers In POSIX Standard

Feb 17, 2010

I have created two threads:
Thread 1 and thread 2

In the main thread, i have put up a timer which generates a signal periodically when it expires, which reults in execution going to signal catcher function.when this function is invoked, under certain condition it goes to thread 1 and under another condition it goes to thread 2. The problem lies here that when it goes to thread2,i have a loop to process but it doesnt come out of the loop and hence from thread2, even though timer has expired.

View 2 Replies View Related

Programming :: Use The Mutexes To "protect" The Access To The Queues

Dec 22, 2010

I'm using the Posix's mutexes in a project. I have 3 threads and 3 queues. The problem is: I used the mutexes to "protect" the access to the queues. But the first started thread monopolizes the use of the queues. See a example code:

[Code].....

View 3 Replies View Related

General :: Unlinking An Open File Then Crashing

Jan 23, 2010

I want to start by stating that I don't have any issues that I'm trying to resolve other than a hypothesis. And I could RTFC, but there's a lot of filesystem code that I'd have to familiarize myself with ;) I'm curious what would happen if I were to open a file and then unlink it in the filesystem (but still have the open handle). Then the system crashes.

Specifically: I'm curious as to whether the files inode will still indicate that it has references, but nothing in the filesystem points to it anymore, or whether it's up to the OS to know that it can't write to the space, but as far as the inode is concerned it's free.

View 1 Replies View Related

Programming :: What Does Closing A File Descriptor Mean

Mar 13, 2011

As we know, every process has a table with a file descriptor table, in which each entry contains a file pointer pointing to the corresponding file table which contains a v-node pointer pointing to the v-node table.

When closing a file descriptor, are all these data structure deleted?

View 2 Replies View Related

Programming :: Closing Parenthesis Script - Two Missing

Aug 30, 2010

I have a file with several parentheses, both () and []. All of them should be closed, but apparently, one of them is open. In order to run a program, I need all of them to be closed... For example, if I write: ((bla (bla (bla)) I would have two parentheses missing. That's what I mean. But I have several parentheses in the file... it would take me ages to do it manually. Is there a way to check which parenthesis is open? can it be done?

View 5 Replies View Related

Programming :: Closing Multiple Client Sockets In Server ?

Nov 30, 2010

I have written a server application which has select for both incoming new client connection requests and incoming data from client. I am able to process incoming connection requests and client data.

For example, server has 8 clients connected to it. If client 3 disconnects from server, how will server come to know this client has disconnected and to close its client socket fd gracefully? Does server's select get data on that client socket fd as 'close' data or any error code in recv() function that notifies server to close this client socket fd? Also if client disconnects abruptly without sending close request to server, how should server handle this? Does server get "EPIPE" error?

View 1 Replies View Related

Programming :: Avoid Application From Closing If A Specific Library Not Found?

Jan 2, 2011

i was wondering if there is away to avoid application from closing if a specific library not found? for example: if my application uses libPng and it wasn't found on the system running my app (binary and not source), is there anyway to just disable the part that uses png from my application?

View 14 Replies View Related

Programming :: Create A Message Forwarder Program That Receive A Message On Port A And Pass It On T Port B?

Sep 6, 2010

We are trying to create a message forwarder program that receive a message on Port A and pass it on t Port B. Also receive a message from Port C and Pass it on to Port D as follows.

[Code]...

View 4 Replies View Related

Programming :: Socket Programming While Displaying Received Message In File

May 11, 2011

i have problem in socket programming, while displaying received message in file,i got a problem... i cant able to write it in the file.... this is the code....

Code:
/* tcpserver.c */
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdio.h>
[Code]....

now my problem is run time error i can able to create file but i cant able to write file....log.txt contain nothing.... as here i have give sample code... dont say not initialising function and all.... i have initialised , please only see func1() - my problem is only not able to write msg which i got received from the client..

View 2 Replies View Related

Slackware :: SBopkg Queues Git Download?

Jun 4, 2011

Anyone know of the simple (!) command syntax to : a) download the full SQF tree from [URl].. b) maintain that tree WITHOUT having to download the whole dang thing again.

I'm 100% certain this is possible - that's exactly what source-code repository tools like subversion and git are supposed to do. But Git is complex and that site doesn't seem to have an obvious (to me) method of doing part b)

View 4 Replies View Related

Ubuntu :: Setting Up Multiple Cups-pdf Queues

Oct 21, 2010

I have an Ubuntu Server running CUPS-PDF successfully. The problem that I am running into now is that we want to have different CUPS-PDF queues.Example:Joe from Finance wants his PDF prints to go to /home/finance which is samba shared out to all users in Finance. Mark from Operations needs logs printed out to /home/ops which is samba shared to all users in Operations and must be landscape.Finance and Operations print from the command line (lp -d print-queue filename) on the server via ssh since their app runs from a terminal.

I have looked and looked all over the net and through the cups-pdf documentation to see if there is a way to force the URI for the cups-pdf print queue instead of it going to the default of $HOME/Desktop as stated in my /etc/cups/cups-pdf.conf file. Basically, I want to set up a cups pdf printer called Finance, Advert and Ops that has all the options they need so when they print something from the linux applications, and they tell it to print to the virtual printer that they have permission to use and it go to the respective directory that they have access too.

View 2 Replies View Related

Debian Configuration :: CUPS Raw Print Queues Not Working?

Apr 16, 2011

I am trying to set up a print server here on a Squeeze system using the stock debian CUPS package. It seems that since Apple has bought this package, it has caused me nothing but grief. I have set up two different USB printers with raw print queues, and every time I send a print job to either of them, the job disappears into thin air, with no error output. In fact, when I look at the queue, it says the job was completed successfully. I look at the logs, and there is no output indicating any issues. Just for kicks, I reconfigured one of the printers to use a linux driver, and it printed just fine (a little slow, but fine). I set it back to raw, and the jobs disappear again into oblivion.

I have done this many times in the past, and never had any issues -- I even had this very same printer set up that way about a year ago, and it worked great. The only noteworthy thing that seems to have changed is that there are no longer any files called "mime.types" and "mime.convs". It seems they have been replaced by "raw.types" and "raw.convs". The contents of these two files are as follows:

raw.types: application/octet-stream

View 9 Replies View Related

Debian :: Posix Related During Compilation?

Sep 4, 2011

I am trying to compile splasutis in my debian wheezy. ./configure run well, but during make I get the following error

make --silent all-recursive
Making all in libs
CONF    libjpeg.a

[code]....

View 7 Replies View Related

Ubuntu :: How To Enable POSIX Shared Mem

Jan 29, 2010

I found out from here that it is not enable URL...I ran the command mount | grep "shm" and got.none on /dev/shm type tmpfs (rw,nosuid,nodev)So how do I enable it?It is need for my ATI graphic card.

View 2 Replies View Related

Ubuntu :: When Does The POSIX Thread Start

Feb 3, 2010

i'm trying to understand the POSIX threads and i can't understand when does the thread start: does it start when i do

pthread_create()
or when i do
pthread_join()

or maybe i'm missing something. i do understand that pthread_join() causes the calling thread to wait till the called thread is finished.

View 2 Replies View Related

General :: Support For POSIX Trace?

Oct 14, 2010

Is it possible to add support for POSIX Trace to my Ubuntu?

# getconf _POSIX_VERSION
200809
# getconf _POSIX_TRACE
undefined

View 2 Replies View Related

General :: Set Distro To Be A POSIX Compliant?

Oct 2, 2010

How to set you distro to be a POSIX compliant?

View 3 Replies View Related

Server :: Use Phpldapadmin Can Add Ou,but Cannot Add Posix Group?

Mar 27, 2010

use phpldapadmin can add ou,but can not add posix group.following is software version

[root@localhost config]# rpm -qa | egrep '(ldap|db4)'
openldap-devel-2.3.27-8.el5_1.3
db4-utils-4.3.29-9.fc6

[code]....

View 1 Replies View Related

General :: Exim Setup For Large Outgoing Mail Queues?

Apr 25, 2011

I have a fairly standard Exim setup for inbound and outbound mail. Recently our development team has put together a PHP app that allows us to send out bulk mails to our clients. The PHP app uses standard PEAR libraries to initiate an SMTP connection to localhost (application and mail server are on the same box). The idea here is that the application will send out roughly 10'000 emails in a very short time period (60 seconds or so) which Exim will then hold in its queue for delivery.

The problem comes in where after about 50 emails, Exim stops accepting mail and loggs the following error in the exim_main.log file: SMTP command timeout on connection from localhost [127.0.0.1] Could it be that this is because Exim immediately starts delivering the mail and then stops accepting new incoming connections? I thought that increasing the SMTP limits may be the problem here, but even after setting new values in the exim.conf file to the following, I still get the same problem:
queue_run_max = 5000
smtp_accept_max = 5000
smtp_accept_queue = 5000

This begs two questions: How do I resolve this? What is the best way for configuring Exim to accept a huge amount of mail into the queue in a very short time period, but then gradually delivery it once it's all in the queue? I've seen some people run separate Exim daemons for incoming and outgoing mail; is this a good solution?

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved