AboutBlogContact
DevOps & InfrastructureMay 15, 1998 2 min read 124Updated: June 22, 2026

Solaris 2.6: Speeding Up IPC with Doors (1998)

AunimedaAunimeda
📋 Table of Contents

Solaris 2.6: Speeding Up IPC with Doors

If you're still using message queues or pipes for high-frequency cross-process calls on Solaris, you're living in the past. Solaris 2.6 introduced Doors, a low-latency RPC mechanism that essentially allows a thread in one process to call a function in another process as if it were a local function call.

The kernel handles the context switch, but it's done much more efficiently than standard signal or socket-based IPC.

Setting up a Door Server

The server creates a "door" and associates it with a path in the filesystem.

#include <door.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

void server_procedure(void *cookie, char *argp, size_t arg_size,
                      door_desc_t *dp, uint_t n_desc) {
    char *response = "Door Call Received!";
    door_return(response, strlen(response) + 1, NULL, 0);
}

int main() {
    int dfd;
    int ffd;

    // Create the door
    dfd = door_create(server_procedure, NULL, 0);
    if (dfd == -1) {
        perror("door_create");
        exit(1);
    }

    // Attach it to a file
    ffd = open("/tmp/my_door", O_RDWR|O_CREAT|O_TRUNC, 0666);
    close(ffd);
    fattach(dfd, "/tmp/my_door");

    printf("Server is ready at /tmp/my_door\n");
    sleep(1000000); // Wait for calls
    return 0;
}

The Client Side

Calling the door is straightforward. You open the file and use door_call.

#include <door.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>

int main() {
    int dfd;
    door_arg_t darg;
    char *data = "Hello from Client";

    dfd = open("/tmp/my_door", O_RDONLY);
    if (dfd == -1) {
        perror("open");
        exit(1);
    }

    darg.data_ptr = data;
    darg.data_size = strlen(data) + 1;
    darg.desc_ptr = NULL;
    darg.desc_num = 0;
    darg.rbuf = NULL;
    darg.rsize = 0;

    if (door_call(dfd, &darg) == -1) {
        perror("door_call");
        exit(1);
    }

    printf("Response: %s\n", darg.data_ptr);
    return 0;
}

This is significantly faster than using standard Unix domain sockets. The kernel literally hands off execution from the client thread to a pre-allocated server thread. If you're building high-performance systems on SPARC/Solaris, Doors are your best friend.


Aunimeda provides DevOps engineering and infrastructure services - CI/CD pipelines, containerization, cloud deployments, and monitoring setups.

Contact us to discuss your infrastructure needs. See also: DevOps Services, Custom Software Development

Read Also

Memcached: Slab Allocation Internals (2007)aunimeda
DevOps & Infrastructure

Memcached: Slab Allocation Internals (2007)

Why is your cache server swapping? It's probably memory fragmentation. Let's look at how Memcached solves this with slabs.

Hunting Memory Leaks: Glibc Malloc Tuning (2001)aunimeda
DevOps & Infrastructure

Hunting Memory Leaks: Glibc Malloc Tuning (2001)

Is your long-running C daemon slowly consuming the entire server's RAM? Learn how to use MALLOC_CHECK_ and mallopt to keep glibc under control.

The Multi-CPU Era: Real-World Multithreading with POSIX pthreads (1999)aunimeda
DevOps & Infrastructure

The Multi-CPU Era: Real-World Multithreading with POSIX pthreads (1999)

Don't leave that second CPU idling. If you're building a 1999-era backend for a high-traffic site, you need to master POSIX threads and avoid the common pitfalls of shared state.

Need IT development for your business?

We build websites, mobile apps and AI solutions. Free consultation.

DevOps Services

Get Consultation All articles