HDTenEightyP/NetNews huggingface dataset:
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer,comp.sys.sun.misc
Subject: Re: Installing a shared library without screwing up.
Keywords: libc.so replacing
Date: 18 Nov 92 08:30:53 GMT
Followup-To: comp.unix.programmer
Organization: Auspex Systems, Santa Clara
Originator: news@auspex-gw.Auspex.COM

>What is the right/best way to replace a libc.so with your site customised
>version? I dont want to have to go find the installation tape everytime
>I attempt it. Do I use 'cp' or 'cat mylib > /usr/lib/libc.so' or what?

Nope!

Doing so will be at least as catastrophic as copying on top of a
demand-page executable that's in use.

I'd be inclined to do:

	cp my_libc.so /usr/lib/libc.so.X.Y.new
	mv /usr/lib/libc.so.X.Y /usr/lib/libc.so.X.Y.save
	mv /usr/lib/libc.so.X.Y.new /usr/lib/libc.so.X.Y

where X and Y are the major and minor version numbers of the current
"libc" shared library.

>Im a
>bit worried that a context switch will happen halfway through it and bugger
>it all up.

UNIX context switches won't make a bit of difference if you use "mv";
processes that attached to the old "libc.so.X.Y" will stay attached to
it as long as they live.

Assuming your new "libc.so" works, the only "window of vulnerability" is
the period when *no* "/usr/lib/libc.so.X.Y" exists - i.e., between the
first "mv" and the second.

"mv" itself is statically linked:

	auspex$ file /usr/bin/mv
	/usr/bin/mv:    sparc pure executable

so it will work even if there's no "libc.so.X.Y".  (In fact, that's
precisely *why* it's statically-linked - so that it can, for example, be
used to restore the old "libc.so.X.Y" if the new one doesn't work.)
Newsgroups: comp.unix.programmer
From: fitzgb@mml0.meche.rpi.edu (Brian Fitzgerald)
Subject: Re: RPC server did not return status
Organization: Rensselaer Polytechnic Institute, Troy, NY
Date: Thu, 19 Nov 1992 15:26:24 GMT

Randy Crawford writes:
>In article <1992Nov11.095253.23538@news.mentorg.com> thiam-chye_sim@mentorg.com writes:
>
>No additional input to the server should be necessary.  However, I believe a 
>return integer* from the server _is_ customary.  After all, aren't the 
>rpcgenned functions (like whatever_1() ) typed to return an int?  Be sure 

They return pointers, as far as I know.

Sim Thiam Chye's rpcgen file generates the following client code:

void *
send_alarm_1(argp, clnt)
        body *argp;
        CLIENT *clnt;
{
        static char res;

        bzero((char *)&res, sizeof(res));
        if (clnt_call(clnt, SEND_ALARM, xdr_body, argp, xdr_void, &res, TIMEOUT)
 != RPC_SUCCESS) {
                return (NULL);
        }
        return ((void *)&res);
}

Many standard rpc functions return void *.  The NULLPROC is an example.

>that the return pointer is to a global or static integer.  Don't return the
>address of an automatic/stack variable.

Good advice.

