Dear User Group:

I  find the easiest way to create a socket--such as /dev/log--
is with a utility program on the target platform.
The source code of such a  program, called "mksock",
follows this note.

Is there some equivalent standard tool ?  If not,  perhaps
this functionality should be included in the standard
"mknod" utility.

Best Regards,

Paul R.

****************  Source Code for mksock ****************

#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>

/*
 * Make a local socket node in the specified directory.
 */
main(int argc, char *argv[])
{
    char *path;
     int r;

    if(argc != 2)
      {
        fprintf(stderr, "Usage: mksock [path]\n");
        exit(-2);
      }
    else
        path = argv[1];

    r = mknod(path,
              (S_IFSOCK |
               S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP |
               S_IROTH | S_IWOTH), (dev_t) 0);

    if(r != 0)
        fprintf(stderr, "mksock: Failure Error = %d\n", errno);

    exit(r);
}


--
Paul Romero

RCOM Communications Software

Phone/Fax: (510)339-2628
E-Mail: [EMAIL PROTECTED]


_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to