Browse Source

doc: Add new frontend.txt file documenting some public interfaces

For now document the database locking “interface”.

Closes: #670897
Guillem Jover 12 years ago
parent
commit
0aec21906f
4 changed files with 28 additions and 0 deletions
  1. 1 0
      Makefile.am
  2. 2 0
      debian/changelog
  3. 1 0
      debian/dpkg-dev.docs
  4. 24 0
      doc/frontend.txt

+ 1 - 0
Makefile.am

@@ -32,6 +32,7 @@ EXTRA_DIST = \
 	doc/README.api \
 	doc/README.feature-removal-schedule \
 	doc/coding-style.txt \
+	doc/frontend.txt \
 	doc/lcov-epilog \
 	doc/lcov-prolog \
 	doc/triggers.txt \

+ 2 - 0
debian/changelog

@@ -9,6 +9,8 @@ dpkg (1.16.4) UNRELEASED; urgency=low
     to dpkg-parsechangelog(1). Closes: #584141
   * Add MiNT support to ostable and triplettable.
     Requested by Thorsten Glaser <tg@mirbsd.de>.
+  * Add new frontend.txt file to dpkg-dev documenting some public interfaces
+    for dpkg frontends. Closes: #670897
 
   [ Updated man page translations ]
   * German (Helge Kreutzmann).

+ 1 - 0
debian/dpkg-dev.docs

@@ -3,4 +3,5 @@ THANKS
 debian/usertags
 doc/README.api
 doc/README.feature-removal-schedule
+doc/frontend.txt
 doc/triggers.txt

+ 24 - 0
doc/frontend.txt

@@ -0,0 +1,24 @@
+Frontend Interfaces
+===================
+
+This file will try to document some of the interfaces that dpkg makes
+available to frontends or that expects them to use, which are currently
+not covered by any other type of documentation.
+
+
+Database Locking
+----------------
+
+Any frontend needing to make sure no write operation is currently happening,
+should lock the dpkg database by locking the file «<admindir>/lock» using
+file record locks (i.e. fcntl(2) advisory locking). The whole file should
+be locked, as that's the most portable way to perform this operation; this
+can be achieved by using start=0, len=0 and whence=SEEK_SET.
+
+Take into account there will be a race condition between the frontend
+unlocking the database and the invoked dpkg locking it again, in which
+another process could lock it.
+
+In the future this functionality will be available through a shared libdpkg
+library, and all frontends will be expected to switch to that instead,
+because this will fix the aforementioned race condition.