>Did you try using rpcgen on the HP on your whetever.x file, and then compiling 
>up the new HP rpcgenned code?  The two rpcgens are a tad different (using 
>bzero() on the sun and goofing up memset() on the HP is "hpux" isn't defined).
>It's worth a try.
>-- 
>| Randy Crawford        crawford@mitre.org        The MITRE Corporation

In Thiam's code,

typedef char *string;
char sys_cmd[2048];

void *send_alarm_1(list)
body *list;
{
        char buf1[2048] ;
        char *token;
        int i;
        int j = 60;

        strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
        strcat(buf1, list->msg);
        strcat(buf1, "\"");
        strcat(sys_cmd, buf1);
        system(sys_cmd);
}

I think strcat(buf1, list->msg); is trouble because buf1 is uninitialized.

I have suggested

        strcpy(sys_cmd,"xalarm -geom +0+0 -nc -time +0 \"");
        strcat(sys_cmd, list->msg);
        strcat(sys_cmd, "\"");
        system(sys_cmd);

Brian
From: sivap-s@acsu.buffalo.edu (Suresh .S)
Newsgroups: comp.unix.programmer
Subject: Re: disk buffer size, portable record locking, cabbages, and kings
Date: 19 Nov 92 06:40:04 GMT
Organization: UB
X-Newsreader: TIN [version 1.1 PL6]

Joe Foster of Borg (jfoster@mcl.ucsb.edu) wrote:
: 1) Where is the best place to look for the disk block size? Calls
: to read() and write() seem to be faster when the size of the
: buffers passed to them are the same as the blocks in the kernel
: disk cache. Also, passing arbitrarily-sized buffers to reads and
: writes to raw disk devices seems to bomb. Again, the buffers seem
: to need to be the same size as the blocks in the disk cache.
: What .h file is best to look at? Is the #define fairly standard?

A call to statfs(2) or stat(2) will give  the best size  for file I/O.
In statfs it is f_bsize and in stat() it is st_blksize.

-- 
Suresh Sivaprakasam                    
Department of Computer Science,    SUNY Buffalo,    Amherst,   NY - 14260-0001
Internet :sivap-s@cs.Buffalo.EDU               Bitnet : sivap-s@SUNYBCS.BITNET
Xref: sparky comp.unix.programmer:5383 comp.unix.admin:6308
From: mike@pacsoft.com (Mike Stefanik)
Newsgroups: comp.unix.programmer,comp.unix.admin
Subject: Tracking software and hardware problems
Date: 21 Nov 92 06:07:14 GMT
Followup-To: comp.unix.programmer
Organization: Pacific Software Group, Riverside, CA

This question applies to both system administrators and software developer
alike, hence the cross-post. Simply put, what do you use to track problems,
either hardware or software in nature, on your UNIX systems?

I'm doing a little research into what software tools are out there that
provide problem tracking and produce reports that will tell you what kind
of problems are most frequently occurring and how long they take to be
resolved. If you use third-party software to track problems, I'd be interested
in hearing about what system you're using (contact information too, please)
and how it's working out for you. If you use something in-house, I'd
appreciate hearing about it as well. Any comments and/or clues are welcome.

Send email to mike@pacsoft.com, and I'll summarize for the net if there
is any interest. Thanks for your input.

-- 
Mike Stefanik  mike@pacsoft.com  ...!uunet!pacsoft!mike  (909) 681-2623
Pacific Software Group, Riverside, CA
Newsgroups: comp.unix.programmer
From: gudmund@itek.norut.no (Gudmundur Joekulsson)
Subject: how to rezero SCSI-bus unit (sun-os 4.1.1)
Organization: FORUT Information Technology
Date: Fri, 20 Nov 1992 09:58:43 GMT
Reply-To: gudmund@itek.norut.no (Gudmundur Joekulsson)


 Hello world,
 A little explanation of the scenario first ...
 I am using a converter box attached to the scsi interface,
 converting to a serial V.11 interface to a network.
 Every now and then (when restarting a daemon operating with the 
 converter box after a previous daemon was killed in while in an
 active state) I get a read error on the device, and the system
 writes out error messages, telling it is retrying the command. Finaly it
 performes a 'rezero' and then the device is OK again.  But the
 daemon causing the reset hangs, and must be taken away, and a new
 one started.  This also takes time (too loooooong !).
 
 I would like to be able to do something to force this
 'rezero'-thing before starting the new daemon, avoiding
 the daemon hanging.  I have the feeling that it is the device
 driver that performs this retry/rezero ?  How do I comand it
 to rezero a certain unit on the bus ?
 
 The system is SUN-OS 4.1.1, using the standard device driver 'esp'
 for the 'sd' devices.
 
 
 I have tried the ioctl requests listed in /usr/include/sun/dkio.h (or
 at least most of them) but they just get theyr info from the systems
 conf. and do not do anything with the physical device it self.
 I can of course write something to the device and thus make it fail
 and then reset by the system/driver, but the best thing would be
 to just reset it directly.  Hilfe Hilfe ...
 
 OR if there is no such shell command or system call ...
 
 Is there a way do 'probe' a specific target on the SCSI-bus, i.e. 
 something analogous to the boot ROM-mode: ROM> probe_SCSI, only from 
 a UNIX shell and to just one of the targets/units on the bus ?
 
 
 How do I do this, any ideas are welcome
 
 gudmundur

