On Apr 1 2007 22:58, Andrew Morton wrote:
>On Sun, 1 Apr 2007 20:17:24 +0200 (MEST) Jan Engelhardt <[EMAIL PROTECTED]> 
>wrote:
>
>> Show the fill status of a pipe (in bytes) when stat'ing one.
>
>Is this useful?  It seems rather an obscure thing, and we generally need a
>good reason to go adding Linux-specific goodies to standard system calls
>like this.  What do "other operating systems" do here?

Other OS seem to always show 0, as Linux does usually. So I do not think
programs actually rely on it having any specific value.
I thought adding pipesize might be helpful in dianosing pipe cases, akin to
Miklos's procfs-fdinfo patch for regular files.

>> +            }
>> +    } else if (S_ISSOCK(inode->i_mode)) {
>> +#ifdef CONFIG_UNIX_MODULE
>> +            loff_t (*uxsize)(struct inode *) = 
>> __symbol_get("unixsock_size");
>> +            if (uxsize != NULL) {
>> +                    stat->size = uxsize(inode);
>> +                    symbol_put("unixsock_size");
>> +            }
>> +#endif
>> +#if defined(CONFIG_UNIX) && !defined(CONFIG_UNIX_MODULE)
>> +            stat->size = unixsock_size(inode);
>> +#endif
>> +    } else {
>> +            stat->size = i_size_read(inode);
>> +    }
>
>That's a bit fugly.

Drop for now.

>> +loff_t unixsock_size(struct inode *inode) {
>> +    struct sock *sk = unix_find_socket_byinode(inode);
>> +    loff_t eax;
>> +
>> +    if(sk == NULL) { return 0; }
>> +    eax = sk->sk_rcvbuf;
>> +    sock_put(sk);
>> +    return eax;
>> +}
>> +EXPORT_SYMBOL(unixsock_size);
>
>That's wildly incorrect coding style, and it doesn't use tabs.

Which means I something really went wrong, because I knew I went through it for
cleanup.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to