[fpc-pascal] Pipe buffering, accessing C-style stdin/stdout
Sorry for not replying in thread, I get the list as digest so I can't reply properly. The problem with FPC is that I can't find any straightforward way to either get PFile-style stdin/stdout from the Text-style input/output (surely there is a connection?) Yes. PFile _IS_ Text style. PFile is the C wrapper implementing buffer, Text the analogue Pascal buffering. I assume that settextbuf to 0 didn't work? ( http://www.freepascal.org/docs-html/rtl/system/settextbuf.html ) I have tried that, but nothing good happened. I don't know how to apply that to Input/Output in a TProcess. If that doesn't work, you need to go back to the raw unbuffered IO, do a IOCTL if necessary. FPOpen, FPClose, FPWrite, FPRead That's what I have been struggling with (apart from TProcess); pipe, fork, dup, ioctl, read, write. I think I figured out how to access stdin/stdout (by importing __sF and calculating offsets from the size of FILE - not very portable code) and used that for setvbuf. Can't one get stdin/stdout from Input/Output? They refer to the same buffers after all. Anyway, it doesn't seem to matter for my problem. TProcess does not do any buffering. What is more, it's up to the called application to decide whether it buffers it's output or not, and TProcess does not have any control over that. I had information claiming the contrary, that the caller can use setvbuf to control the buffering, and then exec to the other program. However, my attempts to do it are not successful so far, so I think you are quite right. So I continue with pseudo-terminals. I found that the other day, and that might help. I spent yesterday working on it and the tests look promising, it might be the solution, at least for most Unixes. /Ingemar ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] [fpstat - file]: Return the correct number of st_mode in order to get chmod permissions ?
Dear I need to return the correct mask of chmod permission, in this case, i have copy the FPC example , but i cannot convert info.st_mode in human readable mask (0777, 0755...) For example, with a file in 0755 mask the function return 16877 value in info.st_mode. best regards unit base_unix; {$mode objfpc}{$H+} interface uses Classes, SysUtils,variants, Linux,BaseUnix,IniFiles,strutils; type Tunix=class private public procedure Free; constructor Create; function get_file_permission(path:string):string; END; implementation constructor Tunix.Create; begin end; //## procedure Tunix.Free; begin end; function Tunix.get_file_permission(path:string):string; var s:string; info : stat; i:Integer; begin fpstat (path,info); writeln; writeln ('Result of fstat on file'); writeln ('Inode : ',info.st_ino); writeln ('Mode: ',info.st_mode); writeln ('nlink : ',info.st_nlink); writeln ('uid : ',info.st_uid); writeln ('gid : ',info.st_gid); writeln ('rdev: ',info.st_rdev); writeln ('Size: ',info.st_size); writeln ('Blksize : ',info.st_blksize); writeln ('Blocks : ',info.st_blocks); writeln ('atime : ',info.st_atime); writeln ('mtime : ',info.st_mtime); writeln ('ctime : ',info.st_ctime); end; //## end. -- David Touzeau -- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849 ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] [fpstat - file]: Return the correct number of st_mode in order to get chmod permissions ?
I need to return the correct mask of chmod permission, in this case, i have copy the FPC example , but i cannot convert info.st_mode in human readable mask (0777, 0755...) http://www.freepascal.org/docs-html/rtl/system/octstr.html Since the PDFs seem currently unsearchable, download a copy of the HTML docs for local searching. ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
Luca Olivetti wrote: synchronize and critical sections, c library with callbacks to pascal, etc.) is working flawlessly in the foreground, but it segfaults if I try to background it (or try to use fpFork), and this is a problem since I want to write a daemon (i can use screen though if that isn't possible). Backgrounding is not the same as forking. Backgrounding is using the shell's job control (and sends some signal(s) to the process), forking is what the program does itself. Can you list an example that crashes with fpfork, and give an strace with it ? Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
Luca Olivetti wrote: [EMAIL PROTECTED]:~$ uname -a Linux lspro 2.6.12.6-arm1 #77 Tue Dec 5 22:23:46 CST 2006 armv5tejl GNU/Linux I've gotten access to an arm-linux system, where I cannot reproduce the crash. That system is using 2.6.18 kernel. Can you try a newer kernel as well ? Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
En/na Micha Nelissen ha escrit: Luca Olivetti wrote: synchronize and critical sections, c library with callbacks to pascal, etc.) is working flawlessly in the foreground, but it segfaults if I try to background it (or try to use fpFork), and this is a problem since I want to write a daemon (i can use screen though if that isn't possible). Backgrounding is not the same as forking. I (vaguely) understand the difference, but I think (probably mistakenly) that the problems are related. Backgrounding is using the shell's job control (and sends some signal(s) to the process), forking is what the program does itself. Can you list an example that crashes with fpfork, and give an strace with it ? the example daemon.pp, for example, crashes right away, strace doesn't seem very useful to me: [EMAIL PROTECTED]:~/fork$ strace -f ./daemon execve(./daemon, [./daemon], [/* 22 vars */]) = 0 syscall: unknown syscall trap 0x8000 A simple program that just repeatedly sleeps after the fork, dies as soon as it receives any signal (e.h HUP, USR1). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
En/na Micha Nelissen ha escrit: Luca Olivetti wrote: [EMAIL PROTECTED]:~$ uname -a Linux lspro 2.6.12.6-arm1 #77 Tue Dec 5 22:23:46 CST 2006 armv5tejl GNU/Linux I've gotten access to an arm-linux system, where I cannot reproduce the crash. That system is using 2.6.18 kernel. Can you try a newer kernel as well ? Unfortunately no. The fine guys at linkstationwiki.net are working hard trying to make a newer kernel work on this machine, but it will take a while. I'll have to wait :-( Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
Luca Olivetti wrote: Backgrounding is not the same as forking. I (vaguely) understand the difference, but I think (probably mistakenly) that the problems are related. I'm not saying the problems are not related; they may be. It's just important to know there is a difference. the example daemon.pp, for example, crashes right away, strace doesn't seem very useful to me: [EMAIL PROTECTED]:~/fork$ strace -f ./daemon execve(./daemon, [./daemon], [/* 22 vars */]) = 0 syscall: unknown syscall trap 0x8000 There is a patch on the internet for strace, to skip this error. Google for strace syscall trap. A simple program that just repeatedly sleeps after the fork, dies as soon as it receives any signal (e.h HUP, USR1). Ok, this will be the same problem as with backgrounding in the shell. Micha ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] problem with threads and backgrounding, fpc 2.1.3 arm native
En/na Luca Olivetti ha escrit: the example daemon.pp, for example, crashes right away, strace doesn't seem very useful to me: but it works fine cross-compiling (with fpc 2.0.4). I cannot find a way to cross-compile my test program: [EMAIL PROTECTED] fork]$ ppcarm -Fu/home/luca/fpc-arm-2.0.4/lib/fpc/2.0.4/units/arm-linux/* -XParm-linux- -Xd -Xr/home/luca/lsproroot/usr/lib/ test.pas Free Pascal Compiler version 2.0.4 [2006/08/23] for arm Copyright (c) 1993-2006 by Florian Klaempfl Target OS: Linux for ARM Compiling test.pas Assembling test Linking test /home/luca/fpc-arm-2.0.4/bin/arm-linux-ld: cannot find -ldl test.pas(12,3) Error: Error while linking Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal] coin3d bindings
Is there already a binding for the coin3d library? For example: http://doc.coin3d.org/SoQt/ Mattias ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Congratulations to FPC!
I saw 2 threads in borland non-tech and references to slashdot about morfik patents: Subject: Morfik Patents AJAX Compiler Is that what you guys are celebrating? I saw too that is a application patent not applyed yet, but I dee desagree with this kind of behavior, not yours, but from morfik, hope never need to use this software. []s Cesar Romero Hi all, After the awesome advanced image editor, Pixel at http://www.kanzelsberger.com. Now, FPC is officially used as backend compiler for another great product, Morfik at http://www.morfik.com. Congratulations! :) PS. Morfik's logo for FPC is nice. ;) -Bee- has Bee.ography at: http://beeography.wordpress.com ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal