History log of /freebsd/lib/libutil/pidfile.c (Results 26 – 50 of 58)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 876a84e8 18-Mar-2013 Martin Matuska <mm@FreeBSD.org>

MFC @248461


# 36a00a3f 14-Mar-2013 Pawel Jakub Dawidek <pjd@FreeBSD.org>

When pidptr was passed as NULL to pidfile_open(3), we were returning
EAGAIN/EWOULDBLOCK when another daemon was running and had the pidfile open.
We should return EEXIST in that case, fix it.

Report

When pidptr was passed as NULL to pidfile_open(3), we were returning
EAGAIN/EWOULDBLOCK when another daemon was running and had the pidfile open.
We should return EEXIST in that case, fix it.

Reported by: Dirk Engling <erdgeist@erdgeist.org>
Reviewed by: jhb, Dirk Engling <erdgeist@erdgeist.org>
MFC after: 1 week

show more ...


Revision tags: release/9.1.0
# 38f1b189 26-Apr-2012 Peter Grehan <grehan@FreeBSD.org>

IFC @ r234692

sys/amd64/include/cpufunc.h
sys/amd64/include/fpu.h
sys/amd64/amd64/fpu.c
sys/amd64/vmm/vmm.c

- Add API to allow vmm FPU state init/save/restore.

FP stuff discussed with: kib


Revision tags: release/8.3.0_cvs, release/8.3.0
# fde44397 20-Feb-2012 Guy Helmer <ghelmer@FreeBSD.org>

Set the O_CLOEXEC flag when opening the pidfile to avoid leaking the
file descriptor via exec(3).

Now that daemon(8) has been fixed to resolve the issue noted by trociny,
the consensus is that this

Set the O_CLOEXEC flag when opening the pidfile to avoid leaking the
file descriptor via exec(3).

Now that daemon(8) has been fixed to resolve the issue noted by trociny,
the consensus is that this change should be OK.

show more ...


# 9dba179d 17-Feb-2012 Bjoern A. Zeeb <bz@FreeBSD.org>

IFC @231845

Sponsored by: Cisco Systems, Inc.


# 000d6ce2 06-Feb-2012 Guy Helmer <ghelmer@FreeBSD.org>

Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lost
when the child process execs daemon's target program thanks to flock(2)
semantics. So, we apparently have to leak the open pidfi

Using the O_CLOEXEC flag on open(2) caused the pidfile lock to be lost
when the child process execs daemon's target program thanks to flock(2)
semantics. So, we apparently have to leak the open pidfile's file
descriptor to keep the lock for the pidfile(3) functions to work properly.

Test case demonstrated by trociny:

ref8-amd64:/home/trociny% uname -r
8.2-STABLE
ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
ref8-amd64:/home/trociny% daemon -p /tmp/sleep.pid sleep 10
daemon: process already running, pid: 19799

kopusha:~% uname -r
10.0-CURRENT
kopusha:~% daemon -p /tmp/sleep.pid sleep 10
kopusha:~% daemon -p /tmp/sleep.pid sleep 10
kopusha:~%

show more ...


# 8fa0b743 23-Jan-2012 Xin LI <delphij@FreeBSD.org>

IFC @230489 (pending review).


# 47b3924b 12-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

Move struct pidfh definition into pidfile.c, and leave a forward declaration
for pidfh in libutil.h in its place.
This allows us to hide the contents of the pidfh structure, and also
allowed removal

Move struct pidfh definition into pidfile.c, and leave a forward declaration
for pidfh in libutil.h in its place.
This allows us to hide the contents of the pidfh structure, and also
allowed removal of the "#ifdef _SYS_PARAM_H" guard from around the
pidfile_* function prototypes.

Suggested by pjd.

show more ...


# 656b6da7 11-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

jilles pointed out that O_CLOEXEC could be used in the open(2) flags
rather than using fcntl(2) later, and in addition to saving a system
call, removes a possible race with fork/exec from threads or

jilles pointed out that O_CLOEXEC could be used in the open(2) flags
rather than using fcntl(2) later, and in addition to saving a system
call, removes a possible race with fork/exec from threads or signal
handlers.

show more ...


# 9de091f2 11-Jan-2012 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Constify arguments.


# 4a25aa06 10-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

Style fixes courtesy of pjd.


# f295618d 10-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

Add pidfile_fileno() to obtain the file descriptor for an open
pidfile.


