HDTenEightyP/NetNews huggingface dataset:
From: lubich@bernina.ethz.ch (Hannes Lubich)
Subject: System V Message Queue Question
Keywords: System V, Message Queue
Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
Date: Thu, 16 Apr 1992 06:58:41 GMT

Hi all,
is there a way to find out how many processes are attached to a system V
message queue (SunOS-4.03), similar to the number of processes that are
attached to a sys V shared memory segment?

Our scenario includes a server, that reads messages from a queue, acts on
them and sends the result/error back to the queue. However, there are several
client processes at the other end, that write to the queue and read from it
(we use the message type to identify the sender/receiver of a message), but
the server does not necessarily know how many processes are at the other end.

One solution would be to let the clients explicitely send a "logout" message
but that would mean that the server needs some knowledge about the number of
clients, such that it can shutdown itself after the last client has gone.

Does anybody know of a more elegant solution?
Thanks & Best Wishes
	--HaL
-- 
~ RFC-822  : lubich@komsys.tik.ethz.ch
~ BBN/Slate: lubich@ktik5.comm.tik.ethz.ch
~ X.400    : C=ch; A=arcom; P=switch; O=ethz; OU=tik; OU=komsys; S=lubich
~ The usual disclaimer : No, it wasn't me, somebody must have used my account.
Newsgroups: comp.unix.programmer
From: bbobak@descartes.waterloo.edu (Brad Bobak)
Subject: sleep and alarm
Organization: University of Waterloo
Date: Wed, 8 Apr 1992 13:01:01 GMT

 Hi all. I have a question about sleep and alarm that I was wondering if you
could answer for me. In the man pages, sleep sez:

                                                    ...The actual
     suspension time may be an arbitrary amount longer because of
     other activity in the system.

 Was wondering if this is true for alarm also?

-- 
                 Brad Bobak -- bbobak@descartes.waterloo.edu
                            -- somewhere along the UUCP bang path
-------------------------------------------------------------------------------
 "#892:ojm,n.120xa/.ajko -- Err..sorry, forgot to uncompress my sig!
From: jik@athena.mit.edu (Jonathan I. Kamens)
Newsgroups: comp.unix.programmer
Subject: Re: Interrupted system calls
Date: 7 Apr 92 03:09:50 GMT
	<27851.Apr622.58.1392@virtualnews.nyu.edu>
Organization: Massachusetts Institute of Technology

In article <27851.Apr622.58.1392@virtualnews.nyu.edu> brnstnd@nyu.edu (Dan Bernstein) writes:

   On broken systems, and in stupid cases, yes. On working systems write()
   will always return the number of bytes written, if that number is
   positive. (Yes, this is part of my definition of ``working''; yes, there
   exist systems which work in this respect.)

Code that is attempting to be portable does not rely on functionality
that is known not to exist on some machines (in this case, a large
number of machines).

If you want to write code that will functional properly only on
systems that you consider "workins" ones, then by all means, don't
deal with the possibility of partial, interrupted write()s.

If, on the other hand, you want your code to be as portable as
possible and therefore used by as many people as possible, it should
be able to deal with the possibility of brain-damage in the
environment.  At they very least, put in an undocumented set of
#ifdef's to deal with the possibility, so that when people complain
that something's breaking, you can tell them, "Put this -D in the
Makefile and send a flame to your vendor."

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
From: tim@mal-s1.gatech.edu (Tim Shelling)
Newsgroups: comp.unix.programmer
Subject: How do i read the keyboard in UNIX?
Date: 11 Apr 92 19:38:58 GMT
Organization: Georgia Tech Res. Inst./Modeling & Analysis Lab

I'm trying to set up a simple numerical - point-and-shoot method for
my user-interface. While i can read lines of text from standard-in just fine,
i cannot get a key-sequence at a time.

My questions is, what call can i make to wait for one character
at a time?


tjs


