Path: utzoo!attcan!uunet!vsedev!logan From: logan@vsedev.VSE.COM (James Logan III) Newsgroups: comp.unix.questions Subject: Re: signals to running processes Message-ID: <1263@vsedev.VSE.COM> Date: 1 Dec 88 00:18:22 GMT References: <950@taux01.UUCP> Reply-To: logan@vsedev.VSE.COM (James Logan III) Organization: VSE Software Development Lab Lines: 36 In article <950@taux01.UUCP> cjosta@taux01.UUCP (Jonathan Sweedler) writes: # I have a program that takes a long time to finish running. From time # to time (sometimes never, sometimes more frequently) I would like to # find out the current status. The way I accomplish this is to send one # of the user defined signals (SIGUSR1 - no. 30) to the process. The ^^ SIGUSR1 is 16 under System V, so you either made a typo or you're using a BSD system. MY RESPONSE WILL NOT HELP YOU IF YOU USE BSD UNIX, but it may give people in this newsgroup some good ideas. # 1) Is there any way for someone who is not the owner of a process to # send the process a signal? Not without being root or you. Writing a setuid program would work, but is rather clumsy. # 2) Or, is there another way for a random user to cause a program to # asynchronously print out a status report (or perform some action) once # it has started running? Yes, use shared memory. Just use shmget(2) to get a hunk of memory as large as an integer, use shmat(2) to get a pointer to the integer, set the integer value to 0, and test the value somewhere that's convenient in your code. When the value is 1, print out a report, then set the integer value back to 0. Then write a simple program that you and your boss can run that uses the same key for shmget(2), use shmat(2) to get a pointer to the same integer, and set the integer value to 1. -Jim -- Jim Logan logan@vsedev.vse.com (703) 892-0002 uucp: ..!uunet!vsedev!logan inet: logan%vsedev.vse.com@uunet.uu.net