[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: KDE does not start on FreeBSD
From: Thiago Macieira <thiagom () wanadoo ! fr>
Date: 2002-01-09 17:05:41
[Download RAW message or body]
Oswald Buddenhagen wrote:
>>>according to the fbsd header it should be
>>> strlen(sockname.sun_path) + 1 + offsetof(sun_path, sockaddr_un)
>>>
>>why the +1? if you do that, then the len is says the structure is 1 byte
>>bigger than it actually is.
The ending ASCII zero in the pathname might account for that.
> /*
> * Definitions for UNIX IPC domain.
> */
> struct sockaddr_un {
> u_char sun_len; /* sockaddr len including null */
> u_char sun_family; /* AF_UNIX */
> char sun_path[104]; /* path name (gag) */
> };
>
> so how would you interpret this?
Linux defines the length as 108, other systems might define differently.
That's quite arbitrary anyways. And the longest pathname is quite longer
than that.
It has been suggested that sun_path should be a zero-sized array, and
that you should allocate the needed size yourself. KUnixSocketAddress
has been designed in that way.
Actually, all sockets in the KDE core libraries are malloc()ed with the
sizes given by the needed functions instead of relying on any sockaddr_*
structure size, including __sockaddr_storage.
--
Thiago Macieira - UFOT Registry number: 1001
thiagom@mail.com
ICQ UIN: 1967141 PGP: 0x8F2978D5 and 0xEA9037A5 (PGP 2.x)
Registered Linux user #65028
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic