Linux-Development-Sys Digest #841, Volume #7     Wed, 10 May 00 11:13:17 EDT

Contents:
  Re: Object oriented OS (?) (Greg Law)
  Re: Two really easy (I'm sure) questions ("Mark Graybill")
  Socket programming (Aymeric BLAZY)
  Re: ** gdb Question (Marc Spoorendonk)
  changing unix user pasword from a program (Emili =?iso-8859-1?Q?Sanrom=E0?=)
  inb/inb_p; outb/outb_p (Pankaj Kakkar)
  Timers? (Colin Ford)
  Re: A need for better insallation programs (Mario Klebsch)
  Re: Two really easy (I'm sure) questions (Mario Klebsch)
  Re: Two really easy (I'm sure) questions (Mario Klebsch)
  Re: Need to find my IP address (Mario Klebsch)
  Re: Need to find my IP address (Mario Klebsch)
  Re: sendmsg / recmsg / sockets / cmsg (Mario Klebsch)
  Re: RS-485 (Mario Klebsch)

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

From: Greg Law <[EMAIL PROTECTED]>
Crossposted-To: alt.os.development
Subject: Re: Object oriented OS (?)
Date: Wed, 10 May 2000 10:32:10 +0100

"Maxim S. Shatskih" wrote:
> 
> > same-machine RPC going over TCP over loopback to get to another process
> > (which is what I believe happens if you do it naively on most UNIXes).
> 
> Are you sure that such RPC will not use UNIX domain sockets?

I don't know.  I sort of assumed that was the case because performance
was so bad :-) (i.e. 55,000 cycles for a same-machine, null-RPC).

Does anyone know what happens here?  i.e. On most UNIXes, when you do an
RPC to a different process on the same machine and you don't do any
'cleverness', do the messages just go over the loopback interface? 
Anyone know how to get null-RPC to improve on (say) Linux?

Greg

-- 
Greg Law,                               email:  [EMAIL PROTECTED]
Dept. Of Computing,                     web:    http://www.soi.city.ac.uk/~gel/
City University,                        phone:  +44 020 7477 8341
London, UK.  EC1V 0HB.                  fax:    +44 020 7477 8587

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

Reply-To: "Mark Graybill" <[EMAIL PROTECTED]>
From: "Mark Graybill" <[EMAIL PROTECTED]>
Crossposted-To: comp.os.linux.development,comp.os.linux.development.apps
Subject: Re: Two really easy (I'm sure) questions
Date: Wed, 10 May 2000 09:43:41 GMT


Peter T. Breuer wrote in message <8fb78r$f2o$[EMAIL PROTECTED]>...
>And I wouldn't want to. Freedom is important to me. It seems you are
>used to dealing with people you can browbeat.


Where do you get browbeating out of:?

>> These people were
>> also not very good team players because of their egos and propensity to
>> competition, and unwillingness to improve their skills - they hindered
team
>> dynamics.  Team playing is a requirement in today's IT.  The lack of
being a
>> good team player and willingness to improve your productivity are
qualities
>> used to weed out candidates.

You want freedom - absolute freedom?  So you want an employer to pay you to
work for them, but you want to do what you want?  Interesting.

Actually, I was speaking about people who think that once they graduate,
they must hang on to superfluous habits taught in school that do not apply
or hinder productivity, or who feel they cannot learn anything (like a
better style or algorithm), or that they feel an employer is suppose to pay
them out of their budget to do a job for them, but they are unwilling to be
a team player, and hence jeopardize the success of the project.  I've been
on large projects - even hundreds of architects and programmers.  Team
dynamics was it's lifeblood.

I too like freedom for creativity and style, and I have experienced projects
where team dynamics produced results far greater than the sum of each of our
individual efforts - and I grew technically from the experience BECAUSE of
our freedom of creativity.  We even had think-tank creative sessions.  Lone
wolfs don't work well in think tanks.

>:>Could NOT care less. That does it. Anyone who can't get a negative right
>:>in speech is not to be trusted on a computer.
>
>: 'NOT' and 'less' are both negatives, and your correction implies that I
am
>: inclined to care more which one I use.   "I could really care less" is
>: really inappropriate (should have used "I don't care", but I get a little
>: punchy late at night).
>
>You seem not to get it. "I could not care less .." is the expression.
>Saying "I could care less .." means that you do care, whereas you mean
>to say that you don't.


The expression is therefore in error, just as irregardless is often used,
but also in error.

Where I come from, "I could not care less" is a form of double negative.

>If money were proof of value ... tell that to all the starving russian
>rocket scientists.


Money is definitely not a proof of value, as my chemical engineer friend
would agree.  However, having a world-class client willing to pay top
dollar, and renew your contract project after project because of the success
of previous projects, is a good indication of value.

Besides, I wouldn't value scientists or millionaires over anyone else -
never have, never will.

>: You misunderstand my question.  What is the technological consequence of
>: using 2<&1 instead of 2>&1.  I understand what's happening with both, but
I
>
>See above. It won't work in some circumstances, and you're lucky it
>works at all.


It works on AIX, Sun, OSF1, and HP-UX.  It also works on OS/2 and NT.

>: want something tangible, like, "it works coincidentally because of a
fluke,
>: and some shells may not support it"; or, "it has caused or could cause
>: uncertain behavior."
>
>That's what I just said, no? I quote "It wouldn't work if the file were
>writable but not readable".


Ok, the context of its use is to redirect all stderr and stdout to the stdin
of the tee program.  The tee program reads from stdin and echos back to
stdout as well as save it to a file.  In this context, when will it fail and
why shouldn't it be used?

>: The clarity of the sentence fragment "Some logical problem?" is a little
>: fuzzy.  Would you clarify it?
>
>Somehow I think you have done it yourself!
>
>: Perhaps you meant to say, "Do you have some problem with logic?"  Not
>: sure... do you?
>
>I meant to say that, and I did. The interrogation at the end marks an
>elided "Is there ..." at the beginning in coloquial speech.


"Is there some logical problem?" is not an appropriate form of American
english.  Since it is obvious we come from two very different english
language backgrounds, then there is no discernable colloquial speach that
exists in our dialogue.

>:>: Or are all we are really doing is showing off?  :)
>:>
>:>No. You are showing yourself UP.
>
>
>: Unless you are using some slang with a meaning I am unaware of, this is a
>: compliment.  Somehow I don't think you intended it to be.
>
>Try dictionary.  To "show someone up" is to reveal them as being
>relatively handicapped.  Well, who knows, perhaps this combination has a
>different meaning in american english? I'm not hip on jive.


No, it means to out do their performance.  To out perform one's previous
performance is positive - a desired achievement, and a compliment.   If you
wish, we can abandon this antagonistic imbroglio, and either terminate our
dialogue or continue in technical context.

I was simply looking for answers, and was dissatisfied with what I was
getting.  I guess out of naivete, I was inviting insolent commentary.

-Mark



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

From: Aymeric BLAZY <[EMAIL PROTECTED]>
Subject: Socket programming
Date: Wed, 10 May 2000 11:08:01 +0200
Reply-To: [EMAIL PROTECTED]

Hi,

I am using a little program named send_arp.
This program sends out ARP packets with source/target IP and Ethernet
hardware addresses suuplied by the user.
I use it to cluster some web server.

I don't understnad why the packet send when i use it is :
09:03:52.679206 > 0:0:0:0:0:0 > 12:34:56:12:34:56 null I (s=4,r=0,R)
len=42
                         0604 0003 1234 5612 3456 c0a8 0101 1234
                         5612 3456 c0a8 0102 0000 0000 0000 0000
                         0000 0000 0000 0000 0000
                         0001 0800 0604 0003 1234 5612 3456 c0a8
                         0101 1234 5612 3456 c0a8 0102 0000 0000
                         0000 0000 0000 0000 0000 0000 0000

0001 0800 0604 0003 1234 5612 3456 c0a8
0101 1234 5612 3456 c0a8 0102 0000 0000
0000 0000 0000 0000 0000 0000 0000 is the packet that i want to be send.

Can somebody point me to some explanation ...
I am planning to rewrite the program with SOCK_RAW better ...
Can somebody point me to a good doc on using socket and the different
FLAG :
SOCK_PACKET, SOCK_RAW etc etc ...

Thank you in advance

The source code is

#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <netdb.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>

#define ETH_HW_ADDR_LEN 6
#define IP_ADDR_LEN 4
#define ARP_FRAME_TYPE 0x0806
#define ETHER_HW_TYPE 1
#define IP_PROTO_TYPE 0x0800
#define OP_ARP_REQUEST 2

#define DEFAULT_DEVICE "eth0"

char usage[]={"send_arp: sends out custom ARP packet. yuri
volobuev'97\n\
\tusage: send_arp src_ip_addr src_hw_addr targ_ip_addr
tar_hw_addr\n\n"};

struct arp_packet {
        u_char targ_hw_addr[ETH_HW_ADDR_LEN];
        u_char src_hw_addr[ETH_HW_ADDR_LEN];
        u_short frame_type;
        u_short hw_type;
        u_short prot_type;
        u_char hw_addr_size;
        u_char prot_addr_size;
        u_short op;
        u_char sndr_hw_addr[ETH_HW_ADDR_LEN];
        u_char sndr_ip_addr[IP_ADDR_LEN];
        u_char rcpt_hw_addr[ETH_HW_ADDR_LEN];
        u_char rcpt_ip_addr[IP_ADDR_LEN];
        u_char padding[18];
};

void die(char *);
void get_ip_addr(struct in_addr*,char*);
void get_hw_addr(char*,char*);

int main(int argc,char** argv){

struct in_addr src_in_addr,targ_in_addr;
struct arp_packet pkt;
struct sockaddr sa;
int sock;

if(argc != 5)die(usage);

sock=socket(AF_INET,SOCK_PACKET,htons(ETH_P_RARP));
if(sock<0){
        perror("socket");
        exit(1);
        }

pkt.frame_type = htons(ARP_FRAME_TYPE);
pkt.hw_type = htons(ETHER_HW_TYPE);
pkt.prot_type = htons(IP_PROTO_TYPE);
printf ("pkt.prot_type : %p \n", pkt.prot_type);
pkt.prot_addr_size = IP_ADDR_LEN;
pkt.op=htons(OP_ARP_REQUEST);

get_hw_addr(pkt.targ_hw_addr,argv[4]);
get_hw_addr(pkt.rcpt_hw_addr,argv[4]);
get_hw_addr(pkt.src_hw_addr,argv[2]);
get_hw_addr(pkt.sndr_hw_addr,argv[2]);

get_ip_addr(&src_in_addr,argv[1]);
get_ip_addr(&targ_in_addr,argv[3]);

memcpy(pkt.sndr_ip_addr,&src_in_addr,IP_ADDR_LEN);
memcpy(pkt.rcpt_ip_addr,&targ_in_addr,IP_ADDR_LEN);

bzero(pkt.padding,18);

strcpy(sa.sa_data,DEFAULT_DEVICE);
if(sendto(sock,&pkt,sizeof(pkt),0,&sa,sizeof(sa)) < 0){
        perror("sendto");
        exit(1);
        }
exit(0);
}


void die(char* str){
fprintf(stderr,"%s\n",str);
exit(1);
}

void get_ip_addr(struct in_addr* in_addr,char* str){

struct hostent *hostp;

in_addr->s_addr=inet_addr(str);
if(in_addr->s_addr == -1){
        if( (hostp = gethostbyname(str)))
                bcopy(hostp->h_addr,in_addr,hostp->h_length);
        else {
                fprintf(stderr,"send_arp: unknown host %s\n",str);
                exit(1);
                }
        }
}

void get_hw_addr(char* buf,char* str){

int i;
char c,val;

for(i=0;i<ETH_HW_ADDR_LEN;i++){
        if( !(c = tolower(*str++))) die("Invalid hardware address");
        if(isdigit(c)) val = c-'0';
        else if(c >= 'a' && c <= 'f') val = c-'a'+10;
        else die("Invalid hardware address");

        *buf = val << 4;
        if( !(c = tolower(*str++))) die("Invalid hardware address");
        if(isdigit(c)) val = c-'0';
        else if(c >= 'a' && c <= 'f') val = c-'a'+10;
        else die("Invalid hardware address");

        *buf++ |= val;

        if(*str == ':')str++;
        }
}




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

Date: Wed, 10 May 2000 12:23:23 -0100
From: Marc Spoorendonk <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Crossposted-To: comp.os.linux.development.apps
Subject: Re: ** gdb Question

"Quang Nguy��" wrote:

> From virtual terminal 1, I want to debug my program and redirect its
> input/output to terminal 2.  With gdb, I can using: gdb -tty=/dev/tty2
> myprog
>
> However, from terminal 2 I can only see its output, but it doesn't accept
> any keystrokes at all.  When I hit enter from tty2, I'm still in the bash
> prompt.
>
> Is there anything I have to do on terminal 2?  minicom? getty?
>
> Hooking a dump terminal to my box should work, but it's not an option for
> me.
>
> Thanks,
> Quang

I actually never used this gdb feature. My educated guess however is that
you should use a _free_ tty. Linux is mostly configured to use 1 upto 6 for
getty. In which case 7 is used by your Xserver. So try to use tty8 upto
tty12

For more info check your /etc/inittab

Marc Spoorendonk


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

From: Emili =?iso-8859-1?Q?Sanrom=E0?= <[EMAIL PROTECTED]>
Subject: changing unix user pasword from a program
Date: Wed, 10 May 2000 15:54:05 +0200

I need a program to change a user password for a linux system from a web
page.
The problem is not the web. By now I had two problems;

- running setuid from C to read /etc/shadow (look at the end)
- the code of crypt

I'm trying with a C program over slackware linux.

Anybody could send me the code of passwd command or a program that does
that
I need or some other help?

thanks a lot,


[EMAIL PROTECTED]
============================


main()
{
system("/usr/bin/grep user1 /etc/shadow");
}

unix$ ls -l a.out
-rwsr-xr-x   1 root     root        11675 May 10 15:47 a.out*
unix$ ./a.out
grep: /etc/shadow: Permission denied


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

From: Pankaj Kakkar <[EMAIL PROTECTED]>
Subject: inb/inb_p; outb/outb_p
Date: Wed, 10 May 2000 10:04:29 -0400

What is the difference between inb and inb_p? outb and oub_p? When
should I be using one and not the other? There isn't a man page that
describes these, and I couldn't find any relevant documentation either.

Pankaj

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

From: Colin Ford <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Timers?
Date: Wed, 10 May 2000 15:24:10 +0100

Hello There,

I was wondering wether Linux implemented
the Posix timers as in timer_create etc?

Can't find them on my RedHat6.1 linux-2.2.12

Do I need a later kernel?

Cheers,
Col.


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

From: [EMAIL PROTECTED] (Mario Klebsch)
Subject: Re: A need for better insallation programs
Date: Wed, 10 May 2000 11:31:23 +0200

"The Wogster" <[EMAIL PROTECTED]> writes:

>Application installers, these can win an ugly contest no matter what OS you
>have, I have seen all of them, and they are all ugly.  Windows installs have
>a nasty habit of replacing the latest version of a DLL with something from
>1983, then you wonder why every application you own just died.

I have seen installprocedures for complex programs on the Macintosh
that were simply draging the program folder from CDROM to the local
hard disk. This step even was optional!

This is wat I call Plug&Play. Just plug the CDROM into the CDROM drive
and use the program.

>I would like to see an installer, that could take a compressed file,
>uncompress it, then intellegently do what is needed, if that is run
>./configure; make; make install; run script xyz then it should do that.

I would like to have a kind of install environment, where I can do
make;make install and this environment keeps track of everything, that
gets written to my file systems outside the source tree. This
Informations could be used to answer questions like: Whop the hell
needs /usr/local/bin/wasauchimmer? It should make removing of
applications much easier, too.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Crossposted-To: comp.os.linux.development,comp.os.linux.development.apps
Subject: Re: Two really easy (I'm sure) questions
Date: Wed, 10 May 2000 12:03:02 +0200

"Mark Graybill" <[EMAIL PROTECTED]> writes:

>Whether I am spawning child processes from a parent process or a script, if
>I wish to capture the exit code, yes, I must use int return type.  But if I
>don't, I won't.  My point was the resistance to the declaration that we
>should never use void return type for main, as a stock axiom - that it was
>bad practice.  My point is, why is it bad practice?

What about:

The caller uses a different signature, that the called function does
provide.

I know, this make no difference on most current systems in THIS case,
but I cannot state, it makes no differencs on any possible system. It
is good practice, to write portable code and to write correct
code. Your code is not correct (since the signatures do not match) and
it is not portable, bacause using unspecified behavoir never is
portable.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Crossposted-To: comp.os.linux.development,comp.os.linux.development.apps
Subject: Re: Two really easy (I'm sure) questions
Date: Wed, 10 May 2000 12:05:57 +0200

Nate Eldredge <[EMAIL PROTECTED]> writes:

>[EMAIL PROTECTED] (Kaz Kylheku) writes:

>> >Well... if you do
>> >
>> >void main() {
>> >...
>> >exit(N);
>> >}
>> >
>> >then it's a slightly fuzzy case, because you will still have an exit
>> >code.
>> 
>> It's not a fuzzy case at all. The program's behavior is undefined,
>> hence its termination status is imponderable.

>You're right.  I meant to say that on most common systems this will
>actually work.

Do you say, that calling exit() will result in undefined behavior? I
know, it works on the systems, I use, and I can accept, that it works
only by accident, but pleaye explain, why the behavoir is undefined?

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux,comp.os.linux.misc
Subject: Re: Need to find my IP address
Date: Wed, 10 May 2000 11:43:57 +0200

[EMAIL PROTECTED] (Chris) writes:

>On Sun, 07 May 2000 02:20:58 GMT, [EMAIL PROTECTED] (Kaz Kylheku)
>wrote in comp.os.linux.development.apps:

>>The recommended method is to not try to find your IP number.  Programs that try
>>to discover the IP address of the local machine are kludgy, and will break
>>under circumstances that the author did not take into account: multiple
>>interfaces, IP aliasing, dynamic IP, etc.

>What is the "reccommended method" of binding a program to only one
>interface/port combination without first determining the address of that
>interface?  The ip(7) man page says that you should either bind to a
>specific address or to INADDR_ANY (which is effectively 0.0.0.0).  Say,
>for example, I have an situation which requires me to run two different
>daemons on the same port number of different interfaces of the same
>machine....

The perfered method for this problem IMHO is to pass the desired
address on the command line. This even works, if you have interfaces
with multiple IP addresses. It is the desired method, because in the
case of having multiple IP addresses, you can express exactly what you
want. You want the service to answer requests to a specific address,
so why not specify this address. A config file (if exists) is a good
place for this information, too.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux,comp.os.linux.misc
Subject: Re: Need to find my IP address
Date: Wed, 10 May 2000 11:40:34 +0200

[EMAIL PROTECTED] (bill davidsen) writes:

>| The idea of replacing ioctl by /proc is absurd.

>Now if you said that some ioctl functions don't map
>well into a /proc model, I would agree completely. And for portability,
>as much as there is with ioctls, it's important to still provide that
>functionality, and desirable for small . But there is a lot of worth to
>the idea that many of the ioctl functions could be provided via a /proc
>interface, even though that is certainly non-portable.

Plan 9 replaced all those obscure functions by special files handling
commands in plain ASCII. I never have used it, myself, but it was
told, you can connect a socket to a server just by using some echo's
in a shell script.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Crossposted-To: comp.os.linux.development.apps,comp.os.linux.networking
Subject: Re: sendmsg / recmsg / sockets / cmsg
Date: Wed, 10 May 2000 12:09:59 +0200

Karl Keusgen <[EMAIL PROTECTED]> writes:
>My Question is: Has anybody an Idea, how to use a pair of connected
>sockets, sometimes you transmit a filedeskriptor, sometimes not. the
>reading side of the "pipe" does not know what kind of message is coming.

What about not changing the type, but the size? just make
msg_controllen or msg_accrightslen 0. I have not tried this, but since
I am going to face this problem in the next days, too. I hav thoght,
this might be the sollution. If I get in trouble, I would set
msg_control or msg_accrights to NULL, too.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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

From: [EMAIL PROTECTED] (Mario Klebsch)
Subject: Re: RS-485
Date: Wed, 10 May 2000 11:49:36 +0200

[EMAIL PROTECTED] (bill davidsen) writes:
>  Then note that virtually all of the serial drivers say you should
>write the 485 driver in user space.
                         ^^^^^^^^^^

>  The last serial driver I wrote was for a USART, in about 1985, and it
>included synchronous as well as asynchronous support, and 20ma current
>loop, but as I recall you need to monitor TBE (buffer empty) instead of
>TXR (transmitter ready) for some functions.^^^^^^^^^^^^^^^^^
                                            ^^^^^^^^^^^^^^^^^
I had this problem, too, when writing a user space driver for a half
duplex RF modem. Please tell me, how can I do this from user space?
The only sollution, I saw, was to do in in kernel space. And I was not
that familiar with the PC UART, to generate an interrupt upon
activation of TBE (buffer empty). So I did poll it, which really was
not my favourite sollution.

73, Mario
-- 
Mario Klebsch                                           [EMAIL PROTECTED]

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


** FOR YOUR REFERENCE **

The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:

    Internet: [EMAIL PROTECTED]

You can send mail to the entire list (and comp.os.linux.development.system) via:

    Internet: [EMAIL PROTECTED]

Linux may be obtained via one of these FTP sites:
    ftp.funet.fi                                pub/Linux
    tsx-11.mit.edu                              pub/linux
    sunsite.unc.edu                             pub/Linux

End of Linux-Development-System Digest
******************************

Reply via email to