Please mail  a copy of your reply to me.
-- 
----------------------------------------------------------------
Timothy J. Shelling, CmpE -- A CmpE is a computer scientist 
                          -- who can screw in his own lightbulbs
tim@mal-s2.gatech.edu        -=-        gt2540b@prism.gatech.edu
Newsgroups: comp.unix.programmer,comp.admin.policy
From: spm2d@uvacs.cs.Virginia.EDU (Steven P. Miale)
Subject: Re: ethics of logging telnet destinations (was Re: logging outgoing...)
Followup-To: comp.admin.policy
Organization: University of Virginia Computer Science Department
Date: Wed, 15 Apr 1992 20:57:02 GMT

shandon@cats.ucsc.edu (Timothy Daniel Kolar) says:

> This leads to the reasonable idea that you only start tracking telnets
> when someone at another site reports an attack from your site.  However,
> if you trust your system administrator (and you had better) then having
> logs that aren't looked at until a problem arises is about the same thing.

No, they are very different things. 
Investigating a crime after it has taken place is standard policy;
however, surveilance without motive is not.
If the police want to watch me, or the FBI wishes to tap my phone, it
is my understanding that they have to suspect me of a crime BEFORE
they start logging.

You seem to feel that it is fine whether or not you are being accused;
I do not. The ability to monitor everyone does not mean that you
should; in this respect, I do not think telnet logging - including
ones not originating at your site, as the original poster also
wanted to do - should occur until a break-in is suspected.

> |> Also, the safety of user's data is most easily secured with backups...
> 
> 	Safety also entails protecting the information from 
> unauthorized access (ironically, backups make that harder instead of
> easier).  
How so?

A reasonably secure system can be had by making sure people don't pick
poor passwords, and making sure people don't give them out. I doubt there
have been a lot of systems broken into that had adequate security measures.

Followups directed to comp.admin.policy.

-- 
Steven Miale - spm2d@virginia.edu   | Backwards compatibility is backward.
Undergraduate Researcher            |
Department of Computer Science      |
University of Virginia              |
Xref: sparky comp.unix.programmer:2274 comp.unix.questions:5979
From: thierry@curlie.UUCP (Thierry Lach   )
Newsgroups: comp.unix.programmer,comp.unix.questions
Subject: Re: Moving the cursor
Date: 6 Apr 92 22:42:14 GMT
Organization: Not An Organization

sfd@bezier.berkeley.edu (Scott Drellishak) writes:

> I'm using the curses library in a project, and have the following
> question: How can I move the cursor into the corner of the screen (out
> of the way) after a refresh?  I've tried using the mvcur() function,
> but this only confuses the rest of curses, and messes up the next
> refresh.  The documentation I have is woefully sucky.  Either pointers
> to better docs or specific solutions are greatly appreciated.
> 
> Scott

Tell the window   "leaveok(window,FALSE)", then use
"wmove(window,y,x)" followed by "wrefresh(window)".  That works
for me...

Thierry Lach				UUCP: sharkey!sycom!curlie!thierry
My opinions are mine and mine alone.
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.unix.programmer
Subject: Re: indirect goto
Date: 10 Apr 1992 19:02:54 GMT
Organization: Thinking Machines Corporation, Cambridge MA, USA
Distribution: dc
NNTP-Posting-Host: telecaster.think.com

In article <1992Apr10.023240.4276@ukelele.UUCP> peterh@ukelele.UUCP (Peter Hartzler) writes:
>amichail@descartes.waterloo.edu (Amir Michail) writes:
>>switch(d){
>>case 1 : goto l1;
>>case 2 : goto l2;
>>case 3 : goto l3;
>>}
>>Is there any other way I could do this?
>If your values of d are contiguous, you could use d to index into an array
>of pointers, as in goto VectTabl[d];, where VectTabl would be your array of
>locally scoped addresses - void *VectTabl[]  = {l0, l1, l2, ... , ln};

Sorry, wrong.

Statement labels aren't first-class objects in C, and can't be assigned to
variables or stored in arrays.  You could do this if you were calling
functions rather than going to labels, since function pointers can be
stored in an array.

You can simplify it a little by using a macro:

#define CG(n) case n: goto l##n

then write

switch(d){
CG(1)
CG(2)
CG(3)
...
}

This will probably require an ANSI-conformant compiler, since more pre-ANSI
implementations don't support the ## token pasting preprocessor operator.
-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Xref: sparky comp.unix.programmer:2393 comp.unix.internals:1117 comp.unix.wizards:2208
From: andre@targon.UUCP (Andre van Dalen)
Newsgroups: comp.unix.programmer,comp.unix.internals,comp.unix.wizards
Subject: Re: What is the system call for microsecond sleep?
Date: 15 Apr 92 08:44:46 GMT
Followup-To: comp.unix.programmer
Organization: Siemens Nixdorf Informatiesystemen BV,dep.SWZ,Postbus 29, 4130 EA Vianen,The Netherlands

In article <1992Apr10.204412.20045@lambda.msfc.nasa.gov> mahmood@lambda.msfc.nasa.gov (Rafique Mahmood) writes:
>I am developing some portable code in which I need to use microsecond
>sleep. So, I used usleep(microsecond) system call. The problem is Decstation
>does not support this call. They have 'napms(milisec)'. How can I get microsec.
>sleep in my portable code? Is usleep() is POSIX call?

If you have select abvailable, you can use it for usleep

struct timeval t;
t.tv_sec = 0;
t.tv_usec = 1;

select(0, (fdset_t *)0, (fdset_t *)0, (fdset_t *)0, &t);

which means 'wait for nothing with a timeout of 1 usec.
-- 
The mail|    AAA         DDDD  It's not the kill, but the thrill of the chase.
demon...|   AA AAvv   vvDD  DD        Ketchup is a vegetable.
hits!.@&|  AAAAAAAvv vvDD  DD                    {nixbur|nixtor}!adalen.via
--more--| AAA   AAAvvvDDDDDD    Andre van Dalen, uunet!sun4nl!targon!andre
Newsgroups: comp.unix.programmer
From: EEAC@rusvm1.rus.uni-stuttgart.de
Subject: Question about Process(es)
Organization: Comp.Center (RUS) U of Stuttgart, FRG
Date: Thu, 9 Apr 1992 20:48:30 GMT

This may be a trivial question, but I can't figure out how to
find out whether a certain process is running or not from a C
program. ( I have the pid )
 Thanks for any help
Newsgroups: comp.unix.programmer
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: Question of wait()
Organization: Sequoia Peripherals, Inc.
Date: Thu, 16 Apr 92 19:51:32 GMT

In article <QINYI.92Apr15150703@r6i.uk.ac.man.cs> qinyi@uk.ac.man.cs (Yi Qin (BCW PhD)) writes:
>Hello.
>The manual page of system call wait() (for SunOS4.1.1) says "_the wait()
>delays its caller until a signal is received_ or one of  its  child
>processes terminates or stops due to tracing." But I found this wait()
>does not behave as said: upon receipt of a signal, it doesn't return
>to the user mode of the process. It either exits in the normal way
>when some unexpected signal is received, or executes the signal handler
>when there is one installed for the received signal, and then resumes
>wait(). IMHO, in the latter case at least, the process should continue
>executs in the user mode after interrupted from wait(). 

The NOTES section of the man page (as well as the man page for 
sigaction) says that wait is one of the system calls that is
automatically restarted unless you ask the system not to. You
have to set the SA_INTERRUPT but of the sa_flags field of your 
struct sigaction before calling sigaction.



-- 
Dave Eisen    dkeisen@leland.Stanford.EDU   Sequoia Peripherals: (415) 967-5644
      There's something in my library to offend everybody.
        --- Washington Coalition Against Censorship
Xref: sparky comp.unix.programmer:2403 comp.admin.policy:738
From: wcsjc@alfred.carleton.ca (John Coughlin)
Subject: Re: Korn Shell
Organization: Carleton University, Ottawa, Canada
Date: Sat, 11 Apr 1992 23:01:42 GMT

In article <1992Apr08.123522.6876@bcsl.uucp> newman@bcsl.uucp (Robert Newman  Programmer) writes:
>Hello
>
>Could anyone direct me in the direction of locating some books or
>documentation on programming within the Korn shell.
>
>Is it the same as the csh shell?

Well...IMHO it's more powerful than csh.  The definitive reference is

    Bolsky, Morris I., Korn, David G.,
    "The Kornshell Command and Programming Language"
    Prentice Hall, 1989
    ISBN 0-13-516972-0
From: bar@bbma.uucp (Joachim Bartsch)
Newsgroups: comp.unix.programmer
Subject: Re: Signals to child processes
Date: 16 Apr 92 14:13:25 GMT
Organization: Bilfinger+Berger, Mannheim, Germany

I guess telnet modifies the stty parameters so no input processing
is done for ^Z (if online). Suspending telnet should work if *your*
program sends the SIGTSTP to telnet.
- switch off input processing for ^Z
- if u read a ^Z, signal to telnet
or
- catch the signal and send this signal to your child.
-- 
 ----------------------------------------------------------------------------
 Joachim Bartsch   eMail: bar@bbma.uucp <...!uunet!mcsun!unido!bbma!bar>
 Systems Engineering Department - Bilfinger+Berger AG, Mannheim, Germany
 "Information is the greatest weapon of power to the modern wizard"
Xref: sparky comp.unix.programmer:2435 comp.unix.questions:6277 comp.unix.misc:2095 comp.std.c:1843
From: rrybacki@ringer.cs.utsa.edu (Richard M. Rybacki)
Newsgroups: comp.unix.programmer,comp.unix.questions,comp.unix.misc,comp.std.c
Subject: Re: Input within a time frame
Date: 17 Apr 92 13:37:26 GMT
Distribution: na
Organization: University of Texas at San Antonio

In article <1992Apr16.233126.4177@iitmax.iit.edu> nowlola@elof.iit.edu (Olatunji Nowlin) writes:
>
>
>Does anyone know how I would be able to get a character
>of input within a certain time limit (say 3 seconds?).
>
>The getchar() , getc() etc., routines don't use time
>limits (you can take as loooong as you want, which
>is not desirable in the program).  Is there some
>routine that would get the input within a certain
>time frame?
>
>PS This thing is really bugging me because I can't think
>   of any solution.
>
>PPS This is on a Unix system btw.
>
>O. Nowlin
>
>What .sig?

Look at select(), here's a quick example of how to get a 'line' of input
form the terminal within a timeout (user has to press return).  If you
are interested in getting each keystroke, you will have to configure your
tty accordingly.

/*
	This compiles under SunOS, but your milage may vary.  See the man pages
	for select() to see what you need to include on your system.
*/
#include <sys/types.h>
#include <sys/time.h>
#include <stdio.h>

main()
{
	struct timeval timeout;
	int cnt;
	fd_set read_set;
	char buffer[256];

	FD_ZERO(&read_set);
	FD_SET(fileno(stdin), &read_set);

	/* Set up for a 10 second timeout */
	timeout.tv_sec = 10;	
	timeout.tv_usec = 0;

	if ((cnt = select(1, &read_set, 0, 0, &timeout)) < 0)
	{
		perror("select");
		exit(1);
	}

	if (cnt > 0 && FD_ISSET(fileno(stdin), &read_set))
	{
		gets(buffer);
		printf("You entered: %s\n", buffer);
	}
	else
		printf("timeout reached\n");
}
-- 
Richard M. Rybacki            |    with Std_Disclaimer;  -- NOT!
rrybacki@ringer.cs.utsa.edu   |    #include <stdisclmr.h> /* More like it! */
From: bengtl@maths.lth.se (Bengt Larsson)
Newsgroups: comp.unix.programmer
Subject: Re: Scripting in general
Date: 13 Apr 92 19:14:38 GMT
Organization: Lund Institute of Technology, Sweden

