Well, you are obviously stat()ing two completely different files.

It is impossible to guess what you are doing wrong because you do not show your code. My crystall ball is not strong enough.

Please see: https://github.com/golang/go/wiki/How-to-ask-for-help

Have you considered using an existing solution instead of trying to reinvent the wheel? A simple google search returns this at the top: https://github.com/ftrvxmtrx/fd

Janne Snabb
sn...@epipe.com

On 15/03/2019 20.12, sbezverk wrote:

Hello,

I am trying to pass a descriptor using syscall.SendMsg/RecvMsg and I noticed that inod for the second process is not the same as original, but according to Unix Networking API, inod should stay the same and only number of reference to inod should be incremented.  Anybody successfully managed to send descriptors using syscall.SendMsg?

Here is Stat of the file on sending side:

File descriptor: 3

File Stat returnd: &{name:test-420291847 size:55 mode:420 modTime:{wall:782108249 ext:63688268119 loc:0xd50460} sys:{Dev:64768  >>>>>Ino:67217215<<<<< Nlink:1 Mode:33188 Uid:0 Gid:0 X__pad0:0 Rdev:0 Size:55 Blksize:4096 Blocks:8 Atim:{Sec:1552671319 Nsec:781108231} Mtim:{Sec:1552671319 Nsec:782108249} Ctim:{Sec:1552671319 Nsec:782108249} X__unused:[0 0 0]}}

Encoded Socket Control Messages: [20 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 3 0 0 0 0 0 0 0]

Here is Stat of the file on receiving side:

Received buffer: [20 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 7 0 0 0 0 0 0 0]

Received messages: [{Header:{Len:20 Level:1 Type:1} Data:[7 0 0 0]}]

Parsed right: [7]

Created file object with name: /tmp/service-2

File Stat returnd: &{name:service-2 size:0 mode:16777727 modTime:{wall:0 ext:62135596800 loc:0xd50460} sys:{Dev:7 >>>>>Ino:35926817 <<<<< Nlink:1 Mode:49663 Uid:0 Gid:0 X__pad0:0 Rdev:0 Size:0 Blksize:4096 Blocks:0 Atim:{Sec:0 Nsec:0} Mtim:{Sec:0 Nsec:0} Ctim:{Sec:0 Nsec:0} X__unused:[0 0 0]}}

Any suggestions are really welcome!

Thank you

Serguei

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com <mailto:golang-nuts+unsubscr...@googlegroups.com>.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to