> From: Keith Packard <[email protected]>
> Date: Thu, 31 Oct 2013 15:43:40 -0700
> 
> This passes a file descriptor from the client to the server, which is
> then mmap'd
> 
> +static int
> +ProcShmCreateSegment(ClientPtr client)
> +{
> +    int fd;
> +    ShmDescPtr shmdesc;
> +    REQUEST(xShmCreateSegmentReq);
> +    xShmCreateSegmentReply rep = {
> +        .type = X_Reply,
> +        .nfd = 1,
> +        .sequenceNumber = client->sequence,
> +        .length = 0,
> +    };
> +    char template[] = "/tmp/shm-XXXXXX";
> +
> +    REQUEST_SIZE_MATCH(xShmCreateSegmentReq);
> +    if ((stuff->readOnly != xTrue) && (stuff->readOnly != xFalse)) {
> +        client->errorValue = stuff->readOnly;
> +        return BadValue;
> +    }
> +    fd = mkstemp(template);

Might make sense to use shm_mkstemp() here, but it seems that's an
OpenBSD-ism even though Debian has a bug report for it long before we
added it ;).
_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to