In article <1992Apr13.005347.27133@Princeton.EDU> pfalstad@phoenix.Princeton.EDU (Paul Falstad) writes:
>bengtl@maths.lth.se (Bengt Larsson) wrote on 11 Apr 92 20:11:23 GMT:

>>As for programming language suitability:
>>   ** It isn't possible to write a "rename" script in "sh" that handles
>>   ** all valid filenames.
>
>I seriously doubt this.  Are you implying that there's some other shell
>(rc?) where you can write a "perfect" rename script which cannot be
>translated into sh, because of deficiencies in the language?  I doubt it.

No, what I mean is that this isn't suitable for a shell-like language
at all. You'd have to use C, or Perl etc.

>[bogus scripts delivered in /bin]
>
>>Re-write them in rc!
>
>Don't bother.  Adding/changing a few characters here and there will make
>them work just fine, for all possible filenames.

Probably. What I'd like to know is the background to the apathy that
lets such things continue. Is SysVR4 better (haven't tried it)? What
does USL really do about quality control? How about other things, as
undocumented limits in commands, etc? You can get GNU tools, but
that's not quite my point.

My wish would be for a new, C-like scripting language, with dynamic
typing, and string handling (and regexps) builtin. There was a man page
posted for such a language about a year ago. I can repost it, if there's
interest.

With such a language you could possibly implement quite a lot of things
as scripts, in a safe way. Perl is a little too much... Perl IMO.

Bengt Larsson.
-- 
Bengt Larsson - bengtl@maths.lth.se
Newsgroups: comp.unix.programmer
From: jik@athena.mit.edu (Jonathan I. Kamens)
Subject: Re: Question about Process(es)
Organization: Massachusetts Institute of Technology
Date: Thu, 9 Apr 1992 21:58:39 GMT

In article <1992Apr9.195105.7002@news.uni-stuttgart.de> EEAC@rusvm1.rus.uni-stuttgart.de writes:

   This may be a trivial question, but I can't figure out how to
   find out whether a certain process is running or not from a C
   program. ( I have the pid )

From the man page kill(2):

     Kill sends the signal sig to a process, specified by the
     process number pid.  Sig may be one of the signals specified
     in sigvec(2), or it may be 0, in which case error checking
     is performed but no signal is actually sent. This can be
     used to check the validity of pid.

So, in order to find out if a process is running it, you kill(2) it
with signal 0 and check for errors.  If there are none, then it is
running.  If there was an error, and errno is EPERM, then the process
is running and you don't have permission to kill it.  If there was an
error, and errno is ESRCH, then the process isn't running.  Any other
errors and something bizarre is going on :-).

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
Newsgroups: comp.unix.programmer
From: bm@cs.columbia.edu (Blair MacIntyre)
Subject: reading /etc/magic ...
Organization: Columbia University
Distribution: comp
Date: Sun, 5 Apr 1992 17:56:13 GMT

Does anyone have (or know of a place that does) a routine to parse
/etc/magic and store it in a reasonable data structure.  I'm writing a
program that needs to identify file types (ala file) but I don't want to
do a system("file bla.bla") for each file.

This is for SunOS4.1, btw.

 Thanks.
  Blair
--
Blair MacIntyre, bm@cs.columbia.edu
Professional Student, Department of Computer Science, Columbia University
Newsgroups: comp.unix.programmer
From: ables@techbook.com (Scott Ables)
Subject: Need help programming a bus adapter
Organization: TECHbooks of Beaverton Oregon - Public Access Unix
Distribution: internet
Date: Thu, 9 Apr 1992 21:30:30 GMT

