tests/unixsock.c

ソースコードを見る。

関数

static int bind_socket (char const *filename)
int main (void)

変数

int errno


関数

static int bind_socket ( char const *  filename  )  [static]

unixsock.c42 行で定義されています。

参照先 size.

参照元 main().

00043 {
00044         int sock_fd;
00045         struct sockaddr_un name;
00046         size_t size;
00047         
00048         /* Create the socket. */
00049         if ((sock_fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
00050                 perror ("socket(PF_LOCAL, SOCK_STREAM)");
00051                 exit(1);
00052         }
00053      
00054         /* Bind a name to the socket. */
00055         name.sun_family = AF_LOCAL;
00056         strncpy(name.sun_path, filename, sizeof (name.sun_path));
00057      
00058        /* The size of the address is
00059           the offset of the start of the filename,
00060           plus its length,
00061           plus one for the terminating null byte.
00062           Alternatively you can just do:
00063           size = SUN_LEN (&name);
00064       */
00065         size = SUN_LEN(&name);
00066         /* XXX: This probably won't work on unfriendly libcs */
00067      
00068         if (bind(sock_fd, (struct sockaddr *) &name, size) < 0) {
00069                 perror ("bind");
00070                 exit(1);
00071         }
00072 
00073         return sock_fd;
00074 }

int main ( void   ) 

unixsock.c77 行で定義されています。

参照先 bind_socket().

00078 {
00079         int sock_fd;
00080         int kid;
00081         char const *filename = "conftest.unixsock.sock";
00082 
00083         /* abolish hanging */
00084         alarm(15);              /* secs */
00085 
00086         if ((sock_fd = bind_socket(filename)) < 0)
00087                 exit(1);
00088 
00089         /* the socket will be deleted when autoconf cleans up these
00090            files. */
00091 
00092         exit(0);
00093 }


変数

int errno


Sambaに対してSat Aug 29 21:24:31 2009に生成されました。  doxygen 1.4.7