unix/SysLegacyAPI.cpp
Go to the documentation of this file.
1 /*----------------------------------------------------------------------------*/
2 /* */
3 /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */
4 /* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */
5 /* */
6 /* This program and the accompanying materials are made available under */
7 /* the terms of the Common Public License v1.0 which accompanies this */
8 /* distribution. A copy is also available at the following address: */
9 /* http://www.ibm.com/developerworks/oss/CPLv1.0.htm */
10 /* */
11 /* Redistribution and use in source and binary forms, with or */
12 /* without modification, are permitted provided that the following */
13 /* conditions are met: */
14 /* */
15 /* Redistributions of source code must retain the above copyright */
16 /* notice, this list of conditions and the following disclaimer. */
17 /* Redistributions in binary form must reproduce the above copyright */
18 /* notice, this list of conditions and the following disclaimer in */
19 /* the documentation and/or other materials provided with the distribution. */
20 /* */
21 /* Neither the name of Rexx Language Association nor the names */
22 /* of its contributors may be used to endorse or promote products */
23 /* derived from this software without specific prior written permission. */
24 /* */
25 /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */
26 /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */
27 /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */
28 /* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */
29 /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */
30 /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */
31 /* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
32 /* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */
33 /* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
34 /* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */
35 /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
36 /* */
37 /*********************************************************************/
38 
39 #ifdef HAVE_CONFIG_H
40 # include "config.h"
41 #endif
42 
43 #include "rexx.h"
44 
45 /*********************************************************************/
46 /* */
47 /* Function: RexxPullQueue() */
48 /* */
49 /* Description: Pull an entry from a queue. */
50 /* */
51 /* Function: Locate the queue, return its top entry to */
52 /* the caller, and tell the queue data */
53 /* manager to delete the entry. */
54 /* */
55 /* If the queue is empty, the caller can elect */
56 /* to wait for someone to post an entry. */
57 /* */
58 /* Notes: Caller is responsible for freeing the returned */
59 /* memory. */
60 /* */
61 /* The entry's control block is stored in the */
62 /* entry's memory. We must therefore obtain */
63 /* addressability to the entry's memory before */
64 /* we can process the entry. */
65 /* */
66 /* Input: external queue name, wait flag. */
67 /* */
68 /* Output: queue element, data size, date/time stamp. */
69 /* */
70 /* Effects: Top entry removed from the queue. Message */
71 /* queued to the queue data manager. */
72 /* */
73 /*********************************************************************/
75  const char *name,
76  PRXSTRING data_buf,
77  REXXDATETIME *dt,
78  size_t waitflag)
79 {
80  RexxQueueTime qt;
81 
82  // for unix platforms, this is a straight passthrough to the real API.
83  RexxReturnCode rc = RexxPullFromQueue(name, data_buf, &qt, waitflag);
84  // older releases for Linux used an internal structure for the timestamp
85  // that had portability problems. We need to manually copy over the fields
86  // because of the mismatches.
87  if (dt != NULL)
88  {
89  dt->hours = qt.hours;
90  dt->minutes = qt.minutes;
91  dt->seconds = qt.seconds;
92  dt->hundredths = qt.hundredths;
93  dt->microseconds = qt.microseconds;
94  dt->day = qt.day;
95  dt->month = qt.month;
96  dt->year = qt.year;
97  dt->weekday = qt.weekday;
98  dt->yearday = qt.yearday;
99  dt->valid = 1;
100  }
101  return rc;
102 }
103 
RexxReturnCode REXXENTRY RexxPullFromQueue(CONSTANT_STRING, PRXSTRING, RexxQueueTime *, size_t)
int RexxReturnCode
Definition: rexx.h:73
uint32_t microseconds
Definition: rexx.h:248
uint16_t year
Definition: rexx.h:246
uint16_t seconds
Definition: rexx.h:242
uint16_t day
Definition: rexx.h:244
uint32_t yearday
Definition: rexx.h:249
uint16_t month
Definition: rexx.h:245
uint16_t hours
Definition: rexx.h:240
uint16_t hundredths
Definition: rexx.h:243
uint16_t minutes
Definition: rexx.h:241
uint16_t weekday
Definition: rexx.h:247
RexxReturnCode REXXENTRY RexxPullQueue(const char *name, PRXSTRING data_buf, REXXDATETIME *dt, size_t waitflag)
#define REXXENTRY