************************************************************************
Gudmundur Joekulsson      
gudmund@itek.norut.no
FORUT IT AS                     Forhaapningen 21-b, po.box 2806 Elverhoy
Norut gruppen			N-9001, TROMSO, NORWAY
From: cmb@epcc.ed.ac.uk (C.M.Brough)
Newsgroups: comp.unix.programmer
Subject: Re: RCS logfile usage
Date: 18 Nov 92 10:51:19 GMT
Followup-To: comp.unix.programmer
Organization: Edinburgh Parallel Computing Centre

In article <1992Nov17.150301.23707@geac.com>, adb@geac.com (Anthony DeBoer) writes:
> Direct keying lets you note the changes as you make them, while they're
> fresh in your mind, as opposed to having to remember a summary of what
> you did, to type in at checkin time.  Using the log feature, on the other
> hand, seems to gain only that the rlog command will list the log
> comments.  A third choice might be keeping the current change notes in a
> separate file and doing "ci foo.c < foo.notes", but that requires editing
> multiple files.

Use the 'rcsdiff' program to remind you of the differences that you
made when you are checking in the changes. I find this particularly
helpful as I can summarise all the changes I have made - say to a long
document, lots of changes all over the place, but all minor
re-arrangements as part of a review process, then I can have a single
``adjustments for review'' in the log, which is much more useful than
bit-by-bit comments on each change. X, with 'ci' in one window and
'rcsdiff' in another, makes this simple...!

> Using either feature gives you the comment changes during an rcsdiff, so
> there's no difference there, and you can always see who changed what and
> when.  Using $Log$ in the source does NOT buy you any log integrity;
> other than adding the most current comment at checkout time, it does not
> verify that previous comments are already there or that they haven't been
> altered or damaged during later editing at some point.

No, you don't gain any integrity. However, when you are sharing files
between multiple users having the log present in the file means that
you don't have to do a separate 'rlog' to find out what your colleague
did last. The size of logs can get out of hand, however, and totally
dominate the size of the file, so for small frequently edited files I
tend not to use $Log$, only $Id$, and explicitly look at the log using
rlog only when I need to.

> What do other RCS users do, and why?  I'd be interested in hearing your
> comments.  Thanks in advance.

Hope the above has been of interest. I too would be interested in how
other people do it.

__________________________________________________________________________
Colin Brough    cmb@epcc.ed.ac.uk      Edinburgh Parallel Computing Centre
From: mezrich@aramis.rutgers.edu (Reuben Mezrich)
Newsgroups: comp.unix.programmer
Subject: Adapting unix for physically handicapped.
Date: 24 Nov 92 02:48:37 GMT
Organization: Rutgers Univ., New Brunswick, N.J.


     I have a unix pc, and I need to somehow modyfiy the terminal
driver to make certain changes in the input stream so as to adapt the
computer to users with physical disabilities.  One of the needs is
simply to create what is called a sticky control key: when the control
key is pressed, followed by another character, it is as if the control
key and the character key were pressed simultaneously.  This is needed
for a person who can, because of physical limitations, only press one
key at a time, but wants to use software which requires control key
combinations for program control.
     If I had the source to the terminal driver, this, and other like
