[Samba] Howto determine flags like readonly and readwrite.

Stef Bon stef at bononline.nl
Mon Feb 8 10:33:07 MST 2010


On Sunday 07 February 2010 23:19:15 Volker Lendecke wrote:
> On Sun, Feb 07, 2010 at 06:03:51PM +0100, Stef Bon wrote:
> > On Sunday 07 February 2010 15:37:42 Volker Lendecke wrote:
> > > On Fri, Feb 05, 2010 at 03:54:31PM +0100, Stef Bon wrote:
> > > > My question is now, how can I determine the flags in human readable
> > > > form, just like smbstatus.
> > > > The pid of the application (here openoffice writer) is
> > > > known, as well as the file/path to it.
> > > > I know where to look for info, /proc/<pidnr>/fdinfo/flags,
> > > > but this gives a (hex?) number. Is this
> > > > the lock I'm looking for, and how can I translate it into
> > > > terms like readonly, readwrite and exclusive.
> > > 
> > > You're on the same box as the smbd is, or on a different
> > > one?
> > 
> > Different, I would say of course.
> > My construction is al about making connections from a workstation to a
> > remote server.
> 
> Ok, then I did not fully understand what you want to
> achieve. You quote smbstatus which is only available
> locally where smbd is running. What kind of information do
> you want to present where?
> 
> Volker
Well,

didn't you read the original email?? All about how my construction works is in 
that post.

Short: my construction is all about connections from a workstation to 
different kinf of respources: FTP, SSH, SMB and local: USB (and others 
follow).

This is based upon resource records.

I;m creating an utility which gives an overview of the active connections, 
simular like smbstatus does for the SMB server. My utility gives such an 
overview on the workstationside:

connections (mounts) , for which useron the workstation, which application, 
which file, and finally which lock is set in the file. And my question is 
about the last issue. The rest I've done already.

Now the pid of the application is known, so the directory 

/proc/<pid>/fdinfo exists.

and the number of the filedescriptor is also known, so the file

/proc/<pid>/fdinfo/fd 
exists, containing the flags parameter. Now this is the representation of the 
way the file is in use, (O_RDONLY, O_EXCL, O_RDWR...etc). MY question is now, 
how can I translate these values back into humanable readable form, instead of 
a number.


Stef  


More information about the samba mailing list