HDTenEightyP/NetNews huggingface dataset:
From: schemers@leland.Stanford.EDU (Roland Schemers)
Subject: pathname "cleanup" routine
Organization: Distributed Computing Group, Stanford University
Date: Thu, 10 Sep 92 04:34:43 GMT

Before I reinvent the wheel, does anyone have or know of a
pathname "cleanup" function that will do the following:

Remove  "/../" and "/./" and "//" from a path.
Expand ~ and environment variables.
Add leading "/" if not present.

It shouldn't check for the existence of the file, just cleanup the 
path.

Examples:

      input          output
   -------------    ---------
   ///../tmp          /tmp
   ///../tmp/../bar   /bar
   ~foo/stuff         /u/foo
   bar                /u/foo/bar  (current dir is /foo/u)
   /usr/./bin         /usr/bin
   $HOME/$MACHINE     /u/foo/mips

Seems like a simple state machine might do it.
Note I can't just pass it off to csh since I want to clean
up stuff like "/../" also.

thanks, Roland
--
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

-- 
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
Newsgroups: comp.unix.programmer
From: dsiebert@icaen.uiowa.edu (Doug Siebert)
Subject: Must Unix domain sockets have a pathname?
Date: Tue, 15 Sep 1992 06:03:17 GMT
Organization: ISCA

Does a Unix domain socket (datagram, where sockets would be sending datagrams
of from 5 - 500 bytes each to each other between processes) have to be bound
to a name in the Unix filesystem?  From the man pages I'd have to say "yes",
but I distinctly remember a few times seeing something that made me think that
unnamed sockets could exist.  I know they can for sending to a named socket,
but I'd have to name the other end...

Its a really trivial point, I know, but it has me curious.

-- 
/-----------------------------------------------------------------------------\
| Doug Siebert                             | "I don't have to take this abuse |
| Internet:  dsiebert@isca.uiowa.edu       |  from you - I've got hundreds of |
| NeXTMail:  dsiebert@chop.isca.uiowa.edu  |  people waiting in line to abuse |
|     ICBM:  41d 39m 55s N, 91d 30m 43s W  |  me!"  Bill Murray, Ghostbusters |
\-----------------------------------------------------------------------------/
From: ravikm@austin.ibm.com (Ravi K Mandava)
Newsgroups: comp.unix.programmer
Subject: Re: calling system() with SIGCLD ignored (SysV).
Date: 4 Sep 92 16:04:19 GMT
Reply-To: piobe!ravikm@ibmpa.awdpa.ibm.com
Distribution: comp
Organization: IBM Austin
Originator: ravikm@piobe.austin.ibm.com


