This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Cygwin IPC - ftok() returns negative values - Bug Report


Dear All,
Â
I have had to compile sblim-sfcbd-1.4.10 on Cygwin. It is using IPC semaphores.
Unfortunately it is returning wrong value as the result of complicated bit-wise logical operations.
I have tried to âhack the systemâ and make multiplication of returned value by -1, but it triggers error in semget()
Environment:
Windows 2012 R2 with latest patches
I have installed Cygwin from official installer couple days ago.
Â
I have attached the gdb session from such invocation. You can see the path and id in arguments are correct and stat() function returns correct values.
Finally result in %rax is negative:
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000701cc1d53ÂÂÂÂÂÂ -5833568862233420461

Best Regards,
Stanislaw Wawszczak
Iscg Poland 

###############################################################
# GDB session
###############################################################
Â
Breakpoint 1, ftok (path=0x4b11f1912 <nls+666> "/usr/local/sbin/sfcbd.exe", id=83) at /usr/src/debug/cygwin-2.5.2-1/winsup/cygwin/ipc.cc:18
18ÂÂÂÂÂ {
(gdb) x/5i
ÂÂ 0x4b1201438 <sfcbSockets>:ÂÂ (bad)
ÂÂ 0x4b1201439 <sfcbSockets+1>: addÂÂÂ %al,(%rax)
ÂÂ 0x4b120143b <sfcbSockets+3>: addÂÂÂ %al,(%rdi)
ÂÂ 0x4b120143d <sfcbSockets+5>: addÂÂÂ %al,(%rax)
ÂÂ 0x4b120143f <sfcbSockets+7>: addÂÂÂ %al,(%rbx)
(gdb) x/5i
ÂÂ 0x4b1201441 <resultSockets+1>:ÂÂÂÂÂÂ addÂÂÂ %al,(%rax)
ÂÂ 0x4b1201443 <resultSockets+3>:ÂÂÂÂÂÂ addÂÂÂ %al,0x0(%rip)ÂÂÂÂÂÂÂ # 0x4b1201449 <ptBase+1>
ÂÂ 0x4b1201449 <ptBase+1>:ÂÂÂÂÂ addÂÂÂ %al,(%rax)
ÂÂ 0x4b120144b <ptBase+3>:ÂÂÂÂÂ addÂÂÂ %al,(%rax)
ÂÂ0x4b120144d <stBase+1>:ÂÂÂÂÂ addÂÂÂ %al,(%rax)
(gdb) x/5i $pc
=> 0x1800c6e50 <ftok(char const*, int)>:ÂÂÂÂÂÂÂ pushÂÂ %rbx
ÂÂ 0x1800c6e51 <ftok(char const*, int)+1>:ÂÂÂÂÂ subÂÂÂ $0xa0,%rsp
ÂÂ 0x1800c6e58 <ftok(char const*, int)+8>:ÂÂÂÂÂ movÂÂÂ %edx,%ebx
ÂÂ0x1800c6e5a <ftok(char const*, int)+10>:ÂÂÂÂ leaÂÂÂ 0x20(%rsp),%rdx
 0x1800c6e5f <ftok(char const*, int)+15>: callq 0x180144970 <stat64(char const*, stat*)>
(gdb) x/5i
ÂÂ 0x1800c6e64 <ftok(char const*, int)+20>:ÂÂÂÂ testÂÂ %eax,%eax
ÂÂ 0x1800c6e66 <ftok(char const*, int)+22>:ÂÂÂÂ jneÂÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>
ÂÂ 0x1800c6e68 <ftok(char const*, int)+24>:ÂÂÂÂ movÂÂÂ 0x20(%rsp),%edx
ÂÂ 0x1800c6e6c <ftok(char const*, int)+28>:ÂÂÂÂ movÂÂÂ 0x28(%rsp),%r8
ÂÂ 0x1800c6e71 <ftok(char const*, int)+33>:ÂÂÂÂ movÂÂÂ %edx,%eax
(gdb) x/5i
ÂÂ 0x1800c6e73 <ftok(char const*, int)+35>:ÂÂÂÂ movzbl %dl,%edx
ÂÂ 0x1800c6e76 <ftok(char const*, int)+38>:ÂÂÂÂ andÂÂÂ $0xff0000,%eax
ÂÂ 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
ÂÂ 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
ÂÂ 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
(gdb) x/5i
ÂÂ 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
ÂÂ 0x1800c6e90 <ftok(char const*, int)+64>:ÂÂÂÂ andÂÂÂ %r8,%rdx
ÂÂ 0x1800c6e93 <ftok(char const*, int)+67>:ÂÂÂÂ andÂÂÂ $0x3fffff,%r8d
ÂÂ 0x1800c6e9a <ftok(char const*, int)+74>:ÂÂÂÂ shrÂÂÂ $0x10,%rdx
ÂÂ 0x1800c6e9e <ftok(char const*, int)+78>:ÂÂÂÂ shlÂÂÂ $0x8,%r8
(gdb) x/5i
ÂÂ 0x1800c6ea2 <ftok(char const*, int)+82>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6ea5 <ftok(char const*, int)+85>:ÂÂÂÂ movÂÂÂ %rax,%rcx
ÂÂ 0x1800c6ea8 <ftok(char const*, int)+88>:ÂÂÂÂ movzbl %bl,%eax
ÂÂ 0x1800c6eab <ftok(char const*, int)+91>:ÂÂÂÂ orÂÂÂÂ %r8,%rax
ÂÂ 0x1800c6eae <ftok(char const*, int)+94>:ÂÂÂÂ orÂÂÂÂ %rcx,%rax
(gdb) x/5i
ÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>:ÂÂÂÂ addÂÂÂ $0xa0,%rsp
ÂÂ 0x1800c6eb8 <ftok(char const*, int)+104>:ÂÂÂ popÂÂÂ %rbx
ÂÂ 0x1800c6eb9 <ftok(char const*, int)+105>:ÂÂÂ retq
ÂÂ 0x1800c6eba <ftok(char const*, int)+106>:ÂÂÂ nopwÂÂ 0x0(%rax,%rax,1)
ÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>:ÂÂÂ movÂÂÂ $0xffffffffffffffff,%rax
(gdb) x/5i
ÂÂ 0x1800c6ec7 <ftok(char const*, int)+119>:ÂÂÂ jmpÂÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>
ÂÂ 0x1800c6ec9 <ftok+121>:ÂÂÂÂÂ nop
ÂÂ 0x1800c6eca <ftok+122>:ÂÂÂÂÂ nop
ÂÂ 0x1800c6ecb <ftok+123>:ÂÂÂÂÂ nop
ÂÂ 0x1800c6ecc <ftok+124>:ÂÂÂÂÂ nop
(gdb) ni
0x00000001800c6e51ÂÂÂÂÂ 18ÂÂÂÂÂ {
(gdb) ni
18ÂÂÂÂÂ {
(gdb) ni
21ÂÂÂÂÂÂÂ if (stat64 (path, &statbuf))
(gdb) x/5i $pc
=> 0x1800c6e5a <ftok(char const*, int)+10>:ÂÂÂÂ leaÂÂÂ 0x20(%rsp),%rdx
 0x1800c6e5f <ftok(char const*, int)+15>: callq 0x180144970 <stat64(char const*, stat*)>
ÂÂ 0x1800c6e64 <ftok(char const*, int)+20>:ÂÂÂÂ testÂÂ %eax,%eax
ÂÂ 0x1800c6e66 <ftok(char const*, int)+22>:ÂÂÂÂ jneÂÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>
ÂÂ 0x1800c6e68 <ftok(char const*, int)+24>:ÂÂÂÂ movÂÂÂ 0x20(%rsp),%edx
(gdb) ni
0x00000001800c6e5fÂÂÂÂÂ 21ÂÂÂÂÂÂÂ if (stat64 (path, &statbuf))
(gdb) x/5i $pc
=> 0x1800c6e5f <ftok(char const*, int)+15>: callq 0x180144970 <stat64(char const*, stat*)>
ÂÂ 0x1800c6e64 <ftok(char const*, int)+20>:ÂÂÂÂ testÂÂ %eax,%eax
ÂÂ 0x1800c6e66 <ftok(char const*, int)+22>:ÂÂÂÂ jneÂÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>
ÂÂ 0x1800c6e68 <ftok(char const*, int)+24>:ÂÂÂÂ movÂÂÂ 0x20(%rsp),%edx
ÂÂ 0x1800c6e6c <ftok(char const*, int)+28>:ÂÂÂÂ movÂÂÂ 0x28(%rsp),%r8
(gdb) ni
0x00000001800c6e64ÂÂÂÂÂ 21ÂÂÂÂÂÂÂ if (stat64 (path, &statbuf))
(gdb) x/5i $pc
=> 0x1800c6e64 <ftok(char const*, int)+20>:ÂÂÂÂ testÂÂ %eax,%eax
ÂÂ 0x1800c6e66 <ftok(char const*, int)+22>:ÂÂÂÂ jneÂÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>
ÂÂ 0x1800c6e68 <ftok(char const*, int)+24>:ÂÂÂÂ movÂÂÂ 0x20(%rsp),%edx
ÂÂ 0x1800c6e6c <ftok(char const*, int)+28>:ÂÂÂÂ movÂÂÂ 0x28(%rsp),%r8
ÂÂ 0x1800c6e71 <ftok(char const*, int)+33>:ÂÂÂÂ movÂÂÂ %edx,%eax
(gdb) r %eax
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83
rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0xffffc768ÂÂÂÂÂÂ 4294952808
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e64ÂÂÂÂÂ 0x1800c6e64 <ftok(char const*, int)+20> eflagsÂÂÂÂÂÂÂÂ 0x202ÂÂÂ [ IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6e66ÂÂÂÂÂ 21ÂÂÂÂÂÂÂ if (stat64 (path, &statbuf))
(gdb) r %eax
The program being debugged has been started already.
Start it from the beginning? (y or n) n
Program not restarted.
(gdb) x/5i $pc
=> 0x1800c6e66 <ftok(char const*, int)+22>:ÂÂÂÂ jneÂÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>
ÂÂ 0x1800c6e68 <ftok(char const*, int)+24>:ÂÂÂÂ movÂÂÂ 0x20(%rsp),%edx
ÂÂ 0x1800c6e6c <ftok(char const*, int)+28>:ÂÂÂÂ movÂÂÂ 0x28(%rsp),%r8
ÂÂ 0x1800c6e71 <ftok(char const*, int)+33>:ÂÂÂÂ movÂÂÂ %edx,%eax
ÂÂ 0x1800c6e73 <ftok(char const*, int)+35>:ÂÂÂÂ movzbl %dl,%edx
(gdb) ni
78 tmp = (((key_t) statbuf.st_dev) & 0x0000000000ff0000LL) << 40;
(gdb) print 0x20(%rsp
A syntax error in expression, near `%rsp'.
(gdb) print 0x20(%rsp)
A syntax error in expression, near `%rsp)'.
(gdb) ni
83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e6c <ftok(char const*, int)+28>:ÂÂÂÂ movÂÂÂ 0x28(%rsp),%r8
ÂÂ 0x1800c6e71 <ftok(char const*, int)+33>:ÂÂÂÂ movÂÂÂ %edx,%eax
ÂÂ 0x1800c6e73 <ftok(char const*, int)+35>:ÂÂÂÂ movzbl %dl,%edx
ÂÂ 0x1800c6e76 <ftok(char const*, int)+38>:ÂÂÂÂ andÂÂÂ $0xff0000,%eax
ÂÂ 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83
rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x7eafb40bÂÂÂÂÂÂ 2125444107 rsiÂÂÂÂÂÂÂÂ ÂÂÂ0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0xffffc768ÂÂÂÂÂÂ 4294952808
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e6cÂÂÂÂÂ 0x1800c6e6c <ftok(char const*, int)+28> eflags ÂÂÂÂÂÂÂÂ0x246ÂÂÂ [ PF ZF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
78 tmp = (((key_t) statbuf.st_dev) & 0x0000000000ff0000LL) << 40;
(gdb) x/5i $pc
=> 0x1800c6e71 <ftok(char const*, int)+33>:ÂÂÂÂ movÂÂÂ %edx,%eax
ÂÂ 0x1800c6e73 <ftok(char const*, int)+35>:ÂÂÂÂ movzbl %dl,%edx
ÂÂ 0x1800c6e76 <ftok(char const*, int)+38>:ÂÂÂÂ andÂÂÂ $0xff0000,%eax
ÂÂ 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
ÂÂ 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
(gdb) ni
83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e73 <ftok(char const*, int)+35>:ÂÂÂÂ movzbl %dl,%edx
ÂÂ 0x1800c6e76 <ftok(char const*, int)+38>:ÂÂÂÂ andÂÂÂ $0xff0000,%eax
ÂÂ 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
ÂÂ 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
ÂÂ 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x7eafb40bÂÂÂÂÂÂ 2125444107 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x7eafb40bÂÂÂÂÂÂ 2125444107 rsiÂÂÂÂÂ ÂÂÂÂÂÂ0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e73ÂÂÂÂÂ 0x1800c6e73 <ftok(char const*, int)+35> eflagsÂÂÂ ÂÂÂÂÂ0x246ÂÂÂ [ PF ZF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
78 tmp = (((key_t) statbuf.st_dev) & 0x0000000000ff0000LL) << 40;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x7eafb40bÂÂÂÂÂÂ 2125444107 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xbÂÂÂÂÂ 11 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂ ÂÂÂÂÂ0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e76ÂÂÂÂÂ 0x1800c6e76 <ftok(char const*, int)+38> eflagsÂÂÂÂÂÂÂÂ 0x246ÂÂÂ [ PF ZF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) x/5i $pc
=> 0x1800c6e76 <ftok(char const*, int)+38>:ÂÂÂÂ andÂÂÂ $0xff0000,%eax
ÂÂ 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
ÂÂ 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
ÂÂ 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
(gdb) ni; x/5i $pc; info registers
Invalid character ';' in expression.
(gdb) ni
83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e7b <ftok(char const*, int)+43>:ÂÂÂÂ shlÂÂÂ $0x30,%rdx
ÂÂ 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
ÂÂ 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
ÂÂ 0x1800c6e90 <ftok(char const*, int)+64>:ÂÂÂÂ andÂÂÂ %r8,%rdx
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0000 11468800
rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83
rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xbÂÂÂÂÂ 11 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂ ÂÂÂ4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e7bÂÂÂÂÂ 0x1800c6e7b <ftok(char const*, int)+43> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
78 tmp = (((key_t) statbuf.st_dev) & 0x0000000000ff0000LL) << 40;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0000 11468800
rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83
rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xb000000000000Â 3096224743817216 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂ ÂÂÂ4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂ Â515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e7fÂÂÂÂÂ 0x1800c6e7f <ftok(char const*, int)+47> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) x/5i $pc
=> 0x1800c6e7f <ftok(char const*, int)+47>:ÂÂÂÂ shlÂÂÂ $0x28,%rax
ÂÂ 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
ÂÂ 0x1800c6e90 <ftok(char const*, int)+64>:ÂÂÂÂ andÂÂÂ %r8,%rdx
ÂÂ 0x1800c6e93 <ftok(char const*, int)+67>:ÂÂÂÂ andÂÂÂ $0x3fffff,%r8d
(gdb) ni
83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e83 <ftok(char const*, int)+51>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
ÂÂ 0x1800c6e90 <ftok(char const*, int)+64>:ÂÂÂÂ andÂÂÂ %r8,%rdx
ÂÂ 0x1800c6e93 <ftok(char const*, int)+67>:ÂÂÂÂ andÂÂÂ $0x3fffff,%r8d
ÂÂ 0x1800c6e9a <ftok(char const*, int)+74>:ÂÂÂÂ shrÂÂÂ $0x10,%rdx
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf00000000000000ÂÂÂÂ ÂÂ-5836665117072162816 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xb000000000000Â 3096224743817216 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂ ÂÂÂÂÂÂ0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e83ÂÂÂÂÂ 0x1800c6e83 <ftok(char const*, int)+51> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂ ÂÂÂÂÂÂÂÂÂ0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6e86ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e86 <ftok(char const*, int)+54>:ÂÂÂÂ movabs $0xffffc00000000000,%rdx
ÂÂ 0x1800c6e90 <ftok(char const*, int)+64>:ÂÂÂÂ andÂÂÂ %r8,%rdx
ÂÂ 0x1800c6e93 <ftok(char const*, int)+67>:ÂÂÂÂ andÂÂÂ $0x3fffff,%r8d
ÂÂ 0x1800c6e9a <ftok(char const*, int)+74>:ÂÂÂ ÂshrÂÂÂ $0x10,%rdx
ÂÂ 0x1800c6e9e <ftok(char const*, int)+78>:ÂÂÂÂ shlÂÂÂ $0x8,%r8
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000000000000ÂÂÂÂÂÂ -5833568892328345600 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xb000000000000Â 3096224743817216 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e86ÂÂÂÂÂ 0x1800c6e86 <ftok(char const*, int)+54> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6e90ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000000000000ÂÂÂÂÂÂ -5833568892328345600 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0xffffc00000000000ÂÂÂÂÂÂ -70368744177664 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂ ÂÂÂ0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e90ÂÂÂÂÂ 0x1800c6e90 <ftok(char const*, int)+64> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6e93ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6e93 <ftok(char const*, int)+67>:ÂÂÂÂ andÂÂÂ $0x3fffff,%r8d
ÂÂ 0x1800c6e9a <ftok(char const*, int)+74>:ÂÂÂÂ shrÂÂÂ $0x10,%rdx
ÂÂ 0x1800c6e9e <ftok(char const*, int)+78>:ÂÂÂÂ shlÂÂÂ $0x8,%r8
ÂÂ 0x1800c6ea2 <ftok(char const*, int)+82>:ÂÂÂÂ orÂÂÂÂ %rdx,%rax
ÂÂ 0x1800c6ea5 <ftok(char const*, int)+85>:ÂÂÂÂ movÂÂÂ %rax,%rcx
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000000000000ÂÂÂÂÂÂ -5833568892328345600 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x7000000000000Â 1970324836974592 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x700000001cc1d 1970324837092381
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂ ÂÂÂÂ0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e93ÂÂÂÂÂ 0x1800c6e93 <ftok(char const*, int)+67> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂ ÂÂÂÂ0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6e9aÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) ni
0x00000001800c6e9eÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000000000000ÂÂÂÂÂÂ -5833568892328345600 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8 0x1cc1d 117789
r9ÂÂÂÂÂÂÂÂÂ ÂÂÂ0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6e9eÂÂÂÂÂ 0x1800c6e9e <ftok(char const*, int)+78> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6ea2ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) ni
0x00000001800c6ea5ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0x7ffa7b5dac7aÂÂ 140713788288122 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂ ÂÂÂÂÂÂÂÂ0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
rip 0x1800c6ea5 0x1800c6ea5 <ftok(char const*, int)+85> eflags 0x286 [ PF SF IF ] cs 0x33 51 ss 0x2b ÂÂÂ43 ds 0x2b 43 es 0x2b 43 fs 0x53 83 gs 0x2b 43
(gdb) x/5i $pc
=> 0x1800c6ea5 <ftok(char const*, int)+85>:ÂÂÂÂ movÂÂÂ %rax,%rcx
ÂÂ 0x1800c6ea8 <ftok(char const*, int)+88>:ÂÂÂÂ movzbl %bl,%eax
ÂÂ 0x1800c6eab <ftok(char const*, int)+91>:ÂÂÂÂ orÂÂÂÂ %r8,%rax
ÂÂ 0x1800c6eae <ftok(char const*, int)+94>:ÂÂÂÂ orÂÂÂÂ %rcx,%rax
ÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>:ÂÂÂÂ addÂÂÂ $0xa0,%rsp
(gdb) ni
0x00000001800c6ea8ÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) x/5i $pc
=> 0x1800c6ea8 <ftok(char const*, int)+88>:ÂÂÂÂ movzbl %bl,%eax
ÂÂ 0x1800c6eab <ftok(char const*, int)+91>:ÂÂÂÂ orÂÂÂÂ %r8,%rax
ÂÂ 0x1800c6eae <ftok(char const*, int)+94>:ÂÂÂÂ orÂÂÂÂ %rcx,%rax
ÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>:ÂÂÂÂ addÂÂÂ $0xa0,%rsp
ÂÂ 0x1800c6eb8 <ftok(char const*, int)+104>:ÂÂÂ popÂÂÂ %rbx
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6ea8ÂÂÂÂÂ 0x1800c6ea8 <ftok(char const*, int)+88> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6eabÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83
rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53 ÂÂÂÂ83
rcxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂ ÂÂÂ0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6eabÂÂÂÂÂ 0x1800c6eab <ftok(char const*, int)+91> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6eaeÂÂÂÂÂ 83ÂÂÂÂÂÂÂ tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d53ÂÂÂÂÂÂÂ 30154067 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂ ÂÂÂÂÂÂÂÂÂ0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂ Â0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂ ÂÂÂÂÂÂÂ0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6eaeÂÂÂÂÂ 0x1800c6eae <ftok(char const*, int)+94> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) x/5i $pc
=> 0x1800c6eae <ftok(char const*, int)+94>:ÂÂÂÂ orÂÂÂÂ %rcx,%rax
ÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>:ÂÂÂÂ addÂÂÂ $0xa0,%rsp
ÂÂ 0x1800c6eb8 <ftok(char const*, int)+104>:ÂÂÂ popÂÂÂ %rbx
ÂÂ 0x1800c6eb9 <ftok(char const*, int)+105>:ÂÂÂ retq
ÂÂ 0x1800c6eba <ftok(char const*, int)+106>:ÂÂÂ nopwÂÂ 0x0(%rax,%rax,1)
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d53ÂÂÂÂÂÂÂ 30154067 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂÂ 4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6eaeÂÂÂÂÂ 0x1800c6eae <ftok(char const*, int)+94> eflagsÂÂÂÂÂÂÂÂ 0x206ÂÂÂ [ PF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
89ÂÂÂÂÂ }
(gdb) info registers
raxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000701cc1d53ÂÂÂÂÂÂ -5833568862233420461 rbxÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 rcxÂÂÂÂÂÂÂÂÂÂÂ 0xaf0b000700000000ÂÂÂÂÂÂ -5833568862263574528 rdxÂÂÂÂÂÂÂÂÂÂÂ 0x700000000ÂÂÂÂÂ 30064771072 rsiÂÂÂÂÂÂÂÂÂÂÂ 0x4ÂÂÂÂ Â4 rdiÂÂÂÂÂÂÂÂÂÂÂ 0x10040596eÂÂÂÂÂ 4299184494 rbpÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 0x4b1201464 <labelProcs> rspÂÂÂÂÂÂÂÂÂÂÂ 0xffffc930ÂÂÂÂÂÂ 0xffffc930
r8ÂÂÂÂÂÂÂÂÂÂÂÂ 0x1cc1d00ÂÂÂÂÂÂÂ 30153984
r9ÂÂÂÂÂÂÂÂÂÂÂÂ 0x4b1201464ÂÂÂÂÂ 20151538788
r10ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r11ÂÂÂÂÂÂÂÂÂÂÂ 0x203ÂÂÂ 515
r12ÂÂÂÂÂÂÂÂÂÂÂ 0x4b11ef0c0ÂÂÂÂÂ 20151464128
r13ÂÂÂÂÂÂÂÂÂÂÂ 0x20ÂÂÂÂ 32
r14ÂÂÂÂÂÂÂÂÂÂÂ 0x0ÂÂÂÂÂ 0
r15ÂÂÂÂÂÂÂÂÂÂÂ 0x5ÂÂÂÂÂ 5
ripÂÂÂÂÂÂÂÂÂÂÂ 0x1800c6eb1ÂÂÂÂÂ 0x1800c6eb1 <ftok(char const*, int)+97> eflagsÂÂÂÂÂÂÂÂ 0x286ÂÂÂ [ PF SF IF ] csÂÂÂÂÂÂÂÂÂÂÂÂ 0x33ÂÂÂÂ 51 ssÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 dsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 esÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43 fsÂÂÂÂÂÂÂÂÂÂÂÂ 0x53ÂÂÂÂ 83 gsÂÂÂÂÂÂÂÂÂÂÂÂ 0x2bÂÂÂÂ 43
(gdb) ni
0x00000001800c6eb8ÂÂÂÂÂ 89ÂÂÂÂÂ }
(gdb) x/5i $pc
=> 0x1800c6eb8 <ftok(char const*, int)+104>:ÂÂÂ popÂÂÂ %rbx
ÂÂ 0x1800c6eb9 <ftok(char const*, int)+105>:ÂÂÂ retq
ÂÂ 0x1800c6eba <ftok(char const*, int)+106>:ÂÂÂ nopwÂÂ 0x0(%rax,%rax,1)
ÂÂ 0x1800c6ec0 <ftok(char const*, int)+112>:ÂÂÂ movÂÂÂ $0xffffffffffffffff,%rax
ÂÂ 0x1800c6ec7 <ftok(char const*, int)+119>:ÂÂÂ jmpÂÂÂ 0x1800c6eb1 <ftok(char const*, int)+97>
(gdb) ni
0x00000001800c6eb9ÂÂÂÂÂ 89ÂÂÂÂÂ }
(gdb) n
Â
##############################################################
# ftok() C source from debugger
##############################################################
Â
Â
/* ipc.cc: Single unix specification IPC interface for Cygwin
Â
ÂÂ Originally written by Robert Collins <robert.collins@hotmail.com>
ÂÂ Updated to 64 bit key_t by Charles Wilson <cygwin@cwilson.fastmail.fm>
Â
ÂÂ This file is part of Cygwin.
Â
ÂÂ This software is a copyrighted work licensed under the terms of the
 Cygwin license. Please consult the file "CYGWIN_LICENSE" for
ÂÂ details. */
Â
#include "winsup.h"
#include <sys/stat.h>
Â
/* Notes: we return a valid key even if id's low order 8 bits are 0. */ extern "C" key_t ftok (const char *path, int id) {
 struct stat statbuf;
 key_t tmp;
 if (stat64 (path, &statbuf))
ÂÂÂ {
ÂÂÂÂÂ /* stat set the appropriate errno for us */
ÂÂÂÂÂ return (key_t) -1;
ÂÂÂ }
Â
 /* Since Cygwin 1.5
ÂÂÂÂ dev_t is 32bits for cygwin
ÂÂÂÂ ino_t is 64bits for cygwin
ÂÂÂÂ and we need 8 bits for the id.
ÂÂÂÂ thus key_t needs 104 bits total -- but we only have 64 (long long)
ÂÂÂÂ We will have to alias; leaving open the possibility that the same
 key will be returned for multiple files. This possibility exists
ÂÂÂÂ also on Linux; the question is, how to minimize this possibility.
Â
 How to solve? Well, based on C. Vinschen's research, the nFileIndex*
ÂÂÂÂ words vary as follows, on a partition with > 110,000 files
ÂÂÂÂ nFileIndexHigh:ÂÂÂ 564 values between 0x00010000 -- 0xffff0000
ÂÂÂÂ nFileIndexLow : 103812 values between 0x00000000 -- 0x0003ffff
ÂÂÂÂ R. Collins suggests that these may represent a tree path,
ÂÂÂÂ and that it would require ~2.9M files to force the tree depth
ÂÂÂÂ to increase and reveal more bit usage.
Â
ÂÂÂÂ Implementation details: dev_t is 32bits, but is formed by
ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ device(32bits) << 16 | unit(32bits)
ÂÂÂÂ But device is ACTUALLY == status & FH_DEVMASK, where FH_DEVMASK
ÂÂÂÂ is 0x00000fff --> 12 bits
Â
ÂÂÂÂ As it happens, the maximum number of devices is actually
ÂÂÂÂ FH_NDEV, not FH_DEVMASK, where FH_NDEV is currently 0x0000001d.
 However, FH_NDEV grows as new device types are added. So
 currently the device number needs 5 bits, but later? Let's
ÂÂÂÂ take a cue from Linux, and use the lower 8 bits (instead of the
ÂÂÂÂ lower 12 or 16) for the device (major?) number.
Â
ÂÂÂÂ Similarly, while 'units' is an int (32bits), it is unclear
ÂÂÂÂ how many of these are significant. For most devices, it seems that
 'units' is equivalent to 'minor'. For FH_TAPE, it's obvious that
 only 8 bits are important. However, for FH_SOCKET...it might be
ÂÂÂÂ as high as 16 significant bits.
Â
ÂÂÂÂ Let's assume that we only need 8 bits from device (major) and
ÂÂÂÂ only 8 bits from unit (minor). (On linux, only 8 bits of minor
ÂÂÂÂ are used, and none from major).
ÂÂÂÂ ---> so, we only need 0x00ff00ff (16 bits) of dev_t
Â
ÂÂÂÂ ---> we MUST have all 8 bits of id.
Â
 ---> So, we only have 64 - 8 - 16 = 40 bits for ino_t. But, we
ÂÂÂÂ need 0xffff0000 for nFileIndexHigh and 0x0003ffff for nFileIndexLow
 minimum, or 16 + 18 = 34 bits. Lucky us - we have 6 more bits
ÂÂÂÂ to distribute.
Â
ÂÂÂÂ For lack of a better idea, we'll allocate 2 of the extra bits to
 nFileIndexHigh and 4 to nFileIndexLow. */
Â
 /* get 8 bits from dev_t (major), put into 0xff00000000000000L */
 tmp = (((key_t) statbuf.st_dev) & 0x0000000000ff0000LL) << 40;
 /* get 8 bits from dev_t (minor), put into 0x00ff000000000000L */
 tmp |= (((key_t) statbuf.st_dev) & 0x00000000000000ffLL) << 48;
 /* get upper 16+2 bits from nFileInfoHigh, put into 0x0000ffffc0000000L
 shift down first, then mask, to avoid sign extension on rightshift */
 tmp |= (((key_t) statbuf.st_ino) & 0xffffc00000000000LL) >> 16;
 /* get lower 18+4 bits from nFileInfoLow, put into 0x000000003fffff00L */
 tmp |= (((key_t) statbuf.st_ino) & 0x00000000003fffffLL) << 8;
 /* use all 8 bits of id, and put into 0x00000000000000ffL */
 tmp |= (id & 0x00ff);
 return tmp;
}
Â
Â


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]