Forum > Unix

Strange behavior with freepascal and IPC Queue Message

(1/2) > >>

eolandro:
I have two codes one in freepascal and anothe in php. The pascal code creates an IPC Queue and sends one byte in that queue. If the queue already has elements. it does not send any byte. The php code only gets the state of the queue.

But the strange is freepascal can not get the length of the queue(sg_qnum). This value is always zero.
In the other hand the php code gets that value without trouble.

I have no other PC maybe is my installation maybe is my code.

Can you help me test my code?

Thanks

Thaddy:
Both attachment read like a piece of shit.
Do better.

eolandro:

--- Quote from: Thaddy on April 18, 2017, 11:08:47 am ---Both attachment read like a piece of shit.
Do better.

--- End quote ---

Show me how. Let me see your code. An example.

Kays:

--- Quote from: eolandro on April 18, 2017, 08:59:54 am ---[…] But the strange is freepascal can not get the length of the queue(sg_qnum). This value is always zero. […]
--- End quote ---
Yeah, this happens occasionally, but usually with new (Linux) features: The record shipped with the RTL doesn't correctly map the memory structure, thus making you read a byte remaining zero. I had to redeclare TMSQid_ds using /usr/include/x86_64-linux-gnu/bits/msq.h as the blueprint:
--- Code: Pascal  window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---        TMSQid_ds = record                /// \brief structure describing operation permission                msg_perm: TIPC_perm;                /// \brief time of last msgsnd command                msg_stime: time_t;                {$ifndef CPUX86_64}                        glibc_reserved0: culong;                {$endif}                /// \brief time of last msgrcv command                msg_rtime: time_t;                {$ifndef CPUX86_64}                        glibc_reserved1: culong;                {$endif}                /// \brief time of last change                msg_ctime: time_t;                {$ifndef CPUX86_64}                        glibc_reserved2: culong;                {$endif}                /// \brief current number of bytes on queue                msg_cbytes: msglen_t;                /// \brief number of messages currently on queue                msg_qnum: msgqnum_t;                /// \brief max number of bytes allowed on queue                msg_qbytes: msglen_t;                /// \brief pid of last msgsnd()                msg_lspid: pid_t;                /// \brief pid of last msgrcv()                msg_lrpid: pid_t;                glibc_reserved3: culong;                glibc_reserved4: culong;        end;
* for failing routines' return values do a equal-comparison
* you can specify octal numbers by prepending an ampersand
* use sizeOf() where appropriate

Thaddy:

--- Quote from: Kays on January 10, 2018, 12:32:24 pm ---[Yeah, this happens occasionally, but usually with new (Linux) features: The record shipped with the RTL doesn't correctly map the memory structure

--- End quote ---
So you did not know to add {$packrecords C} ??

Navigation

[0] Message Index

[#] Next page

Go to full version