HDTenEightyP/NetNews huggingface dataset:
From: andrew@comet.public.sub.org (Andrew Fleming)
Subject: Re: Reading from serial devices
Organization: Unisys Germany
X-Newsreader: Tin 1.1 PL4
Date: Mon, 7 Sep 1992 21:22:02 GMT

rob@marsh.cs.curtin.edu.au (Robert Alley) writes:
: Apologies if this is a really stupid problem, but I'm no wizzard and its
: got me stumped.
: 
: I have recently had to modify some code for reading two devices connected to
: the serial ports on a PS/2 running AIX.  The code uses the low level open,
: and read commands to set up and read from the ports (well setup with IOCTL).
: One device (a grain analyser) is connected at 1200 baud, the other (a weigh-
: bridge) ate 4800 baud.  The code is linked to a database which is running as
: two processes, one reading each device.  Data from the 1200 baud device is
: being lost as it appears not to be buffered.  I tried changing to use higher
: level fget and fopen which I thought were buffered but still no luck.  They
: even fail when used in two small programs running in the background, do to
: much and the 1200 device drops characters.  Getty's are disabled in
: /etc/inittab fro the two ports for what its worth.
: 
: Any ideas on where I'm going wrong?  This is bugging the hell out of me, as
: it's obviously a pretty simple stuff up on my part, oh yeah catting from the
: devices never seems to drop characters no matter how much processing is 
: going on and how lower priority I run the cat at.
: 
: Many Thanks,
: 
: Rob.
: 
: --
: ----------------------------------------------------------------------------
: Robert Alley		| See the stars come falling down from the sky
: GIS Honours Student     | Gently passing, they kiss your tears as you cry
: Curtin Uni. Bentley WA  | See the wind come softly blow your hair from
: Australia		|   your face
: rob@cs.curtin.edu.au    | And the rain come falling down in its crazy way
: 			| Still I'm sad, Still I'm sad
: 			| (Samwell-Smith/McCarthy)
: ----------------------------------------------------------------------------
Hello Robert,
	    Sounds like flow control is not being  used ???
          
--
/* Andrew Fleming   andrew@comet.public.sub.org  Unisys Deutschland SC-U    */
/*             Am Unisys Park 1  W-6231 Sulzbach Ts.                       */

Any opinions expressed here, are my own and NOT those of my employer.
From: sinclair@dcs.glasgow.ac.uk (Duncan Sinclair)
Newsgroups: comp.unix.programmer
Subject: FIFOs vs. Stdio
Date: 5 Sep 92 19:57:51 GMT
Organization: Glasgow University Computing Science Dept.

Is it reasonable to fopen a fifo with mode "a", and expect it to work?

As all writes to a FIFO are by nature appended, and you can't lseek at all
away from here, surely this is a valid thing to do?

Anyhow, FYI, SunOs 4.1.1 doesn't allow it, because stdio gets
an illegal seek as it tries to lseek to the end of the pipe.


I'd be interested in your thoughts.



-- 
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: net@cs.tu-berlin.de (Oliver Laumann)
Subject: Re: Dynamic linking
Organization: Technical University of Berlin, Germany
Date: Thu, 10 Sep 1992 11:38:49 GMT

