HDTenEightyP/NetNews huggingface dataset:
Newsgroups: comp.unix.programmer
Subject: Re: writing servers
From: vpopesc@opus.uucp (Gov. Wilson Sucks)
Date: 9 Sep 92 14:02:43 PDT
Distribution: usa
Organization: California State University, Lost Angels

In article <18kca3INNr52@early-bird.think.com> barmar@think.com (Barry Margolin) writes:
>In article <1992Sep8.230315.2621@nic.csu.net> vpopesc@opus.uucp (Gov. Wilson Sucks) writes:
>>[Hope this doesn't go out in multiplicate. Having posting problems]
>
>There were four copies of the message in the one posting.  Is that what you
>meant?
>

Yes, I am sorry about that. I would cancel them, HOWEVER I only got ONE
copy posted that *I* can see. If that is a major hassle, maybe someone
can cancel them for me.

-- 
_____________     __      ____________ 
\_____      /    /_ \     \     _____/ Valentin Popescu
 \_____     \_____/  \____/     ____/  <vpopesc@opus.calstatela.edu>
  \______________      ____________/   P.O. Box 421181
Newsgroups: comp.unix.programmer
From: chetal@is.morgan.com (Pradeep Chetal)
Subject: Re: Detecting a broken socket
Organization: Morgan Stanley & Company
Date: Tue, 8 Sep 1992 03:04:58 GMT

In article <camh.715839302@balrog> camh@nms.otca.oz.au (Cameron Hutchison) writes:
Path: is1.is.morgan.com!s5!uunet!usc!rpi!batcomputer!munnari.oz.au!metro!otc!balrog!camh
   From: camh@nms.otca.oz.au (Cameron Hutchison)
   Newsgroups: comp.unix.programmer
   Keywords: socket, SunOS, keep_alive
   Date: 7 Sep 92 04:15:02 GMT
   Sender: news@otc.otca.oz
   Lines: 37

   I have a problem with a socket connection that I cant seem to find a
   solution for. I am trying to detect when the remote end of a socket dies.
   I am doing all this on Sun 4's running SunOS 4.1.2.

   My method of testing the keep alive timer was to have a server
   machine "emulating" the comms server (from the standpoint of a socket
   connection) and a client machine to connect to it. I then simulated
   the dropping of the connection by pulling the network connection
   to the server machine. I let the client machine run for about 45
   minutes before giving up. The client machine did not detect the
   broken connection.

Regarding KEEPALIVE time interval:

#define TCPTV_KEEP_IDLE (120*60*PR_SLOWHZ)      /* dflt time before probing */

I think it is 2 hours as per /usr/include/netinet/tcp_timer.h on our Suns.

/Pradeep
--
----------------------------------------------------------------------------
Pradeep Chetal                                          Phone: 81-3-3286-9678
Information Services Deptartment                          FAX: 81-3-3286-9040
Morgan Stanley Japan Ltd.  Tokyo Branch            E-mail: chetal@is.morgan.com
        Ote Center Bldg. 3F, 1-1-3 Otemachi, Chiyoda-ku, Tokyo 100
Newsgroups: comp.unix.programmer
From: schemers@Slapshot.Stanford.EDU (Roland Schemers)
Subject: Re: pathname "cleanup" routine
Organization: Distributed Computing Group, Stanford University
Date: Thu, 10 Sep 92 15:04:54 GMT

In article <HURTTA.92Sep10142337@plootu.Helsinki.FI>, hurtta@cs.Helsinki.FI (Kari E. Hurtta) writes:
|> In article <1992Sep10.043443.20693@leland.Stanford.EDU> schemers@leland.Stanford.EDU (Roland Schemers) wrote:
|> 
|> Warning:
|> 
|> if tmp is symbolic link, then
|> 	tmp/../foo	isn't same as	foo 
|> 
|> - K E H

Yup. Thats why I tempted to just expand ~ and environment variables, then
do a chdir(path), followed by a getwd to get the cleaned up version. This
is for a Motif directory browser anyways, so doing a chdir to the current
directory your browsing is probably a good thing.

-- 
Roland J. Schemers III              |            Networking Systems
Systems Programmer                  |            168 Pine Hall   (415)-723-6740
Distributed Computing Group         |            Stanford, CA 94305-4122
Stanford University                 |            schemers@Slapshot.Stanford.EDU
From: rz64938@mystic.d50.lilly.com (David W. Crumbacher)
Newsgroups: comp.unix.programmer
Subject: Checking if a process exists
Date: 14 Sep 92 20:04:36 GMT
Reply-To: rz64938@mystic.d50.lilly.com (David W. Crumbacher)
Distribution: world,local


Is there a way in C to check if a certain process is running?
--
+--------------------------------------------------------------+---------+
| David W. Crumbacher            |  e-mail: dwc@lilly.com      |         |
| Scientific Information Systems |  Phone : (317) 276-5345     |    o    |
| Lilly Research Laboratories    |  FAX   : (317) 276-4127     |   (     |
| Eli Lilly and Company          |  These are my own opinions, |   [\.   |
| Indianapolis, Indiana 46285    |  not my employer's.         |         |
|            *** Please respond to dwc@lilly.com ***           |         |
+--------------------------------------------------------------+---------+
Newsgroups: comp.unix.programmer
From: rande@rtsg.mot.com (Kristian V. Rande)
Subject: How To Get A List of Processes
Organization: Motorola Inc., Cellular Infrastructure Group
Distribution: usa
Date: Wed, 9 Sep 1992 22:01:36 GMT

I'm trying to get a list of active processes from within some C code running
on a Sun 3/60.  So far I've been having a lot of trouble, though, and I'm
hoping that somebody can give me some help.

I believe I need to use the kernel library routines kvm_open(),
kvm_nextproc(), and kvm_close() to obtain structures of the type defined in
the header file <proc.h>.  Unfortunately I get

    "cannot open /dev/mem: Permission denied" or

    "cannot open /dev/kmem:  Permission denied"

errors whenever I run my code.  I think this is because I have no access to
these special files.  An "ls -lgF" on these two files yields:

   crw-r-----  1 root     kmem       3,   1 Jul 10  1990 /dev/kmem
   crw-r-----  1 root     kmem       3,   0 Aug 10  1990 /dev/mem

I don't have root access, nor do I have kmem group access.

Here's the test code fragment that makes the calls:

   if ( ( kd = kvm_open( NULL, NULL, NULL, O_RDONLY, "test" ) ) != NULL )
   {
      info = kvm_nextproc( kd );
      printf( "pid = %d  uid = %d\n", info->p_pid, info->p_uid );
      kvm_close( kd );
   }


My questions are:

   1. Is there any way I can legitimately get around the mode restrictions
      on "/dev/kmem" so that I can use kvm_nextproc()?

   2. Is there another way that I can get information about all of the
      other active processes in the kernel?

Thanks for any help you can give me.

  ----------------------------------------------------------------------
  Kris V. Rande                                "My opinions are my own."
  Motorola Radio Telephone Systems Group
  Arlington Heights, Illinois                         rande@rtsg.mot.com
From: hurtta@cs.Helsinki.FI (Kari E. Hurtta)
Newsgroups: comp.unix.programmer
Subject: Re: Programming sub-second delays in C programs.
Date: 8 Sep 92 19:05:50 GMT
Organization: Department of Computer Science, University of Helsinki, Finland

In article <1992Sep8.155916.1087@mcshub.dcss.mcmaster.ca> krasnor@nimios.eng.mcmaster.ca (Carl Krasnor) wrote:
> How does one program a sub-second delay under Unix? What I need is a version
> of sleep() which can get down to 10 millisecond resolution instead of just
> whole seconds. 
> 
> I would like to do this both under SunOS and System V.
> 
> I will summarize to the newsgroup if the response justifies it.

Following system calls are possible:

1) usleep
2) select
3) poll
4) setitimer

These are wanted resulution timer. (These all are available in
SunOS): I guess that 3) and perhaps 2) and 4) are in System V.

- K E H "I don't know"
From: avinash@felix.contex.com (Avinash Chopde)
Newsgroups: comp.unix.programmer
Subject: Detecting a broken (socket) connection before write()
Date: 15 Sep 92 19:39:05 GMT

I am looking for functions similar to feof() ferror() for file
descriptors.
For example, if a socket fd connection has been broken, writing
to that fd will result in a Broken Pipe signal.
I would like to detect the broken pipe before writing to it, is this
possible at all ? 

Thanks for any pointers....
-- 
---------------------------
Avinash Chopde         office : 617 246 1776x5582
avinash@contex.com     (...!uunet!contex!avinash)
Xref: sparky comp.unix.programmer:4632 comp.unix.questions:10970 comp.unix.admin:5012
From: nadeau@JSP.UMontreal.CA (Nadeau Jean-Claude)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.admin
Subject: Re: two questions
Date: 11 Sep 92 19:52:57 GMT
Organization: Universite de Montreal

In article <1992Sep4.153813.18069@cs.wayne.edu> upkar@eng.wayne.edu.UUCP (Upkar Singh Kohli) writes:
>
>1. What is the best way to disable echo from within a C program?
>   The purpose is read a password.
>
	See the "getpass" (3) standard function.

