Re: style(9) example :-)

2005-03-18 Thread Miguel Mendez
On Fri, 18 Mar 2005 12:06:12 +1030
Greg 'groggy' Lehey [EMAIL PROTECTED] wrote:

 On Thursday, 17 March 2005 at 19:33:50 +0300, Roman Kurakin wrote:
  Hi,
 
  I was unable to refrain from posting this :-)
 
  int i;main(){for(;i[]i;++i){--i;}];read('-'-'-',i+++hell\
  o, world!\n,'/'/'/'));}read(j,i,p){write(j/p+p,i---j,i/i);}
 
 There used to be a whole culture of this sort of thing.  My favourite
 one is an anagram generator:

The IOCCC (http://www.ioccc.org/) is still alive. Some of the 2004
winners are quite impressive. I tend to prefer obfuscated C over perl,
although you can easily make perl look like line noise :)

Cheers,
-- 
Miguel Mendez [EMAIL PROTECTED]
http://www.energyhq.es.eu.org
PGP Key: 0xDC8514F1



pgpFeK2CKTs4m.pgp
Description: PGP signature


Re: How to send a signal from inside the kernel?

2005-03-18 Thread Robert Watson

On Thu, 17 Mar 2005, John-Mark Gurney wrote:

  but that causes a page fault in kernel mode (ie. Kernel panic :-)
  
  Any help is appreciated, thanks.
 
 Take a look at psignal(9)...  You'll need to look up the struct proc for
 psignal with pfind(9)...  and then PROC_UNLOCK the struct proc after
 you've used psignal... 

Depending on the circumstances, it may also be appropriate to add an
access control check in the form: 

error = p_cansignal(td, p);
if (error) {
PROC_UNLOCK(p);
return (error);
}

Where 'td' is the requesting thread, and 'p' is the target process.

Robert N M Watson


 
 so:
 struct proc *p;
 
 p = pfind(pid);
 if (p != NULL) {
   psignal(p, SIGUSR1);
   PROC_UNLOCK(p);
 }
 
 I haven't tried the code above, but that should do what you want...
 
 -- 
   John-Mark GurneyVoice: +1 415 225 5579
 
  All that I will do, has been done, All that I have, has not.
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to [EMAIL PROTECTED]
 

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Fwd: problem due to hostname change

2005-03-18 Thread Neo-Vortex


On Thu, 17 Mar 2005, Pietro Cerutti wrote:

 Hi Hackers,
 I posted this on freebsd-questions, but couldn't find a solution...

 Maybe here

 Thank you!


 Please: don't Cc me, I'm on the list!


 -- Forwarded message --
 From: Pietro Cerutti [EMAIL PROTECTED]
 Date: Thu, 17 Mar 2005 15:04:45 +
 Subject: Re: problem due to hostname change
 To: Lowell Gilbert [EMAIL PROTECTED]
 Cc: FreeBSD freebsd-questions@freebsd.org


 On 17 Mar 2005 09:57:26 -0500, Lowell Gilbert
 [EMAIL PROTECTED] wrote:
  Pietro Cerutti [EMAIL PROTECTED] writes:
 
   Hi list,
   my computer is not part of a domain, and so I had set my hostname to
   old_hostname.
   Now I changed it in rc.conf to new_hostname:
  
   ~ cat /etc/rc.conf | grep hostname
   hostname=new_hostname
   ~
  
   I rebooted, but my pc is still somewhere configured to be called 
   old_hostname.
   First of all, when the pc boots, I see this in dmesg:
  
   FreeBSD 5.4-PRERELEASE #10: Wed Mar  9 15:40:46 UTC 2005
   my_name@old_hostname:/usr/obj/usr/src/sys/GAHR
 
  That's not a problem; all it means is that's who built the kernel.  It
  doesn't get used for *anything* other than printing that message.
 
   Then, when I try to start apache, I see this in my
   /var/log/httpd-error.log, and apache won't start:
  
   [Thu Mar 17 13:29:11 2005] [alert] mod_unique_id: unable to
   gethostbyname(old_hostname)

grep -ir old_hostname /etc /usr/local/etc
(mabe even for /var/named too...)

that might shed some light as to where its coming from... as for the
bootup the [EMAIL PROTECTED] is just that you compiled the kernel as that,
it affects nothing

  You must have put the old hostname into Apache's configuration
  explicitly.  You will need to change it by hand.  The configuration
  file is (by default, as installed from the port)
  /usr/local/etc/apache/httpd.conf.

 No, this is not the problem. I searched in httpd.conf but I didn't
 find anything concerning my old_hostname.

 I even deinstalled  deleted the configuration files  reinstalled apache.

 Don't forget this:
 FreeBSD 5.4-PRERELEASE #10: Wed Mar  9 15:40:46 UTC 2005
 my_name@old_hostname:/usr/obj/usr/src/sys/GAHR

 Here I have my old_hostname too.

 
  
   My question is: how can I change my hostname to new_hostname safely,
   in a way that the old_hostname is not used anymore in any part of
   the OS?
 
  Changing rc.conf is enough for anything that was configured
  automatically.

 It should be so, but it actually isn't.

 If you changed some other configuration by hand, you
  will need to change it again by hand.  Note that if you had not added
  your hostname to httpd.conf, Apache would have used the system
  hostname by default (I believe; I haven't actually checked this
  recently).

 I'm sure I didn't set my old_hostname anywhere else than in rc.conf

 
  Be well.
 

 However, thank you for your advice, but it didn't solve my problem...


 --
 Pietro Cerutti
 [EMAIL PROTECTED]
 http://www.gahr.ch/pgp-key

 Beansidhe - SwiSS Death / Thrash Metal
 www.beansidhe.ch

 Windows: Where do you want to go today?
 Linux: Where do you want to go tomorrow?
 FreeBSD: Are you guys coming or what?


 --
 Pietro Cerutti
 [EMAIL PROTECTED]
 http://www.gahr.ch/pgp-key

 Beansidhe - SwiSS Death / Thrash Metal
 www.beansidhe.ch

 Windows: Where do you want to go today?
 Linux: Where do you want to go tomorrow?
 FreeBSD: Are you guys coming or what?
 ___
 freebsd-hackers@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
 To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


RE: problem due to hostname change

2005-03-18 Thread Ted Mittelstaedt


 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] Behalf Of Pietro Cerutti
 Sent: Thursday, March 17, 2005 7:42 AM
 To: FreeBSD; freebsd-hackers@freebsd.org
 Subject: Re: problem due to hostname change



 Well I double check once more on my system!


Unless your system is the dns server you need to do as I suggested and
fix the DNS!!

Ted

___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Ziatech 5503 watchdog driver

2005-03-18 Thread Devon H. O'Dell
Hey,

I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
driver, I have no way to identify that the system has the driver, so
I wanted to make it conditional on

options ZT5503

existing in the kernel configuration file. I have a couple of
related questions:

1) Where in the tree should my zt5503wd.c file be placed?

2) Regarding watchdog.h; this device supports other times than those
provided from between 250MS to 256S. Hope nobody minds this changing
:).

3) To make sure I understand how this works:
o The device is compiled in / loaded
o watchdogd is used to tell the system to start the timer
o I get a bunch of flags in my eventhandler function's 2nd
argument that I can then use to write to my device's
registers with the proper information

The first and third questions are the most important, I think.

--Devon


pgpKSN1sdBwYt.pgp
Description: PGP signature


[no subject]

2005-03-18 Thread Danny Braniss
im  writing an iSCSI initiator, which is 'almost' beta, but now im
getting into trouble.
to exercise the system im doing:
cd /to the iscsi device
rsh some-host -n dump 0f - /somefilesystem | restore rf -
this 
o- works fine with no tags on UP/SMP hosts
o- works fine with tags and UP
o- gets stuck with tags and SMP
the restore is usualy waiting on biord.
so my guess is some timing problem, or some resource stagnation, but can't
see anything suspicious. the system is responsive, for a while
then it gets stuck solid in
nfs not respondig ...
the system is diskless :-)

so any ideas on how to back track this problem?
the system is running 5.4-PRERELEASE, but was showing the same with 5.3
the network nic is 
Intel(R) PRO/1000 Network Connection, Version - 1.7.35
and the cpu is a dual
Intel(R) Xeon(TM) CPU 3.06GHz

thanks,
danny


___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Freebsd 5.0 NICs issue

2005-03-18 Thread Amandeep Pannu
Hi daniel,

Josseph in this mailing list responded that I can do

ifconfig em1 alias inet 205.229.165.8 netmask 255.255.255.255