In article <14530@auspex-gw.auspex.com> guy@Auspex.COM (Guy Harris) writes:
> >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).
> 
> For most, if not all, purposes, you don't need a port of any third-party
> dynamic linking code to ELF; any system that I'd consider worthy of the
> name "System V Release 4" has the "-ldl" library.  (Yes, there are
> probably things you can't do with it [...]

The important point here is that there are things you can't do with
-ldl which you *can* do with the DLD package and with BSD-style dynamic
loading in general (on which DLD is based).

For example, an object file dynamically loaded by means of DLD can
directly reference symbols defined by other object files that have
been loaded earlier, while shared objects attached to a program through
the dl-library's dlopen() function can *not* directly reference symbols
exported by objects that have been opened by earlier calls to dlopen().

This functionality is important (and is required by programs like Lisp
and Scheme interpreters), which is the reason why a port of the DLD
package to ELF-based systems would be quite useful (but certainly
diffcult).

--
Oliver Laumann    net@cs.tu-berlin.de  net@tub.UUCP  net@tub.BITNET
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer
Subject: Re: Dynamic linking
Date: 9 Sep 92 21:49:11 GMT
Organization: Auspex Systems, Santa Clara

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

For most, if not all, purposes, you don't need a port of any third-party
dynamic linking code to ELF; any system that I'd consider worthy of the
name "System V Release 4" has the "-ldl" library.  (Yes, there are
probably things you can't do with it, but there are things you can; for
example, the Andrew Toolkit can use "-ldl" on systems that have it.)
From: avinash@felix.contex.com (Avinash Chopde)
Newsgroups: comp.unix.programmer
Subject: bind() and unassigned local port numbers.
Date: 7 Sep 92 18:00:50 GMT

I am experimenting with Berkeley sockets, and was going through an
example in the Silicon Graphics IRIX Network Programming Guide.

The example mentions that the "sin_port" field may be assigned to 0
for a bind() call, in which case the system will assign an appropriate
port number to it.
Well, how does the program then find out what port number was assigned ?

Here's a sketch of what I wrote:

....
struct sockaddr_in sin;
...
sin.sin_addr.s_addr = htonl(INADDR_ANY);
sin.sin_port = htons(0);
bind(s, (struct sockaddr*) &sin, sizeof(sin));

... Now, I looked into sin.sin_port, it still contained 0.
So, how does one get the assigned port number ?

Thanks a lot for any pointers....
-- 
---------------------------
Avinash Chopde         office : 617 246 1776x5582
avinash@contex.com     (...!uunet!contex!avinash)
Newsgroups: comp.unix.programmer
From: achoi@cory.Berkeley.EDU (Andrew Choi)
Subject: Problem with Pseudo TTY of SunOS 4.1.1 for Sun3
Organization: University of California, at Berkeley
Distribution: usa
Date: Wed, 9 Sep 1992 01:08:47 GMT

Hi,

  When I opened a pty pair in SunOS 4.1.1 for Sun3, the master tty
is not recognized as a tty, thus causing standard output buffering
problem.  The result of running the following program is:

Master is not a tty
Slave is a tty

  I tried the same program again under other 4.3BSD dervied Unix'es,
and they give me instead:

Master is a tty
Slave is a tty

  Is this a bug with SunOS, or do I need to do something special
in making the master pty a tty as well?

  Thanks for your help.

XXXXXXXXXXXXXXXXXXXXXXXX CUT HERE XXXXXXXXXXXXXXXXXXXXXXXX

#include <stdlib.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>

#define TTY_NAME		"/dev/TtyXY"
#define TTY_POS_T		5
#define TTY_POS_X		8
#define TTY_POS_Y		9

/* Open a master pty and the corresponding slave tty.  Return 0 if */
/* OK, or -1 if cannot open a valid pty pair */
int
OpenPty(int *master, int *slave)
{
  char				ttyname[] = TTY_NAME;
  char				xnames[] = "pqrs";
  char				ynames[] = "0123456789abcdef";
  int				x, y;
  
  for (x = 0; xnames[x]; x++) {
    ttyname[TTY_POS_X] = xnames[x];
    for (y = 0; ynames[y]; y++) {
      ttyname[TTY_POS_Y] = ynames[y];

      /* Open Master (control) PTY */
      ttyname[TTY_POS_T] = 'p';
      if ((*master = open(ttyname, O_WRONLY)) < 0)
	continue;

      /* Open Slave PTY */
      ttyname[TTY_POS_T] = 't';
      if ((*slave = open(ttyname, O_RDONLY)) < 0)
	(void) close(*master);
      else 
	return 0;
    }
  }

  return -1;
}


int
main(int argc, char *argv[])
{
  int				master, slave;

  if (OpenPty(&master, &slave) < 0) {
    fputs("Failure to open pty\n", stderr);
    exit(-1);
  }

  if (isatty(master))
    puts("Master is a tty");
  else
    puts("Master is not a tty");

  if (isatty(slave))
    puts("Slave is a tty");
  else
    puts("Slave is not a tty");

  exit(0);
}

Newsgroups: comp.unix.programmer
From: geurin@texasex.nosc.mil
Subject: Please Help with buffered serial I/O in SunOS
Organization: Naval Ocean Systems Center, San Diego, CA
Date: Wed, 16 Sep 1992 01:37:18 GMT


Howdy-

I have a problem getting a read() to /dev/ttya (or ttyb) to return
when there aren't any characters to be read.  I did set the O_NDELAY
flag when opening the device:


  if ((sp_id = open(com,O_RDWR|O_NDELAY)) == -1)
    return(0);

  ioctl(sp_id,TIOCFLUSH,0);
  ioctl(sp_id,TIOCEXCL,0);
  ioctl(sp_id,TIOCGETP,&tty);
  tty.sg_ospeed=B9600;
  tty.sg_ispeed=B9600;
  tty.sg_flags=ANYP|RAW|TANDEM;
  ioctl(sp_id,TIOCSETP,&tty);


Whenever a read() is executed, and there no chars to be read, read should
return 0 for the number read, no?  Well, whenever I issue a read(),
the program just hangs there, waiting on something from the serial port.

So, I tried using select():


  FD_ZERO(&fdset);
  FD_SET(sp_id, &fdset);
  if (select(ulimit(4,0), &fdset, 0, 0, 0) <0) {
    perror("select");
    exit(1);
  }
  if (FD_ISSET(sp_id, &fdset)) {
    numrd = read(sp_id,&ch,1);

  etc...


Now, select() never returns!  ulimit() returns OK (64).

I must be missing something really basic, if both are waiting on
the serial port.

Please forgive if this is a stupid question.

Any/All help will be greatly appreciated!
Chance Geurin
geurin@nosc.mil
From: ccpaulm@cybaswan.UUCP (Paul Matthews)
Newsgroups: comp.unix.programmer
Subject: Determining Ethernet Addresses of Network Machines
Keywords: help...
Date: 15 Sep 92 14:49:03 GMT

Hi,

	We've been trying to build up a database of all the
	machines on our network, such as ip number, hostname
	and the ethernet address. So far, the program I've
	come up with is very crude/slow...it takes the /etc/hosts
	file as it's list of known machines and then performs a 
	ping on each machine and then uses arp -a (via grep) to
	find the ethernet address. The program has been running on
	a Sun ELC, and I've tried the standard sun routines, but
	they seem to look at /etc/ethers, which in our case isn't
	used. Is there a slightly neater/quicker way to achieve this ?
	Is there some sort of internal cache that can be interrogated
	or whatever ??

Thanks in advance for any help...

Paul Matthews

p.matthews@swansea.ac.uk
Newsgroups: comp.unix.programmer
From:  saty@ntc.togliatti.su (Sergey A. TsYbanov)
Subject: Re:nonblocking socket
Reply-To: saty@ntc.togliatti.su
Organization: AutoVAZ Research & Development Centre
Date: Mon, 7 Sep 1992 17:16:28 GMT

Hi !
tasos@cs.bu.edu (Anastasios Kotsikonas) writes to ALL:
>       Hi all,
>       assuming that a reader process reads from a nonblocking socket, how
>       can it know that the other end has close()'d?
	
In this programm function AsyncCheck does it asynchronously.
My operation system is Ultrix-32, version 3.1 .

--- CUT HERE ---

#include<sys/types.h>
#include<sys/time.h>
#include<sys/socket.h>
#include<sys/ioctl.h>
#include<netinet/in.h>
#include<netdb.h>
#include<stdio.h>
#include<errno.h>
#define PORT_NUMBER 13000

typedef enum { NOTREADY, ISREADY,  CLOSED }  status_t;

static status_t AsyncCheck( sock)
int sock;
{
  struct timeval tt;
  fd_set msk;
  tt.tv_sec= 0;
  tt.tv_usec= 0;
  FD_ZERO(&msk);
  FD_SET(sock, &msk);
  switch ( select( sock+1, &msk, (int *)0, (int *)0, &tt )  ) {
  case 0:
  return NOTREADY;
  case -1:
          perror("select");
          exit(1); 
  default:
     if( 0>ioctl( sock, FIONREAD, &sock ) )
	       perror("ioctl FIONREAD"), exit(1);
	 return sock>0? ISREADY : CLOSED;
  }
}

static void client(){
int s;
struct sockaddr_in addr_in;
char hostnm[ 32];
struct  hostent *hent;  
puts("Waiting for server to get ready");
sleep(2); 
if( gethostname( hostnm, 32 ) < 0 ) perror("gethostname"), exit(1);
hent=gethostbyname( hostnm );
if( hent == ( struct hostent *) 0 ) perror(hostnm), exit(1);
s= socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
if( s < 0) perror("socket"), exit(1);
addr_in.sin_family= AF_INET;
addr_in.sin_port= htons(PORT_NUMBER);
bcopy( hent->h_addr, (char *) &addr_in.sin_addr, hent->h_length );
if( connect( s, &addr_in, sizeof addr_in) < 0 ) 
perror("connect"), exit(1);
if( ioctl( s, FIONBIO, &s ) < 0 ) perror("ioctl FIONBIO"), exit(1);
 while( AsyncCheck( s) != CLOSED ) 
			      puts("Server exists");
puts("Client exiting...");
}

static void server() {
int s0, s1;
struct sockaddr_in addr_in;
s0= socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
if( s0 < 0) perror("socket"), exit(1);
bzero( (char *) &addr_in, sizeof addr_in);
addr_in.sin_family= AF_INET;
addr_in.sin_port= htons(PORT_NUMBER);
if( bind( s0, &addr_in, sizeof addr_in) < 0 ) perror("bind"), exit(1);
if( listen( s0, SOMAXCONN) < 0 ) perror("listen"), exit(1);
puts("Server is ready");
do 
s1= accept( s0, ( struct sockaddr_in *)0, ( int *)0 );
   while( s1< 0 );
( void) close( s0);
sleep(6);
puts("Server exiting...");
}

void main() {
switch ( fork() ) {
    case 0: server(); 
            exit(0);
    case -1: perror("fork");
             exit(1);
    default : client();
              exit(0);
};
}

--- CUT HERE ---

best regards
	      Saty from Togliatti.
! iH
-- 
 ******************* Is There Anybody Out There ? **********************
 *                   SATY ( Sergey A. TsYbanov ).                      *
 *  E-mail : saty@ntc.togliatti.su Phone : number +7 (8482) 378-17-53. *
 ***********************************************************************

Newsgroups: comp.unix.programmer,comp.protocols.tcp-ip
From: Steinar.Haug@delab.sintef.no (Steinar Haug)
Subject: Re: TCP reliability
Organization: SINTEF DELAB, Trondheim, Norway.
Date: 5 Sep 92 11:56:14

> We are currently implementing a distributed system providing the use of
> different computers (different UNIX workstations) connected by Internet.
> Our System is based on a server - client model using berkeley sockets.
> 
> These two entities are communicating through AF_INET family
> sockets of SOCK_STREAM type. Our Problem is, that a receiver implemented on
> a NeXT receives much more packets than the sender implemented on 
> a Sun workstation sends (1.3 : 1).
> 
> As TCP is known as sequenced, reliable and two-way connection based, this
> fact is surprising to us. Is it possible to avoid this ? 

Yes, TCP is sequenced and reliable. But it does *not* provide "record" (i.e.
packet) boundaries which are visible to the application. You must build these
on top of TCP yourself if you need them. (Or you could use UDP, which *will*
allow you to preserve packet boundaries - but then you must build the
necessary reliability yourself on top of UDP. Much easier to make a small
layer on top of TCP which does what you want.)

The operating system is free to turn one or more of your write() calls into
as many packets as it sees fit. I.e.,

- one write call may turn into many packets (write 50000 bytes and you will
 get approx. Ethernet 34 packets)

- many write calls may turn into one packet (call write many times with 1 byte
buffers, and the OS will probably try to coalesce your writes into bigger
packets)

Similarly, on the receiving side, each read() may return less data than you
asked for - this is also perfectly acceptable.

> The data exchange is made by normal read() and write() calls followed by an 
> acknowledgement. We transmitt packets of 5000 bytes of unstructered data.
> If a sender send 300 packets (as a concrete example) the receiver receives
> over 400 packets and about 120 of them are invalid. We consider this as a

I'm not sure I understand what you mean by saying "120 of them are invalid".
Could you be more specific? In the first place, what do you mean by a packet?
Is it one write() call, or is it for instance an Ethernet packet? From your
description it sounds more like one write() call.

TCP *is* reliable, if correctly implemented. I have used TCP on Suns for
years, and it works just fine. I have no reason to believe that it does not
work correctly on the NeXT...

Steinar Haug, system/networks administrator
SINTEF DELAB, University of Trondheim, NORWAY
Email: Steinar.Haug@delab.sintef.no, 
	sthaug@idt.unit.no, steinar@tosca.er.sintef.no
From: ecco@rniwh.rni.sub.org (Martin Sckopke)
Newsgroups: comp.unix.programmer
Subject: PL/I to C
Date: 6 Sep 92 21:28:49 GMT
Organization: Not organized in any way

Hi all,

does anybody know if there exists a PL/I to C translator for Unix ?
Or could anybody tell me for which Unix Versions there is an PL/I compiler
available ? I'd be especially interested in a compiler for HP/UX, Sinix
and the different PC Unix versions.

-- 
+------------------------------------------------------------------------+
+ Martin Sckopke                Weinheim, Germany                        +
+ ecco@rniwh.rni.sub.org        This space is reserved 4 sth VERY witty  +
+------------------------------------------------------------------------+
Xref: sparky comp.unix.programmer:4662 comp.unix.internals:1810
From: mueller@delta.cs.fsu.edu (Frank Mueller)
Newsgroups: comp.unix.programmer,comp.unix.internals
Subject: Re: spurious early wakeups by SIGALRM under SunOS 4.1
Date: 15 Sep 92 15:28:20 GMT
Followup-To: comp.unix.programmer
Organization: Florida State University Computer Science

In article <1992Sep14.223515.6843@noao.edu>, jdavis@bordeaux.kpno.noao.edu (Jim Davis) writes:
> In article <10728@sun13.scri.fsu.edu> mueller@pi.fsu.edu (Frank Mueller) writes:
> >Has anybody else experienced any spurious early wakeups by the timer signal
> >which was requested by a setitimer (real-time timer) under SunOS 4.1.1?
> >
> >Any ideas why this happens? Is it a known bug?
> 
> Yup.  Here's the patch README.  BTW, mail to pi.fsu.edu bounced with a 'Host
> unknown' error...
> 
> Patch-ID# 100458-02
[stuff deleted]

Thanks, Jim, but that didn't fix it. Our problem is that the SIGALRM is coming
in *early*. When we set up setitimer to send a signal in 60 sec. (from now, i.e.
using gettimeofday), the signal comes in and we check on the current time (again
gettimeofday) just to find out that the signal came up to ~20ms early. We were
under the impression that the semantics of setitimer guarantees that you are
woken up by SIGALRM *no earlier* than the specified time. These results vary
considerably from machine to machine, from always waking up early, over sporadi-
cally doing so, to never doing so.

Has anybody else an idea? (I wonder if Sun knows... Or if they even care... Maybe
it's a feature:-)

Frank
mueller@cs.fsu.edu

P.S. My return address should be fixed now.
Newsgroups: comp.unix.programmer
From: waynes@cognos.com (Wayne Salter )
Subject: password verification on SCO 3.2.2
Organization: Cognos Incorporated, Ottawa CANADA
Date: Thu, 10 Sep 1992 13:56:50 GMT

How do I go about doing password verification on SCO unix with
the C2 security in 3.2.2?

I can't find any clear reference to it in any of the manuals,
just a few scattered references to some of the system calls.

What I need is the calls that have to be made and the order
that they have to be made in to correctly access the authentification
database.

We thought that we had it working until someone changed their password
and now it doesn't work any more!

Any help would be greatly appreciated; even a reference to the
appropriate documentation.

Please respond via e-mail.

Thanks.



-- 
Wayne Salter    (613) 738-1338 x3226                    P.O. Box 9707
Cognos Incorporated                                     3755 Riverside Dr.,
waynes@cognos.com                                       Ottawa, Ontario
                                                        CANADA   K1G 3Z4
Newsgroups: comp.unix.programmer
From: aroll@gucis.cit.gu.edu.au (Ashley Roll)
Subject: Direct disk block an inode manipulation
Organization: Griffith University, Brisbane, Australia.
Date: Wed, 9 Sep 92 02:55:11 GMT

I have a question:

Is it possible to write a program that can directly manipulate disk blocks and 
inodes. That is I want to write a relational database program and for speed I 
want to play with the disk in blocks... Like seting up index files and such.

If anyone has example code to do this that would be great too look at :)

Thanks for your help..

Cheers,
Ashley Roll.


-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
  Ashley Roll - aroll@gucis.cit.gu.edu.au   Griffith University, Australia
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
   The difference between genius and stupidity is that genius has its limits.
                                   - Unknown.

                        - - - - - - - - - - - - - -
  The thoughts, ideas and opinions expressed herein are my own and as such  
    are completly correct, I will however respect your right to be wrong. 
-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
From: c23st@kocrsv01.delcoelect.com (Spiros Triantafyllopoulos)
Newsgroups: comp.unix.programmer
Subject: How can I get a stack trace within a program?
Date: 9 Sep 92 21:15:16 GMT
Organization: Delco Electronics Corp.

Hello net,

we're looking for a program to do stack a trace before it coredumps. We
would like to see, for example, the sequences of calls that resulted
in the program to bomb. I.e. something like that:

Main:
   foo( )
     bar( )
       abnormal termination line so and so.

Now we're doing lots of X windows stuff and once in a while we dump
core and would like some hint as to why this happens.  This should not
be impossible as 'trace' does more or less what we want. We have our
own signal catcher (signal 11, where are you?) and at least do some
damage repair there but would very much like more information.

I have seen how adb or dbx can do it (adb with '$c' and dbx/dbxtool
with 'where') but what we really want is to have this compiled in to
our code, and upon detection of the right signal (argh!), dump the
stack trace in a file or the screen and exit. Doing it post-mortem on
core files is not practical, and after we catch the signal there may
not even be a core file in most cases.

Any hints on how to do this would be vastly appreciated...

Thanks in advance,

Spiros

-- 
Spiros Triantafyllopoulos                    c23st@kocrsv01.delcoelect.com
Software Technology, Delco Electronics       striantafyll@kosds1.gm.hac.com
GM Hughes Electronics, Kokomo, IN 46904      [A Different Kind of Disclaimer]
Newsgroups: comp.unix.programmer
From: kly@sci.ccny.cuny.edu (Gregory Kozlovsky)
Subject: Dynamic linking
Reply-To: kly@sci.ccny.cuny.edu (Gregory Kozlovsky)
Organization: City College of New York - Science Computing Facility
Date: Wed, 9 Sep 1992 04:01:35 GMT

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?

I would appreciate your help.

Gregory