# 0dc6d4d1 10-Jan-2012 Guy Helmer <ghelmer@FreeBSD.org>

Set the FD_CLOEXEC flag on the open pidfile file descriptor.

Discussed with: pjd, des


Revision tags: release/9.0.0
# 70d8f36a 27-Oct-2011 Peter Grehan <grehan@FreeBSD.org>

IFC @ r226824


# e8cc80c0 16-Oct-2011 Pawel Jakub Dawidek <pjd@FreeBSD.org>

In pidfile_open(), if the pidfile is locked, but empty (PID is not stored yet)
and the caller requested other process' PID by passing non-NULL pidptr
argument, we will wait at most 100ms for the PID

In pidfile_open(), if the pidfile is locked, but empty (PID is not stored yet)
and the caller requested other process' PID by passing non-NULL pidptr
argument, we will wait at most 100ms for the PID to show up in the file and if
it won't, we will store -1 in *pidptr.

From now on, pidfile_open() function never sets errno to EAGAIN on failure.

In collaboration with: des
MFC after: 1 week

show more ...


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0
# 51e75198 20-Oct-2008 Dag-Erling Smørgrav <des@FreeBSD.org>

There is no point in releasing a lock on a file which we've unlinked and
are about to close, so don't. As a bonus, pidfile_remove(3) will now
work with an fcntl(2)-based flopen(3).


Revision tags: release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0
# fefc6803 12-Oct-2007 Konstantin Belousov <kib@FreeBSD.org>

When pidfile is already locked and has zero length, do not return
success and zero pid from pidfile_read(). Return EAGAIN instead. Sleep
up to three times for 5 ms while waiting for pidfile to be wri

When pidfile is already locked and has zero length, do not return
success and zero pid from pidfile_read(). Return EAGAIN instead. Sleep
up to three times for 5 ms while waiting for pidfile to be written.

mount(8) does the kill(mountpid, SIGHUP). If mountd pidfile is truncated,
that would result in the SIGHUP delivered to the mount' process group
instead of the mountd.

Found and analyzed by: Peter Holm
Tested by: Peter Holm, kris
Reviewed by: pjd
MFC after: 1 week

show more ...


# 062044eb 03-Aug-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Back out previous commit until I figure out why my regression test fails.

Approved by: re (kensmith)


# 7eb198c6 03-Aug-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Use fcntl(2)-style locks instead of less-portable flock(2)-style locks.

Approved by: re (kensmith)


# b31d5b56 11-May-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

strlcpy() may be faster than snprintf(), but it is less portable, and this
is not performance critical code anyway. Also, avoid using strlen() to
obtain information which we already have.

MFC after

strlcpy() may be faster than snprintf(), but it is less portable, and this
is not performance critical code anyway. Also, avoid using strlen() to
obtain information which we already have.

MFC after: 3 weeks

show more ...


# 3884dc67 10-May-2007 Dag-Erling Smørgrav <des@FreeBSD.org>

Use flopen(3).

MFC after: 3 weeks


Revision tags: release/6.2.0_cvs, release/6.2.0
# 25b5a928 23-Jun-2006 Brian Somers <brian@FreeBSD.org>

Remove some unused variables


Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0
# 4d5e876b 12-Apr-2006 John-Mark Gurney <jmg@FreeBSD.org>

use pwrite to always write at the begining of the file.. If multiple calls
to pidfile_write happen, the pidfile will have nul characters prepended
due to the cached file descriptor offset...

Review

use pwrite to always write at the begining of the file.. If multiple calls
to pidfile_write happen, the pidfile will have nul characters prepended
due to the cached file descriptor offset...

Reviewed by: scottl
MFC after: 3 days

show more ...


Revision tags: release/6.0.0_cvs, release/6.0.0
# 412fa8f1 24-Aug-2005 Pawel Jakub Dawidek <pjd@FreeBSD.org>

Add a family of functions for reliable pidfiles handling.

Idea from: jmg
Discussed on: arch@


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0, release/8.1.0_cvs, release/8.1.0, release/7.3.0_cvs, release/7.3.0, release/8.0.0_cvs, release/8.0.0, release/7.2.0_cvs, release/7.2.0, release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0
# 51e75198 20-Oct-2008 Dag-Erling Smørgrav <des@FreeBSD.org>

There is no point in releasing a lock on a file which we've unlinked and
are about to close, so don't. As a bonus, pidfile_remove(3) will now
work with an fcntl(2)-based flopen(3).


123