HDTenEightyP/NetNews huggingface dataset:
From: bill@bailey.UUCP (Bill Glidden 882-8369)
Subject: Re: Process & Signal Question
Newsgroups: comp.unix.programmer,comp.unix.misc
Date: 15 Aug 92 05:39:24 GMT
Distribution: world
Organization: Ben Bailey's Home..Tampa Fl.

bill@bailey.UUCP (Bill Glidden 882-8369) writes:
> herberj@prism.CS.ORST.EDU (John Wesley Herberg) writes:
> > 
> > 1 - Is there an effecient way for one process to know if another is running 
> > when the only thing you know about it is its name.  The way I'm doing it now
> > is grabbing info for all the processes by using pstat(an HP-UX call) &
> > searching through that info for a matching process name.  Is there some type 
> > of call I could do on the executable to see if it is in use.  I noticed
> > make doesn't allow you to update a file when its being used - how does it know?
> > 
> Make knows the executable is in use because when you fopen or open a file for
> create and it is in use, the operating system returns an error condition to
> the calling program. Of course, I don't recommend this for your situation.
> 
You could also try opening the executable file in exclusive mode. However,
that may not be 100% reliable. For instance, someone may be compiling
the program and your program would not be able to open the file exclusively,
even if no one is currently executing it.
Newsgroups: comp.unix.programmer,comp.unix.internals
From: gram@aim1.aztec.co.za (Graham Wheeler)
Subject: Re: debugging streams
Organization: Aztec Information Management
Date: Fri, 14 Aug 1992 09:41:07 GMT

stanonik@nprdc.navy.mil (Ron Stanonik) writes:

>We're trying to track down a problem with a serial port.
>We'd like to "see" what's being passed between ldterm and fxm.

The way to do this is with a module that dumps messages. Such a module
is inlcuded in the STREAMS manual (although it has bugs). I have typed it
in and fixed the bugs I noticed, but I could never actually get it to
push. I posted it about a week or so ago, but if you can't find it, I can
repost it or mail it to you, if you are interested in trying to get it
to work.

-- 
Graham Wheeler                     | "That which is weak conquers the strong,
Software Systems Engineer/Student  | that which is soft conquers the hard."
Aztec Information Management/UCT   | 		Lao Tzu - Tao Te Ching Ch. 78
gram@aim1.aztec.co.za / gram@cs.uct.ac.za
From: rstevens@noao.edu (W. Richard Stevens)
Newsgroups: comp.unix.programmer
Subject: Re: SIGPIPE Delivery on socket close
Keywords: SIGPIPE signal TCP socket
Date: 23 Aug 92 12:16:15 GMT
Organization: National Optical Astronomy Observatories, Tucson, AZ, USA

In article <BtCqCG.DMw@usenet.ucs.indiana.edu> jackson@daimler.ucs.indiana.edu (Jeff Jackson) writes:
>
>In the client, after the server has timed out and closed the socket,
>I expected to get a SIGPIPE signal the next time I tried a write to 
>the socket. What I am finding is that the first write that I do to
>the socket completes normally - returning the number of bytes that
>were written. Sometimes even the second write will appear to succeed.
>Usually however the second or third write causes the SIGPIPE signal, which
>is trapped and closes the socket. 
>
>What needs to be done to get the SIGPIPE signal the FIRST time I write
>to the socket? 

You are encoutnering TCP's half-close.  The server's closing of its
socket causes its TCP to send a FIN.  That only closes the data flow
from the server to the client.  As far as the client's TCP is concerned,
it can still *send* data to the server.  Your first write will be OK,
but the server's TCP will respond with a RST (since the server really
terminated and didn't do a real half-close), which causes the second
client write to get SIGPIPE.  You can't change this--it's a TCP feature.

What you need to do is call select from the client--then the socket
will be marked readable in the client when the server terminates and
your read will receive an EOF.  Use that to not write anything else
to the server.

	Rich Stevens  (rstevens@noao.edu)