In article <1992Sep2.164144.11558@glas.rtsg.mot.com>, hartnett@glas.rtsg.mot.com (Ger Hartnett) writes:
> 
> I need to spawn off processes and not allow them to become zombie when
> finished. I also need to make calls to the system() function in the
> parent process.

	You could block SIGCHLD signals before you call system() function.
	However, since system() does its own waitpid(), you'd need to
	reset your signal handler (from SIG_IGN or a user-defined function
	with wait()) to SIG_DFL, so that its waitpid() would receive its
	child's exit status correctly.

	An example piece of code could be:

		...
		#include <sys/types.h>
		#include <signal.h>

		...
		struct sigaction	newchldact, oldchldact;
		sigset_t		newmask, oldmask;
		...
		(void) sigemptyset(&newmask);
		(void) sigaddset(&newmask, SIGCHLD);
		if (sigprocmask(SIG_BLOCK, &newmask, &oldmask) == -1)
		   ...

		newchldact.sa_handler = SIG_DFL;
		(void) sigemptyset(&newchldact.sa_mask);
		newchldact.sa_flags = 0;
		if (sigaction(SIGCHLD, &newchldact, &oldchldact) == -1)
		   ...

		... = system("...");
		...	/* return code checking */

		if (sigaction(SIGCHLD, &oldchldact, (struct sigaction *)NULL)
		    == -1)
		   ...

		if (sigprocmask(SIG_SETMASK, &oldmask, (sigset_t *)NULL) == -1)
		   ...


	Or, alternatively, you could still keep your original signal handler
	(SIG_IGN or a user-defined function with wait()) installed, but
	avoid using system().  That is, replace system() call with your
	own code calling fork() and exec() without a wait() (if you're not
	interested in the child's exit status).

Hope this helps,
-- 
*******************************************************************************
Ravi K Mandava		email:	piobe!ravikm@ibmpa.awdpa.ibm.com
*******************************************************************************
Newsgroups: comp.unix.programmer
From: reed@snake.tc.cornell.edu (Michael G. Reed)
Subject: Re: Trying to write my own ls
Keywords: inodes
Reply-To: reed@TC.Cornell.EDU
Organization: Cornell National Supercomputing Facility
Date: Wed, 9 Sep 1992 17:05:31 GMT

In article <1992Sep9.125031.17878@monu6.cc.monash.edu.au>, int233p@mdw033.cc.monash.edu.au (Mr A.J. Bucknell) writes:
|>    I am trying to write a small program that lists the files and subdirectories
|> of a specified directory. I have got the following program running, and it
|> works fine when I run it on the home directory, but when I run it on any other
|> directory, it gives incorrect file sizes. Can anyone point my error ? The 
|> code is :
|> 
|> 
|> #include <stdio.h>
|> #include <sys/types.h>
|> #include <sys/dir.h>
|> #include <sys/stat.h>
|> 
|> void main(int argc, char *argv[])
|> {
|> 	struct stat buf;
|> 	DIR *dirp;
|> 	struct direct *dp;
|> 	
|> 	dirp = opendir(argv[1]);
|>         for (dp = readdir(dirp); dp != NULL; dp = readdir(dirp))
|> 	{
|> 		stat(dp->d_name, &buf);

BINGO!  Here's your problem.  The string pointed to by dp->d_name is local to
the directory, not global to the filesystem.  Therefore, when you the stat on the
files, it is checking your CURRENT directory (not the directory you want it to
check) for the file information.  You could get around this by prepending argv[1]
to dp->d_name in temporary memory before doing the stat, or by issuing a
chdir(argv[1]) at the beginning of your code.  Does anyone know if fchdir(dirp)
might work (I didn't take a look at the structure definitions for FILE and DIR)?

|> 		printf("%-15s%8d\n", dp->d_name, buf.st_size);
|> 	}
|> 	closedir(dirp);
|> }
|> 
|> Thanks in advance for any help. Replies via email, or to here if you think its
|> of interest to others.

-Michael

-----------------------------------------------------------------------------
Michael G. Reed                                         (reed@TC.Cornell.EDU)
Cornell National Supercomputing Facility                       (607)/254-8806
-----------------------------------------------------------------------------
        Why be normal, it's boring; and boring people should be shot.

Note:  These are not the views of my employer (and probably not mine either).
Newsgroups: comp.unix.programmer
From: kaleb@thyme.jpl.nasa.gov (Kaleb Keithley)
Subject: changing process groups
Organization: Jet Propulsion Lab, Pasadena, CA
Date: Wed, 9 Sep 92 23:15:40 GMT

On a Sun SPARC running SunOS 4.1.1 I have two programs, one, a trivial 
daemon is started from rc.local, and the other, an X application is 
started from the window manager.  Both programs detach from any controlling 
terminal.

I want to enlist the aid of the kernel to automatically send a signal to 
the X application when the daemon is terminated.  To that end, the daemon 
calls setsid() to become a session leader and a process group leader, and 
stores the process group ID (pgid) it returns into shared memory.  

The X client reads that pgid from the shared memory, and calls setpgid() 
to attempt to join the daemons process group.

I've read and reread TFM, as well as W. Richard Stevens latest book,
"Advanced Programming in the UNIX Environment", and can find no documented
reason why this shouldn't work, yet the call to setpgid() in the X appli-
cation returns -1 and errno is EPERM.

This error is triggered even when both programs are SGID to the same group.
Evidently the error is that the programs aren't in the same session initially.

As the daemon runs as root, it can send signals to the X application(s)
directly, however when I tried that strategy, and there are many (16+) X 
apps, I observe that some of them don't receive the signal.  They're all 
the same program, and the daemon *is* sending the signal to all of them

Anyone have an explanation about the wherefor of any of the above?

Thanks.

-- 

Kaleb Keithley                          kaleb@thyme.jpl.nasa.gov

Not authorized, in any way, shape, or form, to speak for anyone.
From: bpja@codex.com.au (Brett Adam)
Newsgroups: comp.unix.programmer
Subject: Re: Multithreads in SunOS 4.1.2
Date: 11 Sep 92 08:57:29 GMT
Reply-To: bpja@codex.com.au
Organization: Codex Software Development Pty Ltd

In article <1992Sep10.114315.4875@knight.vf.ge.com> doug@happy.vf.ge.com (Doug  
Hughes) writes:
> In article <1992Sep8.200022@hlrz24.hlrz.kfa-juelich.de>,  
melin@hlrz24.hlrz.kfa-juelich.de (Stephan Melin) writes:
> > I have the following problem:
> > I need to write a program that runs multiple processes concurrently, eg.:
> > 
> > void proc(void);
> > 
> > void main(void)
> > {
> >   StartThread(proc);
> >   printf("main\n");
> >   ... /* some stuff to wait for the other thread */
> >   printf("main acknowledged\n");
> >   ... /* some stuff to tell the thread to go ahead */
> >   printf("end main\n");
> > } 
> > 

[munch]

> > Synchronization, of the processes will be done by semaphores...
> > I have already looked at the lwp library, but I don't want to
> > mess with this lowlevel stuff (I don't want to write my own
> > scheduler). So is there any way to solve this problem in an
> > easy way?
> > 
> > Thanks in advance
> > 
> 
> Why not just fork off a process and then exec a new process? That
> way you can have the two processes running in parallel using the
> existing UNIX scheduling algorithms.  Then, all you have to write
> is a good producer-consumer relationship (which can be pulled out
> of any good OS textbook)


Whilst this is valid, there are many cases where it is truly easier and better  
to use threads.

What you want is the CMU cthreads library. It offers non-preemptive threading  
for Sun OS and many other platforms. Includes mutex variables, condition  
variables, etc. for thread sync and communications.

I have the full source if you can't find it elsewhere.

regards,
-- 
---------------------------------------------------------------
Brett Adam                 Xedoc Software Development Pty. Ltd.
NeXTMail: bpja@codex.oz.au                  AppleLink: AUST0335
(Preferred.)                                 (Only if you must) 
Newsgroups: comp.unix.programmer
From: rstevens@noao.edu (W. Richard Stevens)
Subject: Re: Detecting a broken socket
Keywords: socket, SunOS, keep_alive
Organization: National Optical Astronomy Observatories, Tucson, AZ, USA
Date: Mon, 7 Sep 1992 22:06:01 GMT

>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.

What do you mean by "dies"?  If the process dies but the host stays up
(and I'm assuming you're using TCP), then the connection is closed and
your end should appear readable with the read returning 0, which you
indicate you've tried.  If the comms server is a dedicated box that
crashes, and perhaps reboots, then maybe it's not closing the connection,
which accounts for why your select didn't indicate readable.  If the comms
server isn't sending out a FIN segment, your end won't detect that it's
crashed.  If the comms server does reboot then the keepalive would work,
but as someone else has indicated, the timer value is usually not
per-process-configurable, and the recommended default is now 2 hours
of inactivity on the connection before a keepalive packet is sent.

	Rich Stevens  (rstevens@noao.edu)
Newsgroups: comp.unix.programmer
From: karish@pangea.Stanford.EDU (Chuck Karish)
Subject: Re: Checking if a process exists
Organization: Mindcraft, Inc.
Distribution: world,local
Date: Tue, 15 Sep 1992 00:15:25 GMT

In article <1992Sep14.150438.128@inet.d48.lilly.com>
rz64938@mystic.d50.lilly.com (David W. Crumbacher) writes:

>Is there a way in C to check if a certain process is running?

kill(pid, 0) returns 0 if the process exists but returns -1
and sets errno to ESRCH if the process does not exist.
--

    Chuck Karish          karish@mindcraft.com
    (415) 323-9000 x117   karish@forel.stanford.edu
Newsgroups: comp.unix.programmer
From: robm@void.ncsa.uiuc.edu (Rob McCool)
Subject: Re: HELP!!! How do I get rid of .tar
Organization: University of Illinois at Urbana
Date: Sat, 12 Sep 1992 23:53:28 GMT



tar xvf xtank1.3e.tar


-- 
Rob McCool, NCSA STG System Administrator
robm@ncsa.uiuc.edu r-mccool@uiuc.edu robm@imsa.edu
It was working ten minutes ago, I swear...
Newsgroups: comp.unix.programmer
From: pham@ucselx.sdsu.edu (Peter Pham)
Subject: How md_space in struct mb_device defined?
Keywords: [SunOS4.1.1]
Organization: San Diego State University Computing Services
Date: Wed, 9 Sep 1992 23:22:35 GMT


I am trying to make a device driver loadable on SunOS 4.1.1
(on a Sun4/330).  There is a structure 'mb_device' that I need
to initialize.  Under this structure, there is a field called
'u_int  md_space'.  The comment for this field (structure 
defined in <sundev/mbvar.h>) says this is a field for "encoded
address space".  Suppose I want the VME address space of 32D32,
what should I put in this field?  Does anyone know the "encoded
address space" is pre-defined some where?

Thanks in advance.

Peter Pham
Newsgroups: comp.unix.programmer
From: berg@physik.tu-muenchen.de (Stephen R. van den Berg)
Subject: Re: SIGALRM handlers and sleep
Originator: berg@tabaqui
Organization: Rechnerbetrieb Informatik  /  RWTH Aachen
Date: Tue, 15 Sep 92 13:52:22 GMT

Gautham K. Kudva writes:

>this. Richard Stevens' "UNIX Network Programming" says that sleep can 
>interact with a process' own SIGALRM handlers; but no details are given. 
>I haven't found anything on these lines in the man pages either. So is there 
>any way in which my signal handler can peacefully co-exist with sleep()?
>Or do I need to replace all sleep calls (using defines or something)
>with my custom sleep function which handles alarms right?

I'm afraid using a custom sleep() is the only portable solution.  At least that
was the conclusion I reached after inspecting the sleep() and SIGALRM
implementations on several machines.

It basically boils down to recomputing the alarm() time after every sleep()
has finished and to compensate for the slept seconds.
-- 
Sincerely,                                  berg@pool.informatik.rwth-aachen.de
           Stephen R. van den Berg (AKA BuGless).    berg@physik.tu-muenchen.de

"I have a *cunning* plan!"
From: cgregory@ziggy.cs.uiuc.edu (Christine Gregory)
Newsgroups: comp.unix.aix
Subject: AIX 3.2 wasn't allowing mounts...
Date: 9 Sep 92 01:28:03 GMT
Organization: University of Illinois at Urbana-Champaign


A week or two ago, we posted about some problems we were having after
upgrading our servers to 3.2 -- some minor annoyances, and one major
problem:  One nfs server would not allow mounts while the other --
which also happened to be the YP server -- would.  What really puzzled
us was that we were getting RPC time-out errors -- as if the network
were down -- but all other network traffic (rlogin, telnet, ftp)
went through just fine in all directions.

Well, thanks to lots of help from some folks over at UI's CSO
(Milt Cloud and Bob Booth), we discovered some little 'bad habits'
that 3.2 wasn't letting us get away with -- like having more than one
nameserver listed in resolv.conf (and not all the nameservers were 'good' -
some outdated addresses, and some just plain old mistakes...).
The strange thing is, these little things didn't cause problems (at least
that we could SEE) in 3.1, but 3.2 wasn't about to let us get away with
it anymore!  :-)