Can I?
I need the other NIC for some internal operations.



 On Fri, 18 Mar 2005 06:47, Amandeep Pannu wrote:
 Now the em0 nic is up with 205.229.165.4 netmask 255.255.255.0
 ifconfig em1 inet 205.229.165.8 netmask 255.255.255.0 up

 You can't have 2 NIC's on the same subnet (you can't have 2 IPs on any NIC
 in
 the same subnet).

 Why do you want to do this? If you want an alias you only need 1 NIC and
 you
 do..

 ifconfig em0 inet 205.229.165.4 netmask 255.255.255.0
 ifconfig em0 alias inet 205.229.165.8 netmask 255.255.255.255

 What is the second NIC going to be used for?

 --
 Daniel O'Connor software and network engineer
 for Genesis Software - http://www.gsoft.com.au
 The nice thing about standards is that there
 are so many of them to choose from.
   -- Andrew Tanenbaum
 GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C



-- 
Amandeep.S
[EMAIL PROTECTED]
http://aman.chamkila.org
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Best way to force a process preempt (for troubleshooting)

2005-03-18 Thread Matthew Hagerty
Greetings,
I'm trying to test for the possibility of interleaved data when two more
more processes are writing to a pipe and more than PIPE_BUF bytes need
to be written.  How can I make a situation where this scenario can be
caused reliably so I can make my test case, then apply my patch and make
sure the changes worked?  Additionally, in one case the processes are
created from fork() and in another case they are threads (not sure if
this makes any difference to the scheduler.)
Any insight would be greatly appreciated.
Thank you,
Matthew
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Ziatech 5503 watchdog driver

2005-03-18 Thread Warner Losh
 I'm busy writing a Ziatech 5503 watchdog driver for FreeBSD (and
 porting all the watchdog stuff to DragonFly BSD) and Plan 9. For my
 driver, I have no way to identify that the system has the driver, so
 I wanted to make it conditional on
 
 options ZT5503

That's not a good enough reason to make it an option, it should really
be a device.  Users that want it can add it to their kernel config.
In fact, they'd have to add it either way, so why make it weird for
them.

Put this device on the ISA bus, give it an identify routine that
always adds it (this isn't GENERIC safe, but since there's no way to
know the device is there, you are stuck with that).

 existing in the kernel configuration file. I have a couple of
 related questions:
 
 1) Where in the tree should my zt5503wd.c file be placed?

usually these thigns go in dev/foo/foo.c.  However FreeBSD and
DragonFly have differeing layouts.  FreeBSD has a modules subtree to
build modules, while DF has it in the dev tree.  The dev tree is also
partitioned so it would be in dev/misc/foo/foo.c.

 2) Regarding watchdog.h; this device supports other times than those
 provided from between 250MS to 256S. Hope nobody minds this changing
 :).

Nope. :-)

 3) To make sure I understand how this works:
   o The device is compiled in / loaded

You'll need to make it a real device if you want loading to work.  The
alternative is to make it a pseudo-device, but that's more hassle than
it is worth since you need to access resources.  An option definitely
won't work.

   o watchdogd is used to tell the system to start the timer
   o I get a bunch of flags in my eventhandler function's 2nd
 argument that I can then use to write to my device's
 registers with the proper information

These don't look like questions...


Warner
___
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: Freebsd 5.0 NICs issue

2005-03-18 Thread Daniel O'Connor
On Sat, 19 Mar 2005 04:04, Amandeep Pannu wrote:
 ifconfig em1 alias inet 205.229.165.8 netmask 255.255.255.255

 Can I?

Not sure, I would expect you'd get complaints from ARP because both NIC's are 
on the same segment.

 I need the other NIC for some internal operations.

Errm.. Why do they need to be on the same subnet? Are they connected to the 
same ethernet segment? Are you trying to do bridging?

ie more details please :)

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgpZxRjPb6Luj.pgp
Description: PGP signature


Re: Ziatech 5503 watchdog driver

2005-03-18 Thread Daniel O'Connor
On Sat, 19 Mar 2005 09:25, Warner Losh wrote:
 That's not a good enough reason to make it an option, it should really
 be a device.  Users that want it can add it to their kernel config.
 In fact, they'd have to add it either way, so why make it weird for
 them.

 Put this device on the ISA bus, give it an identify routine that
 always adds it (this isn't GENERIC safe, but since there's no way to
 know the device is there, you are stuck with that).

A good example of this (which I shamelessly stole for work :) is in if_ep 
(although you only need the stuff from child = .. to bus_set_resource..).

-- 
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
The nice thing about standards is that there
are so many of them to choose from.
  -- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C


pgp49WiAhGg3E.pgp
Description: PGP signature