i = getpid() & 0xffff?

i = getpid() & 0xffff?

Post by Cove Schneid » Wed, 06 Dec 1995 04:00:00



I was just looking through the source to a ping program when I came
across i = getpid() & 0xffff;. Why would you & pid_t with 0xffff?
All I could think of was it's a strange way to do a cast (Pre-ANSI,
or on some old machine). I'm sure this is historical more than
anything..

Could some one educate me?

Thanks,
any info appreciated.

Cove

--

 
 
 

i = getpid() & 0xffff?

Post by Rene Pijlma » Wed, 06 Dec 1995 04:00:00



>I was just looking through the source to a ping program when I came
>across i = getpid() & 0xffff;. Why would you & pid_t with 0xffff?
>All I could think of was it's a strange way to do a cast (Pre-ANSI,
>or on some old machine). I'm sure this is historical more than
>anything..

>Could some one educate me?

Cove,

Ping needs to send an ICMP echo request packet with a 16-bit IDENTIFIER
field which uniquely identifies the sending process. The only unique number
readily available is the pid, but unfortunately it's a 32-bit number.
Ping ignores the most signifficant 16 bits, which would be incorrect
if UNIX really used 32-bit pid's. I think in practice typical UNIX'es
cycle the pid on 30,000 (or some other magic number in the 16-bit range)
and the & 0xffff construction is meaningless but also harmless.

HTH,
--
Rene Pijlman


 
 
 

i = getpid() & 0xffff?

Post by Robert Kl » Thu, 07 Dec 1995 04:00:00



 >I was just looking through the source to a ping program when I came
 >across i = getpid() & 0xffff;. Why would you & pid_t with 0xffff?

To make sure 'i' isn't higher than 65535.

                                                                robert

 
 
 

1. Cardbus problems (vendor 0xffff, device 0xffff)

I'm stuck with my Trendnet TEW-221PCI wireless lan card (Cardbus) not
working in Linux... (it works in Windoze 2k).
Card insertion is detected, but the card itself is not recognized.

I have searched everywhere and I am not able to find any solution.

Here is what I get in dmesg:
cs: cb_alloc(bus 2): vendor 0xffff, device 0xffff
PCI: device 02:00.0 has unknown header type 7f, ignoring.
PCI: No IRQ known for interrupt pin ? of device 02:00.0

lspci says that the card's vendor is unknown.

cardctl status:
Socket 0:
3.3V CardBus card
function 0: [ready]

cardctl ident:
Socket 0:
no product info available

I have several kernels (RH 9.0 one as well as 2.4.21 and 2.4.22-rc1).
PCMCIA utilities are pcmcia-cs-3.2.4.

My cardbus controller is detected prefectly (it is made by ENE), machine
is ECS Green 550.

The card uses ADMtek 8211 chipset (if that matters).
Unfortunately I don't have other cards to test, but this one works in
Windows on the same machine...

I don't know if this a bug or something, but I'm really stuck, so any
advice is appreciated.
Please CC me when replying if possible.

2. How to get debug info

3. &&&&----Looking for a unix shell------&&&&&

4. Linux...via *gopher*?

5. 3c59x:command 0x3002 did not complete! Status=0xffff

6. Python DAT 4320

7. cant get match tcp src PORT 0xffff to work!

8. Netscape download problem

9. ppp && PPPoE && ADSL && net && buffer(s)

10. 没有人用中文吗?

11. &&&&&& SUGGESTION ??? &&&&&&&&

12. getpid from driver

13. getpid = other program