Hello:		
I'm using a PS/2 running AIX 1.2.1 with a IBM Token Ring adapter (the 16/4).

Can anyone email me 8086 assembly code that "talks" to the Token Ring adapter,
or any other adapter (better than nothing).  

Can anyone give me an overviewish summary of how its done?

I'm trying to program the adapter to modify the token priority.  I know this 
can be done, but how . . .

Thanks,
-- 
Scott Ables, Analyst, Consolidated Freightways, Inc., POB 4845, Portland,
OR 97208  voice: 503-499-2130 fax 503-499-2182 ables@techbook.COM  
Public Access UNIX at (503) 644-8135 (1200/2400) 
Public Access User --- Not affiliated with TECHbooks
Newsgroups: comp.unix.programmer
From: jik@athena.mit.edu (Jonathan I. Kamens)
Subject: Re: How to get input from a file to come from output of a process?
Organization: Massachusetts Institute of Technology
Date: Mon, 6 Apr 1992 14:48:13 GMT

If your system supports FIFOs, then you can create a FIFO, have a
program open it and write to it, and then have other programs open it
to read from it.

See the man page(s) for mknod to find out if FIFOs are supported on
your system.

There are several examples of this in the alt.sources archives.
Search in the index for the words "plan" or "FIFO" in order to find
them.

-- 
Jonathan Kamens						jik@MIT.Edu
MIT Information Systems/Athena		    Moderator, news.answers
    (Send correspondence related to the news.answers newsgroup
	{and ONLY correspondence related to the newsgroup}
		 to news-answers-request@MIT.Edu.)
From: ccx018@cch.coventry.ac.uk (Leslie Griffiths)
Newsgroups: comp.unix.programmer
Subject: Execl and tar
Keywords: execl(), tar, wait3().
Date: 6 Apr 92 07:29:53 GMT
Organization: Coventry Polytechnic, Coventry, UK

Hi.

I have written a program to create a tar file from a large number of files
distributed around the file system. It creates a string which is a list of
filenames and then tars those file names out to a file, adding to the file
by successive calls to execl() and tar (with the -uf flags).

The whole thing seems to work fine until the tar file gets to about 3 megs,
and then falls over. Tar actually exits (Not signalled or stopped). The value
of the status.w_retcode field in the union wait status produced by wait3(), is
32. I initially thought that this was being produced by tar(), but as execl()
is letting /bin/sh do the work, I was informed that the exit status of 32 
must be produced by the shell.

The fact that the whole thing goes on smoothly for some time before falling
over suggests to me that it is a resource problem. The program is running as
root, however, so it is unlikely to be due to the max number of processes being
exceeded. Also, disk space is not a problem. The partition upon which the tar
file is created has > 140 megs free.


Any pointers would be gratefully received. In case this is of use, the call
to execl is included here.

#define BOURNE /bin/sh

command is something like "tar -uf foo.tar file1 file2 ...."

execl(BOURNE,BOURNE, "-c", command, NULL)

(Perhaps execing a shell is not a good idea).

Cheers

-- 
Griff				\\         	ccx018@uk.ac.cov
^^^^^		       		 :-=       	^^^^^^^^^^^^^^^^
		        	//
Newsgroups: comp.unix.programmer
From: newman@bcsl.uucp (Robert Newman  Programmer)
Subject: Korn Shell
Organization: Business Computer Systems Limited
Date: Wed, 08 Apr 1992 12:35:22 GMT

Hello

Could anyone direct me in the direction of locating some books or
documentation on programming within the Korn shell.

Is it the same as the csh shell?

Thanx in advance
Robert Newman

-- 
Robert Newman (Programmer)                      newman@bcsl.UUCP
Business Computer Systems Ltd.                  uunorth!bcsl!newman
Toronto, Ont., Canada