[kdbus] KDBUS_ITEM_PAYLOAD_OFF items are (once again) relative to msg header
[platform/upstream/glib.git] / glib / gwakeup.c
index ad92d56..c0f1ba0 100644 (file)
@@ -12,9 +12,7 @@
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  *
  * Author: Ryan Lortie <desrt@desrt.ca>
  */
@@ -22,7 +20,7 @@
 #include "config.h"
 
 
-/* gwakeup.h is special -- GIO and some test cases include it.  As such,
+/* gwakeup.c is special -- GIO and some test cases include it.  As such,
  * it cannot include other glib headers without triggering the single
  * includes warnings.  We have to manually include its dependencies here
  * (and at all other use sites).
@@ -229,19 +227,26 @@ g_wakeup_acknowledge (GWakeup *wakeup)
 void
 g_wakeup_signal (GWakeup *wakeup)
 {
-  guint64 one = 1;
   int res;
 
   if (wakeup->fds[1] == -1)
     {
+      guint64 one = 1;
+
+      /* eventfd() case. It requires a 64-bit counter increment value to be
+       * written. */
       do
         res = write (wakeup->fds[0], &one, sizeof one);
       while (G_UNLIKELY (res == -1 && errno == EINTR));
     }
   else
     {
+      guint8 one = 1;
+
+      /* Non-eventfd() case. Only a single byte needs to be written, and it can
+       * have an arbitrary value. */
       do
-        write (wakeup->fds[1], &one, 1);
+        res = write (wakeup->fds[1], &one, sizeof one);
       while (G_UNLIKELY (res == -1 && errno == EINTR));
     }
 }