ibcs2_other.c (11397) | ibcs2_other.c (11527) |
---|---|
1/* 2 * Copyright (c) 1995 Steven Wallace 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 60 unchanged lines hidden (view full) --- 69 70 largs.fd = uap->fd; 71 largs.offset = uap->offset; 72 largs.whence = uap->whence; 73 error = lseek(p, &largs, (int *)&lret); 74 *(long *)retval = lret; 75 return (error); 76} | 1/* 2 * Copyright (c) 1995 Steven Wallace 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 60 unchanged lines hidden (view full) --- 69 70 largs.fd = uap->fd; 71 largs.offset = uap->offset; 72 largs.whence = uap->whence; 73 error = lseek(p, &largs, (int *)&lret); 74 *(long *)retval = lret; 75 return (error); 76} |
77 78#ifdef SPX_HACK 79#include <sys/socket.h> 80#include <sys/un.h> 81 82int 83spx_open(struct proc *p, void *uap, int *retval) 84{ 85 struct socket_args sock; 86 struct connect_args conn; 87 struct sockaddr_un *Xaddr; 88 caddr_t name; 89 int fd, error; 90 caddr_t sg = stackgap_init(); 91 92 /* obtain a socket. */ 93 DPRINTF(("SPX: open socket\n")); 94 sock.domain = AF_UNIX; 95 sock.type = SOCK_STREAM; 96 sock.protocol = 0; 97 error = socket(p, &sock, retval); 98 if (error) 99 return error; 100 101 /* connect the socket to standard X socket */ 102 DPRINTF(("SPX: connect to /tmp/X11-unix/X0\n")); 103 Xaddr = stackgap_alloc(&sg, sizeof(struct sockaddr_un)); 104 Xaddr->sun_family = AF_UNIX; 105 Xaddr->sun_len = sizeof(struct sockaddr_un) - sizeof(Xaddr->sun_path) + 106 strlen(Xaddr->sun_path) + 1; 107 copyout("/tmp/.X11-unix/X0", Xaddr->sun_path, 18); 108 109 conn.s = fd = *retval; 110 conn.name = (caddr_t)Xaddr; 111 conn.namelen = sizeof(struct sockaddr_un); 112 error = connect(p, &conn, retval); 113 if (error) { 114 struct close_args cl; 115 cl.fd = fd; 116 close(p, &cl, retval); 117 return error; 118 } 119 *retval = fd; 120 return 0; 121} 122#endif /* SPX_HACK */ |
|