[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: and _PC_PIPE_BUF..

From: Robert Millan
Subject: Re: and _PC_PIPE_BUF..
Date: Thu, 24 Apr 2003 01:25:48 +0200
User-agent: Mutt/1.5.4i

On Wed, Apr 23, 2003 at 10:24:28PM +0200, Robert Millan wrote:
> one more thing, it appears to me that fpathconf(fd, _PC_PIPE_BUF) is
> always -1 for files, and has a positive value for pipes, fifos and
> sockets. is that it? (for GNU and for any system)

i'd better show an example, this is fixed code from gs. does it seem
correct to you? (considering the file descriptor is expected to be
a socket, if pipe_buf is -1 then something weird happened)

/* Get packet from the server. */
private int hpijs_get_pk(PK * pk, int fd)
#ifdef PIPE_BUF
   return read(fd, pk, PIPE_BUF - 1);
   long int pipe_buf = fpathconf(fd, _PC_PIPE_BUF);
   if (pipe_buf == -1)
     /* no pipe_buf, so we fail */
     return -1;
     return read(fd, pk, pipe_buf - 1);

Robert Millan

make: *** No rule to make target `war'.  Stop.

Another world is possible - Just say no to genocide

reply via email to

[Prev in Thread] Current Thread [Next in Thread]