[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    Re: Microcom
From:       Denys Vlasenko <vda.linux () googlemail ! com>
Date:       2007-09-22 16:47:14
Message-ID: 200709221747.14798.vda.linux () googlemail ! com
[Download RAW message or body]

Hi Vladimir,

Plese let us know what copyright and license terms should be
at the top of microcom.c

On Saturday 22 September 2007 16:03, Vladimir Dronnikov wrote:
> Still have 2 comments
> 
> 1.
> The code
> -------------
> // %4d to make mgetty happy. It treats 4-bytes lock files as binary,
> // not text, PID. Making 5+ char file. Brrr...
> s = xasprintf("%4d\n", getpid());
> write(sfd, s, strlen(s));
> -------------
> will be producing exactly 4-byte file.
> Concurrent mgetty process will then get from this file a PID of wrong blocking \
> process and may cause malfunction...

No. You miss '\n'. With '\n' there will be at least 5 chars.

(Needless to say that mgetty is doing a rather crazy thing.
Just imagine that you run it on the peculiar arch with CPU
capable of running in big and little-endian modes...)

> -------------
> fcntl(sfd, F_SETFL, O_RDWR); // why? To clear O_NDELAY. It makes things easier if \
>                 we use blocking IO...
> -------------

Why we don't open without O_NDELAY?

Not that I am against it, I just feel there should be a comment
explaining why we open with O_NDELAY, and then clear it.
--
vda
_______________________________________________
busybox mailing list
busybox@busybox.net
http://busybox.net/cgi-bin/mailman/listinfo/busybox


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic