How to work around this compiler bug

2010-05-01 Thread Christopher Zimmermann
Hi,

the following piece of code compiles fine using g++ 4.2.4, but 
fails using g++ 3.3.5 in the base system:

error: operands to ?: have different types

It is part of ptlib, which is the base library for opal, which in 
turn is needed for ekiga, which I'm trying to port.

What is your suggestion? Can anyone think of a workaround for 
this or should I just compile it using eg++ 4.2.4 ?


Christopher


#includeerr.h

#define WarnIfNULL(x) ((x) ? (x) : (warn(blub),(x)))

class A
{
  protected:
int a;
};

class B : A
{
  public:
void blub()
{
 WarnIfNULL(A::a);
}
};



Re: How to work around this compiler bug

2010-05-01 Thread Landry Breuil
On Sat, May 1, 2010 at 11:39 AM, Christopher Zimmermann
madro...@zakweb.de wrote:
 Hi,

 the following piece of code compiles fine using g++ 4.2.4, but
 fails using g++ 3.3.5 in the base system:

 error: operands to ?: have different types

 It is part of ptlib, which is the base library for opal, which in
 turn is needed for ekiga, which I'm trying to port.

Save yourself time, pkg_add ekiga.



Re: How to work around this compiler bug

2010-05-01 Thread Marc Espie
On Sat, May 01, 2010 at 11:39:00AM +0200, Christopher Zimmermann wrote:
 Hi,
 
 the following piece of code compiles fine using g++ 4.2.4, but 
 fails using g++ 3.3.5 in the base system:
 
 error: operands to ?: have different types
 
 It is part of ptlib, which is the base library for opal, which in 
 turn is needed for ekiga, which I'm trying to port.
 
 What is your suggestion? Can anyone think of a workaround for 
 this or should I just compile it using eg++ 4.2.4 ?
 
 
 Christopher
 
 
 #includeerr.h
 
 #define WarnIfNULL(x) ((x) ? (x) : (warn(blub),(x)))
 
 class A
 {
   protected:
 int a;
 };
 
 class B : A
 {
   public:
 void blub()
 {
  WarnIfNULL(A::a);
 }
 };

Why do some C++ programmer still use macros where they're not needed ?
bunch of idiots, let them stay with C.

#includeerr.h

templatetypename T
inline T WarnIfNULL(T x)
{
if (!x)
warn(blub);
return x;
}

class A
{
  protected:
int a;
};

class B : A
{
  public:
void blub()
{
 WarnIfNULL(A::a);
}
};



Curso: RECLUTAMIENTO Y SELECCION DE PERSONAL

2010-05-01 Thread Servicios Visión Humana
   V I S I S N H U M A N A




Visisn Humana (Consultorma en Recursos Humanos) tiene el agrado de invitarlo
al Seminario Reclutamiento y Seleccisn de Personal que se llevara a cabo en
el mes de Mayo de 2010.



OBJETIVO: Que el participante al finalizar el curso pueda realizar el proceso
de reclutamiento y seleccisn de personal dependiendo el puesto a cubrir,
utilizando los medios y fuentes de reclutamiento recomendados para cada
vacante, ticnicas de entrevista y evaluaciones que se adecuen al perfil.





TEMARIO:



X Introduccisn al proceso de Reclutamiento y Seleccisn de Personal

X Elaboracisn de Perfiles Laborales

X Medios y Fuentes de Reclutamiento (Incluyendo las Redes Sociales
Actuales como Facebook y Twitter)

X Ticnicas de Entrevista Laboral

X  Ticnica de Cleaver








GRUPO 1



Viernes 14  de Mayo de 2010

09:00 a 14:00 horas


PROMOCISN CON PRONTO PAGO AL DIacute;A 11 DE MAYO

$750 maacute;s IVA

Costo Normal $1,200 maacute;s IVA







GRUPOS REDUCIDOS




Incluye:

XManual del curso

XConstancia emitida por agente capacitador registrado ante la STPS

XCoffee Break

XCD con prueba psicolsgica




SEDE:

 Visioacute;n Humana

 Dr. Barragaacute;n Nordm; 560 Despacho 5 Col. Narvarte, Meacute;xico D.F.

 Tels. 4633 7752 (llamada local en el D.F.)

 Fax: 3548 1624 (llamada local en el D.F.)

   capacitac...@visionhumana.net
OTROS CURSOS:

Reclutamiento y Seleccioacute;n de Personal

  Curso Praacute;ctico deNoacute;mina 2010

   Entrevista por Competencias

Introduccioacute;n al IMSS e INFONAVIT (SUA, IDSE)

Evaluacioacute;n del Desempentilde;o

  Curso de Pruebas Psicoloacute;gicas

  Administracioacute;n de Recursos Humanos

Introduccioacute;n a la Grafologiacute;a en R.H.



SERVICIOS

Reclutamiento y Seleccioacute;n de Personal

   Evaluaciones Psicoloacute;gicas

   Estudios Socioeconoacute;micos

Desarrollo de Sistemas de Evaluacioacute;n

  Maquila de Noacute;mina



 CONTACTO


  capacitac...@visionhumana.netwww.visionhumana.net

 Tels:   (0155) 4633 7752

  Fax: (0155) 3548 1624







Recuerde que esta informacisn le puede ser ztil en un futuro. Para darse de
baja responder con el tmtulo BORRAR.



Re: How to work around this compiler bug

2010-05-01 Thread Michael Small
Christopher Zimmermann madro...@zakweb.de writes:

 Hi,

 the following piece of code compiles fine using g++ 4.2.4, but 
 fails using g++ 3.3.5 in the base system:

 error: operands to ?: have different types

How about something like this...

#includeerr.h

// #define WarnIfNULL(x) ((x) ? (x) : (warn(blub),(x)))

templateclass T
inline T WarnIfNULL(T x)
{
if (!x)
warnx(blub);
return x;
}

class A
{
  protected:
A() : a(0) {}
//A() : a(1) {}
int a;
};

class B : A
{
  public:
void blub()
{
 WarnIfNULL(A::a);
}
};


int
main()
{
B b;
b.blub();
return 0;
}


-- 
Mike Small
sma...@panix.com



Forking and catching SIGCHLD, si_pid always contains 0.

2010-05-01 Thread Jesus Sanchez
Hi, using 4.6 release.

I'm doing some code on process forking and catching signals on
OpenBSD. My interest here is to catch the SIGCHLD signal and do things
with the pid which sended the signal on the function called to treat it.

As said in Advanced Programming in the Unix Environment book, when
calling a sigaction function there is a siginfo_t * with data about the
process sending the signal. On this struct, the member int si_pid
contains the PID of the process sending the signal. I tried in a very
simple code to obtain the PID of the child process but si_pid member
always contains 0 when I print it, and don't know what's wrong with it.

I included a very simple source code to try this with the mail, what
I'm missing?

Google didn't helped at all.

Thanks for your time.
-J
#include signal.h
#include stdio.h
#include stdlib.h
#include sys/types.h
#include sys/wait.h
#include unistd.h

/* this func is called when SIGCHLD is received */
void mysigaction(int nsig, siginfo_t * info , void *nothing){

   /* print some info values */
printf(info-si_pid: %d info-si_code: %d info-si_status: %d --\n,
info-si_pid , (*info). si_code, (*info).si_status);
printf(nsig: %d\n,nsig);

return ;
}

int main(){

struct sigaction myaction;
myaction.sa_sigaction=mysigaction;
myaction.sa_flags=SA_SIGINFO ;
   /* use sa_sigaction instead sa_handler to
* have siginfo_t * values */

sigaction(SIGCHLD,myaction,(void*)NULL);

int pid=fork();
if (pid  0 ) { // father
printf(father, child pid is:  %d\n,pid);
wait(NULL);
}

if (pid == 0){ // son
printf(son, getpid() returns: %d\n,getpid());
exit(0);
}

return 0;
}



M-CORRECTOR HARDWARE SOFTWARE LIST for VW - AUDI - CHRYSLER - FORD - GMC

2010-05-01 Thread MILEAGE CORRECTION TOOLS
!DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.0 Transitional//EN
HTMLHEAD
META content=text/html; charset=unicode http-equiv=Content-Type
META name=GENERATOR content=MSHTML 8.00.7600.16535/HEAD
BODYSPAN style=FONT-FAMILY: Verdana; COLOR: black; FONT-SIZE: 8pt
DIV align=leftMILEAGE CORRECTION 
TOOLSnbsp;nbsp;nbsp;(nbsp;nbsp;M-CORRECTOR HARDWARE amp; SOFTWARE 
LISTnbsp; )BRnbsp;BRnbsp;Dear Clients,BRnbsp;NKAAY presents you, 
valued customers, new oppurtunities for your automotive electronic
business. You 
can benefit from our production service in automotive electronic repair
field. 
Best quality and Best price guarantee car electronic mileage correction 
tools.BRnbsp;BRnbsp;MILEAGE CORRECTION TOOLSBRnbsp;M-CORRECTOR
HARDWARE 
amp; SOFTWARE LIST for VW - AUDI - CHRYSLER - FORD - GMC 
BRnbsp;BRnbsp;Willing to make long term mutual business with 
you.BRnbsp;BRnbsp;Kind Regards,BRnbsp;NKAAY CO., HK 
LIMITEDBRnbsp;Research and Development
BRnbsp;BRnbsp;www.bynkaay.comBRnbsp;BRnbsp;BRnbsp;M-CORRECTOR 
HARDWARE A
href=http://www.bynkaay.com/user_productlist.jsp?cmbcatlist=13amp;cmbsubcatlist=19;click
 
here /ABRnbsp;220 EURBRnbsp;BRnbsp;BRnbsp;Hand-held mileage 
correction tool HARDWARE Hand-held mileage correction tool,
BRnbsp;powered by 
two CORTEX ARM cores, speed up to 200MHZ. With SD card interface to load
and 
save files, BRnbsp;USB port for update by Internet. 320*240 TET LCD with
256K 
colors to show pictures and help files in detail. BRnbsp;Integrate
CAN-BUS / 
J1850 / CCD-BUS / ISO9141 / SPI protocols in one multifunctional 
interface.BRnbsp;BRnbsp;Hardware include: Main hardware, OBD adapter,
USB 
cable, SD card and Power cables. NO SOFTWAREBRnbsp;BRnbsp;SOFTWARE
PRICE 
LISTnbsp; : BRnbsp;BRnbsp;Software Number Covered Cars Price in EURO
BRnbsp;BRnbsp;GMC-001 : 400 euroBRnbsp;Hummer H2 03-06 
BRnbsp;Avalanche 03-06 BRnbsp;Escalade 03-06 BRnbsp;Silverado
03-06 
BRnbsp;Sierra 03-up BRnbsp;Suburban 03-06 BRnbsp;Tahoe 03-06 
BRnbsp;Yukon 03-06 BRnbsp;Denali 03-06 BRnbsp;BRnbsp;GMC-002 :
300 
euroBRnbsp;S10 98-up BRnbsp;Astro 01-up BRnbsp;Silverado 97-01 
BRnbsp;Avalanche -02 BRnbsp;Escalade -02 BRnbsp;Safari 01-up 
BRnbsp;Sierra 98-01 BRnbsp;Suburban 98-up BRnbsp;Tahoe 00-02 
BRnbsp;Yukon 00-02 BRnbsp;Denali 00-02 BRnbsp;Blazer 98-up 
BRnbsp;Sonoma 98-up BRnbsp;BRnbsp;GMC-003 : 300
euroBRnbsp;Century 
98-up BRnbsp;Venture 00-up BRnbsp;Impala 00-05 BRnbsp;Allure 05-09
BRnbsp;Intrigue 98-up BRnbsp;Alero 98-up BRnbsp;Silhouette 00-up 
BRnbsp;Pacifica 03-07 BRnbsp;Firstland BRnbsp;Monte Carlo.00-up 
BRnbsp;Regal 98-up BRnbsp;Voyager 01-08 BRnbsp;Montana SW6 05-09 
BRnbsp;Uplander 05-09 BRnbsp;Montana 00-05 BRnbsp;Grand Am 98-up 
Rnbsp;Hummer H2 03-06 
Rgt;nbsp;Hummer H2 03-06 BRnbsp;Lacrosse 05-09 BRnbsp;Relay 05-07 
BRnbsp;Terraza 05-09 BRnbsp;BRnbsp;GMC-004 : 300
euroBRnbsp;Hummer 
H3 05-08 BRnbsp;Canyon 05-08 BRnbsp;Colorado 05-08 
BRnbsp;BRnbsp;GMC-005 : 300 euroBRnbsp;Express 03-07
BRnbsp;Savana 
03-07 BRnbsp;BRnbsp;GMC-006 : 400 BRnbsp;Acadia 07-up
BRnbsp;Enclave 
07-up BRnbsp;Equinox 07-up BRnbsp;Outlook 07-up BRnbsp;Torrent
07-up 
BRnbsp;BRnbsp;GMC-007 : 164 euroBRnbsp;Avalanche 07-up
BRnbsp;Denali 
07-up BRnbsp;Torrent 07-up BRnbsp;Hummer H2 07-up BRnbsp;Silverado
07-up BRnbsp;Suburban 07-up BRnbsp;Tahoe 07-up BRnbsp;Yukon 07-up 
BRnbsp;BRnbsp;GMC-008 : 350 euroBRnbsp;Express 08-up
BRnbsp;Impala 
06-up BRnbsp;Montecarlo 06-up BRnbsp;Savana 08-up 
BRnbsp;BRnbsp;GMC-009 : 145 euroBRnbsp;DTS 07-up 
BRnbsp;BRnbsp;GMC-010 : 220 euroBRnbsp;Escalade 07-up 
sp;Grand Am 98-up 
Rnbsp;Hummer H2 03-06 
BRnbsp;BRnbsp;GMC-011 : 150 euroBRnbsp;STS4 07-up er H2 03-06 
BRnbsp;BRnbsp;GMC-012 : 110 euroBRnbsp;S10 97-98 BRnbsp;Blazer
97-98 
BRnbsp;Sonoma 97-98 BRnbsp;BRnbsp;GMC-013 : 110 
euroBRnbsp;Trailblazer -up BRnbsp;Envoy -up BRnbsp;Bravada -up 
BRnbsp;BRnbsp;GMC-014 : 75 
euroBRnbsp;Rendezvous.00-upBRnbsp;BRnbsp;GMC-015 : 75 
euroBRnbsp;Aztek 00-up BRnbsp;BRnbsp;GMC-016 : 75 
euroBRnbsp;Corvette 99-04 75 BRnbsp;BRnbsp;FORD-001 : 370 
euroBRnbsp;E250 08-upBRnbsp;FREESTAR 06-upBRnbsp;Escape 08-up 
BRnbsp;F250 08-upBRnbsp;F350 08-upBRnbsp;F450 08-up BRnbsp;F500
05-07BRnbsp;Linc Mark LT 05-upBRnbsp;F500 08-up BRnbsp;Focus 
08-upBRnbsp;F550 08-upBRnbsp;E450 08-up BRnbsp;Freestile 
05-upBRnbsp;Merc Mariner 08-up BRnbsp;Taurus 08-upBRnbsp;Town Car
05-up 
BRnbsp;BRnbsp;FORD-002 : 370 euroBRnbsp;Expedition 
07-upBRnbsp;Explorer-07-up BRnbsp;Navigator-07-up 
BRnbsp;BRnbsp;FORD-003 : 370 euroBRnbsp;F150 06-07 BRnbsp;F150
08-up 
BRnbsp;F250 06-07 BRnbsp;F350 06-07 BRnbsp;F450 06-07
BRnbsp;F550 
06-07 BRnbsp;Focus 05-07 BRnbsp;BRnbsp;FORD-004 : 300 
euroBRnbsp;Focus 09-up BRnbsp;Edge-06-up BRnbsp;Linc Mkz-07-up 
BRnbsp;Fusion-06-up BRnbsp;Linc MXZ-07-up BRnbsp;Linc Zephir-06-up
BRnbsp;Merc Milan-06-up BRnbsp;MUSTANG 05-up 
BRnbsp;BRnbsp;CHRYSLER-001 : 300 euroBRnbsp;Avenger 07-up 
BRnbsp;Caliber 06-up BRnbsp;300C BRnbsp;Charger 04-up
BRnbsp;Charger 
04-up BRnbsp;Pacifica 08-up BRnbsp;Magnum 04-up BRnbsp;Sebring
07-up 

Re: How to work around this compiler bug

2010-05-01 Thread Marco Peereboom
Use a less retarded language.

On Sat, May 01, 2010 at 11:39:00AM +0200, Christopher Zimmermann wrote:
 Hi,
 
 the following piece of code compiles fine using g++ 4.2.4, but 
 fails using g++ 3.3.5 in the base system:
 
 error: operands to ?: have different types
 
 It is part of ptlib, which is the base library for opal, which in 
 turn is needed for ekiga, which I'm trying to port.
 
 What is your suggestion? Can anyone think of a workaround for 
 this or should I just compile it using eg++ 4.2.4 ?
 
 
 Christopher
 
 
 #includeerr.h
 
 #define WarnIfNULL(x) ((x) ? (x) : (warn(blub),(x)))
 
 class A
 {
   protected:
 int a;
 };
 
 class B : A
 {
   public:
 void blub()
 {
  WarnIfNULL(A::a);
 }
 };



ΠΡΟΣΦΟΡΑ ΜΑΪΟΥ 2010 - ΝΕΟ!

2010-05-01 Thread Akis Angelakis
V_ker jai v_koi,

Sto sumgll]mo aqwe_o sar pqote_moule lia wq^silg jai emdiav]qousa sukkoc^
bibk_ym, cd jai dvd se idia_teqa pqomoliaj^ til^.

Le vikijo}r waiqetislo}r,

jgr Accek\jgr LLM, SAC Dip.,

Authorized Trainer  Counselor

S}lboukor Epiweiq^seym, Ejd|tgr, Succqav]ar.

Image A Seminars, Ejd|seir PKGQOTGTA

Ehmij^r Amtist\seyr 21, M]a Wakjgd|ma, Ah^ma 143 43

Tgk. 210-2512988  210-2584880 Fax 210-2512988

www.akis-angelakis.com

Am dem epihule_te ma kalb\mete tgm paqap\my akkgkocqav_a, paqajako}le
pat^ste ed~

[demime 1.01d removed an attachment of type application/pdf which had a name of 
=?windows-1253?Q?=D0=D1=CF=D3=D6=CF=D1=C1_=C2=C9=C2=CB=C9=D9=CD_=C3=C9=C1_=D4=CF_=CC=C7=CD=C1_=CC=C1=C9=CF.pdf?=]



Re: Forking and catching SIGCHLD, si_pid always contains 0.

2010-05-01 Thread Otto Moerbeek
On Sat, May 01, 2010 at 03:59:07PM +0200, Jesus Sanchez wrote:

 Hi, using 4.6 release.
 
 I'm doing some code on process forking and catching signals on
 OpenBSD. My interest here is to catch the SIGCHLD signal and do things
 with the pid which sended the signal on the function called to treat it.
 
 As said in Advanced Programming in the Unix Environment book, when
 calling a sigaction function there is a siginfo_t * with data about the
 process sending the signal. On this struct, the member int si_pid
 contains the PID of the process sending the signal. I tried in a very
 simple code to obtain the PID of the child process but si_pid member
 always contains 0 when I print it, and don't know what's wrong with it.
 
 I included a very simple source code to try this with the mail, what
 I'm missing?

On OpenBSD, only a few fields are filled for a few signals. Use any of
the wait(2) functions to get your info.

-Otto

 
 Google didn't helped at all.
 
 Thanks for your time.
 -J
 #include signal.h
 #include stdio.h
 #include stdlib.h
 #include sys/types.h
 #include sys/wait.h
 #include unistd.h
 
 /* this func is called when SIGCHLD is received */
 void mysigaction(int nsig, siginfo_t * info , void *nothing){
 
/* print some info values */
   printf(info-si_pid: %d info-si_code: %d info-si_status: %d --\n,
   info-si_pid , (*info). si_code, (*info).si_status);
   printf(nsig: %d\n,nsig);
 
   return ;
 }
 
 int main(){
 
   struct sigaction myaction;
   myaction.sa_sigaction=mysigaction;
   myaction.sa_flags=SA_SIGINFO ;
/* use sa_sigaction instead sa_handler to
 * have siginfo_t * values */
 
   sigaction(SIGCHLD,myaction,(void*)NULL);
 
   int pid=fork();
   if (pid  0 ) { // father
   printf(father, child pid is:  %d\n,pid);
   wait(NULL);
   }
 
   if (pid == 0){ // son
   printf(son, getpid() returns: %d\n,getpid());
   exit(0);
   }
 
   return 0;
 }



Re: couldn't map interrupt

2010-05-01 Thread Dave Anderson
** Reply to message from Dave Anderson d...@daveanderson.com on Sun,
4 Apr 2010 20:30:15 -0400 (EDT)

On Thu, 1 Apr 2010, Dave Anderson wrote:

On Thu, 1 Apr 2010, Dave Anderson wrote:

I've inherited an old notebook (Sony Vaio PCG-FX120) whose CardBus slots
are (presumably) unusable because their interrupts aren't mapped:

cbb0 at pci1 dev 2 function 0 Ricoh 5C476 CardBus rev 0x80: couldn't \
map interrupt
cbb1 at pci1 dev 2 function 1 Ricoh 5C476 CardBus rev 0x80: couldn't \
map interrupt

I've updated the BIOS to the latest version I can find, and am running
current (as of March 30th).  This happens both with APM and with ACPI
(APM disabled); I've included both full dmesgs below.

With ACPI there's one additional couldn't map interrupt for a device
which is configured properly with APM:

uhci0 at pci0 dev 31 function 2 Intel 82801BA USB rev 0x03: couldn't \
map interrupt

One more thing I should have mentioned: this system has a very simple
BIOS with only a few tweakable settings; I've tried them all without
changing this behavior.

I'd really like to get this working properly, since I can't afford to
buy a new system right now.  If anyone is interested in looking into
this, I'd be happy to run any tests, patches or whatever; the system
isn't in use yet, so even complete reinstalls are fine.

Thanks for any help,

I bit of searching turned up 'UKCchange pcibios' and setting the flags
to 0x30; this 'verbose' dmesg plus pcidump -v ( both included below)
produce a bunch of interesting-looking information which, unfortunately,
I do not (yet) know enough to make sense of.

I also found a truly gross hack used by someone in similar circumstances
(http://www.gratisoft.us/ftp/pub/todd/OpenBSD/srx77/cardbus.diff), which
I'll try to adapt if I don't find anything better.

This is primarily for the record, though it may help someone with
similar problems.

After spending some time crawling through the code and reading PCI
specs, I determined that the underlying problem is that the BIOS is
reporting an incorrect PCI bus attachment for the Cardbus devices --
resulting in the 'how to attach interrupts' lookup failing.  Since in
my case all of the device numbers in the table from the BIOS are
unique, a simple patch to match on only the device number (if there's
only one entry with that device number, and if there's no match on both
bus and device) corrects the problem and allows the interrupts to be
properly connected.

There's still a problem (which I haven't yet dug in to) where it
appears that interrupts still don't work properly if the Cardbus device
is in place when the system boots, but since it works if I hotplug it
later this is something I can live with (at least for a while).

Here's the patch (against -current as of a week or two ago):

Index: sys/arch/i386/pci/pci_intr_fixup.c
===
RCS file: /cvs/src/sys/arch/i386/pci/pci_intr_fixup.c,v
retrieving revision 1.62
diff -u sys/arch/i386/pci/pci_intr_fixup.c
--- sys/arch/i386/pci/pci_intr_fixup.c  7 Dec 2008 14:33:26 -   1.62
+++ sys/arch/i386/pci/pci_intr_fixup.c  1 May 2010 17:02:28 -
@@ -336,15 +336,29 @@
 {
struct pcibios_intr_routing *pir;
int entry;
+   int dev_entry = -1;
 
if (pcibios_pir_table == NULL)
return (NULL);
 
for (entry = 0; entry  pcibios_pir_table_nentries; entry++) {
pir = pcibios_pir_table[entry];
-   if (pir-bus == bus 
-   PIR_DEVFUNC_DEVICE(pir-device) == device)
-   return (pir);
+   if (PIR_DEVFUNC_DEVICE(pir-device) == device) {
+   if (pir-bus == bus)
+   return (pir);
+   else if (dev_entry == -1)
+   dev_entry = entry;
+   else
+   dev_entry = -2;
+   }
+   }
+
+   if (dev_entry = 0) {
+   pir = pcibios_pir_table[dev_entry];
+   if (pcibios_flags  PCIBIOS_INTRDEBUG)
+   printf(pciintr_pir_lookup(%i,%i): matching bus %i\n,
+   bus, device, pir-bus);
+   return (pir);
}
 
return (NULL);

=

Dave


OpenBSD 4.7-current (GENERIC) #560: Wed Mar 24 00:26:42 MDT 2010
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Intel Pentium III (GenuineIntel 686-class) 696 MHz
cpu0: 
FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE
real mem  = 534798336 (510MB)
avail mem = 508944384 (485MB)
User Kernel Config
UKC chn\^H \^Hange pcibios
361 pcibios0 at bios0 flags 0x0
change (y/n) ?
flags [0] ? 0x30
361 pcibios0 changed
361 pcibios0 at bios0 flags 0x30
UKC quit
Continuing...
mainbus0 at root
bios0 at mainbus0: AT/286+ BIOS, date 03/06/02, BIOS32 rev. 0 @
0xfd878, SMBIOS rev. 2.31 @ 0xd8010 (15 entries)
bios0: vendor Phoenix 

Serial port programming problems

2010-05-01 Thread Neil O'Brien
I run OpenBSD 4.6 (i386) on a PCEngines ALIX2c3, as a low power
file/web/DHCP server.  I would like to have this machine regularly
retrieve data from an instrument which communicates over RS-232.
I'm using a Prolific USB-RS232 converter (full dmesg for the ALIX
below).

I have no protocol documentation but have been able to reverse engineer
a subset of the instrument's protocol.  I have written a code to
extract data from the instrument which compiles cleanly on OpenBSD,
Linux (gcc) and Solaris x86 (Sun Studio).  On Linux and Solaris,
the resulting binary always reads the data that I want.  On OpenBSD,
the code appears to hang on every second execution, its entry in the
output of top looking similar to:

0  204K  496K idle  ttyin 0:00  0.00% reader

I've come up with a minimal example to demonstrate where the problem
begins, and have pasted it below.  The code sends an initialisation
string to the instrument and should get an ACK (ASCII decimal 6) back.
On Linux it works; on OpenBSD, it works the first time after insertion
of the USB-RS232 converter but not subsequently.

I don't believe this is likely to be a hardware problem with the
USB-RS232 converter, since I successfully used the same one in Linux
and Solaris.  I also think it unlikely to be the USB host controller,
since I have identical behaviour on another OpenBSD box, with a
different USB controller, see lines from its dmesg:

uhci0 at pci0 dev 7 function 2 Intel 82371AB USB rev 0x01: irq 11
usb0 at uhci0: USB revision 1.0
uhub0 at usb0 Intel UHCI root hub rev 1.00/1.00 addr 1
uplcom0 at uhub0 port 2 Prolific Technology Inc. USB-Serial Controller
D rev 1.10/4.00 addr 2
ucom0 at uplcom0

Running on OpenBSD, either on the ALIX or on my other box, the
behaviour I see is:

# cc -Wall -o ex_obsd ex_obsd.c
# ./ex_obsd; sleep 5; ./ex_obsd; sleep 5; ./ex_obsd; sleep 5; ./ex_obsd
1 bytes available, read: 6
1 bytes available, read: 10
Expecting ACK, got 10
1 bytes available, read: 10
Expecting ACK, got 10
1 bytes available, read: 10
Expecting ACK, got 10

Running identical code (save for a change of device name) on Linux
(on another different machine), I get:

$ ./ex_lin; sleep 5; ./ex_lin; sleep 5; ./ex_lin; sleep 5; ./ex_lin 
1 bytes available, read: 6
1 bytes available, read: 6
1 bytes available, read: 6
1 bytes available, read: 6

On OpenBSD, I can get the desired behaviour if I manually unplug and
re-plug the USB to serial converter during each sleep.

I'd be very grateful if anyone has any advice on what I should change
to get the desired behaviour from this code on OpenBSD.

Many thanks in advance.

Neil


My code:
#include stdio.h  
#include string.h
#include unistd.h
#include fcntl.h 
#include errno.h
#include termios.h
#include err.h

int open_port(void);/* Opens port, returns file descriptor */
void set_port(int fd);  /* Sets port options on file descriptor fd */

int main(void)
{
  int n,fd;
  char resp;
  char initString[] = {0x0D, 0x01, 0x39, 0x31, 0x38};
  char ack = 0x06;
  char eot = 0x03;

  fd = open_port();
  set_port(fd);
  if(DEBUG != 0) printf(Port has been opened and set up\n);

  // send CRSOH918
  n = write(fd,initString,5);
  if (n != 5) {printf(Failed to write init string.\n); return(-1);}
  
  // See if it replies - want ACK
  n = read(fd,resp,1);
  printf(%i bytes available, read: %i\n,n,resp);
  if (resp != ack) printf(Expecting ACK, got %i\n,resp);

  // Send EOT
  n = write(fd,eot,1);
  if (n != 1) {printf(Failed to write EOT.\n); return(-1);}
  
  // Close the port
  n = close(fd);
  if (n != 0) 
{
  printf(failed to close port: close returned %d\n,n);
  return(-1);
}

  return 0;
}

void set_port(int fd)
{
  struct termios options;
  int status;
  
  // Get current settings for the port
  tcgetattr(fd, options);
  
  // Set baud rate = 1200
  cfsetispeed(options, B1200);
  cfsetospeed(options, B1200);
  
  // Set 7 bits, even parity
  options.c_cflag |= PARENB;
  options.c_cflag = ~PARODD;
  options.c_cflag = ~CSTOPB;
  options.c_cflag = ~CSIZE;
  options.c_cflag |= CS7;
  
  // Raw input
  options.c_lflag = ~(ICANON | ECHO | ECHOE | ISIG);

  // Check and strip parity bit.
  options.c_iflag |= (INPCK | ISTRIP);

  // Disable software flow control 
  options.c_iflag = ~(IXON | IXOFF | IXANY);

  // Output to be raw
  options.c_oflag = ~(OPOST | OLCUC | ONLCR | OCRNL );
  
  // Set new options for port
  status = tcsetattr(fd, TCSANOW, options);
  if (status  0)
  {
errx(1,set_port(): failed.);
  }
  
}
  

int open_port(void)
{
  int fd;

  fd = open(/dev/ttyU0, O_RDWR | O_NOCTTY | O_NDELAY);
  if (fd  0)
  {
errx(1,open_port: Unable to open /dev/ttyS0.);
  }
  else
  {
fcntl(fd, F_SETFL, 0);
  }
  return (fd);
}

dmesg from ALIX:
OpenBSD 4.6 (GENERIC) #0: Thu Apr  8 14:17:46 BST 2010
r...@alix:/usr/src/sys/arch/i386/compile/GENERIC
cpu0: Geode(TM) Integrated Processor by AMD PCS (AuthenticAMD
586-class) 499 MHz
cpu0: FPU,DE,PSE,TSC,MSR,CX8,SEP,PGE,CMOV,CFLUSH,MMX
real mem  = 

Re: Forking and catching SIGCHLD, si_pid always contains 0.

2010-05-01 Thread Jesus Sanchez

El 01/05/2010 18:14, Otto Moerbeek escribis:

On Sat, May 01, 2010 at 03:59:07PM +0200, Jesus Sanchez wrote:

   

Hi, using 4.6 release.

 I'm doing some code on process forking and catching signals on
OpenBSD. My interest here is to catch the SIGCHLD signal and do things
with the pid which sended the signal on the function called to treat it.

 As said in Advanced Programming in the Unix Environment book, when
calling a sigaction function there is a siginfo_t * with data about the
process sending the signal. On this struct, the member int si_pid
contains the PID of the process sending the signal. I tried in a very
simple code to obtain the PID of the child process but si_pid member
always contains 0 when I print it, and don't know what's wrong with it.

 I included a very simple source code to try this with the mail, what
I'm missing?
 

On OpenBSD, only a few fields are filled for a few signals. Use any of
the wait(2) functions to get your info.
   


well thats a relief, i thought that I was screwing up something.

It's in some kind of TODO list or the OpenBSD project isn't
interested in implement such a things.

Thanks a lot for your answer
-J


-Otto

   

Google didn't helped at all.

Thanks for your time.
-J
#includesignal.h
#includestdio.h
#includestdlib.h
#includesys/types.h
#includesys/wait.h
#includeunistd.h

/* this func is called when SIGCHLD is received */
void mysigaction(int nsig, siginfo_t * info , void *nothing){

/* print some info values */
printf(info-si_pid: %d info-si_code: %d info-si_status: %d --\n,
info-si_pid , (*info). si_code, (*info).si_status);
printf(nsig: %d\n,nsig);

return ;
}

int main(){

struct sigaction myaction;
myaction.sa_sigaction=mysigaction;
myaction.sa_flags=SA_SIGINFO ;
/* use sa_sigaction instead sa_handler to
 * have siginfo_t * values */

sigaction(SIGCHLD,myaction,(void*)NULL);

int pid=fork();
if (pid  0 ) { // father
printf(father, child pid is:  %d\n,pid);
wait(NULL);
}

if (pid == 0){ // son
printf(son, getpid() returns: %d\n,getpid());
exit(0);
}

return 0;
}