From: mwk@IMPAB.SE (Maria Waldemark)
Newsgroups: comp.unix.programmer
Subject: Exec a shell
Date: 21 Aug 92 17:38:27 GMT


	Hi,

	I want to run following command from a C-program by an exec call:

	>x.cmd param1 param2 ...

	Before x.cmd is executed I want to run the login shell.

	Everything works perfectly if I do as described below but it 
	only works from one user.

	--------------------------------------------------------------------

	freopen("/dev/null", "r", stdin);
	freopen("/user/mwk/log", "a", stdout);

	arg[0] = "-";
	arg[1] = "-c";
	arg[2] = "/user/mwk/x.cmd param1 param2";
	arg[3] = NULL;


	ret = execve("/usr/bin/sh", arg, env);


	--------------------------------------------------------------------

     mwk 29596     1  0 10:36:34 ?        0:00 - -c /user/mwk/x.cmd parma1 param2 
     mwk 29597 29596  0 10:36:34 ?        0:00 - -c /user/mwk/x.cmd param1 parma2 

	--------------------------------------------------------------------



	I want to do the execve call from a daemon, which has no controlling
	terminal. The daemon never runs the script !!!
	In the logfile /user/mwk/log there is only some debug prints from
	the daemon.

	
	Can someone help me please ?

	/Maria


-- 

  Maria Waldemark                   Tel: +46-8-6507525  Fax: +46-8-6502870
  IM Program AB						Email : mwk@impab.se
  Fleminggatan 56
S-112 45 Stockholm,  Sweden
Newsgroups: comp.unix.programmer
From: boyd@prl.dec.com (Boyd Roberts)
Subject: Re: Process & Signal Question
Organization: Digital Equipment Corporation - Paris Research Laboratory
Date: Wed, 19 Aug 1992 19:10:08 GMT

In article <shj.714240376@login.dkuug.dk>, shj@login.dkuug.dk (Stig Jacobsen) writes:
> True. Well, mostly. This may be a bug in the NFS implementation
> we're using, but if the binary is opened via NFS, you can unlink
> the file locally on the machine where the file resides. Odd.
> 

It's not odd if you know something about the implementation of NFS.
The server knows nothing about which files are being executed remotely.
Executables are read from the server, which explains why NFS imported
executables must be readable by the invoker.  Should such an executable
be removed on the server the process executing it on the server will
_probably_ die, depending on the executable's magic no and its memory
state.


Boyd Roberts			boyd@prl.dec.com

``When the going gets wierd, the weird turn pro...''
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.unix.programmer
Subject: Re: Socket breaking in mid transmission.
Date: 13 Aug 1992 09:47:29 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
NNTP-Posting-Host: gandalf.think.com
Keywords: TCP/IP sockets

In article <749@jahangir.UUCP> wayne@jahangir.UUCP (wayne) writes:
>    The problem being... The mac tends to crash in the 
>middle of a transmission. When this happens the sun 
>takes a *long* time to recognize that the connection is 
>broken. I suspect it's the mac's fault. Not closing it's
>device drivers when it goes south. 

If the Mac has crashed, then it has no opportunity to close device drivers,
since it just stops dead in its tracks.

If the Sun is transmitting when this happens, it will eventually time out
waiting for an acknowledgement.  However, this takes a long time, because
TCP connections are supposed to be resilient to temporary network problems
(for instance, if a router goes down, it can sometimes take a couple of
minutes for routing tables to stabilize with an alternate route).  There's
no way to tell whether the ack timed out because the destination is dead or
the network is disconnected, so it must make a conservative assumption.

If the Mac was transmitting when it crashed, then it's even harder to
detect it, since there's no way to know why it isn't transmitting (unless
your application is designed so that you can expect the Mac to send
something periodically).  You could try turning SO_KEEPALIVE on, though;
this causes the Sun to send an empty packet periodically, which should
elicity an ack if the Mac is still up.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Newsgroups: comp.unix.programmer
From: clennox@vaxeline.ftp.com (Systems Anarchist)
Subject: Re: Yielding a Timeslice
Organization: FTP Software, Inc., Wakefield, MA
Date: Thu, 20 Aug 1992 19:41:14 GMT