>2. What is the best unique identifier for machines to use for
>   software licensing? I have heard that even the "effective"
>   ethernet address can be changed. I know the hostids can easily
>   be changed on certain architectures like DEC and SGI.
>
	Some machines have a node id in a ROM on the mother board
	(Apollo work station per example).  But there's no
	universal way to use this feature.  Sorry ;-(

>Thanks!
>Upkar
>
	You are welcome

>(if possible please email upkar@eng.wayne.edu... followup over
> news will be ok too, except I read it less)


-- 
Jean-Claude Nadeau, ing.	<nadeau@JSP.UMontreal.CA>
Services informatiques		<nadeau@ERE.UMontreal.CA>
Universite de Montreal		<nadeau@UMTLVR.BITNET>
Tel. (514) 343-6111,ext 5234	Fax  (514) 343-2155
Newsgroups: comp.unix.programmer
From: casper@fwi.uva.nl (Casper H.S. Dik)
Subject: Re: Sun's XDR routines won't work on Sun machines ...
Organization: FWI, University of Amsterdam
Date: Thu, 10 Sep 1992 13:02:05 GMT

mauriti@cs.tu-berlin.de (Frank Hartlep) writes:


>... although they do on a NeXT.
>Perhaps somebody can see an error in this code.

Funny, someone has exactly the same problems as you did, some days ago.

>        xdrmem_create (&Stream, Buffer + Offset, BufferSize - Offset, XDR_ENCODE);

This call is in error: Offset is not guaranteed to be a multiple of
4 bytes in your code, but the documentation says it should be.
Sun forgot to document that you should properly align the ``Buffer + Offset''
parameter on a 4 byte boundary. The Bus error is an alignment error
(Dbx will tell you as much). NeXTs don't require strict alignment,
but the code will run slower. The culprit is xdrmem_*long where
a char * is cast to a long *. For efficiency's sake, I expect that
Sun will change the documentation, not the code.

Casper
-- 
						|	Casper H.S. Dik
						|	casper@fwi.uva.nl
Newsgroups: comp.unix.programmer
From: scairns@is.morgan.com (Scott Cairns)
Subject: malloc() and free()
Organization: Morgan Stanley - IS
Date: Tue, 8 Sep 1992 21:19:47 GMT


When I free(3) a memory block/pointer previously allocated by a call
to the malloc(3) family of calls, what happens to that previously
allocated memory?

It's always been my understanding that this memory has been free()'d
but only to the process which initially malloc()'ed it.  Is this
correct?  If so, how does that process reuse this freed memory?

-- 
+------------------------------------------------------------------+
| Scott Cairns           	|   email: scairns@fsg.com         |
| Fusion Systems Group		|      or: scairns@is.morgan.com   |
| New York, New York, USA   	|                                  |
+------------------------------------------------------------------+
| Standard disclaimers apply.   				   | 
+------------------------------------------------------------------+
| Better not take a dog on the space shuttle, because if he sticks |
| his head out the window coming home, his face might burn up.     |
|    					- Jack Handey		   |
+------------------------------------------------------------------+
From: camh@nms.otca.oz.au (Cameron Hutchison)
Newsgroups: comp.unix.programmer
Subject: Detecting a broken socket
Keywords: socket, SunOS, keep_alive
Date: 7 Sep 92 04:15:02 GMT

I have a problem with a socket connection that I cant seem to find a
solution for. I am trying to detect when the remote end of a socket dies.
I am doing all this on Sun 4's running SunOS 4.1.2.

The situation is that I have an open socket to a comms server that
occasionally dies. When this happens I would like to close down the
connection and open a new one. However, I cant seem to find any way
of telling when the other end of the socket dies. Normally I would
be able to tell because a write(2) would fail, but in this instance,
I'm only reading from the socket.

I have experimented with the keep alive timer option but I cant seem
to get it to work. I set the option correctly with setsockopt(2) (and
have verified that it is set by reading it back with getsockopt(2)).
As I understand it, my select(2) call will return with a read ready
on the broken socket and the read(2) will return 0 bytes. This just
isn't happening. The select does not return.

My method of testing the keep alive timer was to have a server
machine "emulating" the comms server (from the standpoint of a socket
connection) and a client machine to connect to it. I then simulated
the dropping of the connection by pulling the network connection
to the server machine. I let the client machine run for about 45
minutes before giving up. The client machine did not detect the
broken connection.

Another solution might be to periodically check the socket. However,
I don't know how to check the socket. I don't want to do any reads or
writes (ie the check must be passive) and I could see no other system
calls available that might help.

Does anybody have any clues as to what is going on with the keep
alive timer, or failing that, a way to periodically check the socket?

--
Cameron Hutchison (camh@nms.otca.oz.au)
Beware of the clams
Newsgroups: comp.unix.programmer
From: mjo@ef2007.efhd.ford.com (Mike O'Connor)
Subject: Re: I need PD ansi C (full) LIBC
X-Disclaimer: Not an official spokesperson for Ford OPEO
Reply-To: Mike O'Connor <mjo@fmsrl7.srl.ford.com>
Organization: International Affairs, Overseas Engineering, "Fordz"
Date: Tue, 8 Sep 1992 11:39:43 GMT

In article <AAQGsggKI1@soft.sapsan.msk.su> ddw@soft.sapsan.msk.su writes:
:Has anybody ANSI C public domain libc (portable) ?
:I need internationals functions.
:Help me please.

Get gcc and the glib code, available for anonymous FTP from prep.ai.mit.edu.

						...Mike

-- 
 Michael J. O'Connor           |  Internet:  mjo@fmsrl7.srl.ford.com
 Ford Motor Company, OPEO      |  UUCP:      ...!{backbone}!fmsrl7!mjo
 20000 Rotunda, Bldg. 1-3001   |  Phone:     +1 (313) 248-1260
 Dearborn, MI  48121           |  Fax:       +1 (313) 323-6277
Newsgroups: comp.unix.programmer
From: krasnor@nimios.eng.mcmaster.ca (Carl Krasnor)
Subject: Programming sub-second delays in C programs.
Followup-To: poster
Organization: Communications Research Laboratory, McMaster Univ
Date: Tue, 8 Sep 1992 16:52:12 GMT

Forgive me if I am asking a question which is widely known but I have Read
The Fine Manual ad nauseum and cannot answer this question:

How does one program a sub-second delay under Unix? What I need is a version
of sleep() which can get down to 10 millisecond resolution instead of just
whole seconds. 

I would like to do this both under SunOS and System V.

I will summarize to the newsgroup if the response justifies it.

Thanks in advance for your suggestions.
-- 
===============================================================================
Carl Krasnor, Communications Research Lab, McMaster U., Hamilton, Ont. CANADA
krasnor@McMaster.CA   VE3EGK   Tel:(416) 525-9140 x4171    FAX:(416) 521-2922
===============================================================================
From: ggraham@utdallas.edu (Gregory S. Graham)
Newsgroups: comp.unix.programmer
Subject: Curses help
Summary: I need to know how to make the cursor invisible.
Keywords: curses, cursor, curs_set, leaveok
Date: 10 Sep 92 15:11:48 GMT
Distribution: usa
Organization: Univ. of Texas at Dallas

I have been unable to get curses to cause the cursor to not appear on the
screen.  I have tried the curs_set and leaveok calls, both of which the man
page says can turn off the cursor.  I get ERR returned from curs_set and
leaveok does not turn off the cursor.

I am using a Silicon Graphics 340VGX with IRIX 4.0.1.  I am using a VT220
terminal or a PC running NCSA telnet with the TERM environment variable
set to vt100.  I have the same problem using the SGI console window with
TERM=iris-ansi.  I have also tried this on a Sun 4 running Sun OS 4.1.1 with
the NCSA telnet PC for a terminal and the results were the same.

I would appreciate any help.

Code example follows:

#include <curses.h>
main()
{
	char c;
	int i;

	/* setup curses */
	initscr();
	cbreak();
	noecho();

	/* two attempts to turn off the cursor */
	leaveok(stdscr, TRUE);
	i = curs_set(0);

	/* test message */
	mvaddstr(3, 4, "");
	mvprintw(4, 4, "Cursor Test, curs_set returns %d", i);
	refresh();

	/* wait for a keypress so that screen can be observed */
	c = getch();
	endwin();
}
From: Chuck.Phillips@FtCollinsCO.NCR.COM (Chuck Phillips)
Newsgroups: comp.unix.programmer
Subject: Re: File Locking across NFS mounts
Date: 10 Sep 92 10:13:22 GMT
Followup-To: comp.unix.programmer
Organization: NCR Microelectronics, Ft. Collins, CO
In-reply-to: lebrun@ll.mit.edu's message of 8 Sep 92 21:04:45 GMT

>>>>> On 8 Sep 92 21:04:45 GMT, lebrun@ll.mit.edu ("Steven F. LeBrun") said:
Steven> Submitted-by: lebrun@ll.mit.edu ("Steven F. LeBrun")

Steven> I am looking for a method of file locking what works across NFS
Steven> mounted directories and am interested on what methods other people
Steven> are using.

Steven> I tried flock() and discovered a bug that only exists if the file 
Steven> being locked is a remote (NFS) file.  If a program terminates without 
Steven> unlocking an NFS file (due to a system reboot, user abort, program 
Steven> bug [this is how I discovered the problem -- bugs can be useful at 
Steven> times :-) etc.] the file remains locked so that no other programs 
Steven> can access the file.

Under SunOS, lockf() (and fcntl() based locks) are supposed to work with NFS.
I say "supposed" because this feature was broken in early versions of SunOS
4.0.x, fixed, then broken again with the initial release of 4.1.  I don't
know the current status, but while it _was_ working, we were able to lock
files across Sun and non-Sun machines.  Because it broke again, we were
forced to find alternate solutions as were a few of our software suppliers.
--
Chuck Phillips  MS440
NCR Microelectronics 			Chuck.Phillips@FtCollinsCO.NCR.COM
2001 Danfield Ct.
Ft. Collins, CO.  80525
From: sinclair@dcs.glasgow.ac.uk (Duncan Sinclair)
Newsgroups: comp.unix.programmer
Subject: FIFOs vs. pipes w.r.t EOFs and select
Date: 6 Sep 92 19:33:12 GMT
Organization: Glasgow University Computing Science Dept.

I've just been messing about with pipes, and named pipes, and
found a strange problem.

When I'm selecting on a normal pipe, and the other side closes it,
select wakes up on that pipe, and I get an eof.  That's what I expect.

When I'm selecting on a named pipe, and the other side closes it,
select doesn't wake up, and so I dont get to see any eof that may
or may not be there.  This doesn't seem right.

The standard reason for not getting eofs, is because some other process
has the descriptor open, but this doesn't seem likely in this case.  I
don't get the problem with normal pipes, and I'm creating the named
pipes with a compatibility routine to make them look like normal pipes,
so I don't see where the difference could be.

This is with SunOS 4.1.1.  Is this behaviour normal, or is it a problem
with Sun's implementation, or is it me just screwing up as usual?



-- 
Duncan Sinclair                     |  Try one    sinclair@dcs.glasgow.ac.uk
Computing Science Research Student  |  of these:  sinclair@uk.ac.glasgow.dcs
University of Glasgow               |..!mcsun!ukc!uk.ac.glasgow.dcs!sinclair
           ---  Rave Culture: Don't techno for an answer.  ---
Newsgroups: comp.unix.programmer
From: bosullvn@unix1.tcd.ie (Bryan O'Sullivan)
Subject: Re: Dynamic linking
Organization: Department of Computer Science, Trinity College, Dublin, Ireland
Date: Wed, 9 Sep 1992 19:33:40 GMT

kly@sci.ccny.cuny.edu (Gregory Kozlovsky) writes:

>I have written an interpreter and I would like to have the capability
>to link and call C functions in run-time. These C functions would be
>created in a separate source file which then will be compiled. The tricky
>part is to link .o file with the interpreter and to call the function.

>I remember this question being discussed two years ago and somebody
>named Wilson Ho offered a package called DLD for dynamic linking.
>Are you still on the net Wilson?

He's now working for MIPS/SGI; I don't know if he has net access.
In any case, the answer you need is yes.  Last time I looked, DLD
was available for anonymous FTP from prep.ai.mit.edu (18.71.0.38).
However, it only runs under BSD flavours of UNIX at the moment, as
I recall; I don't think it is likely to support ELF or other library
formats in the foreseeable future (according to Wilson).

	-- Bryan

--
Bryan O'Sullivan                                                 +353-1-767551
Advanced Development Group                               bosullvn@unix1.tcd.ie
Department of Computer Science            "No matter how cynical you are, it's
University of Dublin                       hard to keep up." -- Woody Allen
From: dickerso@fester.dell.com (Russell Dickerson - X5409)
Newsgroups: comp.unix.programmer
Subject: Finding out if output is available in a FILE *
Date: 10 Sep 92 21:01:11 GMT
Reply-To: dickerso@cpat.stortek.com
Distribution: usa
Organization: IO SpecialistsConsulting

I'm trying to filedesc = popen(...) in a program.  I've had it working
for a while but would like to modify it so I can check to see if there
is any output before I attempt to read from the pipe since the read is
blocking.  Since this is in an X program, blocking is not desirable.

I saw something posted akin to this some time back but I can't find the
printout.

reply>>> dickerso@cpat.stortek.com
--
-----------------------------------------------------------------------
Russell Dickerson	Unix/X Consultant	IOSpecialists
(303) 673-5409 ---REPLY TO>>> dickerso@cpat.stortek.com <<<!!!!--------
#include <standard.disclaimer>