/usr directory: a system or user place?

2010-05-01 Thread Harrell
Hi list,

Not no off-topic, but a little unix history oriented question.

In hier(7) OpenBSD describe /usr as Contains the majority of user utilities
and applications.

In
http://www.usna.edu/Users/cs/delooze/teaching/IC221/Lectures/LN02/class02.html
they
say that /usr Stands for Unix System Resources. Contains system utilities.

In wikipedia they say /usr is *Secondary hierarchy* for read-only user
data; contains the majority of
(multi-http://en.wikipedia.org/wiki/Multi-user)user
utilities and applications
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

So my doubt is: Is usr an abbreviation of user? If that is so (as as
hier(7) can be understood), why /usr contains mainly system resources and
not user resources? In fact only root has w permission inside /usr, so it
seems more a system directory. I know that a system directory contains
resources for the user, but, just for curiosity, what is the origin of this
directory name? A user place o a unix system place?

Thanks.

Harrell



Re: Forking and catching SIGCHLD, si_pid always contains 0.

2010-05-01 Thread Ted Unangst
On Sat, May 1, 2010 at 9:59 AM, Jesus Sanchez zexe...@gmail.com wrote:
As said in Advanced Programming in the Unix Environment book, when
 calling a sigaction function there is a siginfo_t * with data about the
 process sending the signal. On this struct, the member int si_pid
 contains the PID of the process sending the signal. I tried in a very
 simple code to obtain the PID of the child process but si_pid member
 always contains 0 when I print it, and don't know what's wrong with it.

The si_pid is not generally reliable, so it's a good idea not to use
it.  What happens if two processes send the same signal before you
receive it?



Re: Forking and catching SIGCHLD, si_pid always contains 0.

2010-05-01 Thread Philip Guenther
On Sat, May 1, 2010 at 2:01 PM, Ted Unangst ted.unan...@gmail.com wrote:
 On Sat, May 1, 2010 at 9:59 AM, Jesus Sanchez zexe...@gmail.com wrote:
As said in Advanced Programming in the Unix Environment book, when
 calling a sigaction function there is a siginfo_t * with data about the
 process sending the signal. On this struct, the member int si_pid
 contains the PID of the process sending the signal. I tried in a very
 simple code to obtain the PID of the child process but si_pid member
 always contains 0 when I print it, and don't know what's wrong with it.

 The si_pid is not generally reliable, so it's a good idea not to use
 it.  What happens if two processes send the same signal before you
 receive it?

Sure, but it can be reliable for the SIGCHLD generated when a process
exits, as the kernel has to keep track of the zombies anyway.

This is on my todo list, but it seems to keep getting pushed down by
other things...


Philip Guenther



Re: /usr directory: a system or user place?

2010-05-01 Thread Chris Bennett

On 05/01/10 15:52, Harrell wrote:

Hi list,

Not no off-topic, but a little unix history oriented question.

In hier(7) OpenBSD describe /usr as Contains the majority of user utilities
and applications.

In
http://www.usna.edu/Users/cs/delooze/teaching/IC221/Lectures/LN02/class02.html
they
say that /usr Stands for Unix System Resources. Contains system utilities.

In wikipedia they say /usr is *Secondary hierarchy* for read-only user
data; contains the majority of
(multi-http://en.wikipedia.org/wiki/Multi-user)user
utilities and applications
http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard

So my doubt is: Is usr an abbreviation of user? If that is so (as as
hier(7) can be understood), why /usr contains mainly system resources and
not user resources? In fact only root has w permission inside /usr, so it
seems more a system directory. I know that a system directory contains
resources for the user, but, just for curiosity, what is the origin of this
directory name? A user place o a unix system place?

Thanks.

Harrell



When you boot into single user mode, what is available?
/ which includes /bin /sbin /etc /dev

This includes all the basic system utilities.

If you want fancier stuff, you need to mount /usr /home /var etc



Re: /usr directory: a system or user place?

2010-05-01 Thread J.C. Roberts
On Sat, 1 May 2010 22:52:54 +0200 Harrell
elbibliotecarioci...@gmail.com wrote:

 Hi list,
 
 Not no off-topic, but a little unix history oriented question.
 
 In hier(7) OpenBSD describe /usr as Contains the majority of user
 utilities and applications.
 
 In
 http://www.usna.edu/Users/cs/delooze/teaching/IC221/Lectures/LN02/class02.html
 they
 say that /usr Stands for Unix System Resources. Contains system
 utilities.
 
 In wikipedia they say /usr is *Secondary hierarchy* for read-only
 user data; contains the majority of
 (multi-http://en.wikipedia.org/wiki/Multi-user)user
 utilities and applications
 http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard
 
 So my doubt is: Is usr an abbreviation of user? If that is so (as
 as hier(7) can be understood), why /usr contains mainly system
 resources and not user resources? In fact only root has w
 permission inside /usr, so it seems more a system directory. I know
 that a system directory contains resources for the user, but, just
 for curiosity, what is the origin of this directory name? A user
 place o a unix system place?
 
 Thanks.
 
 Harrell

In many situations knowing where a name comes from is really helpful,
but in other situations, knowing where a name came from is completely
misleading since over time, definitions change. The name of the /usr
directory is the latter. 

At one point in time in the ancient past, the /usr directory is where
user directories were once stored, but over time the usage of this
directory changed. The claim of 'usr' being an abbreviation for Unix
System Resources is a backronym, (i.e. an abbreviation created
after the fact).

jcr

-- 
The OpenBSD Journal - http://www.undeadly.org



Re: /usr directory: a system or user place?

2010-05-01 Thread Matthew Szudzik
On Sat, May 01, 2010 at 10:52:54PM +0200, Harrell wrote:
 So my doubt is: Is usr an abbreviation of user? If that is so (as as

Chapter 4 of Greg Lehey's Porting Unix Software

 http://www.lemis.com/grog/Documentation/PUS/

has the following to say about the /usr directory:

 This directory used to be the other file system on a UNIX machine.  In
 the System V ABI it has lost most of its importance.  The ABI states
 uses only for /usr/bin and /usr/share, and the name /usr has lost its
 original meaning: the ABI specifies /usr only as a location for system
 files that users may wish to access.



Re: /usr directory: a system or user place?

2010-05-01 Thread Barry Miller
On Sat, May 01, 2010 at 10:52:54PM +0200, Harrell wrote:

 Is usr an abbreviation of user? ... just for curiosity, what is
 the origin of this directory name?

Your question has already been answered, but in case you are looking
for documentation, here's Dennis Ritchie (as in KR C)in the 1978
(July-August) Bell System Technical Journal, pp. 1953-4:

  It is common for the totality of user files to be too voluminous
  for a given device.  It is then impossible for the directories of
  all users to be members of the same directory, say /usr.  Instead
  they must be split into groups, say /usr1 and /usr2;

And Steve Bourne (as in Bourne shell), same issue, p. 1981, referring
to user fred setting the $PATH environment variable:

  PATH=:/usr/fred/bin:/bin:/usr/bin

Finally, looking at our old 1984 SVR2 source distribution, it is
evident that the Bell Labs guys preferred abbreviations to acronyms.
The distributed root filesystem consisted of:

  bck bin etc dev lib stand tmp

The /usr filesystem contained (in cpio format!):

  adm bin catman games include lib lost+found mail news preserve
  pub spool tmp

Not until the top level of the source tape do we hit an acronym:

  cmd games head lib stand uts

where uts=Unix Time-sharing System, which I guess is hard to abbreviate;)

Yes, I know this is somewhat off-topic, but I think it's fascinating,
like, Why'd they call it 'awk'?  Now there's an acronym for you.

Today, hier(7) rules.

-- 
Barry



Re: /usr directory: a system or user place?

2010-05-01 Thread Rod Whitworth
On Sat, 1 May 2010 20:23:50 -0400, Barry Miller wrote:

Yes, I know this is somewhat off-topic, but I think it's fascinating,
like, Why'd they call it 'awk'?  Now there's an acronym for you.

Did you leave that as an exercise for the reader ?

It's too easy and, although I'm not spoiling the exercise, I'll bet
somebody jumps in very soon!

*** NOTE *** Please DO NOT CC me. I am subscribed to the list.
Mail to the sender address that does not originate at the list server is 
tarpitted. The reply-to: address is provided for those who feel compelled to 
reply off list. Thankyou.

Rod/
---
This life is not the real thing.
It is not even in Beta.
If it was, then OpenBSD would already have a man page for it.



Re: /usr directory: a system or user place?

2010-05-01 Thread Denny White
 On Sun, May 02, 2010 at 11:18:01AM +1000, Rod Whitworth spoke thusly:
 On Sat, 1 May 2010 20:23:50 -0400, Barry Miller wrote:
 
 Yes, I know this is somewhat off-topic, but I think it's fascinating,
 like, Why'd they call it 'awk'?  Now there's an acronym for you.
 
 Did you leave that as an exercise for the reader ?
 
 It's too easy and, although I'm not spoiling the exercise, I'll bet
 somebody jumps in very soon!

Kersplash! I'm in. ;)

[A]ho + [W]einberger + [K]ernighan = AWK

Possible alternative definitions:

Awesome Word Kinesis
Awfully Weird Kool-Aid
 
 *** NOTE *** Please DO NOT CC me. I am subscribed to the list.
 Mail to the sender address that does not originate at the list server is 
 tarpitted. The reply-to: address is provided for those who feel compelled to 
 reply off list. Thankyou.
 
 Rod/
 ---
 This life is not the real thing.
 It is not even in Beta.
 If it was, then OpenBSD would already have a man page for it.
 

-- 

  \\\  ///
  (  @ @ ) 
   +-oOOo-(_)-oOOo-+
===
Denny White - denny...@cableone.net
GnuPG key  : 0x1644E79A  |  http://wwwkeys.de.pgp.net 
Fingerprint: D0A9 AD44 1F10 E09E 0E67  EC25 CB44 F2E5 1644 E79A
===
() ASCII ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
===



Escenas Temidas del Terapeuta Familiar

2010-05-01 Thread difusion-esa
Responder a: i...@escuelasistemica.com.ar

[IMAGE]

Taller Vivencial

ESCENAS TEMIDAS

DEL TERAPEUTA FAMILIAR

El objetivo fundamental es poder ampliar el sentido de la escena,

cristalizado en la historia del terapeuta

Coordinador: Dr. Horacio SEREBRINSKY

[IMAGE]

Dirigido a:Trabajadores de la salud mental

Propuesta: Se trabajara con el genograma de cada terapeuta, desde una
sptica gestaltica y psicodramatica haciendo un recorrido sobre la
historia del terapeuta en funcisn del trabajo clmnico con familias. Se
trabajara sobre miedos, secretos inconfesables, duelos y vmnculos
traumaticos, entre otros y la escena familiar.

Objetivo: Este trabajo facilitara el poder despegarse de clisis
personales y lograr un mejor rol profesional.

Fecha y horario: Sabado 8 de mayo de 09 a 16hs

CUPOS LIMITADOS - INSCRIPCISN PREVIA

Informes e Inscripcisn:

Fray J. S. M. de Oro 1843 (1414) - Te.Fax: 4774-2875/6112 4899-1053

i...@escuelasistemica.com.ar / www.escuelasistemica.com.ar

[demime 1.01d removed an attachment of type image/jpeg which had a name of 
flia2.jpg]