changes would be easy enough, but I wonder what other alternatives
exists.  For example, is it possible to write  a process which acts as
a filter for the terminal driver: which has as it's input the standard
in which other processes would normally access and outputs the
slightly modified stream ?  I imagine if I simply executed a shell
with it's input redirected from a program which does the desired
filtering, that it would work, but how would I make such a scheme
function system wide, regardless of which user logged on.  Also, how
could any program which does modify the terminal driver check for the
user pressing the contrl key which is not returned by itself as part
of the normal input stream ?  Any ideas or suggestions about
approaches to this problem would be appreciated.  Please do not
respond using email, as this is not my account.  A friend is allowing
me to use his account to post this question.  Please respone on this
newsgroup.

                                                    Much thanks,
                                                        Dave Grossberg
From: rdorich@jade.tufts.edu (Rob)
Newsgroups: comp.unix.programmer
Subject: Implementing semaphores in Unix (how?)
Date: 19 Nov 92 19:59:31 GMT
Organization: Tufts University - Medford, MA

Dear Netters,
	
	Not too long ago, I was given an assignment in which I had to
use semaphores.  We were given some functions that served as an
interface to all those sem.h functions, it turned out that they
weren't too consistent, and not too portable.

	And the question is!... Can any of you give me some guidelines
on how to create my own semaphores?  I don't think that the man pages
are enough for me... I get lost.  I just need some simple example to
get me started.

	Thank you very much in advance,

	Rob
-- 


-------------------------------------------------------------------------------
Roberto Dorich		 |           /~~  \ /  ~~/~~ /~~/  /~~  /|  /    /~~
Xref: sparky comp.unix.programmer:5339 comp.sys.sun.misc:5324
From: jrh@mustang.dell.com (Randy Howard)
Newsgroups: comp.unix.programmer,comp.sys.sun.misc
Subject: Re: Installing a shared library without screwing up.
Keywords: libc.so replacing
Date: 18 Nov 92 19:46:47 GMT
Organization: Dell Computer Co

mark@coombs.anu.edu.au (Mark) writes:

>On SunOS 4.x.x:
>I've heard a lot of horror stories about mistakes with libc.so replacing and
>how dynamic library loading programs die real quick if you tamper with their
>library.

>What is the right/best way to replace a libc.so with your site customised
>version? I dont want to have to go find the installation tape everytime
>I attempt it. Do I use 'cp' or 'cat mylib > /usr/lib/libc.so' or what? Im a
>bit worried that a context switch will happen halfway through it and bugger
>it all up.

>How would you guys replace it?

Use the rename(3) system call, since it is "supposedly" guaranteed to be
atomic.

>Any hints welcome.
>Mark
>mark@coombs.anu.edu.au
>mark@gnu.ai.mit.edu
>markm@rmit.edu.au
-- 
Randy Howard            _o	    @'s: jrh@dell.com
Dell Computer Corp.     \<,	    !'s: ...!uunet!dellunix!jrh
______________________()/ ()______________________________________________
Newsgroups: comp.unix.programmer,comp.sys.sun.misc
From: bosman@fwi.uva.nl (Cor Bosman)
Subject: Sun KeyBoard help wanted
Organization: FWI, University of Amsterdam
Date: Mon, 16 Nov 1992 18:35:44 GMT

Im trying to code something, but im not very succesfull with it sofar.
Here's my problem:

  I want to get keyboard events (mainly keypresses) from the keyboard
without disturbing other processes. So, whatever process I run
(this includes processes that want input, like 'vi') my program
needs to get all keypresses and perform some action with it.
This, while leaving other processes unharmed. So for example
'vi' doesnt even notice my other process is reading the characters
too. Is this possible? 
Sofar ive played a bit with opening /dev/kbd. Then read() from it.
This doesnt work. Somehow it has to be possible to read chars
without other processes being disturbed by it. 
Id appreciate any help/info. Maybe someone knows some code that
already does this (or partly). Or has some other general hints.

