2 * This file and its contents are supplied under the terms of the
3 * Common Development and Distribution License ("CDDL"), version 1.0.
4 * You may only use this file in accordance with the terms of version
7 * A full copy of the text of the CDDL should have accompanied this
8 * source. A copy of the CDDL is also available via the Internet at
9 * http://www.illumos.org/license/CDDL.
13 * Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
18 #include <sys/socket.h>
20 #include <sys/types.h>
28 main(int argc
, char *argv
[])
30 struct sockaddr_un sock
;
35 fprintf(stderr
, "usage: %s /path/to/socket\n", argv
[0]);
39 size
= sizeof (sock
.sun_path
);
40 (void) snprintf(sock
.sun_path
, size
, "%s", path
);
42 sock
.sun_family
= AF_UNIX
;
43 if ((fd
= socket(AF_UNIX
, SOCK_DGRAM
, 0)) == -1) {
47 if (bind(fd
, (struct sockaddr
*)&sock
, sizeof (struct sockaddr_un
))) {