? Ovfork.po ? _Exit.po ? ___runetype_mb.po ? __get_tcb.po ? __getcwd.po ? __mb_cur_max.po ? __semctl.po ? __set_tcb.po ? __syscall.po ? __sysctl.po ? __threxit.po ? __thrsigdivert.po ? __thrsleep.po ? __thrwakeup.po ? _catclose.po ? _catgets.po ? _catopen.po ? _def_messages.po ? _def_monetary.po ? _def_numeric.po ? _def_time.po ? _exit.po ? _getlogin.po ? _ptrace.po ? _rand48.po ? _setjmp.po ? _setlogin.po ? _sys_errlist.po ? _sys_nerr.po ? _sys_siglist.po ? _wctrans.po ? _yp_check.po ? a64l.po ? abort.po ? abs.po ? accept.po ? accept4.po ? access.po ? acct.po ? adddi3.po ? adjfreq.po ? adjtime.po ? alarm.po ? anddi3.po ? arc4random.po ? arc4random_uniform.po ? asctime.po ? ashldi3.po ? ashrdi3.po ? asprintf.po ? asr.po ? asr_debug.po ? asr_utils.po ? assert.po ? atexit.po ? atof.po ? atoi.po ? atol.po ? atoll.po ? auth_none.po ? auth_subr.po ? auth_unix.po ? authenticate.po ? authunix_prot.po ? base64.po ? basename.po ? bcmp.po ? bcopy.po ? bcrypt.po ? bind.po ? bindresvport.po ? blowfish.po ? brk.po ? bsearch.po ? bt_close.po ? bt_conv.po ? bt_debug.po ? bt_delete.po ? bt_get.po ? bt_open.po ? bt_overflow.po ? bt_page.po ? bt_put.po ? bt_search.po ? bt_seq.po ? bt_split.po ? bt_utils.po ? btowc.po ? bzero.po ? catclose.po ? catgets.po ? catopen.po ? cerror.po ? cfgetispeed.po ? cfgetospeed.po ? cfmakeraw.po ? cfree.po ? cfsetispeed.po ? cfsetospeed.po ? cfsetspeed.po ? chdir.po ? chflags.po ? chmod.po ? chown.po ? chroot.po ? citrus_ctype.po ? citrus_none.po ? citrus_utf8.po ? clnt_generic.po ? clnt_perror.po ? clnt_raw.po ? clnt_simple.po ? clnt_tcp.po ? clnt_udp.po ? clock.po ? clock_getcpuclockid.po ? clock_getres.po ? clock_gettime.po ? clock_settime.po ? close.po ? closedir.po ? closefrom.po ? clrerr.po ? cmpdi2.po ? confstr.po ? connect.po ? creat.po ? crypt.po ? crypt2.po ? cryptutil.po ? ctermid.po ? ctype_.po ? daemon.po ? db.po ? devname.po ? difftime.po ? dirfd.po ? dirname.po ? disklabel.po ? div.po ? divdi3.po ? dlfcn_stubs.po ? dmisc.po ? dprintf.po ? drand48.po ? dtoa.po ? dup.po ? dup2.po ? dup3.po ? ecvt.po ? elf_hash.po ? erand48.po ? err.po ? errc.po ? errlist.po ? errno.po ? errx.po ? ethers.po ? exec.po ? exect.po ? execve.po ? exit.po ? explicit_bzero.po ? fabs.po ? faccessat.po ? fchdir.po ? fchflags.po ? fchmod.po ? fchmodat.po ? fchown.po ? fchownat.po ? fclose.po ? fcntl.po ? fdatasync.po ? fdopen.po ? feof.po ? ferror.po ? fflush.po ? ffs.po ? fgetc.po ? fgetln.po ? fgetpos.po ? fgets.po ? fgetwc.po ? fgetws.po ? fhopen.po ? fhstat.po ? fhstatfs.po ? fileno.po ? findfp.po ? fixdfdi.po ? fixsfdi.po ? fixunsdfdi.po ? fixunsdfsi.po ? fixunssfdi.po ? flags.po ? floatdidf.po ? floatdisf.po ? floatunsdidf.po ? flock.po ? flockfile.po ? flt_rounds.po ? fmemopen.po ? fnmatch.po ? fopen.po ? fork.po ? fpathconf.po ? fpclassify.po ? fpclassifyl.po ? fpgetmask.po ? fpgetround.po ? fpgetsticky.po ? fprintf.po ? fpsetmask.po ? fpsetround.po ? fpsetsticky.po ? fpu_add.po ? fpu_compare.po ? fpu_div.po ? fpu_explode.po ? fpu_implode.po ? fpu_mul.po ? fpu_q.po ? fpu_qp.po ? fpu_reg.po ? fpu_sqrt.po ? fpu_subr.po ? fpurge.po ? fputc.po ? fputs.po ? fputwc.po ? fputws.po ? fread.po ? freeaddrinfo.po ? freopen.po ? frexp.po ? fscanf.po ? fseek.po ? fsetpos.po ? fstab.po ? fstat.po ? fstatat.po ? fstatfs.po ? fsync.po ? ftell.po ? ftok.po ? ftruncate.po ? fts.po ? ftw.po ? funopen.po ? futimens.po ? futimes.po ? fvwrite.po ? fwalk.po ? fwide.po ? fwprintf.po ? fwrite.po ? fwscanf.po ? gai_strerror.po ? gcvt.po ? gdtoa.po ? get_myaddress.po ? getaddrinfo.po ? getaddrinfo_async.po ? getbsize.po ? getc.po ? getcap.po ? getchar.po ? getcwd.po ? getdelim.po ? getdents.po ? getdomainname.po ? getdtablecount.po ? getdtablesize.po ? getegid.po ? getentropy.po ? getenv.po ? geteuid.po ? getfh.po ? getfsstat.po ? getgid.po ? getgrent.po ? getgrouplist.po ? getgroups.po ? gethex.po ? gethostid.po ? gethostnamadr.po ? gethostnamadr_async.po ? gethostname.po ? getifaddrs.po ? getitimer.po ? getline.po ? getloadavg.po ? getlogin.po ? getmntinfo.po ? getnameinfo.po ? getnameinfo_async.po ? getnetbyaddr.po ? getnetbyname.po ? getnetent.po ? getnetgrent.po ? getnetnamadr.po ? getnetnamadr_async.po ? getopt_long.po ? getpagesize.po ? getpeereid.po ? getpeername.po ? getpgid.po ? getpgrp.po ? getpid.po ? getppid.po ? getpriority.po ? getprogname.po ? getproto.po ? getprotoent.po ? getprotoname.po ? getpwent.po ? getresgid.po ? getresuid.po ? getrlimit.po ? getrpcent.po ? getrpcport.po ? getrrsetbyname.po ? getrrsetbyname_async.po ? getrtable.po ? getrusage.po ? getservbyname.po ? getservbyport.po ? getservent.po ? getsid.po ? getsockname.po ? getsockopt.po ? getsubopt.po ? getthrid.po ? gettimeofday.po ? getttyent.po ? getuid.po ? getusershell.po ? getw.po ? getwc.po ? getwchar.po ? getwd.po ? glob.po ? gmisc.po ? gmon.po ? hash.po ? hash_bigkey.po ? hash_buf.po ? hash_func.po ? hash_log2.po ? hash_page.po ? hcreate.po ? hd_init.po ? hdtoa.po ? heapsort.po ? herror.po ? hexnan.po ? htonl.po ? htons.po ? if_indextoname.po ? if_nameindex.po ? if_nametoindex.po ? imaxabs.po ? imaxdiv.po ? index.po ? inet_addr.po ? inet_lnaof.po ? inet_makeaddr.po ? inet_net_ntop.po ? inet_net_pton.po ? inet_neta.po ? inet_netof.po ? inet_network.po ? inet_ntoa.po ? inet_ntop.po ? inet_pton.po ? infinity.po ? initgroups.po ? insque.po ? ioctl.po ? iordi3.po ? ip6opt.po ? isatty.po ? isctype.po ? isfdtype.po ? isfinite.po ? isfinitel.po ? isinf.po ? isinfl.po ? isnan.po ? isnanl.po ? isnormal.po ? isnormall.po ? issetugid.po ? iswctype.po ? jrand48.po ? kevent.po ? kill.po ? killpg.po ? kqueue.po ? ktrace.po ? l64a.po ? labs.po ? lchown.po ? lcong48.po ? ldexp.po ? ldiv.po ? ldtoa.po ? link.po ? linkaddr.po ? linkat.po ? listen.po ? llabs.po ? lldiv.po ? localeconv.po ? localtime.po ? lockf.po ? locks.po ? login_cap.po ? lrand48.po ? lsearch.po ? lseek.po ? lshldi3.po ? lshrdi3.po ? lstat.po ? madvise.po ? makebuf.po ? malloc.po ? mblen.po ? mbrlen.po ? mbstowcs.po ? mbtowc.po ? mcount.po ? md5.po ? md5hl.c ? md5hl.po ? memccpy.po ? memchr.po ? memcmp.po ? memcpy.po ? memmem.po ? memmove.po ? memrchr.po ? memset.po ? merge.po ? mincore.po ? minherit.po ? misc.po ? mkdir.po ? mkdirat.po ? mkfifo.po ? mkfifoat.po ? mknod.po ? mknodat.po ? mktemp.po ? mlock.po ? mlockall.po ? mmap.po ? moddi3.po ? modf.po ? mount.po ? mpool.po ? mprotect.po ? mquery.po ? mrand48.po ? msgctl.po ? msgget.po ? msgrcv.po ? msgsnd.po ? msync.po ? mul.po ? muldi3.po ? multibyte_citrus.po ? munlock.po ? munlockall.po ? munmap.po ? nan.po ? nanosleep.po ? ndbm.po ? negdi2.po ? nfssvc.po ? nftw.po ? nice.po ? nl_langinfo.po ? nlist.po ? notdi2.po ? nrand48.po ? ntohl.po ? ntohs.po ? open.po ? open_memstream.po ? open_wmemstream.po ? openat.po ? opendir.po ? pathconf.po ? pause.po ? perror.po ? pipe.po ? pipe2.po ? pmap_clnt.po ? pmap_getmaps.po ? pmap_getport.po ? pmap_prot.po ? pmap_prot2.po ? pmap_rmt.po ? poll.po ? popen.po ? posix_madvise.po ? posix_pty.po ? posix_spawn.po ? ppoll.po ? pread.po ? preadv.po ? printf.po ? profil.po ? pselect.po ? psignal.po ? ptrace.po ? putc.po ? putchar.po ? puts.po ? putw.po ? putwc.po ? putwchar.po ? pw_dup.po ? pwcache.po ? pwrite.po ? pwritev.po ? qabs.po ? qdiv.po ? qdivrem.po ? qsort.po ? quotactl.po ? radixsort.po ? raise.po ? rand.po ? random.po ? rcmd.po ? rcmdsh.po ? read.po ? readdir.po ? readdir_r.po ? readlink.po ? readlinkat.po ? readpassphrase.po ? readv.po ? reallocarray.po ? realpath.po ? reboot.po ? rec_close.po ? rec_delete.po ? rec_get.po ? rec_open.po ? rec_put.po ? rec_search.po ? rec_seq.po ? rec_utils.po ? recv.po ? recvfrom.po ? recvmsg.po ? refill.po ? regcomp.po ? regerror.po ? regexec.po ? regfree.po ? rem.S ? rem.po ? remove.po ? remque.po ? rename.po ? renameat.po ? res_comp.po ? res_data.po ? res_debug.po ? res_debug_syms.po ? res_init.po ? res_mkquery.po ? res_query.po ? res_random.po ? res_search_async.po ? res_send.po ? res_send_async.po ? revoke.po ? rewind.po ? rewinddir.po ? rget.po ? rindex.po ? rmd160.po ? rmd160hl.c ? rmd160hl.po ? rmdir.po ? rpc_callmsg.po ? rpc_commondata.po ? rpc_dtablesize.po ? rpc_prot.po ? rresvport.po ? rthdr.po ? rune.po ? runeglue.po ? runetable.po ? ruserok.po ? saveregs.po ? sbrk.po ? scandir.po ? scanf.po ? sched_yield.po ? sdiv.S ? sdiv.po ? seed48.po ? seekdir.po ? select.po ? semctl.po ? semget.po ? semop.po ? send.po ? sendmsg.po ? sendsyslog.po ? sendto.po ? setbuf.po ? setbuffer.po ? setdomainname.po ? setegid.po ? setenv.po ? seteuid.po ? setgid.po ? setgroups.po ? sethostent.po ? sethostid.po ? sethostname.po ? setitimer.po ? setjmp.po ? setjmperr.po ? setlocale.po ? setmode.po ? setpgid.po ? setpgrp.po ? setpriority.po ? setproctitle.po ? setprogname.po ? setregid.po ? setresgid.po ? setresuid.po ? setreuid.po ? setrlimit.po ? setrtable.po ? setrunelocale.po ? setsid.po ? setsockopt.po ? settimeofday.po ? setuid.po ? setvbuf.po ? sha1.po ? sha1hl.c ? sha1hl.po ? sha2.po ? sha224hl.c ? sha224hl.po ? sha256hl.c ? sha256hl.po ? sha384hl.c ? sha384hl.po ? sha512hl.c ? sha512hl.po ? shm_open.po ? shmat.po ? shmctl.po ? shmdt.po ? shmget.po ? shutdown.po ? sigaction.po ? sigaltstack.po ? sigcompat.po ? siginterrupt.po ? siglist.po ? signal.po ? signame.po ? signbit.po ? signbitl.po ? sigpending.po ? sigprocmask.po ? sigreturn.po ? sigsetjmp.po ? sigsetops.po ? sigsuspend.po ? sleep.po ? smisc.po ? snprintf.po ? sockatmark.po ? socket.po ? socketpair.po ? sprintf.po ? srand48.po ? sscanf.po ? stack_protector.po ? stat.po ? statfs.po ? statvfs.po ? stdio.po ? stpcpy.po ? stpncpy.po ? strcasecmp.po ? strcasestr.po ? strcat.po ? strchr.po ? strcmp.po ? strcoll.po ? strcpy.po ? strcspn.po ? strdup.po ? strerror.po ? strerror_r.po ? strftime.po ? strlcat.po ? strlcpy.po ? strlen.po ? strmode.po ? strncat.po ? strncmp.po ? strncpy.po ? strndup.po ? strnlen.po ? strpbrk.po ? strptime.po ? strrchr.po ? strsep.po ? strsignal.po ? strspn.po ? strstr.po ? strtod.po ? strtodg.po ? strtof.po ? strtofflags.po ? strtoimax.po ? strtok.po ? strtol.po ? strtold.po ? strtoll.po ? strtonum.po ? strtorQ.po ? strtord.po ? strtoul.po ? strtoull.po ? strtoumax.po ? strxfrm.po ? subdi3.po ? sum.po ? svc.po ? svc_auth.po ? svc_auth_unix.po ? svc_raw.po ? svc_run.po ? svc_simple.po ? svc_tcp.po ? svc_udp.po ? swab.po ? swapctl.po ? swprintf.po ? swscanf.po ? symlink.po ? symlinkat.po ? sync.po ? sysarch.po ? syscall.po ? sysconf.po ? sysctl.po ? syslog.po ? syslog_r.po ? system.po ? tcdrain.po ? tcflow.po ? tcflush.po ? tcgetattr.po ? tcgetpgrp.po ? tcgetsid.po ? tcsendbreak.po ? tcsetattr.po ? tcsetpgrp.po ? telldir.po ? tempnam.po ? tfind.po ? tfork_thread.po ? time.po ? timer_create.po ? timer_delete.po ? timer_getoverrun.po ? timer_gettime.po ? timer_settime.po ? times.po ? timezone.po ? timingsafe_bcmp.po ? timingsafe_memcmp.po ? tmpfile.po ? tmpnam.po ? tolower_.po ? toupper_.po ? truncate.po ? tsearch.po ? ttyname.po ? ttyslot.po ? ualarm.po ? ucmpdi2.po ? udiv.S ? udiv.po ? udivdi3.po ? ulp.po ? umask.po ? umoddi3.po ? umul.po ? uname.po ? ungetc.po ? ungetwc.po ? unithread_malloc_lock.po ? unithread_mutex.po ? unithread_tag.po ? unlink.po ? unlinkat.po ? unmount.po ? unvis.po ? urem.S ? urem.po ? usleep.po ? utime.po ? utimensat.po ? utimes.po ? utrace.po ? uuid_compare.po ? uuid_create.po ? uuid_create_nil.po ? uuid_equal.po ? uuid_from_string.po ? uuid_hash.po ? uuid_is_nil.po ? uuid_stream.po ? uuid_to_string.po ? valloc.po ? vars6.po ? vasprintf.po ? vdprintf.po ? verr.po ? verrc.po ? verrx.po ? vfprintf.po ? vfscanf.po ? vfwprintf.po ? vfwscanf.po ? vis.po ? vprintf.po ? vscanf.po ? vsnprintf.po ? vsprintf.po ? vsscanf.po ? vswprintf.po ? vswscanf.po ? vwarn.po ? vwarnc.po ? vwarnx.po ? vwprintf.po ? vwscanf.po ? wait.po ? wait3.po ? wait4.po ? waitpid.po ? warn.po ? warnc.po ? warnx.po ? wbuf.po ? wcscasecmp.po ? wcscat.po ? wcschr.po ? wcscmp.po ? wcscoll.po ? wcscpy.po ? wcscspn.po ? wcsdup.po ? wcsftime.po ? wcslcat.po ? wcslcpy.po ? wcslen.po ? wcsncat.po ? wcsncmp.po ? wcsncpy.po ? wcspbrk.po ? wcsrchr.po ? wcsspn.po ? wcsstr.po ? wcstod.po ? wcstof.po ? wcstoimax.po ? wcstok.po ? wcstol.po ? wcstold.po ? wcstoll.po ? wcstombs.po ? wcstoul.po ? wcstoull.po ? wcstoumax.po ? wcswcs.po ? wcswidth.po ? wcsxfrm.po ? wctob.po ? wctomb.po ? wmemchr.po ? wmemcmp.po ? wmemcpy.po ? wmemmove.po ? wmemset.po ? wprintf.po ? write.po ? writev.po ? wscanf.po ? wsetup.po ? xdr.po ? xdr_array.po ? xdr_domainname.po ? xdr_float.po ? xdr_keydat.po ? xdr_mapname.po ? xdr_mem.po ? xdr_peername.po ? xdr_rec.po ? xdr_reference.po ? xdr_stdio.po ? xdr_valdat.po ? xdr_ypbind_binding.po ? xdr_ypbind_resp.po ? xdr_ypbind_resptype.po ? xdr_ypbind_setdom.po ? xdr_ypmaplist.po ? xdr_ypreq_key.po ? xdr_ypreq_nokey.po ? xdr_ypresp_all.po ? xdr_ypresp_key_val.po ? xdr_ypresp_maplist.po ? xdr_ypresp_master.po ? xdr_ypresp_order.po ? xdr_ypresp_val.po ? xdr_ypstat.po ? xordi3.po ? yp_all.po ? yp_bind.po ? yp_first.po ? yp_get_default_domain.po ? yp_maplist.po ? yp_master.po ? yp_order.po ? yperr_string.po ? ypexclude.po ? ypmatch_cache.po ? ypprot_err.po Index: net/rcmd.c =================================================================== RCS file: /cvs/src/lib/libc/net/rcmd.c,v retrieving revision 1.56 diff -u -p -r1.56 rcmd.c --- net/rcmd.c 18 Nov 2009 07:43:22 -0000 1.56 +++ net/rcmd.c 9 Oct 2014 04:49:30 -0000 @@ -46,6 +46,7 @@ #include #include #include +#include int rcmd(char **ahost, int rport, const char *locuser, const char *remuser, @@ -63,7 +64,6 @@ rcmd_af(char **ahost, int porta, const c struct addrinfo hints, *res, *r; int error; struct sockaddr_storage from; - fd_set *readsp = NULL; sigset_t oldmask, mask; pid_t pid; int s, lport, timo; @@ -188,18 +188,14 @@ rcmd_af(char **ahost, int porta, const c write(s, "", 1); lport = 0; } else { + struct pollfd pfd[2]; char num[8]; int s2 = rresvport_af(&lport, af), s3; socklen_t len = sizeof(from); - int fdssize = howmany(MAX(s, s2)+1, NFDBITS) * sizeof(fd_mask); if (s2 < 0) goto bad; - readsp = (fd_set *)malloc(fdssize); - if (readsp == NULL) { - close(s2); - goto bad; - } + listen(s2, 1); (void)snprintf(num, sizeof(num), "%d", lport); if (write(s, num, strlen(num)+1) != strlen(num)+1) { @@ -210,12 +206,15 @@ rcmd_af(char **ahost, int porta, const c goto bad; } again: - bzero(readsp, fdssize); - FD_SET(s, readsp); - FD_SET(s2, readsp); + memset(pfd, 0, sizeof(pfd)); + pfd[0].fd = s; + pfd[0].events = POLLIN; + pfd[1].fd = s2; + pfd[1].events = POLLIN; + errno = 0; - if (select(MAX(s, s2) + 1, readsp, 0, 0, 0) < 1 || - !FD_ISSET(s2, readsp)) { + if (poll(pfd, 2, INFTIM) < 1 || + (pfd[1].revents & POLLIN) == 0) { if (errno != 0) (void)fprintf(stderr, "rcmd: select (setting up stderr): %s\n", @@ -288,14 +287,11 @@ again: goto bad2; } sigprocmask(SIG_SETMASK, &oldmask, NULL); - free(readsp); return (s); bad2: if (lport) (void)close(*fd2p); bad: - if (readsp) - free(readsp); (void)close(s); sigprocmask(SIG_SETMASK, &oldmask, NULL); return (-1);