Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!elroy.jpl.nasa.gov!decwrl!pa.dec.com!mogul From: mogul@wrl.dec.com (Jeffrey Mogul) Newsgroups: comp.unix.ultrix Subject: Re: problem with gethostname() under 4.1 Message-ID: <1991Jan26.021822.28952@pa.dec.com> Date: 26 Jan 91 02:18:22 GMT References: <40589@ucbvax.BERKELEY.EDU> Sender: news@pa.dec.com (News) Organization: DEC Western Research Lines: 31 In article <40589@ucbvax.BERKELEY.EDU> robm@janus.Berkeley.EDU (Rob McNicholas) writes: >I am trying to get nfswatch running on my DECstation 3100 (24 meg, >ultrix 4.1, Rev. 52). However, the program always immediately exits >with a "No such file or directory" error. Using gdb, I have >traced the error down to a "gethostname" call. When run from the >debugger, I get this output: > >(gdb) >154 if (gethostname(myhost, sizeof(myhost)) < 0) { >(gdb) >gethostname () (../gethostname.s line 18) >../gethostname.s: No such file or directory. I don't use gdb, but almost certainly the "No such file or directory" message you are getting from gdb has nothing to do with the "No such file or directory" message you are getting from nfswatch. Gdb is merely telling you that it cannot find the source file for the gethostname() function. The gethostname() system call cannot return this error code. My guess is that your error comes when the program tries to open the packet filter pseudo-device. Before you can use nfswatch (or similar programs such as tcpdump), you must (1) configure your kernel to include the packet filter ("man 4 packetfilter" for details.) (2) create the proper entries in /dev/pf (again, "man 4 packetfilter") (3) do "/usr/etc/pfconfig +p -a" ("man 8 pfconfig") (Failing to do step #3 will not cause your error message, it will simply cause the program to be very boring.) -Jeff