Cor Bosman
-- 
|bosman@fwi.uva.nl_   //     | Honest Officer , had I known my health      |
|-----------------\\ //AMIGA | stood in jeopardy I would never had lit one.|
|  PE no.1         \\/       |             -MAXIM (of the Hells Angels)-   |
|__________ Quickly Scotty,beam me up.There is no ox..y..ge..._____________|
Newsgroups: comp.unix.programmer
From: ihle@freia.inf.tu-dresden.de (Torsten Ihle)
Subject: Re: Decompress while merging?
Keywords: merge compress
Organization: Free University of Berlin, Germany
Date: Mon, 16 Nov 1992 10:33:05 GMT

I'm so sorry, of course the "wait" has to come before the "make clean" 
( I used to make clean manually )
From: swanger@accs.duc.auburn.edu (David Swanger)
Subject: How do you shell out of a C program
Reply-To: swanger@accs.duc.auburn.edu
Organization: Auburn University, AL
Date: Thu, 19 Nov 1992 21:42:20 GMT


I am writing a C program for my SUN IPC Workstation, SunOs 4.1.2,
and would like to be able to shell in and out of the program.  My
program uses curses (Sys V).  I tried the following command:

system("/bin/csh");

When the program reached this point, it seemed to shell out (I saw
the prompt), but the terminal froze up.  Obviously I am missing
something with either C or curses or system() or something.  I
would really appreciate some help with this.

Thanks in advance (and sorry if I posted to the wrong group).


David Swanger
Academic Computing Services
Auburn University, AL
swanger@accs.duc.auburn.edu
Newsgroups: comp.unix.programmer
From: bmehlman@trirex.com(Ben Mehlman)
Subject: Determining what ports are unused at run-time???
Reply-To: bmehlman@trirex.com
Organization: Trirex Systems Inc.
Date: Mon, 16 Nov 1992 22:15:40 GMT


I have an application in which a number of processes are running on either  
the same or different machines.  Each of these processes will be accepting  
connections on some port.  The process binds a socket to its port, and  
then reports the port number to a central process listening on a well  
known port.

The question is: How do I assign the port numbers at run time?  Right now  
Each process is manually assigned a known free port when it starts up.  I  
would like instead for it to somehow determine what is a good port on that  
machine, and use it.

Any suggestions would be greatly appreciated.
Thanks!
--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
    \|/        Ben Mehlman                      Indigo..
   ^   ^       Trirex Systems Inc      
   #   #       bmehlman@trirex.com                   Indigoing..
     @
   \___/       >NeXTMail Welcome<                           Indigone.
Xref: sparky comp.unix.programmer:5347 comp.sys.sun.misc:5336
From: guy@Auspex.COM (Guy Harris)
Newsgroups: comp.unix.programmer,comp.sys.sun.misc
Subject: Re: Installing a shared library without screwing up.
Keywords: libc.so replacing
Date: 19 Nov 92 02:23:09 GMT
Followup-To: comp.unix.programmer
Organization: Auspex Systems, Santa Clara

>Use the rename(3) system call, since it is "supposedly" guaranteed to be
>atomic.

Or just use the "mv" command, making sure the "from" and "to" names are
on the same file system, because, if they are, it'll do the "rename()"
call for you without you having to write code to use it (definitely so
in SunOS 4.x; true in SVR4 as well unless somebody screwed up
massively).

There is, of course, more to it than *just* the rename; see other
postings in this thread.
From: tmilner@hprpcd.rose.hp.com (Tom Milner)
Date: Thu, 19 Nov 1992 22:53:40 GMT
Subject: Re: mmap() for hp-ux?
Organization: Performance Technology Center, Roseville
Newsgroups: comp.unix.programmer

In comp.unix.programmer, mikey@ontek.com (euphausia superba) writes:

|    Is there an equivalent to mmap() under hp-ux?  Or are the
|    shm* sys calls the closest thing?  Any help would be appreciated!
|
|         the krill
|

