comp.unix.programmer
  Home FAQ Contact Sign in
comp.unix.programmer only
 
Advanced search
May 2008
motuwethfrsasuw
   1234 18
567891011 19
12131415161718 20
19202122232425 21
262728293031  22
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.unix.programmer Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Prevent from reading part of information         


Author: Steven Woody
Date: May 31, 2008 07:19

Hi List,

The OS is Linux. I am writting some program which communicated via
pipe and unix domain socket. These processes exchange information by
reading/writting on pipes and unix domain sockets. In the information
reading end, I usually use a select(2) to find out if some a
information is comming followed by a read(2) operation on the same
file descritor. The information is something like below, and let's
called it `msg':

struct msg {
unsigned int len;
unsigned char data[];
}

My question is, in the msg reading end, after select(2) returned and
indicated there were something to read, is there any chance that the
reading end only got part of the `msg' via read(2)? I understand,
for internet socket, it is usual, but since I am now working on Unix
domain sockets and pipes, so I guess things may be different.

-
narke
6 Comments
  FREE Tutorials on HTML XHTML CSS JavaScript XML XSL ASP SQL ADO VBScript, SAP - ABAP and more...         


Author: Dhanabal
Date: May 30, 2008 23:34

access all computer tutorials for free visit http://freecomputertutorialz1.blogspot.com/
no comments
  Edge-Triggered epoll and starvation         


Author: Krivenok Dmitry
Date: May 30, 2008 23:02

Hello gurus!

I have a question about epoll and possible starvation.
As epoll(4) says, when epoll is used in Edge-Triggered mode
it's very important to read all the data available in the
buffer.
Otherwise next epoll_wait call may block forever (if there
are no changes on monitored file descriptor).

Lets suppose, that epoll_wait detected new events on three
file descriptors 5, 6 and 7.
So, we should handle I/O on all of them.

Read handling loop may be implemented as follows:
Show full article (1.32Kb)
1 Comment
  ndbm update not visible         


Author: Amitava
Date: May 30, 2008 12:35

Need your help in solving this ndbm problem.

I have a set of two programs using an ndbm database,
and using shared reader-writer lock (pthread_rwlock_t).

One program is a Reader which is a persistent daemon,
and the other is a Writer which is a transient program.

What I see is that even _after_ the Writer has updated the
value for a given key, the Reader continues to see the old value.

I noticed that if the Reader fetches any other Key, and then
fetches the old key, then, and only then, does it get the new value.

The sequence is as follows:

1. Writer: Update(Key1, Value1)

2. Reader: Get(Key1) ---> Value1

3. Writer: Update(Key1, Value2)

4. Reader: Get(Key1) ---> Value1

5. Reader: Get(KeyX) ---> ValueX

6. Reader: Get(Key1) ---> Value2

I was expecting that the Reader should get Value2 at step 4.

What can I do so that the update by the Writer
is immediately visible in the Reader?
Show full article (0.92Kb)
9 Comments
  Help with report gen. awk/sed         


Author: David.LPower
Date: May 30, 2008 00:53

Hello,

I am trying to generate a report and in doing so i discovered I need
to search for a particular background color (in a html source file)
and remove the line break / return stroke.

How would I go about doing this?
8 Comments
  debug question         


Author: sinbad
Date: May 29, 2008 22:57

how to find if a binary has debug symbols in it.
3 Comments
  Per-target make rules.         


Author: jason.cipriani
Date: May 29, 2008 07:14

I have a project that consists of a bunch of static libraries, each
with their own individual testing programs. Right now I have Makefiles
all over the place and it is very disorganized. I am trying to write a
common Makefile that I can include when I need to that defines rules
for building a static library and a tester program.

The library can have multiple source files, and so can the tester
program. This means I want to be able to do something like this in
each of the library Makefiles (using gcc and C++ as an example):

LIB_SOURCE = lib1.cpp lib2.cpp lib3.cpp
LIB_OUTPUT = liblib.a
TEST_SOURCE = test1.cpp test2.cpp
TEST_OUTPUT = testlib
include CommonMakefile

And voila, magic happens. My problem is I need to pass different
compiler options to gcc for the library and tester program. I don't
know how to do that in CommonMakefile. I can define something like
this (just assume undefined vars in example below are defined
somewhere else):
Show full article (1.75Kb)
3 Comments
  view son this program         


Author: arnuld
Date: May 29, 2008 06:49

STATEMENT:

A server program that echoes back to the client what the client says.
it handles multiple clients using fork().

WHAT I WANT:

some advices and views of yours for improvement.

/* a fork server */

#include
#include
#include
#include
#include
#include
#include
#include

#define SERVER_IP "127.0.0.1"

enum { BUFFSIZE = 100, MAX_CONNECTION = 25 };

void echo_back( int );
Show full article (4.10Kb)
7 Comments
  fastest transition from bitmask to the position of it's lowest SET bit         


Author: Lars Uffmann
Date: May 29, 2008 06:40

I want to combine a bitmask M with a byte-aligned variable V to extract
a (not necessarily) byte-aligned parameter P (from a network protocol).

The bitmask of the same bitsize as V has the (successive) bits set to 1,
where the parameter is stored, and the rest to 0.

So basically I wanna apply this math:

P = (V AND M) SHR O

where AND is a bitwise AND, SHR is bitwise shift-right and O is the
order of the lowest set bit in the bitmask.

For example:
V = b0110101000110010 (2 bytes)
M = b0000011111110000 (2 bytes)
O = ln (16) / ln (2) = 4

P = b0110101000110010
AND b0000011111110000
SHR 4
= b0000001000110000 SHR 4 = b0000000000100011 = b100011 (= d35)

Now I am quite at a loss to determine that order O in a single
mathematical operation other than the logarithm.
Show full article (1.11Kb)
29 Comments
  understanding fork()         


Author: arnuld
Date: May 29, 2008 02:34

WHAT I KNOW:

I can understand fork() using diagrams shown in Stevens'
UnP volume 1 and I do know that it copies the parent process
with all the data and then it just works like another server.

PROBLEM:

I am not able to find a match between his explanation of the way
fork() works and the code he used to explain the fork(). This is the code
from section 4.8 titled "Concurrent Servers":

#include "unp.h"

int main(int argc, char **argv)
{
int listenfd, connfd;
pid_t childpid;
socklen_t clilen;
struct sockaddr_in cliaddr, servaddr;

listenfd = Socket(AF_INET, SOCK_STREAM, 0);
Show full article (2.54Kb)
no comments
1 2 3 4 5 6 7 8 9