HDTenEightyP/NetNews huggingface dataset:
From: mark@drd.com (Resident.Alien)
Subject: Getting ready to use sfio: Any gotchas?
Organization: DRD Corporation
Date: Thu, 12 Nov 1992 23:28:50 GMT


I'm getting ready to employ the sfio library functions.  I've got a
situation where some client code writes a line-oriented temporary
file and then turns right around and hands the pathname to a library
function that immediately slurps the contents of the file in
line-oriented mode, formats into sql insert/update statements as
appropriate and passes it down a connection to an rdbms back-end.

I was thinking that this was a golden opportunity to exercise sfio's
SF_STRING|SF_LINE type of stream and hand the stream handle across the
library call.

Anybody have any gotcha's before I pile in?  I'm interested in
establishing contact with other sfionauts.

-- 
mark.lawrence@drd.com                                     (918)743-3013
DRD Corp., 5506 South Lewis Ave., Tulsa, OK 74105         (918)745-9037 fax
From: mikey@ontek.com (euphausia superba)
Newsgroups: comp.unix.programmer
Subject: Re: How do I make dynamic link libraries?
Date: 11 Nov 92 21:57:34 GMT
Organization: Ontek Corporation -- Laguna Hills, California

In comp.unix.programmer, tse@leland.stanford.edu (Eric Tse) writes:
| Hi,
| 	I am new to dynamic-link libraries and wonder how I can 
| create one. For example, if I want to make f1.o f2.o into a 
| libtest.so.0.1, do I do:
| 	ld -Bdynamic f1.o f2.o -o libtest.so.0.1
| ?
| 	Then if I want to compile a programm a.out originally
| using f1.o and f2.o, do I do:
| 	cc -Bdynamic -o a.out other1.o other2.o libtest.so.0.1
| ?
| 	If I want to execute a.out, do I have to
| 	setenv LD_LIBRARY_PATH /path_of_the_so
| before I run a.out?
| 
| But it does not work! Any help? Please?

Judging by your use of the -Bdynamic option, I'm guessing that
you're doing this with SunOS or at a least BSD-ish linker.

Here's what you have to do.

1. When you compile f1.c and f2.c use the -pic option.  If you're
using gcc try -fpic.  This tells the compiler that it needs
to generate position-independent-code, so that the library can be
linked in at any old place in the address space at run time.
If the library becomes too large you will need -PIC or -fPIC.

2. Create the library like so

  ld -o libtest.so.0.1 -assert pure-text f1.o f2.o

The -assert pure-text is there to make sure you compiled everything
with -pic.  To get full benefit of the "shared" part of shared
dynamic libraries you should put code which contains definitions
of global variables into a separate .sa library.  RTFM ld(1) for 
more details.   Your code will still run with globals, but if 
it's a large library that many programs may be using at once,
using a .sa library can reduce the load on the system a bit.

3. link your program to the library.  I prefer this method:

  cc -o a.out other1.o other2.o -L/libdirname -ltest

Where libdirname is the full pathname where the test library is 
located.  -Bdynamic is the default for SunOS's ld so there's
no need to mention it on the command line.  The -L option
makes fiddling with LD_LIBRARY_PATH less necessary.

       the krill

Newsgroups: comp.unix.programmer
From: tone@leland.stanford.edu (Tony Lin)
Subject: NNTP newsreader programming
Keywords: NNTP, network
Organization: DSG, Stanford University
Date: Sat, 7 Nov 92 08:27:10 GMT

Hi everyone!  I am trying to update my newsreader so that it would be
able to connect to our NNTP news server from another machine.  I have
read RFC 977, but am not sure how to use that.  I am new to network
programming, and am looking for any source code from existing
newsreaders, code fragments on how to connect to another machine, and tips
or suggestions.  Does anyone know where I can get more information?
Have any of you written a newsreader like rn?  Please e-mail responses
directly to me (tone@leland.Stanford.EDU).  Thanks.

					Tony

		