The two biggest ones were -- as I mentioned -- listing more than one
nameserver, and listing the 'short' hostname in the TCP menu rather than
the long one.  I.e.  3.1 let us get away with "ibma0" -- 3.2 wants
"ibma0.cs.uiuc.edu".

Well, we're still chugging along with upgrading the rest of the clients,
but at least we're back 'in business'!  And we've found that passwd
(or yppasswd) now WORKS on yp clients -- it didn't used to in 3.1.
chsh and friends still don't work on the clients, but at least the
error message says so.  (The old way, it used to just add a line to 
the local passwd file -- so we had eventually disabled it on the clients.)
From: taluskie@hagar.ph.utexas.edu (Vince Taluskie)
Newsgroups: comp.unix.aix
Subject: PTF questions...
Date: 15 Sep 92 02:28:38 GMT
Organization: Institute for Fusion Studies, UT-Austin

>|> Tom McConnell (tmcconne@sedona.intel.com) wrote:
>|>
>|> IBM now claims to have a 3.2 version of this patch.  Same APAR number
>|> obviously, PTF U403044.
>
>And PTF U403044 is superseded by PTF U407530.
>So ask for PTF U407530.

Last week I ordered the PTF to fix the -H printer flag problem, after
a few days...I received a tape with the fix and about 40-50 others on
there.  

