Note that this happens for regular files only under /dev directory. What setting or env. is causing this behavior?
Why 0 byte files? Why regular files get 'srwxrwxrwt' under /dev?
Are these really 'socket' files?
Are you creating them, though? In your test above you get 'permission denied'. Which is what you'd expect trying to write to socket files, which don't work that way.
My intention is to create a text file under /dev directory.
But whenever I try creating it through a program or even from the command line as mentioned earlier they get created as 'socket' files. Some weird process is doing this.
I wonder if it's some odd property of the filesystem itself. I don't know Solaris in any detail but /dev/ is often its own pseudo-filesystem with unusual properties. Usually one doesn't make txt files under /dev.
Source code for the open call on Illumos /dev file system is here: Cross Reference: /illumos-gate/usr/src/uts/common/fs/dev/sdev_vnops.c It's been a few years since that was forked from OpenSolaris code, but it's probably still really close to Solaris 11.2 /dev file system code.
/*
* vnode ops for the /dev filesystem
*
* - VDIR, VCHR, CBLK, and VLNK are considered must supported files
* - VREG and VDOOR are used for some internal implementations in
* the global zone, e.g. devname and devfsadm communication
* - other file types are unusual in this namespace and
* not supported for now
*/
Yes. You are not supposed to create plain files under /dev. /dev is mounted using a specific file system type and is normally under the control of devfsadm.
You should only create directories and named sockets here.
One side effect of that feature is that it prevents the disk full situations that would happen should someone mistype a tape or other device while trying to archive something.