[arch-general] get pid of daemon in init script
Hi to .* I must write a rc init script for a server I am packaging. Therefor I have copied the init script of cups. Now I recognized that both pid files, cups.pid and my own, in /var/run are empty. Further investigations have shown that "pidof -o %PPID -x /usr/bin/cdvserver" returns nothing in the start) case but in stop) it seems to work. I don't understand why pidof isn't working as expected. Kind Regards, Michael Krauss Here is my init script: #!/bin/bash . /etc/rc.conf . /etc/rc.d/functions PID=`pidof -o %PPID -x /usr/bin/cdvserver` PIDFILE="/var/run/cdvserver.pid" case "$1" in start) stat_busy "Starting Codeville Server" [ -z "$PID" ] && /usr/bin/cdvserver if [ $? -gt 0 ]; then stat_fail else echo "Started " $PID echo $PID > $PIDFILE add_daemon cdv stat_done fi ;; stop) stat_busy "Stopping Codeville Server" [ ! -z "$PID" ] && kill $PID &> /dev/null if [ $? -gt 0 ]; then stat_fail else rm $PIDFILE rm_daemon cdv stat_done fi ;; restart) $0 stop sleep 1 $0 start ;; *) echo "usage: $0 {start|stop|restart}" esac exit 0
[arch-general] Fw: get pid of daemon in init script
On 08/02/08, Dan McGee wrote: > Because you are calling pidof before the process starts- bash does not > do lazy evaluation of your expressions. > > If you want to store the PID of the newly started process, you will > have to make another PID=... call to get it in the else block where > you access it. Ohh, you are absolutely right. It is working now. I must get this damn Common Lisp out of my head before writing shell scripts next time. I will file a bug report on cups too. Thanks, Michael Krauss
[arch-general] strange access permissions in /var/spool/mail
Hello, while testing dma (Mail Transfer Agent from DragonflyBSD) on Arch Linux I stumbled on this: [EMAIL PROTECTED] mickraus]\$ ls -la /var/spool/mail insgesamt 12 drwxrwxrwt 2 root root 4096 16. Mai 15:11 . drwxr-xr-x 5 root root 4096 16. Mai 15:26 .. -- 1 mickraus users 201 16. Mai 15:11 mickraus Is it normal that a user has no access to his own mail box? I looked into postfix.install but it doesn't correct the file mode either. So what is the trick? Kind Regards, Michael Krauss
[arch-general] problem with gcc and __unused function attribute
Hello, dma is now running on Arch Linux but I found one odd thing: There is this function in net.c: static void sig_alarm(int signo __unused) { longjmp(timeout_alarm, 1); } ggc can't handle the __unused attribute: [EMAIL PROTECTED] dma]\$ LANG=us gcc -DHAVE_CRYPTO -o dma dma.c conf.c crypto.c lex.yy.c y.tab.c net.c base64.c -lssl net.c:68: error: expected ';', ',' or ')' before '__unused' net.c: In function 'read_remote': net.c:105: error: 'sig_alarm' undeclared (first use in this function) net.c:105: error: (Each undeclared identifier is reported only once net.c:105: error: for each function it appears in.) After removing the attribute everything works. But in the gcc manual exactly this attribute is listed: http://gcc.gnu.org/onlinedocs/gcc-4.3.0/gcc/Function-Attributes.html The original net.c file can be found here: http://opengrok.creo.hu/dragonfly/xref/src/libexec/dma/net.c To compile it on linux you have to include two additional headers: #ifdef __linux #include #include #endif /* __linux */ Is there a compiler switch that I have overlooked? Kind Regards Michael Krauss
[arch-general] Fw: problem with gcc and __unused function attribute
On 17/05/08, Byron Clark wrote: > On Sat, May 17, 2008 at 05:08:37PM +0000, Michael Krauss wrote: > > static void > > sig_alarm(int signo __unused) > > { > > longjmp(timeout_alarm, 1); > > } > > gcc can handle an unused variable attribute, but a different syntax is > used: > > static void > sig_alarm(int signo __attribute__((unused))) > { > longjmp(timeout_alarm, 1); > } > This one works, thanks. But I wonder how it is compiled on DragonFly because they use gcc4.1? It doesn't greatly matter. I will ask when I am sending patches upstream. Kind regards, Michael Krauss
[arch-general] system call numbers on amd64
Hello arch users! I am running Arch64: [EMAIL PROTECTED] lib]\$ uname -m x86_64 Looking into /usr/include/asm/unistd.h, it uses unistd_64.h on AMD64. According to this file the _exit syscall has number 60. But on my machine I have to use syscall 1 instead, as listed in unistd_32.h. Here is an example code for nasm (the version in extra repo is far deprecated by the way, had to compile a newer version by myself): ; tiny.asm BITS 64 GLOBAL _start SECTION .text _start: mov eax,1 mov ebx,42 int 0x80 This works. But changing the 1 to 60 breaks. Build procedure: [EMAIL PROTECTED] elf]\$ nasm -f elf64 tiny.asm [EMAIL PROTECTED] elf]\$ gcc -s -Wall -nostdlib tiny.o [EMAIL PROTECTED] elf]\$ ./a.out; echo $? 42 What is my error here? Kind regards, Michael Krauss
[arch-general] how to install several 2.6.27 kernels in parallel?
Hello Arch users, the new kernel version causes me some trouble. Since version 2.6.27 architecture independent firmware is installed to /lib/firmware. The install path doesn't depend on the actual name of the kernel: http://kernelnewbies.org/Linux_2_6_27#head-a1eaa0eeec567ae80d95dedf354e3663ae03f76b Hence it isn't possible to install two different kernel packages in parallel anymore, because both packages include the same content of /lib/firmware, so pacman refuses to install the second package. Up to now I "solve" this problem by simply deleting the firmware in my own kernel package. Don't needing the frimware myself makes this an acceptable solution. But for my savekernel skript in the AUR I need a full featured backup kernel. I have examined the interesting part of the kernel config file: CONFIG_PREVENT_FIRMWARE_BUILD=y CONFIG_FW_LOADER=y CONFIG_FIRMWARE_IN_KERNEL=y CONFIG_EXTRA_FIRMWARE="" and looked at the commits to the kernel git: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=4d2acfbfdf68257e846aaa355edd10fc35ba0feb http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=d172e7f5c67f2d41f453c7aa83d3bdb405ef8ba There doesn't seem to exist a simple switch to install the firmware relative to the kernel name. The only solution I can see so far is to stick every firmware name into the EXTRA_FIRMWARE variable and to set EXTRA_FIRMWARE_DIR to a directory related to the specific kernel. I tried to be clever and looked into the kernel26-ice package from AUR but it suffers the same problem. Maybe the maintainer never tried to install kernel26-ice and the official kernel26 in parallel. The question is: Are there any options to install the firmware relative to the kernel version in general? Kind regards, Michael Krauss