summaryrefslogtreecommitdiff
path: root/lib/process.c
Commit message (Collapse)AuthorAgeFilesLines
* list: Rename all functions in list.h with ovs_ prefix.Ben Warren2016-03-301-3/+3
| | | | | | | This attempts to prevent namespace collisions with other list libraries Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* list: Remove lib/list.h completely.Ben Warren2016-03-301-1/+1
| | | | | | | | All code is now in include/openvswitch/list.h. Signed-off-by: Ben Warren <ben@skyportsystems.com> Acked-by: Ryan Moats <rmoats@us.ibm.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* Move lib/dynamic-string.h to include/openvswitch directoryBen Warren2016-03-191-1/+1
| | | | | Signed-off-by: Ben Warren <ben@skyportsystems.com> Signed-off-by: Ben Pfaff <blp@ovn.org>
* lib: Move vlog.h to <openvswitch/vlog.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | A new function vlog_insert_module() is introduced to avoid using list_insert() from the vlog.h header. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* lib: Expose struct ovs_list definition in <openvswitch/list.h>Thomas Graf2014-12-151-1/+1
| | | | | | | | Expose the struct ovs_list definition in <openvswitch/list.h>. Keep the list access API private for now. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* list: Rename struct list to struct ovs_listThomas Graf2014-12-151-2/+2
| | | | | | | struct list is a common name and can't be used in public headers. Signed-off-by: Thomas Graf <tgraf@noironetworks.com> Acked-by: Ben Pfaff <blp@nicira.com>
* process: block signals while spawning child processesAnsis Atteka2014-05-301-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | Between fork() and execvp() calls in the process_start() function both child and parent processes share the same file descriptors. This means that, if a child process received a signal during this time interval, then it could potentially write data to a shared file descriptor. One such example is fatal signal handler, where, if child process received SIGTERM signal, then it would write data into pipe. Then a read event would occur on the other end of the pipe where parent process is listening and this would make parent process to incorrectly believe that it was the one who received SIGTERM. Also, since parent process never reads data from this pipe, then this bug would make parent process to consume 100% CPU by immediately waking up from the event loop. This patch will help to avoid this problem by blocking signals until child closes all its file descriptors. Signed-off-by: Ansis Atteka <aatteka@nicira.com> Reported-by: Suganya Ramachandran <suganyar@vmware.com> Issue: 1255110
* lib/process, socket-util: Update necessary headersYAMAMOTO Takashi2014-02-221-0/+1
| | | | | | | | Fix the regression introduced by commit 4f57ad10. ("socket-util: Move get_max_fds() to process.c") Signed-off-by: YAMAMOTO Takashi <yamamoto@valinux.co.jp> Signed-off-by: Gurucharan Shetty <gshetty@nicira.com>
* socket-util: Move get_max_fds() to process.c.Gurucharan Shetty2014-02-211-0/+43
| | | | | | | | | | get_max_fds() is used only from process.c. Move it there along with rlim_is_finite(). Since process_start() can only be called before any additional threads are created, we no longer need the thread safety checks in get_max_fds(). Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* process: Make changes for Windows.Gurucharan Shetty2014-02-191-0/+21
| | | | | | | | | | | As of now, we are using the process subsystem in ovsdb-server to handle the "--run" command line option. That particular option is not used often and till deemed necessary, make it unsupported on Windows platform. Signed-off-by: Gurucharan Shetty <gshetty@nicira.com> Acked-by: Ben Pfaff <blp@nicira.com>
* Remove unused variables and functions.Jarno Rajahalme2013-09-271-1/+0
| | | | | | | | Found by Clang. Signed-off-by: Jarno Rajahalme <jrajahalme@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Replace all uses of strerror() by ovs_strerror(), for thread safety.Ben Pfaff2013-06-281-3/+3
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* ovs-thread: Add support for various thread-related assertions.Ben Pfaff2013-06-281-0/+4
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* process: Add thread safety comments.Ben Pfaff2013-06-101-0/+4
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* process: Make signal handling thread-safe.Ben Pfaff2013-06-101-74/+34
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* process: Remove unused features from process_start().Ben Pfaff2013-06-101-42/+4
| | | | | Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* process: Remove process_run(), process_run_capture(), and related code.Ben Pfaff2013-06-101-227/+0
| | | | | | | They are unused. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ansis Atteka <aatteka@nicira.com>
* signals: Make signal_name() thread-safe.Ben Pfaff2013-06-051-2/+8
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* Use pthread_sigmask() in place of sigprocmask(), for thread safety.Ben Pfaff2013-05-021-3/+3
| | | | | | | | | | | POSIX says that multithreaded programs must not use sigprocmask() but must use pthread_sigmask() instead. This commit makes that replacement. The actual use of signals in Open vSwitch is still not thread safe following this commit, but this change is a necessary prerequisite for fixing the other problems. Signed-off-by: Ben Pfaff <blp@nicira.com>
* process: Check return value of set_nonblocking().Ben Pfaff2013-02-011-3/+9
| | | | | | | | | It's unlikely to fail but checking it can't hurt. Found by Coverity. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* Replace most uses of assert by ovs_assert.Ben Pfaff2013-01-161-3/+2
| | | | | | | | This is a straight search-and-replace, except that I also removed #include <assert.h> from each file where there were no assert calls left. Signed-off-by: Ben Pfaff <blp@nicira.com> Acked-by: Ethan Jackson <ethan@nicira.com>
* lib: Add xpipe_nonblocking helperEd Maste2012-09-281-3/+1
| | | | | Signed-off-by: Ed Maste <emaste@adaranet.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* socket-util: New function xset_nonblocking().Ben Pfaff2012-07-181-3/+3
| | | | Signed-off-by: Ben Pfaff <blp@nicira.com>
* Global replace of Nicira Networks.Raju Subramanian2012-05-021-1/+1
| | | | | | | | Replaced all instances of Nicira Networks(, Inc) to Nicira, Inc. Feature #10593 Signed-off-by: Raju Subramanian <rsubramanian@nicira.com> Signed-off-by: Ben Pfaff <blp@nicira.com>
* process: Let process_run_capture() caller set maximum capture size.Ben Pfaff2011-06-071-8/+10
| | | | An upcoming patch needs a larger value.
* Log anything that could prevent a daemon from starting.Ben Pfaff2011-04-041-15/+7
| | | | | If a daemon doesn't start, we need to know why. Being able to consistently consult the log to find out is helpful.
* signals: New function signal_name().Ben Pfaff2011-04-041-11/+5
| | | | This will acquire a new user in an upcoming commit.
* process: Avoid late failure if /dev/null cannot be opened.Ben Pfaff2011-02-231-6/+18
| | | | | | | It is (very slightly) risky to open /dev/null every time that we need it, because open can fail. So this commit opens /dev/null in advance instead. Coverity #10719.
* coverage: Make the coverage counters catalog program-specific.Ben Pfaff2010-11-301-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, the collection of coverage counters supported by a given OVS program was not specific to that program. That means that, for example, even though ovs-dpctl does not have anything to do with mac_learning, it still has a coverage counter for it. This is confusing, at best. This commit fixes the problem on some systems, in particular on ones that use GCC and the GNU linker. It uses the feature of the GNU linker described in its manual as: If an orphaned section's name is representable as a C identifier then the linker will automatically see PROVIDE two symbols: __start_SECNAME and __end_SECNAME, where SECNAME is the name of the section. These indicate the start address and end address of the orphaned section respectively. Systems that don't support these features retain the earlier behavior. This commit also fixes the annoyance that files that include coverage counters must be listed on COVERAGE_FILES in lib/automake.mk. This commit also fixes the annoyance that modifying any source file that includes a coverage counter caused all programs that link against libopenvswitch.a to relink, even programs that the source file was not linked into. For example, modifying ofproto/ofproto.c (which includes coverage counters) caused tests/test-aes128 to relink, even though test-aes128 does not link again ofproto.o.
* vlog: Make client supply semicolon for VLOG_DEFINE_THIS_MODULE.Ben Pfaff2010-10-291-1/+1
| | | | | It's kind of odd for VLOG_DEFINE_THIS_MODULE to supply its own semicolon, so this commit switches to the more common form.
* Switch many macros from using CONTAINER_OF to using OBJECT_CONTAINING.Ben Pfaff2010-10-011-1/+1
| | | | | These macros require one fewer argument by switching, which makes code that uses them shorter and more readable.
* Avoid shadowing local variable names.Ben Pfaff2010-09-201-1/+1
| | | | | | | | | | | All of these changes avoid using the same name for two local variables within a same function. None of them are actual bugs as far as I can tell, but any of them could be confusing to the casual reader. The one in lib/ovsdb-idl.c is particularly brilliant: inner and outer loops both using (different) variables named 'i'. Found with GCC -Wshadow.
* vlog: Introduce VLOG_DEFINE_THIS_MODULE for declaring vlog module in use.Ben Pfaff2010-07-211-2/+2
| | | | | | | Adding a macro to define the vlog module in use adds a level of indirection, which makes it easier to change how the vlog module must be defined. A followup commit needs to do that, so getting these widespread changes out of the way first should make that commit easier to review.
* Properly escape quotes in process_escape_args() library functionJustin Pettit2010-03-011-1/+1
|
* Merge "master" into "next".Ben Pfaff2010-02-111-2/+2
|\ | | | | | | | | The main change here is the need to update all of the uses of UNUSED in the next branch to OVS_UNUSED as it is now spelled on "master".
| * Rename UNUSED macro to OVS_UNUSED to avoid naming conflict.Ben Pfaff2010-02-111-3/+3
| | | | | | | | Requested by Jean Tourrilhes <jt@hpl.hp.com>.
* | process: Remove pointless, redundant assignments from stream_read().Ben Pfaff2010-02-111-4/+2
| | | | | | | | Found by Clang (http://clang-analyzer.llvm.org/).
* | fatal-signal: Run signal hooks outside of actual signal handlers.Jesse Gross2010-01-061-8/+0
| | | | | | | | | | | | | | Rather than running signal hooks directly from the actual signal handler, simply record the fact that the signal occured and run the hook next time around the poll loop. This allows significantly more freedom as to what can actually be done in the signal hooks.
* | Clean-up compiler warnings about ignoring return valuesJustin Pettit2009-12-151-2/+2
| | | | | | | | | | | | | | Some systems complain when certain functions' return values are not checked. This commit fixes those warnings. Creating ignore() function suggested by Ben Pfaff.
* | Add new function xzalloc(n) as a shorthand for xcalloc(1, n).Ben Pfaff2009-11-041-1/+1
|/
* process: New function process_run_capture().Ben Pfaff2009-07-161-0/+197
| | | | | | In an upcoming commit, ovs-brcompatd will need to create a subprocess and capture both its stdout and stderr separately, which one cannot do with simple interfaces such as popen(). This function provides that ability.
* process: Factor code out of process_start() into helper functions.Ben Pfaff2009-07-161-29/+69
| | | | | An upcoming commit will add a new function that can also use these helper functions.
* process: Fix races on fatal signal handling in process_start().Ben Pfaff2009-07-161-0/+7
| | | | | | | | | To prevent fatal signals in a child process from causing the parent process's pidfile, etc. to be deleted, we need to block fatal signals around fork and call fatal_signal_fork() in the child process. This problem was noticed through code inspection; it has not been observed in practice.
* Add function get_null_fd(), to reduce code redundancy.Ben Pfaff2009-07-161-0/+2
|
* Update primary code license to Apache 2.0.Ben Pfaff2009-06-151-10/+10
|
* Import from old repository commit 61ef2b42a9c4ba8e1600f15bb0236765edc2ad45.v0.90.0Ben Pfaff2009-07-081-0/+417