Annotation of researchv10no/cmd/nupas/ipc/mipsdkcon.c, revision 1.1

1.1     ! root        1: #include <stdio.h>
        !             2: #include <ipc.h>
        !             3: #include <sysexits.h>
        !             4: 
        !             5: extern int ipcdebug;
        !             6: 
        !             7: /*
        !             8:  *  dial a name and return an fd to the connection
        !             9:  */
        !            10: int
        !            11: dk_connect(dest, param)
        !            12: char *dest, *param;
        !            13: {
        !            14:        ipcinfo info;
        !            15:        int ret;
        !            16:        char fulldest[256];     /* stub - limit this */
        !            17: 
        !            18:        strcpy(fulldest, "/cs/dk!");
        !            19:        strcat(fulldest, dest);
        !            20: 
        !            21:        info.rfd = info.cfd = -1;
        !            22:        info.myname = info.user = info.machine = NULL;
        !            23:        info.uid = info.gid = -1;
        !            24:        info.name = fulldest;
        !            25:        info.param = param;
        !            26:        info.flags = IPC_OPEN;
        !            27:        ret = ipcdial(&info);
        !            28:        if (ret < 0) {
        !            29:                if (ipcdebug != 0) {
        !            30:                        perror("mipsdk connect error");
        !            31:                        fprintf(stderr, "mips ipcdial returned %d, %d\n",
        !            32:                                ret, errno);
        !            33:                        fprintf(stderr, "myname=%s user=%s name=%s param=%s\n",
        !            34:                                info.myname, info.user, info.name, info.param);
        !            35:                        fprintf(stderr, "rfd=%d cfd=%d uid=%d gid=%d flags=%d\n",
        !            36:                                info.rfd, info.cfd, info.uid, info.gid,
        !            37:                                info.flags);
        !            38:                        fprintf(stderr, "machine=%s\n", info.machine);
        !            39:                }
        !            40:                ipcseterror(EX_IOERR, "dk_connect",
        !            41:                        "can't connect to machine/service");
        !            42:        }
        !            43:        return ret;
        !            44: }
        !            45: 
        !            46: int
        !            47: dk_close(fd)
        !            48: int fd;
        !            49: {
        !            50:        write(fd, &fd, 0);      /* stub - is this useful or necessary? */
        !            51:        return close(fd);
        !            52: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.