FastCGI on Sockets

Mansoor Peerbhoy mansoor at zimbra.com
Tue Aug 14 14:35:19 MSD 2007


Uh, sorry to interrupt the conversation, mate: 
(I know this is off-topic for NGINX):
On UN*X systems, different types of objects are represented by files, and there are different ways to create such files:

touch x // creates a file
mkdir x // creates a dir
mkfifo x // creates a named pipe
mksock x // creates a socket
mknod x // creates a device
ln -s // creates a symlink

Now, data that flows through pipes, sockets, and devices, is not written out to disk blocks in the same way that data is written 
to a file.

You cannot expect the size of a socket/device/fifo file as shown by stat (ls -l) to indicate the amount of data that's available to be read off the socket/device/fifo. 

Neither can you expect regular file IO to work on socket files (although it will work for named pipes and devices, but that's for entirely different reasons). So you can't do "cat /tmp/fastcgi.socket" or anything like that :)

Heck, if that was to be the case, imagine the size of /dev/null !

-M


----- Original Message -----
From: "somebody nobody" <makdar at gmail.com>
To: nginx at sysoev.ru
Sent: Tuesday, August 14, 2007 3:52:25 PM (GMT+0530) Asia/Calcutta
Subject: Re: FastCGI on Sockets

It works ! :) Thanks a lot... just one question 

when i run: 
file /tmp/fastcgi.socket -> i get : 

/tmp/fastcgi.socket: socket 

so the file is correct but when i run: 

ls -l /tmp/fastcgi.socket -> i get: 

.... 0 aug 14 12:09 /tmp/fastcgi.socket 

i'm wandering if the size of the file shouldent be higher, nginx is running under nobody user and nobody is owner of the socket 






More information about the nginx mailing list