Xref: sparky comp.unix.programmer:5237 alt.sys.sun:3369
From: mlevin@husc8.harvard.edu (Michael Levin)
Newsgroups: comp.unix.programmer,alt.sys.sun
Subject: a question about xview
Date: 10 Nov 92 21:36:35 GMT
Article-I.D.: husc3.1992Nov10.163636.17315
Distribution: usa
Organization: Harvard University Science Center


    I have just come into the posession of some C code which runs on a
certain sun-4. I tried recompiling it on a different sun-4, and 
it is not able to find /usr/include/xview/. What exactly is xview
(i.e., what relation does Sun's xview have to X11 in general, etc.)
and what determines whether a particular sun machine will have it or
not? Also, it it possible to easily (i.e., without rewriting all of
the graphics code) to recompile a program which uses xview calls on a
DecStation or a Silicon Graphics Iris, or is xview only a Sun thing?
Please reply to husc8.harvard.edu.

Mike Levin
Newsgroups: comp.unix.programmer
From: tse@leland.stanford.edu (Eric Tse)
Subject: How do I make dynamic link libraries?
Organization: Stanford University
X-Newsreader: Tin 1.1 PL5
Date: Wed, 11 Nov 92 00:45:46 GMT

Hi,
	I am new to dynamic-link libraries and wonder how I can 
create one. For example, if I want to make f1.o f2.o into a 
libtest.so.0.1, do I do:
	ld -Bdynamic f1.o f2.o -o libtest.so.0.1
?
	Then if I want to compile a programm a.out originally
using f1.o and f2.o, do I do:
	cc -Bdynamic -o a.out other1.o other2.o libtest.so.0.1
?
	If I want to execute a.out, do I have to
	setenv LD_LIBRARY_PATH /path_of_the_so
before I run a.out?

But it does not work! Any help? Please?


--
========================================================================
Eric Tse
tse@leland.stanford.edu
========================================================================
Newsgroups: comp.unix.programmer
From: patters@eecs.nwu.edu (Sean K. Patterson)
Subject: TCP, UDP protocols vs. Unix domain protocols
Originator: patters@eden.eecs.nwu.edu
Organization: EECS Department, Northwestern University
Date: Fri, 6 Nov 1992 15:07:56 GMT


I am writing some distributed software using Sun RPC 4.0.  The software
consists of one client and several servers.  Besides accessing servers
on remote hosts, the client will also have to be able to access servers
running on the same host as the client.

My question is about accessing these local servers.  I know that it is no
problem for a client to access a local server using Sun RPC, but I am worried
about the performance.  I have gathered from the RPC documentation that TCP
(or UDP) is used for all remote procedure calls even if the server is running
on the same host as the client.

Is this slower than creating some sockets and using the Unix domain protocols?
It is important to me that the performance of remote procedure calls to
a server on the same host be as good as possible.

I guess this question boils down to:

When a process communicates with another process on the same host using TCP
(or UDP), are packets actually put on the network, which then come right back
to the host?  Or is the communication handled by the kernel (as with the Unix
domain protocols)?

I am trying to determine whether I should commit the time and effort into
writing my own RPC package (using Unix domain sockets) for communication
between a client and server on the same host and using Sun RPC for
communication between clients and servers on different hosts, or just using
Sun RPC for everything.

Thank you.

Sean

-- 

Sean Patterson
Northwestern University
s-patterson@nwu.edu
Newsgroups: comp.unix.programmer
From: dave@copi.cmhnet.org (David Diller)
Subject: Extended Terminal Interface Lib or something Similar?
Organization: Coordinated Office Programs
Date: Wed, 11 Nov 1992 15:21:36 GMT

Does anyone use ETI or has anyone created their own version of ETI?
These routines are most annoying to use, the problem I'm having is form_driver
once returned E_UNKNOWN_COMMAND when you gave it a FUNCTION_KEY value.
After an update ISC 2.2 to ISC 3.0 the laws of ETI no longer apply.

If you send form_driver a value between 0402 and 0600 it swallows it and
returns E_OK instead of E_UNKNOWN_COMMAND as it once did.

There is a work around so it's not a real problem, I'm just venting my
frustration!  I'll break down buy the latest book on programming with
ETI and call SunSoft and complain.

If someone knows of a package that works with Terminals and does forms panels
menus like things let me know.

Thanks,
-- 
David Diller            (dave@copi.cmhnet.org)     (614) 469-0240 Work.
From: huang1@husc10.harvard.edu (Howard Huang)
Newsgroups: comp.unix.programmer
Subject: Re: Creating a background process from within C prog
Date: 11 Nov 92 01:18:31 GMT
Article-I.D.: husc10.HUANG1.92Nov10171831
Organization: Harvard Arts and Sciences Computer Services, Cambridge, MA
In-reply-to: jcmurphy@acsu.buffalo.edu's message of 27 Oct 92 22:55:41 GMT

jcmurphy@acsu.buffalo.edu (Jeff Murphy) writes:

     kiddo = fork();

     if (kiddo == 0)
       {      
	 system("ls > /tmp/myfile");
	 exit(0);
       }  
     printf("world\n");

In a real application be sure you check the return value of fork for
errors.  For example, fork will fail if the user has reached his/her
process limit.
From: behrenss@Informatik.TU-Muenchen.DE (Soenke Behrens)
Newsgroups: comp.unix.programmer
Subject: debugging format?
Date: 5 Nov 92 12:39:03 GMT
Organization: Technische Universitaet Muenchen, Germany
Originator: behrenss@hphalle5a.informatik.tu-muenchen.de


Hello,

could someone point me to literature about the format of the source level
debugging information that many compilers are able to generate? I.e.
how are the symbol tables constructed, how does the debugger know a new
line has begun, etc.

I am aware that there might be different implementations of this. Is there
perhaps a lib that allows one to write portable compilers? Etc.

I apologize for the dumb question, but the man-pages were little help,
and I'd rather have a good reference in printed form.

Soenke
-- 
===========================================================================
More than silver, more than gold, I need   !    behrenss@informatik.
electricity. I need it for my dreams.      !    tu-muenchen.de
(RACTER)                                   !  FIDO: 2:246/13 Soenke Behrens
From: tasos@cs.bu.edu (Anastasios Kotsikonas)
Newsgroups: comp.unix.programmer
Subject: Re: SO_REUSEADDR (was: Re: Socket Programm
Date: 10 Nov 92 01:30:16 GMT
Organization: Computer Science Department, Boston University, Boston, MA, USA

In article <1992Nov9.161326.19246@wuecl.wustl.edu> pete@arl.wustl.edu writes:
>In article 101017@bu.edu, tasos@cs.bu.edu (Anastasios Kotsikonas) writes:
>>In article <1992Nov7.023043.19007@wuecl.wustl.edu> pete@arl.wustl.edu writes:
>   [.. my comment saying SO_REUSEADDR doesn't work as advertised...]
>>
>>I am sorry but this is nonsense. I have used SO_REUSEADDR on BSD 4.1.1, AIX
>
>hmmm, I think some more detail is needed...  I'm not saying your wrong
>(please, no flames :-),  just that I've got conflicting stories...


... technical stuff [which I do not understand] deleted ...

Here is the code I am using that has NEVER had any problems:

 if ((sock = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
    report_progress (report, "\ncreate_connection(): Could not create socket",
		     TRUE);
    return -1;
  }
  if (setsockopt (sock, SOL_SOCKET, SO_SNDBUF, (char *) &sendbuf,
		  sizeof (sendbuf)) < 0)
    report_progress (report, "\ncreate_connection(): Could not set socket \
options", TRUE);
  if (setsockopt (sock, SOL_SOCKET, SO_RCVBUF, (char *) &recvbuf,
		  sizeof (recvbuf)) < 0)
    report_progress (report, "\ncreate_connection(): Could not set socket \
options", TRUE);
  if (setsockopt (sock, SOL_SOCKET, SO_KEEPALIVE, (char *) &val,
      sizeof (val)) < 0)
    report_progress (report, "\ncreate_connection():WARNING: Cannot toggle \
keep-alive connections", TRUE);
  val = 1;
  if (setsockopt (sock, SOL_SOCKET, SO_REUSEADDR, (char *) &val,
      sizeof (val)) < 0)
    report_progress (report, "\ncreate_connection():WARNING: Cannot toggle \
reuse of local address", TRUE);

... and now for the binf() ...:

  while (bind (sock, (struct sockaddr *) &server, sizeof (server)) < 0 &&
	 errno == EADDRINUSE && timeout < 180) { /* For perm port keep trying */
    ++timeout;
    errno = 0;
    sleep (1);
  }
  if (timeout >= 180) {
    report_progress (report, "\ncreate_connection(): Could not bind", TRUE);
    return -1;
  }


TRUE, I expect bind to delay me, but it has never delayed more than 3 seconds
(3 iterations of the loop).

>I really just want an answer to how to close a socket hard, in such a way that any data
>still in the system is discarded, and I can start up right away again.  I realise that discarding

I use close() which guarrantees the fastest return to the program, and flushing
of the data if the connection is broken, etc.

Lastly, I am very hesitant to believe that someone found a bug with
SO_REUSEADDR after so many years in use! I would be convinced if I could read
the code to inetd and in it such a problem was mentioned!!!

Tasos
Newsgroups: comp.unix.programmer
From: jck@kimba.catt.citri.edu.au (Justin Kibell)
Subject: lockf problem on SparcStation 2
Keywords: lockf
Organization: CATT Centre at CITRI, Melbourne, Australia
Date: Tue, 10 Nov 92 01:44:53 GMT

I am currently trying to get file locking for a program I am working on and
it isn't working to well.

My question is, can you use fd = fileno(fp) where fp is (FILE *fp) and then 
pass the result to lockf(fd, F_LOCK, 0L)? The result I get is :- 

lockf: Bad file number

I've checked permissions on files etc and it just ain't working. :-(

SparcStation 2 - OS 4.1.2

Justin Kibell: SDL 88 GR Case Tool Development Project - XMelba Version 0.13
               Centre for Advanced Technology in Telecommunications	
               Collaborative Information Technology Research Institute
               jck@jaguar.catt.citri.edu.au		Phone: +61 3 282 2456
Newsgroups: comp.unix.programmer,comp.mail.mh
From: leisner@wrc.xerox.com ( Marty Leisner)
Subject: setuid programs and calls...
Reply-To: leisner.henr801c@xerox.com
Organization: Xerox
X-Newsreader: TIN [version 1.1 PL6]
Date: Thu, 5 Nov 1992 22:08:32 GMT


I have two programs. There both setuid to root...:
I'm on Sparcs on SunOS 4.1.2...

This works:
cat readzombi2.c
main()
{
        if(0 != setuid(220)) {
                perror("setuid failed: ");
                exit(1);
        }
        system("printenv LD_LIBRARY_PATH");
        system("scan -file /net/zombi/files5/spool/mail/leisner");
        system("id");
}

leisner@annapurna$ ls -l readzombi2*
-rwsr-xr-x   1 root     staff       24576 Nov  5 16:23 readzombi2*
-rw-r--r--   1 leisner  staff         192 Nov  5 12:58 readzombi2.c
leisner@annapurna$ readzombi2
/usr/lib/X11:/usr/openwin/lib:/usr/marty/lib
   1  10/22 Ellie Young        I'm away from the USENIX office<<I will be out of the office from October 20-
   2  11/05 Marty Leisner 767  <<hi there >>
uid=220(leisner2) gid=10(staff) groups=10(staff),0(wheel),2(kmem),3(bin),6(news),25(testrcs)

This doesn't:
leisner@annapurna$ cat readzombimail.c; ls -l readzombimail*; readzombimail
#include <stdio.h>

main()
{
        int i;

        if(0 != setruid(220)) {
                perror("setuid failed: ");
                exit(1);
        }
        system("printenv LD_LIBRARY_PATH");
        i = system("scan -file /net/zombi/files5/spool/mail/leisner");
        printf("i = %d\n", i);
        system("id");
}

-rwsr-xr-x   1 root     staff       24576 Nov  5 16:31 readzombimail*
-rw-r--r--   1 leisner  staff         250 Nov  5 16:31 readzombimail.c
/usr/lib/X11:/usr/openwin/lib:/usr/marty/lib
ld.so: libmh.so.1: not found
i = 32512
uid=220(leisner2) gid=10(staff) euid=0(root) groups=10(staff),0(wheel),2(kmem),3(bin),6(news),25(testrcs),300(siena)

I don't understand why it can't find the shared library doing setruid instead of setuid (I see nothing else different
(except for the i). 

What am I missing?  This doesn't make sense to me...

--
marty
leisner.henr801c@xerox.com  
Member of the League for Programming Freedom
Newsgroups: comp.unix.programmer
From: jwang@white.toronto.edu (Jingwen Wang)
Subject: Ho to avoid hanging when file server is down?
Organization: CSRI, University of Toronto
Date: 7 Nov 92 21:05:34 GMT


   I am writing a daemon that would occasionally log events into a log file.
The log file is in the file server and I am using fprintf() to write records
into the file. The problem is: if the file server is down, I do not want to
hang there until the file server comes back. I would prefer to continue
to do other things and when file server comes back, I write the information
in batch.

   My questions are:

1. Is there a way to know if the file server is down before I actually 
   execute fprintf()?

2. If the file is NFS automounted from another file server, I sometimes
   got a 'Stale NFS file handle' message when the server comes back from
   a reboot. 

   For the second question, if I close and re-open the file, then it would
   be fine, but still there is possible hanging during fopen().

Any help?

Thanks.

jwang

  {}
{}(){} -----> Jingwen Wang, Univ. of Toronto       (416)-978-1675 (office)
  {}          jwang@sys.toronto.edu         (416)-593-6750 (home)

--
  {}
{}(){} -----> Jingwen Wang, Univ. of Toronto       (416)-978-1675 (office)
  {}          jwang@snow.white.toronto.edu         1-800-ASK-wang (home)

Newsgroups: comp.unix.programmer
From: dkeisen@leland.Stanford.EDU (Dave Eisen)
Subject: Re: Creating a background process from within C prog
Organization: Sequoia Peripherals, Inc.
Date: Thu, 12 Nov 92 02:09:13 GMT

In article <1992Nov12.003035.24322@tc.cornell.edu> mdw@theory.TC.Cornell.EDU (Matt Welsh) writes:
>In article <1992Nov11.032950.23086@leland.Stanford.EDU> dkeisen@leland.Stanford.EDU (Dave Eisen) writes:
>>If you're going to use system, you might as well take the shell
>>you spawn for all it's worth and write:
>>
>>      system ("ls > /tmp/myfile &");
>
>Um, why? The process running the system is fork()ed from the parent, which 
>isn't neccesarily wait()ing for the child to finish. That won't buy you
>much (unless I'm very confused :)). 


No no no.... Do the system in the parent. My point is that
if you are going to do a "system", there is no reason to
fork in the parent. The system statement above runs ls
in the background without having to do any explicit forks.

I said to replace:

   kiddo = fork ();
   if (kiddo == 0) {
      system ("ls > /tmp/myfile");
      exit (0);
   }

with
   
   system ("ls > /tmp/myfile &");



-- 
Dave Eisen                               Sequoia Peripherals: (415) 967-5644
dkeisen@leland.Stanford.EDU              Home:                (415) 321-5154
       There's something in my library to offend everybody. 
          --- Washington Coalition Against Censorship
From: kwang@zeus.calpoly.edu (Kevin Wang aka The Scarecrow)
Newsgroups: comp.unix.programmer
Subject: RS6000 aix 3.2x & signals
Date: 5 Nov 92 21:57:39 GMT
Followup-To: poster
Organization: The Outland Riders

NOTE: I DO NOT READ THIS NEWSGROUP REGULARLY. PLEASE EMAIL ME DIRECTLY

Apparently, the sigvec() either doesn't work right, or SIGIO is
specifically broken... can anyone confirm/deny this?

The fd's that I should be getting input are internet stream sockets.

Also, a similar symptom is when using just signal() (different program)
accept() does not return EINTR when interrupted by a SIGALRM, but then
again, it isn't listed on the man pages either (how bass ackwards CAN
ibm get?).

Here's the code that uses the SIGIO:

FUNCTION int WhosNext(int sock, inetfulladdr *addr, int *addrlen, int *insock)
{  /* insock=-1 for interrupted accept & returns CLIENT, else returns REMOTE */
	/* look for new client, or wait for SIGIO from existing clients */
	struct sigvec sigctrl;
	
	sigctrl.sv_handler = AlarmHandler;
	sigctrl.sv_mask = SIGIO;
	sigctrl.sv_flags = 0;
    sigvec(SIGIO, &sigctrl, NULL);
	puts("Waiting for new");
	*insock = AcceptConnect(sock, addr, addrlen); 
	puts("going...");
	sigctrl.sv_handler = SIG_IGN;
	sigctrl.sv_mask = 0;
	sigvec(SIGIO, &sigctrl, NULL);
	if (-1 != *insock)
		{  /* if not interrupted by SIGIO */
		if (REMOTE == RecvHeader(*insock, DEFAULT_TIMEOUT))
			return(REMOTE);
		}
/* else 1: sigio interrupted, and not remote 2: normal accept, not remote */
	return(CLIENT);
}

   - kevin Wang
...And now, for your local station identification, on the hour, every hour...
kwang@nike.calpoly.edu or kwang@gauss.elee.calpoly.edu
---
   "The angle of the dangle,
    is inversely proportional
    to the heat of the meat,
    while the mass of the ass is constant."
Xref: sparky comp.unix.aix:11547 comp.protocols.nfs:2762
From: bguest@ateam.ems.cdc.com (Brandon Guest)
Newsgroups: comp.unix.aix,comp.protocols.nfs
Subject: Re: UDP Checksum on NFS in AIX 3.2?
Keywords: NFS udp checksum
Date: 12 Nov 92 14:57:47 GMT
Followup-To: comp.unix.aix
Organization: Empros Systems International, a division of Control Data

In article <BxKvzC.5p9@well.sf.ca.us> nlane@well.sf.ca.us (Nathan D. Lane) writes:
>I am attempting to run NFS over a slip link on AIX 3.2.2 at 19.2K.  Now, I know
>that slip is no way to run NFS, but I am conducting reliability and feasibility
>tests for the VERY occassional use of this access method.

[stuff deleted]

>Anyone know if udp checksums can be turned on in AIX 3.2.2?
>My SE is out of town and probably wouldn't know anyway :(
>
>Thanks in advance for any help.
>
>-Nathan Lane
>Trico Title Company, Santa Barbara, CA
>nlane@well.sf.ca.us
> 

We have also had occasion to need UDP checksumming (during a problem
with a router).  Upon investigation we found that there is no standard
way in AIX to do this.  We were, however, able to get a patch from
Austin technical support which turned UDP checksumming on.  

The problem with this was that it was just a patch and not a part of
standard AIX.  This made it somewhat difficult to use.  Based on
our experience, we opened a PMR requesting this feature be added to
standard AIX.  So far we have had not action on our PMR.  

My suggestion is as follows:

1) For your immediate need- talk to tech support and see if you can
   get a patch for your level of the system which allows you to turn
   it on.

2) For everyone's long term benefit, open a PMR requesting it be made
   standard like we did.  I believe the only way we can ever get this
   to happen is if enought people request it.

If you want additional info on our experience, please email me.

Brandon

-- 
H. Brandon Guest                | bguest@ems.cdc.com
Empros Systems International    | (A division of Something)
2300 Berkshire Lane North       | Voice (612) 553-4529
Plymouth, MN 55441-3694         | Fax   (612) 553-4018
Newsgroups: comp.unix.aix
From: aknowles@expert.expert.com (Anne Knowles)
Subject: Migrating to the RS/6000
Organization: Computer Publishing Group
Distribution: comp
Date: Fri, 6 Nov 1992 16:01:17 GMT

I am a reporter with RS/Magazine, a magazine for RS/6000 users. I am
working on a story about downsizing from other platforms to
the RS/6000. I am interested in talking to any users who have either
already done a migration or are in the midst of one. Please email me
if you'd be interested in discussing your migration experiences
with me.

Thanks in advance for any help.

Anne Knowles