HP-UX 9.0 supports mmap().
Newsgroups: comp.unix.programmer
From: sinan@carson.u.washington.edu (Sinan Karasu)
Subject: swapcontext etc...
Organization: University of Washington, Seattle
Date: Thu, 19 Nov 1992 22:24:13 GMT

Hi,
The following code runs as it should but then hangs.
The output should be :

metsun% rtt1
 Calling 1 
 HELLO THERE 1 
 Calling 2 
 HELLO THERE 2 
 Calling 3 
 HELLO THERE 3 
metsun% 

Without the Control-C ( I always have to abort it).
What I want it to do is to return back to main and stop. 
What am I doing wrong?

Environment: 
Sparc2
Solaris2


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


#include <ucontext.h>
ucontext_t test_cp,exec_cp;
void rtt_exec(mode,func)
int mode;
void func();
{
   switch (mode) {
	case 1: /* Remember the address of  */
                getcontext(&test_cp);
                makecontext(&test_cp,func,0);
                return;
 	case 2: /* Execute the TEST routine */
		swapcontext(&exec_cp,&test_cp);
		return;
   }
 }

void rtt_return()
{ 
        swapcontext(&test_cp,&exec_cp);
	return;  
}
void TEST()

{	printf(" HELLO THERE 1 \n");
 	rtt_return();
 	printf(" HELLO THERE 2 \n");
 	rtt_return();
 	printf(" HELLO THERE 3 \n");
 	return;
}
main()

{ 

	rtt_exec(1,TEST);
	printf(" Calling 1 \n");
	rtt_exec(2);
	printf(" Calling 2 \n");
	rtt_exec(2);
	printf(" Calling 3 \n");
	rtt_exec(2);
}





Newsgroups: comp.unix.programmer
From: rlerdorf@zeus.UWaterloo.ca (Rasmus Lerdorf)
Subject: IPC programming under Ultrix 4.2
Keywords: Motif Xm Xt Xlib IPC
Reply-To: rlerdorf@zeus.UWaterloo.ca
Organization: University of Waterloo
Date: Fri, 20 Nov 1992 17:19:47 GMT

I am writing a Motif application and I wish to fork and exec another  
application.  This second application needs to communicate with the parent.  I  
have read everything I could find on IPC programming, but am still quite unsure  
of which is the best method to approach this problem.  If anybody could shed  
some light on this, I would appreciate it.  Code fragments showing the use of  
IPC functions would also be very welcome.  Or even just a hint at which  
publically available applications out there does something like this so I could  
go grab the code somewhere.

Thanks in advance for any help
--
Rasmus Lerdorf     internet: rlerdorf@zeus.uwaterloo.ca (NeXT-mail)
  _   _   _   _    FAX     : 519 746-4791                     Nutec Corp. 
 _ _   _ _ _ _     Phone   : 519 886-6009                     DIA member
_   _   _   _   ** AlphaWindows(tm) Coming soon to a terminal near you **
Newsgroups: comp.unix.programmer
From: dsiebert@icaen.uiowa.edu (Doug Siebert)
Subject: What are the units of time in struct linger?
Organization: ISCA
Date: Mon, 23 Nov 1992 12:12:08 GMT

I want to set a linger interval on a socket so it doesn't hang around forever
in a CLOSING state with stuff in the send queue.  I'm given this helpful entry
in TFM:

/*
 * Structure used for manipulating linger option.
 */
struct  linger {
        int     l_onoff;                /* option on/off */
        int     l_linger;               /* linger time */
};


What exactly are the units of time for "linger time"?  Writing a test program
seems a bit difficult in this case, since I don't know exactly how to simulate
the conditions necessary for the linger option to come into play.  What I want
is a linger time of maybe 5 seconds -- do I put a 5 in there, or is this in
units other than seconds, as seems likely to me?

-- 
/-----------------------------------------------------------------------------\
| 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 |
\-----------------------------------------------------------------------------/
Newsgroups: comp.unix.programmer