In article <1992Aug19.184837.24219@news.weeg.uiowa.edu> schwaigr@news.weeg.uiowa.edu (Jim Schwaiger) writes:
>Is there a standard (or commonly accepted) way for a program to yield
>its timeslice?  I have a program which checks on a condition in shared
>memory and would like to sleep (for less than 1 second) if that condition
>is not met, rather than waiting in the "hot" loop.

Try sleep(0).

-- 
%SYSTEM-F-ANARCHISM, the operating system has been overthrown
From: cse0935@desire.wright.edu
Newsgroups: comp.unix.programmer
Subject: profil() details?
Date: 21 Aug 92 19:43:00 GMT
Organization: Wright State University



Question.  Does anyone know where I can get detailed info on the
profile() and trace() system calls??? emphasis on DETAILED.

thanks in advance...

please respond to: jprikkel@discover.wright.edu
From: rrybacki@ringer.cs.utsa.edu (Richard M. Rybacki)
Newsgroups: comp.unix.programmer
Subject: Re: Process & Signal Question
Date: 18 Aug 92 20:55:21 GMT
Organization: University of Texas at San Antonio

In article <1992Aug18.145412.6352@wuecl.wustl.edu> pete@achilles.arl writes:
>>A vague memory tells me that on System V machines, demand-paged
>>executables which are in use (being executed) can't be overwritten. If you
>>could, horrid things would happen to the running process when it tried to
>>demand page from the executable. I believe the errno you get if you try to
>>open such an executable image for writing is ETXTBSY (Text File busy).
>>
>>Could someone confirm or deny this?
>
>I don't know about Sys V, but Sun OS 4.1.1 lets you do this.  On several occasions I have 
>installed a new executable for a running program and it's almost always resulted in 
>Bus Errors...  Nothing worse than that though...

If you are talking about a file which is being shared via NFS, this could
happen, because NFS does not completely implement the UNIX file deletion
semantics.  In the local filesystem case, this should not present a problem.
I believe Sun tried to mitigate this by renaming the deleted file on the
server side, but this does not help the case where two NFS clients are
sharing a single executalbe from a common server.
-- 
                            Richard M. Rybacki
                       rrybacki@ringer.cs.utsa.edu
                              (512) 731-0000
                          "Will consult for food"
From: udo@umunk.GUN.de (Udo Munk)
Newsgroups: comp.unix.programmer
Subject: Re: Receiving output of Shell script into C program?
Date: 14 Aug 92 20:01:59 GMT
Organization: umunk (private)
X-Newsreader: Tin 1.1 PL4

bibhas@pico.engr.mun.ca (Bibhas Bhattacharya) writes:
: I am new to UNIX/C. I don't know if it's a FAQ, but, I couldn't find anyway
: to communicate between shell scripts and C programs. It must be possible
: through files (hopefully in UNIX every data target/source is a file?).
: I'm not even thinking of ASCII files, which will work but would be
: hopelessly impractical.
: Any idea guys?
: Bibhas.

Open a pipe with pipe() and reconnect stdin and stdout with dup2() to the
pipe. Create a child process with fork() and exec() your shell script
from the child process. Now everything what the parent process writes
into the pipe goes to stdin of the shell script. Everything what the
shell script writes to stdout can be readed by the parent process from
the pipe.
--
Udo Munk     | voice:      +49 2131 275348             | uucp: +49 2131 278869
Oberstr. 21  | mail :      udo@umunk.GUN.de            |     2400/1200/300 8N1
4040 Neuss 1 | ...!{mcshh,smurf,unido}!easix!umunk!udo | MYNAME=bbsuser
Fed. Rep. of | CompuServe: 100021,2515                 | login: uucp
Germany      | at first connect get ~/info  and ~/files| pwd:   public
Newsgroups: comp.unix.programmer
From: ccx018@cch.coventry.ac.uk (Leslie Griffiths (Griff))
Subject: A regexp quickie
Summary: How to express a certain pattern
Keywords: regexp.
Organization: Coventry University
Date: Fri, 14 Aug 1992 07:38:15 GMT

Hi folks, I have a quick regexp query. Does anyone know how one would express
the regexp 'a word, surrounded either by whitespace OR at the beginning of a
line and ending in white space.'

e.g.

white

	or

    white

Its easy to express either of these

/^.*[ 	]*/

and

/[ 	][ 	]*.*[ 	][ 	]*/

But how would one express both in a regexp.

NOTE - I am using sed, so no full regexps, no | or +

Cheers


-- 
Griff				\\         	ccx018@uk.ac.cov
^^^^^		       		 :-=       	^^^^^^^^^^^^^^^^
		        	//
From: cmhui@cucs18.cs.cuhk.hk (Hui Chau Man)
Newsgroups: comp.unix.programmer
Subject: Oasys contact wanted
Date: 14 Aug 92 02:42:14 GMT
Organization: Faculty of Engineering, The Chinese U. of Hong Kong

Dear netters,

Can anybody tell me the contact FAX number of Oasys. Oasys is the
developer of Green Hill C and Green Hill C++ compiler.

Thanks in advance.


C.M. Hui
Dept. of Computer Science
The Chinese University of Hongkong
Shatin, N.T.
Hongkong

Internet: cmhui@cucs18.cs.cuhk.hk
FAX: (852) 6035024
Xref: sparky comp.unix.programmer:4275 comp.unix.questions:10039
From: bsullivn@sc.sni.ie (Bryan O'Sullivan)
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: dynamic link libraries on the sun
Date: 13 Aug 92 12:55:55 GMT
Article-I.D.: sc.155
Reply-To: bryan@sc.sni.ie
Organization: Siemens-Nixdorf Software Development Centre, Dublin
X-Newsreader: Tin 1.1 PL3



mirchand@dendrite.cs.unc.edu (Jaideep Mirchandani) writes:
: I know about dlopen/dlsym/dlclose, but :
: 1. Isn't there an export file anywhere ? Hpw does the dll advertise the
: symbols that it has ?

It doesn't.  They're stored in the object file symbol table.

: 2. Which ld option is used ? The man page says something about -B. It also
: mentions something about running ld twice, but is doesn't specify how
: all this is done.

The -G option to ld combines a number of relocatable object files into a
shared object.

	-- Bryan
-- 
Bryan O'Sullivan                                             +353-1-767551 x225
Siemens-Nixdorf Informationssysteme AG                          bryan@sc.sni.ie
Software Development Centre                    "Theory like mist on eyeglasses.
Dublin                                          Obscure facts." -- Charlie Chan
Newsgroups: comp.unix.programmer
From: larry@acts.uucp (Larry Palmer)
Subject: Problem with gdb/Sun?
Organization: Active Software Inc.
Date: Sat, 15 Aug 92 14:48:05 GMT


We've been experiencing a problem running gdb inside emacs (on a Sun 4).
Occasionally someone's target program gets a bus error or segmentation
violation.  If they accidently "continue" gdb, instead of restarting
the program, the ethernet lights up solid with what appear to be
continuous NFS requests, and all attached X-terminals become totally
unresponsive.  So far rebooting has been the only fix.

Configuration is SunOS 4.1.2, emacs 18.58.1, gdb 4.6.  Emacs is run on
an X-terminal logged into workstation A, directory with the target
being debugged and source code is NFS mounted from workstation B (also
a Sun 4).  If it's at all relevant, the debugged target makes some
minimal use of the Sun lightweight processes library (switching
between threads, but only one thread ever runs at a time).

Any ideas?

-- 
Larry Palmer 508-266-1334 (v/f)           |   Active Software, Inc.
uunet!acts!larry, or                      |   20 Ethan Allen Drive
larry%acts@uunet.uu.net                   |   Acton, MA 01720
Newsgroups: comp.unix.programmer
From: crash@ckctpa.UUCP (Frank "Crash" Edwards)
Subject: docs for SVR4 form(3x), menu(3x), and panel(3x)
Date: Thu, 13 Aug 1992 06:47:10 GMT
Reply-To: crash%ckctpa@tct.com (Frank "Crash" Edwards)
Organization: Edwards & Edwards Consulting

Hi all!

As mentioned in the subject line, I'm looking for documentation on
the three curses add-on packages under SVR4 called forms(3x),
menus(3x), and panels(3x).  Under AmigaUnix I've got a minimal set of
man pages that describe the prototypes for the functions but no
examples or overall conceptual guideline.

I'd prefer some form of on-line docs, but I'm not against going into
BookStop and looking for hardcopy (in fact, I'll do that later today).

Thanks for the help.
-- 
Frank "Crash" Edwards            King Marine Electronics, Inc.
Home: 813/786-3675               Work: 813/530-3411
Newsgroups: comp.unix.programmer
From: murthy@ee.uwm.edu (Murthy Nyayapati)
Subject: Newuser program for a University
Organization: University of Wisconsin, Milwaukee
Date: Mon, 17 Aug 1992 17:41:12 GMT

Hi!

I am currently managing two machines which run Unix (HP-UX and DEC/Ultrix).

Being a university,  we have to constantly add accounts and before giving
the 
accounts we should be able to check for their validity.  I have been assigned 
to write a "newuser" program for these machines.  All the necessary security
checks should be done.  A "valid" student should be able to sit at a terminal
and "give" himself/herself an account.  We get a tape of all the list to students
who are registered.

Before I start working on this, I just wanted to find out if there is any
free/shareware software available.  Basically, I am looking for this program
from any university/institution where it is currently being used.  I can
"tailor-fit" the program to suit our needs.

Any input from anyone in this regrad is appreciated.

Thanks a lot in anticipation.

Murthy Nyayapati
Systems Administrator
University of Wisconsin-Milwaukee
murthy@ee.uwm.edu
Newsgroups: comp.unix.programmer
From: pete@achilles.arl (Peter Flugstad,,,)
Subject: Re: Process & Signal Question
Reply-To: pete@achilles.arl
Organization: Washington University, School of Engineering, St. Louis MO
Date: Tue, 18 Aug 1992 14:54:12 GMT

In article 9JI@gumby.ocs.com, obi@gumby.ocs.com (Kuryan "Obi" Thomas) writes:
>In article <1657227@bailey.UUCP>, bill@bailey.UUCP (Bill Glidden 882-8369)
>writes:
>> Make knows the executable is in use because when you fopen or open a file for
>> create and it is in use, the operating system returns an error condition to
>> the calling program. Of course, I don't recommend this for your situation.
>
>A vague memory tells me that on System V machines, demand-paged
>executables which are in use (being executed) can't be overwritten. If you
>could, horrid things would happen to the running process when it tried to
>demand page from the executable. I believe the errno you get if you try to
>open such an executable image for writing is ETXTBSY (Text File busy).
>
>Could someone confirm or deny this?


I don't know about Sys V, but Sun OS 4.1.1 lets you do this.  On several occasions I have 
installed a new executable for a running program and it's almost always resulted in 
Bus Errors...  Nothing worse than that though...
From: ravikm@austin.ibm.com (Ravi K Mandava)
Newsgroups: comp.unix.programmer
Subject: Re: Converting inet names/addresses....
Keywords: gethostbyname() , etc....
Date: 18 Aug 92 21:07:19 GMT
Reply-To: piobe!ravikm@ibmpa.awdpa.ibm.com
Distribution: usa
Organization: IBM Austin
Originator: ravikm@piobe.austin.ibm.com


In article <1992Aug17.214158.6393@ncar.ucar.edu>, morreale@niwot.scd.ucar.edu (Peter W. Morreale, SCD Consulting) writes:
 > On a Sun, I need the ability to convert:
 >      foo.bar.edu
 > To it's inet number:
 >     128.???.??.??
 > (both are character strings....)
 > 
 > I've found gethostbyname(3) which returns the proper host (and an
 > address in network byte order), and also inet_ntoa(3) (which converts a
 > struct in_addr to the proper form) but for the life of me I can't figger
 > out how to create a proper struct in_addr for inet_ntoa().  What I need
 > is a:
 > char *get_inet_a_addr_from_host_name(char *hostname) 

 You're pretty close to the solution.  gethostbyname() returns host addresses
 in network long format in the member h_addr_list of struct hostent.  Note
 that this member is of type 'char **', and with a suitable cast to struct
 in_addr for each char pointer, you should be able to get the inet address
 in the format *.*.*.*.  An example piece of code is included below.  Tailor
 it to suit your requirements (char *get_inet_a_...).

--------------------------------------------------------------------------
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>

int
main(int argc, char **argv)
{
   struct hostent	*hp;

   if (argc < 2) {
      (void)fprintf(stderr, "Usage: %s hostname\n", *argv);
      exit(1);
   }
   if (!(hp = gethostbyname(*(argv+1)))) {
      perror("GETHOSTBYNAME");
      exit(2);
   }
   while (hp->h_addr_list && *hp->h_addr_list)
      (void)printf("Inet Address = %s\n",
		   inet_ntoa(*(struct in_addr *)*hp->h_addr_list++));

   return 0;
}
--------------------------------------------------------------------------

Hope this helps,
-- 
*******************************************************************************
Ravi K Mandava		email:	piobe!ravikm@ibmpa.awdpa.ibm.com
*******************************************************************************
From: carpenter@vixvax.mgi.com
Newsgroups: comp.unix.programmer
Subject: another curses question
Date: 20 Aug 92 13:49:34 CDT
Organization: Management Graphics, Inc.

Another question from a curses neophyte:

According to the man pages, a call to initscr() sets things up so
that the first call to refresh() will clear the screen.  I'd like to
create a window that occupies only the bottom line or two of the screen,
and have everything else left alone.  Is there a way?
============================================================================
"Far away is far away only if you don't go there."
============================================================================
Dave Carpenter                                       Voice:  +1 612 851 6142
Management Graphics                                    FAX:  +1 612 851 6159
1401 E. 79th St.                        Internet:   carpenter@vixvax.mgi.com
Bloomington, MN   55425 USA

Newsgroups: comp.unix.programmer
From: dbrillha@dave.mis.semi.harris.com (Dave Brillhart)
Subject: Re: Threads quotation (Re: A question on style ...)
Date: Wed, 12 Aug 1992 13:18:54 GMT
Reply-To: dbrillha@dave.mis.semi.harris.com (Dave Brillhart)
Organization: Harris Semiconductor

Tim Goodwin writes:

>Anyway, my interpretation of this comment is that UNIX processes
>originally *were* "light weight", and the current vogue for putting
>threads inside UNIX processes illustrates how far we have strayed from
>the minimalist path.

"Classic" UNIX processes are by definition *not light weight*. Although
I've never used LWPs, I believe they are called LW because they don't
carry around all the baggage of a "classic" process (additional kernel
tables, ...) and operate within the address space of the parent.

>This has nothing to do with C.  Followups to comp.unix.programmer.

But it does have everything to do with UNIX.PROGRAMMING.

--
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 Dave Brillhart                              Harris Semiconductor
 dbrillha@dave.mis.semi.harris.com           Mail Stop 62A-024
 Voice: (407) 729-5430                       P.O. Box 883
 Fax:   (407) 724-7486                       Melbourne, FL 32902-0883
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Newsgroups: comp.unix.programmer,comp.unix.