When I tried to install the fix, it came back with some wierd
requirements that it said needed to be installed.  So I called IBM
again, and this time they told me that installp was broken and needed a
fix.  I ordered the appropriate PTF (U406852) and after a few more
days...I received the fix.  This tape only has about 10 other PTFs on
it.

All I want to know is why can't IBM just send me a complete tape with
all the fixes on there.  The access might be slower - but at
least it would be faster than waiting for the mailman to deliver the
next PTF tape.  Better yet , take AIX , apply all the fixes available,
test it and then ship a real working version that I don't have to keep
calling IBM to get fixes for....

Can someone send me a master list of PTF numbers and problems reported ?
I'd like to know what else is out there that I don't know about...

Thanks,

-- 
   _
  (_)  Vince Taluskie, taluskie@utpapa.ph.utexas.edu

Newsgroups: comp.unix.aix
From: mjo@snclib.snc.edu (Mike O'Connor)
Newsgroups: comp.unix.aix
Subject: Re: PS Viewer
Date: 10 Sep 92 08:09:34 GMT
Reply-To: Mike O'Connor <mjo@snclib.snc.edu>
Organization: :noitazinagrO

In article <18l48fINNitr@spool.mu.edu> craig@spool.mu.edu (Craig Schanning) writes:
:	Is there a PD PostScript viewer available for AIX?
:
:Please send responses to pwickman@cerebus.cc.edu

I'm sure that someone's filled his mailbox with "Ghostscript" and
"Ghostview" -- if nothing else, I've mailed him.  What I wonder is
why IBM ships Display Postscript and yet doesn't ship a tool to
*view* Postscript!  DEC and Sun certainly don't have this problem.
Any comments?

-- 
Mike O'Connor
"The NNTP Administrator"
<mjo@snclib.snc.edu>
Xref: sparky comp.unix.aix:9440 comp.os.os2.apps:5950
From: ctkosti@afterlife.ncsc.mil (Chris Kostick)
Newsgroups: comp.unix.aix,comp.os.os2.apps
Subject: Dear IBM: ...
Date: 8 Sep 92 14:47:20 GMT
Organization: The Great Beyond

Could someone from IBMland give me an idea of when DCE will be available
to the average consumer?

Things I'm vaguely aware of (please correct anything wrong):

	- DCE will be available on AIX, OS/2, and MVS.
	- A developer's toolkit should be available at least for OS/2
	  sometime in Sept. or Oct.
	- DCE was originally to be available 4Q 92, but alas, it isn't.
	  Any new dates?
	- Since AIX is a reference platform for OSF, what are the
	  difficulties in taking an OSF snapshot and turning that into
	  a product?

Any insight would be appreciated.

--
chris kostick (ctkosti@afterlife.ncsc.mil)

#include <signature.file>
Newsgroups: comp.unix.aix
From: gerth@watson.ibm.com (John Gerth)
Subject: Re: What Does IBMR2 Mean?
Date: Sat, 12 Sep 1992 01:16:01 GMT
Disclaimer: This posting represents the poster's views, not necessarily those of IBM
Organization: IBM T.J. Watson Research Center
Keywords: IBMR2

Yes, _IBMR2 identifies "RISC System/6000" hardware while _AIX
identifies AIX operating system.  As to why _IBMR2 was chosen,
those present-at-the-creation will have to explain.

Unfortunately I do not know of any way to reliably distinguish
between AIX 3.1 and AIX 3.2 however desirable that might be.

-- 
John Gerth	 gerth@watson.ibm.com		(914) 784-7639
From: johnk@opel.secondsource.COM (John Kennedy)
Newsgroups: comp.unix.aix
Subject: dial(3c) missing from XL C libc.a
Date: 9 Sep 92 16:31:42 GMT
Reply-To: johnk@secondsource.COM (John Kennedy)
Organization: Second Source, Inc., Annapolis, MD

Anyone tried to use the dial(3c) function on AIX?  We can't seem
to find it or a successor.  Could IBM have omitted this functionality?
It seems odd, given that all of the other BNU functionality seems
to be in place.

While we're at it, has anyone kept a list of any other System V features
that don't seem to have made the port?


-- 
John Kennedy                     uunet!opel!johnk
Second Source, Inc.              johnk@secondsource.COM 
Annapolis, MD
From: julie@levell.austin.ibm.com (Julie L. Craft)
Newsgroups: comp.unix.aix
Subject: Re: Moving volume groups between disks
Date: 8 Sep 92 22:12:49 GMT
Organization: IBM, Austin

In article <1992Sep8.213105.29350@awdprime.austin.ibm.com> jaime@austin.vnet.ibm.com writes:
>In article <1992Sep4.234806.3359@otago.ac.nz>, infoian@otago.ac.nz (Ian
>G. Connelly) writes:
>> Subject: Moving volume groups between disks
>> From: infoian@otago.ac.nz (Ian G. Connelly)
>> 
>> Hi,
>> 
>> What is the best way to move a volume group from two small disks on our server
>> to one BIG disk?
>> 
>>  We currently have two 320 disks for AIX/CATIA/Misc Scripts and programs that
>> go to make up the rootvg.  We also have two 857 disks that contain all
>the user
>> data and configuration of CATIA.  And I would like to move all the data from
>> the two 857 disks to a 2Gig, preserving the logical
>volumes/filesystems in the
>> same format/size (this must be done as painlessly as possible, and the server
>> is vital to our operations so it must be done reliably).
>> 
>>  Then we will be removing the 320 disks and installing AIX on one of the 857
>> disks.  All this has come about because SCSI only lets us attach 7 devices to
>> one card and we now have 8!! (2x320,2x857,2x2Gig,tape,CD).
>> 
>
>Look into the 'migratepv' command.  It tells how it's done.  And it is very 
>painless.  Post or e-mail if you have any additional questions.
>
>Jaime Vazquez			
>

	Right, just 
	extendvg yourvg hdisk857 
	migratepv hdisk1 hdisk857
	migratepv hdisk2 hdisk857
	reducevg yourvg hdisk1
	reducevg yourvg hdisk2
	

	migratepv's are cool, as long as you don't have a
	dump device or boot logical volume on the disk,
	then it just gets more complicated, but it
	can be done.

	Later,
	Julie


-- 
*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*=*
Julie Levell Craft IBM AUSTIN,TX  Internet: julie@aixwiz.austin.ibm.com
IBMNET: JULIEL at AUSVM6 2F-007/903  (512) 838-2677 (Tie 678-2677)
"I'm not getting defensive!"
Newsgroups: comp.unix.aix
From: louis@obelix.newshost.uwo.ca (Chan Louis)
Subject: Commnets on C++ Compiler in AIX 3.2
Organization: /m4/student/1985/louis/.organization
Distribution: comp.unix.aix
Date: Tue, 15 Sep 1992 02:04:17 GMT

Hi guys,
	I am going to have to project on AIX 3.2 using its C++ compiler.
Could someone gives me some comment about that ?  Both Good and Bad ....
	Thanks in advance.

Louis
Xref: sparky comp.unix.aix:9598 comp.unix.large:304 comp.protocols.nfs:2309