/usr/include/ace/OS_NS_stdio.inl is in libace-dev 6.0.1-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 | // -*- C++ -*-
//
// $Id: OS_NS_stdio.inl 92182 2010-10-08 08:21:27Z olli $
#include "ace/OS_NS_unistd.h"
#include "ace/OS_NS_stdlib.h"
#include "ace/OS_NS_fcntl.h"
#include "ace/OS_NS_errno.h"
#include "ace/OS_NS_string.h"
#include "ace/OS_NS_pwd.h"
#include "ace/OS_NS_macros.h"
#include "ace/OS_NS_sys_stat.h"
#include "ace/OS_Memory.h"
#if defined (ACE_HAS_TRIO)
# include <trio.h>
#endif /* ACE_HAS_TRIO */
/*****************************************************************************/
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
#if defined (ACE_WIN32)
ACE_INLINE void
ACE_OS::flock_adjust_params (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T &start,
ACE_OFF_T &len)
{
switch (whence)
{
case SEEK_SET:
break;
case SEEK_CUR:
{
LARGE_INTEGER offset;
# if !defined (ACE_LACKS_WIN32_SETFILEPOINTEREX)
LARGE_INTEGER distance;
distance.QuadPart = 0;
if (!::SetFilePointerEx (lock->handle_,
distance,
&offset,
FILE_CURRENT))
{
ACE_OS::set_errno_to_last_error ();
return;
}
# else
offset.LowPart = ::SetFilePointer (lock->handle_,
0,
&offset.HighPart,
FILE_CURRENT);
if (offset.LowPart == INVALID_SET_FILE_POINTER &&
::GetLastError() != NO_ERROR)
{
ACE_OS::set_errno_to_last_error ();
return;
}
# endif /* ACE_LACKS_WIN32_SETFILEPOINTEREX */
# if defined (_FILE_OFFSET_BITS) && _FILE_OFFSET_BITS == 64
start += offset.QuadPart;
# else
start += offset.LowPart;
# endif /* _FILE_OFFSET_BITS == 64 */
}
break;
case SEEK_END:
{
ACE_OFF_T const size = ACE_OS::filesize (lock->handle_);
if (size == -1)
return;
start += size;
}
break;
}
lock->overlapped_.Offset = ACE_LOW_PART (start);
lock->overlapped_.OffsetHigh = ACE_HIGH_PART (start);
if (len == 0)
{
ACE_OFF_T const tlen = ACE_OS::filesize (lock->handle_);
if (tlen != -1)
len = tlen - start;
}
}
#endif /* ACE_WIN32 */
ACE_INLINE int
ACE_OS::flock_init (ACE_OS::ace_flock_t *lock,
int flags,
const ACE_TCHAR *name,
mode_t perms)
{
ACE_OS_TRACE ("ACE_OS::flock_init");
#if defined (ACE_WIN32)
// Once initialized, these values are never changed.
lock->overlapped_.Internal = 0;
lock->overlapped_.InternalHigh = 0;
lock->overlapped_.OffsetHigh = 0;
lock->overlapped_.hEvent = 0;
#endif /* ACE_WIN32 */
lock->handle_ = ACE_INVALID_HANDLE;
lock->lockname_ = 0;
if (name != 0)
{
ACE_OSCALL (ACE_OS::open (name, flags, perms),
ACE_HANDLE,
ACE_INVALID_HANDLE,
lock->handle_);
if (lock->handle_ != ACE_INVALID_HANDLE)
lock->lockname_ = ACE_OS::strdup (name);
return lock->handle_ == ACE_INVALID_HANDLE ? -1 : 0;
}
else
return 0;
}
ACE_INLINE int
ACE_OS::flock_unlock (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T start,
ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_unlock");
#if defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
ACE_UNUSED_ARG (start);
ACE_UNUSED_ARG (len);
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
ACE_OS::flock_adjust_params (lock, whence, start, len);
DWORD low_len = ACE_LOW_PART (len);
DWORD high_len = ACE_HIGH_PART (len);
ACE_WIN32CALL_RETURN (
ACE_ADAPT_RETVAL (::UnlockFileEx (lock->handle_,
0,
low_len,
high_len,
&lock->overlapped_),
ace_result_), int, -1);
#else
lock->lock_.l_whence = whence;
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_UNLCK; // Unlock file.
// release lock
ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1);
#endif /* ACE_WIN32 */
}
ACE_INLINE int
ACE_OS::flock_destroy (ACE_OS::ace_flock_t *lock,
int unlink_file)
{
ACE_OS_TRACE ("ACE_OS::flock_destroy");
if (lock->handle_ != ACE_INVALID_HANDLE)
{
ACE_OS::flock_unlock (lock);
// Close the handle.
ACE_OS::close (lock->handle_);
lock->handle_ = ACE_INVALID_HANDLE;
if (lock->lockname_ != 0)
{
if (unlink_file)
ACE_OS::unlink (lock->lockname_);
ACE_OS::free (
static_cast<void *> (const_cast<ACE_TCHAR *> (lock->lockname_)));
}
lock->lockname_ = 0;
}
return 0;
}
ACE_INLINE int
ACE_OS::flock_rdlock (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T start,
ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_rdlock");
#if defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
ACE_UNUSED_ARG (start);
ACE_UNUSED_ARG (len);
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
ACE_OS::flock_adjust_params (lock, whence, start, len);
DWORD low_len = ACE_LOW_PART (len);
DWORD high_len = ACE_HIGH_PART (len);
ACE_WIN32CALL_RETURN (ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
0,
0,
low_len,
high_len,
&lock->overlapped_),
ace_result_), int, -1);
#else
lock->lock_.l_whence = whence;
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_RDLCK; // set read lock
// block, if no access
ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLKW,
reinterpret_cast<long> (&lock->lock_)),
int, -1);
#endif /* ACE_WIN32 */
}
ACE_INLINE int
ACE_OS::flock_tryrdlock (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T start,
ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::ace_flock_tryrdlock");
#if defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
ACE_UNUSED_ARG (start);
ACE_UNUSED_ARG (len);
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
ACE_OS::flock_adjust_params (lock, whence, start, len);
DWORD low_len = ACE_LOW_PART (len);
DWORD high_len = ACE_HIGH_PART (len);
ACE_WIN32CALL_RETURN (
ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
LOCKFILE_FAIL_IMMEDIATELY,
0,
low_len,
high_len,
&lock->overlapped_),
ace_result_), int, -1);
#else
lock->lock_.l_whence = whence;
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_RDLCK; // set read lock
int result = 0;
// Does not block, if no access, returns -1 and set errno = EBUSY;
ACE_OSCALL (ACE_OS::fcntl (lock->handle_, F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1, result);
if (result == -1 && (errno == EACCES || errno == EAGAIN))
errno = EBUSY;
return result;
#endif /* ACE_WIN32 */
}
ACE_INLINE int
ACE_OS::flock_trywrlock (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T start,
ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::ace_flock_trywrlock");
#if defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
ACE_UNUSED_ARG (start);
ACE_UNUSED_ARG (len);
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
ACE_OS::flock_adjust_params (lock, whence, start, len);
DWORD low_len = ACE_LOW_PART (len);
DWORD high_len = ACE_HIGH_PART (len);
ACE_WIN32CALL_RETURN (
ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
LOCKFILE_FAIL_IMMEDIATELY | LOCKFILE_EXCLUSIVE_LOCK,
0,
low_len,
high_len,
&lock->overlapped_),
ace_result_), int, -1);
#else
lock->lock_.l_whence = whence;
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_WRLCK; // set write lock
int result = 0;
// Does not block, if no access, returns -1 and set errno = EBUSY;
ACE_OSCALL (ACE_OS::fcntl (lock->handle_,
F_SETLK,
reinterpret_cast<long> (&lock->lock_)),
int, -1, result);
if (result == -1 && (errno == EACCES || errno == EAGAIN))
errno = EBUSY;
return result;
#endif /* ACE_WIN32 */
}
ACE_INLINE int
ACE_OS::flock_wrlock (ACE_OS::ace_flock_t *lock,
short whence,
ACE_OFF_T start,
ACE_OFF_T len)
{
ACE_OS_TRACE ("ACE_OS::flock_wrlock");
#if defined (ACE_LACKS_FILELOCKS)
ACE_UNUSED_ARG (lock);
ACE_UNUSED_ARG (whence);
ACE_UNUSED_ARG (start);
ACE_UNUSED_ARG (len);
ACE_NOTSUP_RETURN (-1);
#elif defined (ACE_WIN32)
ACE_OS::flock_adjust_params (lock, whence, start, len);
DWORD low_len = ACE_LOW_PART (len);
DWORD high_len = ACE_HIGH_PART (len);
ACE_WIN32CALL_RETURN (
ACE_ADAPT_RETVAL (::LockFileEx (lock->handle_,
LOCKFILE_EXCLUSIVE_LOCK,
0,
low_len,
high_len,
&lock->overlapped_),
ace_result_), int, -1);
#else
lock->lock_.l_whence = whence;
lock->lock_.l_start = start;
lock->lock_.l_len = len;
lock->lock_.l_type = F_WRLCK; // set write lock
// block, if no access
ACE_OSCALL_RETURN (ACE_OS::fcntl (lock->handle_, F_SETLKW,
reinterpret_cast<long> (&lock->lock_)),
int, -1);
#endif /* ACE_WIN32 */
}
ACE_INLINE void
ACE_OS::clearerr (FILE* fp)
{
ace_clearerr_helper (fp);
}
#if !defined (ACE_LACKS_CUSERID)
ACE_INLINE char *
ACE_OS::cuserid (char *user, size_t maxlen)
{
ACE_OS_TRACE ("ACE_OS::cuserid");
#if defined (ACE_VXWORKS)
ACE_UNUSED_ARG (maxlen);
if (user == 0)
{
// Require that the user field be non-null, i.e., don't
// allocate or use static storage.
ACE_NOTSUP_RETURN (0);
}
else
{
::remCurIdGet (user, 0);
return user;
}
#elif defined (ACE_HAS_PHARLAP) || defined (ACE_HAS_WINCE)
ACE_UNUSED_ARG (user);
ACE_UNUSED_ARG (maxlen);
ACE_NOTSUP_RETURN (0);
#elif defined (ACE_WIN32)
BOOL const result = GetUserNameA (user, (u_long *) &maxlen);
if (result == FALSE)
ACE_FAIL_RETURN (0);
else
return user;
#elif defined (ACE_HAS_ALT_CUSERID)
# if defined (ACE_LACKS_PWD_FUNCTIONS)
# error Cannot use alternate cuserid() without POSIX password functions!
# endif /* ACE_LACKS_PWD_FUNCTIONS */
// POSIX.1 dropped the cuserid() function.
// GNU GLIBC and other platforms correctly deprecate the cuserid()
// function.
if (maxlen == 0)
{
// It doesn't make sense to have a zero length user ID.
errno = EINVAL;
return 0;
}
struct passwd *pw = 0;
// Make sure the file pointer is at the beginning of the password file
ACE_OS::setpwent ();
// Should use ACE_OS::setpwent() but I didn't want to move this
// method after it.
// Use the effective user ID to determine the user name.
pw = ::getpwuid (ACE_OS::geteuid ());
// Make sure the password file is closed.
ACE_OS::endpwent ();
if (pw == 0)
{
errno = ENOENT;
return 0;
}
size_t max_length = 0;
char *userid = 0;
if (user == 0)
{
// Not reentrant/thread-safe, but nothing else can be done if a
// zero pointer was passed in as the destination.
#if defined (_POSIX_SOURCE) && defined (L_cuserid)
const size_t ACE_L_cuserid = L_cuserid;
#else
const size_t ACE_L_cuserid = 9; // 8 character user ID + NULL
#endif /* _POSIX_SOURCE */
static char tmp[ACE_L_cuserid] = { '\0' };
max_length = ACE_L_cuserid - 1; // Do not include NULL in length
userid = tmp;
}
else
{
max_length = maxlen;
userid = user;
}
// Extract the user name from the passwd structure.
if (ACE_OS::strlen (pw->pw_name) <= max_length)
{
return ACE_OS::strcpy (userid, pw->pw_name);
}
else
{
errno = ENOSPC; // Buffer is not large enough.
return 0;
}
#else
// Hackish because of missing buffer size!
ACE_UNUSED_ARG (maxlen);
ACE_OSCALL_RETURN (::ace_cuserid(user), char*, 0);
#endif /* ACE_VXWORKS */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::cuserid (wchar_t *user, size_t maxlen)
{
# if defined (ACE_HAS_WINCE)
ACE_UNUSED_ARG (user);
ACE_UNUSED_ARG (maxlen);
ACE_NOTSUP_RETURN (0);
# elif defined (ACE_WIN32)
BOOL const result = GetUserNameW (user, (u_long *) &maxlen);
if (result == FALSE)
ACE_FAIL_RETURN (0);
else
return user;
# else /* ACE_WIN32 */
char *char_user;
wchar_t *result = 0;
ACE_NEW_RETURN (char_user, char[maxlen + 1], 0);
if (ACE_OS::cuserid (char_user, maxlen))
{
ACE_OS::strcpy (user, ACE_Ascii_To_Wide (char_user).wchar_rep ());
result = user;
}
delete [] char_user;
return result;
# endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
#endif /* ACE_LACKS_CUSERID */
ACE_INLINE int
ACE_OS::fclose (FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fclose");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fclose (fp), int, -1);
}
ACE_INLINE FILE *
ACE_OS::fdopen (ACE_HANDLE handle, const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fdopen");
#if defined (ACE_HAS_WINCE)
# if defined (ACE_HAS_NONCONST_WFDOPEN)
ACE_OSCALL_RETURN (::_wfdopen ((int)handle, const_cast <ACE_TCHAR*> (ACE_TEXT_ALWAYS_WCHAR (mode))),
FILE*,
0);
# else
ACE_OSCALL_RETURN (::_wfdopen (handle, ACE_TEXT_ALWAYS_WCHAR (mode)),
FILE*,
0);
# endif
#elif defined (ACE_WIN32)
// kernel file handle -> FILE* conversion...
// Options: _O_APPEND, _O_RDONLY and _O_TEXT are lost
FILE * file = 0;
int const crt_handle = ::_open_osfhandle (intptr_t (handle), 0);
if (crt_handle != -1)
{
# if defined (ACE_USES_WCHAR)
file = ::_wfdopen (crt_handle, mode);
# else
file = ::_fdopen (crt_handle, mode);
# endif /* ACE_USES_WCHAR */
if (!file)
{
::_close (crt_handle);
}
}
return file;
#elif defined (ACE_LACKS_FDOPEN)
ACE_UNUSED_ARG (handle);
ACE_UNUSED_ARG (mode);
ACE_NOTSUP_RETURN (0);
#else
ACE_OSCALL_RETURN
(::fdopen (handle, ACE_TEXT_ALWAYS_CHAR (mode)), FILE *, 0);
#endif /* ACE_HAS_WINCE */
}
ACE_INLINE int
ACE_OS::fflush (FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fflush");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fflush (fp), int, -1);
}
ACE_INLINE int
ACE_OS::fgetc (FILE* fp)
{
return ace_fgetc_helper (fp);
}
ACE_INLINE int
ACE_OS::getc (FILE* fp)
{
return ace_getc_helper (fp);
}
ACE_INLINE int
ACE_OS::fgetpos (FILE* fp, fpos_t* pos)
{
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetpos (fp, pos), int, -1);
}
ACE_INLINE char *
ACE_OS::fgets (char *buf, int size, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fgets");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgets (buf, size, fp), char *, 0);
}
#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FGETWS)
ACE_INLINE wchar_t *
ACE_OS::fgets (wchar_t *buf, int size, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fgets");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fgetws (buf, size, fp), wchar_t *, 0);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FGETWS */
ACE_INLINE ACE_HANDLE
ACE_OS::fileno (FILE *stream)
{
#if defined ACE_FILENO_EQUIVALENT
return (ACE_HANDLE)ACE_FILENO_EQUIVALENT (stream);
#else
return ace_fileno_helper (stream);
#endif
}
#if !(defined (ACE_WIN32) && !defined (ACE_HAS_WINCE))
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
ACE_OS::fopen (const char *filename, const char *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
ACE_OSCALL_RETURN (::fopen (filename, mode), FILE *, 0);
}
#if defined (ACE_HAS_WCHAR)
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
ACE_OS::fopen (const char *filename, const wchar_t *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
ACE_Wide_To_Ascii n_mode (mode);
ACE_OSCALL_RETURN (::fopen (filename, n_mode.char_rep ()), FILE *, 0);
}
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
ACE_OS::fopen (const wchar_t *filename, const wchar_t *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
#if defined (ACE_HAS_WINCE)
ACE_OSCALL_RETURN (::_wfopen (filename, mode), FILE *, 0);
#else
// Non-Windows doesn't use wchar_t file systems.
ACE_Wide_To_Ascii n_filename (filename);
ACE_Wide_To_Ascii n_mode (mode);
ACE_OSCALL_RETURN
(::fopen (n_filename.char_rep (), n_mode.char_rep ()), FILE*, 0);
#endif /* ACE_HAS_WINCE */
}
// Win32 PC implementation of fopen () is in OS_NS_stdio.cpp.
ACE_INLINE FILE *
ACE_OS::fopen (const wchar_t *filename, const char *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
#if defined (ACE_HAS_WINCE)
ACE_Ascii_To_Wide n_mode (mode);
ACE_OSCALL_RETURN
(::_wfopen (filename, n_mode.wchar_rep ()), FILE *, 0);
#else
// Non-Windows doesn't use wchar_t file systems.
ACE_Wide_To_Ascii n_filename (filename);
ACE_OSCALL_RETURN
(::fopen (n_filename.char_rep (), mode), FILE*, 0);
#endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
#endif /* ACE_WIN32 */
ACE_INLINE int
ACE_OS::ungetc (int c, FILE *fp)
{
return ace_ungetc_helper (c, fp);
}
ACE_INLINE int
ACE_OS::fputc (int c, FILE *fp)
{
return ace_fputc_helper (c, fp);
}
ACE_INLINE int
ACE_OS::putc (int c, FILE *fp)
{
return ace_putc_helper (c, fp);
}
ACE_INLINE int
ACE_OS::fputs (const char *s, FILE *stream)
{
ACE_OS_TRACE ("ACE_OS::fputs");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputs (s, stream), int, -1);
}
#if defined (ACE_HAS_WCHAR) && !defined(ACE_LACKS_FPUTWS)
ACE_INLINE int
ACE_OS::fputs (const wchar_t *s, FILE *stream)
{
ACE_OS_TRACE ("ACE_OS::fputs");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fputws (s, stream), int, -1);
}
#endif /* ACE_HAS_WCHAR && !ACE_LACKS_FPUTWS */
ACE_INLINE size_t
ACE_OS::fread (void *ptr, size_t size, size_t nelems, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fread");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fread (ptr, size, nelems, fp),
size_t,
0);
}
ACE_INLINE FILE *
ACE_OS::freopen (const ACE_TCHAR *filename, const ACE_TCHAR *mode, FILE* stream)
{
ACE_OS_TRACE ("ACE_OS::freopen");
#if defined (ACE_WIN32) && defined(ACE_USES_WCHAR)
ACE_OSCALL_RETURN (::_wfreopen (ACE_TEXT_ALWAYS_WCHAR (filename),
ACE_TEXT_ALWAYS_WCHAR (mode),
stream),
FILE *, 0);
#else
ACE_OSCALL_RETURN
(ACE_STD_NAMESPACE::freopen (ACE_TEXT_ALWAYS_CHAR (filename),
ACE_TEXT_ALWAYS_CHAR (mode),
stream),
FILE *, 0);
#endif /* ACE_WIN32 && ACE_USES_WCHAR */
}
ACE_INLINE int
ACE_OS::fseek (FILE *fp, long offset, int whence)
{
# if defined (ACE_WIN32)
# if SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END
//#error Windows NT is evil AND rude!
switch (whence)
{
case SEEK_SET:
whence = FILE_BEGIN;
break;
case SEEK_CUR:
whence = FILE_CURRENT;
break;
case SEEK_END:
whence = FILE_END;
break;
default:
errno = EINVAL;
return -1; // rather safe than sorry
}
# endif /* SEEK_SET != FILE_BEGIN || SEEK_CUR != FILE_CURRENT || SEEK_END != FILE_END */
# endif /* ACE_WIN32 */
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fseek (fp, offset, whence), int, -1);
}
ACE_INLINE int
ACE_OS::fsetpos (FILE* fp, fpos_t* pos)
{
ACE_OSCALL_RETURN (::fsetpos (fp, pos), int, -1);
}
ACE_INLINE long
ACE_OS::ftell (FILE* fp)
{
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::ftell (fp), long, -1);
}
ACE_INLINE size_t
ACE_OS::fwrite (const void *ptr, size_t size, size_t nitems, FILE *fp)
{
ACE_OS_TRACE ("ACE_OS::fwrite");
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::fwrite (ptr, size, nitems, fp),
size_t,
0);
}
ACE_INLINE void
ACE_OS::perror (const char *s)
{
ACE_OS_TRACE ("ACE_OS::perror");
#if defined (ACE_LACKS_PERROR)
ACE_UNUSED_ARG (s);
#else
::perror (s);
#endif /* ACE_HAS_WINCE */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE void
ACE_OS::perror (const wchar_t *s)
{
ACE_OS_TRACE ("ACE_OS::perror");
#if defined (ACE_LACKS_PERROR)
ACE_UNUSED_ARG (s);
#elif defined (ACE_WIN32)
::_wperror (s);
#else
ACE_Wide_To_Ascii n_s (s);
::perror (n_s.char_rep ());
#endif /* ACE_LACKS_PERROR */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::puts (const char *s)
{
ACE_OS_TRACE ("ACE_OS::puts");
ACE_OSCALL_RETURN (::puts (s), int, -1);
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::puts (const wchar_t *s)
{
ACE_OS_TRACE ("ACE_OS::puts");
#if defined (ACE_WIN32)
ACE_OSCALL_RETURN (::_putws (s), int, -1);
#else /* ACE_WIN32 */
// There's no putws()...
ACE_Wide_To_Ascii n_s (s);
ACE_OSCALL_RETURN (::puts (n_s.char_rep ()), int, -1);
#endif /* ACE_WIN32 */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::rename (const char *old_name,
const char *new_name,
int flags)
{
# if defined (ACE_HAS_WINCE)
// Win CE is always wide-char.
ACE_UNUSED_ARG (flags);
if (0 == ::MoveFile (ACE_TEXT_CHAR_TO_TCHAR (old_name),
ACE_TEXT_CHAR_TO_TCHAR (new_name)))
ACE_FAIL_RETURN (-1);
return 0;
# elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX)
// NT4 (and up) provides a way to rename/move a file with similar semantics
// to what's usually done on UNIX - if there's an existing file with
// <new_name> it is removed before the file is renamed/moved. The
// MOVEFILE_COPY_ALLOWED is specified to allow such a rename across drives.
if (flags == -1)
flags = MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING;
if (::MoveFileExA (old_name, new_name, flags) == 0)
ACE_FAIL_RETURN (-1);
return 0;
# else
ACE_UNUSED_ARG (flags);
ACE_OSCALL_RETURN (::rename (old_name, new_name), int, -1);
# endif /* ACE_HAS_WINCE */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::rename (const wchar_t *old_name,
const wchar_t *new_name,
int flags)
{
# if defined (ACE_HAS_WINCE)
ACE_UNUSED_ARG (flags);
if (::MoveFileW (old_name, new_name) == 0)
ACE_FAIL_RETURN (-1);
return 0;
# elif defined (ACE_WIN32) && !defined (ACE_LACKS_WIN32_MOVEFILEEX)
// NT4 (and up) provides a way to rename/move a file with similar semantics
// to what's usually done on UNIX - if there's an existing file with
// <new_name> it is removed before the file is renamed/moved. The
// MOVEFILE_COPY_ALLOWED is specified to allow such a rename across drives.
if (flags == -1)
flags = MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING;
if (::MoveFileExW (old_name, new_name, flags) == 0)
ACE_FAIL_RETURN (-1);
return 0;
# elif defined (ACE_WIN32)
ACE_UNUSED_ARG (flags);
ACE_OSCALL_RETURN (::_wrename (old_name, new_name), int, -1);
# else
ACE_Wide_To_Ascii nold_name (old_name);
ACE_Wide_To_Ascii nnew_name (new_name);
return ACE_OS::rename (nold_name.char_rep (), nnew_name.char_rep (), flags);
# endif /* ACE_HAS_WINCE */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE void
ACE_OS::rewind (FILE *fp)
{
#if !defined (ACE_HAS_WINCE)
ACE_OS_TRACE ("ACE_OS::rewind");
::rewind (fp);
#else
// This isn't perfect since it doesn't reset EOF, but it's probably
// the closest we can get on WINCE.
(void) ::fseek (fp, 0L, SEEK_SET);
#endif /* ACE_HAS_WINCE */
}
ACE_INLINE char *
ACE_OS::tempnam (const char *dir, const char *pfx)
{
ACE_OS_TRACE ("ACE_OS::tempnam");
#if defined (ACE_LACKS_TEMPNAM)
ACE_UNUSED_ARG (dir);
ACE_UNUSED_ARG (pfx);
ACE_NOTSUP_RETURN (0);
#elif defined (ACE_HAS_NONCONST_TEMPNAM)
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::tempnam (const_cast <char *> (dir), const_cast<char *> (pfx)), char *, 0);
#else /* ACE_LACKS_TEMPNAM */
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::tempnam (dir, pfx), char *, 0);
#endif /* ACE_LACKS_TEMPNAM */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE wchar_t *
ACE_OS::tempnam (const wchar_t *dir, const wchar_t *pfx)
{
ACE_OS_TRACE ("ACE_OS::tempnam");
#if defined (ACE_LACKS_TEMPNAM)
ACE_UNUSED_ARG (dir);
ACE_UNUSED_ARG (pfx);
ACE_NOTSUP_RETURN (0);
#elif defined(ACE_WIN32)
# if defined (ACE_HAS_NONCONST_TEMPNAM)
ACE_OSCALL_RETURN (::_wtempnam (const_cast <wchar_t*> (dir), const_cast <wchar_t*> (pfx)), wchar_t *, 0);
# else
ACE_OSCALL_RETURN (::_wtempnam (dir, pfx), wchar_t *, 0);
# endif /* ACE_HAS_NONCONST_TEMPNAM */
#else /* ACE_LACKS_TEMPNAM */
// No native wide-char support; convert to narrow and call the char* variant.
char *ndir = ACE_Wide_To_Ascii (dir).char_rep ();
char *npfx = ACE_Wide_To_Ascii (pfx).char_rep ();
char *name = ACE_OS::tempnam (ndir, npfx);
// ACE_OS::tempnam returns a pointer to a malloc()-allocated space.
// Convert that string to wide-char and free() the original.
wchar_t *wname = 0;
if (name != 0)
{
size_t namelen = ACE_OS::strlen (name) + 1;
wname = reinterpret_cast<wchar_t *>
(ACE_OS::malloc (namelen * sizeof (wchar_t)));
if (wname != 0)
ACE_OS::strcpy (wname, ACE_Ascii_To_Wide (name).wchar_rep ());
ACE_OS::free (name);
}
return wname;
#endif /* ACE_LACKS_TEMPNAM */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vasprintf (char **bufp, const char* format, va_list argptr)
{
#if defined (ACE_HAS_VASPRINTF)
return ::vasprintf (bufp, format, argptr);
#else
return ACE_OS::vasprintf_emulation (bufp, format, argptr);
#endif /* ACE_HAS_VASPRINTF */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vasprintf (wchar_t **bufp, const wchar_t* format, va_list argptr)
{
#if defined (ACE_HAS_VASWPRINTF)
return ::vaswprintf (bufp, format, argptr);
#else
return ACE_OS::vaswprintf_emulation (bufp, format, argptr);
#endif /* ACE_HAS_VASWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vprintf (const char *format, va_list argptr)
{
return ::vprintf (format, argptr);
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vprintf (const wchar_t *format, va_list argptr)
{
#if defined (ACE_HAS_VWPRINTF)
return ::vwprintf (format, argptr);
#else
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_VWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vfprintf (FILE *fp, const char *format, va_list argptr)
{
return ACE_STD_NAMESPACE::vfprintf (fp, format, argptr);
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vfprintf (FILE *fp, const wchar_t *format, va_list argptr)
{
#if defined (ACE_HAS_VFWPRINTF)
return ::vfwprintf (fp, format, argptr);
#else
ACE_UNUSED_ARG (fp);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_HAS_VFWPRINTF */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vsprintf (char *buffer, const char *format, va_list argptr)
{
return ::vsprintf (buffer, format, argptr);
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsprintf (wchar_t *buffer, const wchar_t *format, va_list argptr)
{
# if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \
(defined (sun) && !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION-0==4))) || \
defined (ACE_HAS_DINKUM_STL) || defined (__DMC__) || \
defined (ACE_HAS_VSWPRINTF) || \
(defined (ACE_WIN32_VC10) && !defined (ACE_HAS_WINCE)) || \
(defined (ACE_WIN32_VC9) && !defined (ACE_HAS_WINCE)) || \
(defined (ACE_WIN32_VC8) && !defined (ACE_HAS_WINCE) && \
_MSC_FULL_VER > 140050000)
// The XPG4/UNIX98/C99 signature of the wide-char sprintf has a
// maxlen argument. Since this method doesn't supply one, pass in
// a length that works (ULONG_MAX doesn't on all platform since some check
// to see if the operation will remain in bounds). If this isn't ok, use
// ACE_OS::snprintf().
return vswprintf (buffer, 4096, format, argptr);
# elif defined (ACE_WIN32)
// Windows has vswprintf, but the pre-VC8 signature is from the older
// ISO C standard. Also see ACE_OS::snprintf() for more info on this.
return vswprintf (buffer, format, argptr);
# else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (argptr);
ACE_NOTSUP_RETURN (-1);
# endif /* XPG5 || ACE_HAS_DINKUM_STL */
}
#endif /* ACE_HAS_WCHAR */
ACE_INLINE int
ACE_OS::vsnprintf (char *buffer, size_t maxlen, const char *format, va_list ap)
{
#if !defined (ACE_LACKS_VSNPRINTF)
int result;
# if 0 /* defined (ACE_HAS_TR24731_2005_CRT) */
// _vsnprintf_s() doesn't report the length needed when it truncates. This
// info is needed and relied on by others things in ACE+TAO, so don't use
// this. There's adequate protection via the maxlen.
result = _vsnprintf_s (buffer, maxlen, _TRUNCATE, format, ap);
# elif !defined (ACE_WIN32)
result = ::vsnprintf (buffer, maxlen, format, ap);
# else
result = ::_vsnprintf (buffer, maxlen, format, ap);
// Win32 doesn't regard a full buffer with no 0-terminate as an overrun.
if (result == static_cast<int> (maxlen) && maxlen > 0)
buffer[maxlen-1] = '\0';
// Win32 doesn't 0-terminate the string if it overruns maxlen.
if (result == -1 && maxlen > 0)
buffer[maxlen-1] = '\0';
# endif
// In out-of-range conditions, C99 defines vsnprintf() to return the number
// of characters that would have been written if enough space was available.
// Earlier variants of the vsnprintf() (e.g. UNIX98) defined it to return
// -1. This method follows the C99 standard, but needs to guess at the
// value; uses maxlen + 1.
if (result == -1)
{
result = static_cast <int> (maxlen + 1);
}
return result;
#elif defined (ACE_HAS_TRIO)
return trio_vsnprintf (buffer, maxlen, format, ap);
#else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (maxlen);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (ap);
ACE_NOTSUP_RETURN (-1);
#endif /* ACE_LACKS_VSNPRINTF */
}
#if defined (ACE_HAS_WCHAR)
ACE_INLINE int
ACE_OS::vsnprintf (wchar_t *buffer, size_t maxlen, const wchar_t *format, va_list ap)
{
# if (defined _XOPEN_SOURCE && (_XOPEN_SOURCE - 0) >= 500) || \
(defined (sun) && !(defined(_XOPEN_SOURCE) && (_XOPEN_VERSION-0==4))) || \
(defined (ACE_HAS_DINKUM_STL) || defined (__DMC__)) || \
defined (ACE_HAS_VSWPRINTF) || \
defined (ACE_WIN32)
int result;
# if defined (ACE_WIN32)
// Microsoft's vswprintf() doesn't have the maxlen argument that
// XPG4/UNIX98 define. They do, however, recommend use of _vsnwprintf()
// as a substitute, which does have the same signature as the UNIX98 one.
result = ::_vsnwprintf (buffer, maxlen, format, ap);
// Win32 doesn't regard a full buffer with no 0-terminate as an overrun.
if (result == static_cast<int> (maxlen) && maxlen > 0)
buffer[maxlen-1] = '\0';
// Win32 doesn't 0-terminate the string if it overruns maxlen.
if (result == -1 && maxlen > 0)
buffer[maxlen-1] = '\0';
# else
result = vswprintf (buffer, maxlen, format, ap);
#endif
// In out-of-range conditions, C99 defines vsnprintf() to return the
// number of characters that would have been written if enough space
// was available. Earlier variants of the vsnprintf() (e.g. UNIX98)
// defined it to return -1. This method follows the C99 standard,
// but needs to guess at the value; uses maxlen + 1.
if (result == -1)
result = static_cast <int> (maxlen + 1);
return result;
# else
ACE_UNUSED_ARG (buffer);
ACE_UNUSED_ARG (maxlen);
ACE_UNUSED_ARG (format);
ACE_UNUSED_ARG (ap);
ACE_NOTSUP_RETURN (-1);
# endif /* platforms with a variant of vswprintf */
}
#endif /* ACE_HAS_WCHAR */
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
#if defined (ACE_WIN32)
ACE_INLINE const ACE_TEXT_OSVERSIONINFO &
ACE_OS::get_win32_versioninfo ()
{
return ACE_OS::win32_versioninfo_;
}
ACE_INLINE HINSTANCE
ACE_OS::get_win32_resource_module ()
{
return ACE_OS::win32_resource_module_;
}
ACE_INLINE void
ACE_OS::set_win32_resource_module (HINSTANCE instance)
{
ACE_OS::win32_resource_module_ = instance;
}
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_OS::default_win32_security_attributes (LPSECURITY_ATTRIBUTES sa)
{
#if defined (ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES)
if (sa == 0)
{
// @@ This is a good place to use pthread_once.
static SECURITY_ATTRIBUTES default_sa;
static SECURITY_DESCRIPTOR sd;
InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(&sd, TRUE, 0, FALSE);
default_sa.nLength = sizeof(SECURITY_ATTRIBUTES);
default_sa.lpSecurityDescriptor = &sd;
default_sa.bInheritHandle = TRUE;
sa = &default_sa;
}
return sa;
#else /* !ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
return sa;
#endif /* ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
}
ACE_INLINE LPSECURITY_ATTRIBUTES
ACE_OS::default_win32_security_attributes_r (LPSECURITY_ATTRIBUTES sa,
LPSECURITY_ATTRIBUTES sa_buffer,
SECURITY_DESCRIPTOR* sd_buffer)
{
#if defined (ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES)
if (sa == 0)
{
if (sa_buffer != 0 && sd_buffer != 0)
{
InitializeSecurityDescriptor
(sd_buffer, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl (sd_buffer, TRUE, 0, FALSE);
sa_buffer->nLength = sizeof(SECURITY_ATTRIBUTES);
sa_buffer->lpSecurityDescriptor = sd_buffer;
sa_buffer->bInheritHandle = TRUE;
sa = sa_buffer;
}
}
return sa;
#else /* !ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
ACE_UNUSED_ARG(sa_buffer);
ACE_UNUSED_ARG(sd_buffer);
return sa;
#endif /* ACE_DEFINES_DEFAULT_WIN32_SECURITY_ATTRIBUTES */
}
#endif /* ACE_WIN32 */
#endif
ACE_END_VERSIONED_NAMESPACE_DECL
|