Re: Deprecate 'nagle' (Was: Deprecate 'begin'?)
On Mon, Jul 13, 2009 at 01:11:55PM +0200, Alexander Burger wrote: >(native NIL "setsockopt" 'I Sock IPPROTO_TCP TCP_NODELAY (4) 4) This is not correct, the (4) argument creates a 4-byte uninitialized buffer. Correct would be (native NIL "setsockopt" 'I Sock IPPROTO_TCP TCP_NODELAY (4 0 . 0) 4) to pass the int value 0, and (native NIL "setsockopt" 'I Sock IPPROTO_TCP TCP_NODELAY (4 1 . 0) 4) to pass an int value of 1. Explanation: (4) allocates a buffer of 4 bytes. (4 . 0) allocates 4 bytes and initializes them to zero (4 . 255) allocates 4 bytes and initializes them to 0xFF (4 0 0 0 0) also allocates 4 bytes and initializes them to zero (4 1 . 0) allocates 4 bytes, initializes the first to '1' and the rest to zero That is, you can supply either some explicit byte values, or a number in the CDR of the last cell which tells how to initialize the rest of the buffer. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Deprecate 'nagle' (Was: Deprecate 'begin'?)
On Mon, Jul 13, 2009 at 08:54:54AM +0200, randall@gmail.com wrote: > With the new 'native' function are such capabilities are easily > available. I agree that deprecating things that are more consistently > done with the '(native ...' is better. Yes. With the current testing version you can do (def 'IPPROTO_TCP 6) (def 'TCP_NODELAY 1) (native NIL "setsockopt" 'I Sock IPPROTO_TCP TCP_NODELAY (4) 4) (There is no function like 'connect' or 'listen' yet to populate 'Sock' though, as the networking functions are still missing). And for applications running on the 32-bit version it is sufficient to include the following code fragment: (load "lib/gcc.l") (gcc "net" NIL 'nagle) #include #include #include // (nagle 'cnt 'flg) -> cnt any nagle(any ex) { any x, y; int sd, opt; x = cdr(ex), y = EVAL(car(x)); sd = (int)xCnt(ex,y); x = cdr(x), opt = isNil(EVAL(car(x)))? 1 : 0; if (setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char*)&opt, sizeof(int)) < 0) err(ex, NULL, "IP setsockopt error: %s", strerror(errno)); return y; } /**/ Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Re: Deprecate 'nagle' (Was: Deprecate 'begin'?)
Hi All! With the new 'native' function are such capabilities are easily available. I agree that deprecating things that are more consistently done with the '(native ...' is better. Cheers, - Rand On Mon, Jul 13, 2009 at 7:42 AM, Alexander Burger wrote: > Hi all, > > the same would apply to 'nagle' (network socket option), I suppose. > > It should not be part of the core system, and could easily be written in > inline-C if really needed. I'd also remove it. > > Cheers, > - Alex > -- > UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe > -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe
Deprecate 'nagle' (Was: Deprecate 'begin'?)
Hi all, the same would apply to 'nagle' (network socket option), I suppose. It should not be part of the core system, and could easily be written in inline-C if really needed. I'd also remove it. Cheers, - Alex -- UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe