aboutsummaryrefslogtreecommitdiff
path: root/src/port/thread.c
Commit message (Collapse)AuthorAge
* Update copyright for 2016Bruce Momjian2016-01-02
| | | | Backpatch certain files through 9.1
* Remove configure test for nonstandard variants of getpwuid_r().Tom Lane2015-01-11
| | | | | | | | | | We had code that supposed that some platforms might offer a nonstandard version of getpwuid_r() with only four arguments. However, the 5-argument definition has been standardized at least since the Single Unix Spec v2, which is our normal reference for what's portable across all Unix-oid platforms. (What's more, this wasn't the only pre-standardization version of getpwuid_r(); my old HPUX 10.20 box has still another signature.) So let's just get rid of the now-useless configure step.
* Fix libpq's behavior when /etc/passwd isn't readable.Tom Lane2015-01-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some users run their applications in chroot environments that lack an /etc/passwd file. This means that the current UID's user name and home directory are not obtainable. libpq used to be all right with that, so long as the database role name to use was specified explicitly. But commit a4c8f14364c27508233f8a31ac4b10a4c90235a9 broke such cases by causing any failure of pg_fe_getauthname() to be treated as a hard error. In any case it did little to advance its nominal goal of causing errors in pg_fe_getauthname() to be reported better. So revert that and instead put some real error-reporting code in place. This requires changes to the APIs of pg_fe_getauthname() and pqGetpwuid(), since the latter had departed from the POSIX-specified API of getpwuid_r() in a way that made it impossible to distinguish actual lookup errors from "no such user". To allow such failures to be reported, while not failing if the caller supplies a role name, add a second call of pg_fe_getauthname() in connectOptions2(). This is a tad ugly, and could perhaps be avoided with some refactoring of PQsetdbLogin(), but I'll leave that idea for later. (Note that the complained-of misbehavior only occurs in PQsetdbLogin, not when using the PQconnect functions, because in the latter we will never bother to call pg_fe_getauthname() if the user gives a role name.) In passing also clean up the Windows-side usage of GetUserName(): the recommended buffer size is 257 bytes, the passed buffer length should be the buffer size not buffer size less 1, and any error is reported by GetLastError() not errno. Per report from Christoph Berg. Back-patch to 9.4 where the chroot failure case was introduced. The generally poor reporting of errors here is of very long standing, of course, but given the lack of field complaints about it we won't risk changing these APIs further back (even though they're theoretically internal to libpq).
* Update copyright for 2015Bruce Momjian2015-01-06
| | | | Backpatch certain files through 9.0
* pgindent run for 9.4Bruce Momjian2014-05-06
| | | | | This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
* Update copyright for 2014Bruce Momjian2014-01-07
| | | | | Update all files in head, and files COPYRIGHT and legal.sgml in all back branches.
* Update copyrights for 2013Bruce Momjian2013-01-01
| | | | | Fully update git head, and update back branches in ./COPYRIGHT and legal.sgml files.
* Update copyright notices for year 2012.Bruce Momjian2012-01-01
|
* Stamp copyrights for year 2011.Bruce Momjian2011-01-01
|
* Remove cvs keywords from all files.Magnus Hagander2010-09-20
|
* Update copyright for the year 2010.Bruce Momjian2010-01-02
|
* Remove empty #ifdef block.Bruce Momjian2009-01-14
|
* Update copyright for 2009.Bruce Momjian2009-01-01
|
* Don't pull in pthreads header files in this file because we never use them.Magnus Hagander2008-04-22
|
* Update copyrights in source tree to 2008.Bruce Momjian2008-01-01
|
* Update comment for new thread_test location.Bruce Momjian2007-04-03
|
* Update CVS HEAD for 2007 copyright. Back branches are typically notBruce Momjian2007-01-05
| | | | back-stamped for this.
* Replace strncpy with strlcpy in selected places that seem possibly relevantTom Lane2006-09-27
| | | | | | | to performance. (A wholesale effort to get rid of strncpy should be undertaken sometime, but not during beta.) This commit also fixes dynahash.c to correctly truncate overlength string keys for hashtables, so that its callers don't have to anymore.
* WIN32 fixes:Bruce Momjian2006-07-06
| | | | | | | | | I take out patch for this as a promise. This is client-build support of MS-VC6+. Fix for different getaddrinfo structure ordering on Win32 for IPv6. Hiroshi Saito
* Prepare code to be built by MSVC:Bruce Momjian2006-06-07
| | | | | | | | | | o remove many WIN32_CLIENT_ONLY defines o add WIN32_ONLY_COMPILER define o add 3rd argument to open() for portability o add include/port/win32_msvc directory for system includes Magnus Hagander
* Update copyright for 2006. Update scripts.Bruce Momjian2006-03-05
|
* Standard pgindent run for 8.1.Bruce Momjian2005-10-15
|
* Fix a whole bunch of #includes that were either wrong or redundant.Tom Lane2005-07-28
| | | | | | | | The first rule of portability for us is 'thou shalt have no other gods before c.h', and a whole lot of these files were either not including c.h at all, or including random system headers beforehand, either of which sins can mess up largefile support nicely. Once you have included c.h, there is no need to re-include what it includes, either.
* Tag appropriate files for rc3PostgreSQL Daemon2004-12-31
| | | | | | | | Also performed an initial run through of upgrading our Copyright date to extend to 2005 ... first run here was very simple ... change everything where: grep 1996-2004 && the word 'Copyright' ... scanned through the generated list with 'less' first, and after, to make sure that I only picked up the right entries ...
* Revert patch that removed BUFSIZ usage. The memory has to hold theBruce Momjian2004-09-28
| | | | structures plus pointers used by the structure.
* Remove use of large BUFSIZ for buffers and use the proper struct sizes.Bruce Momjian2004-09-27
| | | | This greatly helps threaded libpq programs.
* Add new macro as shorthand for MS VC and Borland C++:Bruce Momjian2004-09-27
| | | | | | + #if defined(_MSC_VER) || defined(__BORLANDC__) + #define WIN32_CLIENT_ONLY + #endif
* Pgindent run for 8.0.Bruce Momjian2004-08-29
|
* Update copyright to 2004.Bruce Momjian2004-08-29
|
* Include c.h instead of postgres.h in files that need to be usable inTom Lane2004-06-24
| | | | both frontend and backend. Per Andreas Pflug.
* Have strerror_r return "Unknown error".Bruce Momjian2004-06-08
|
* Fix strerror_r by checking return type from configure.Bruce Momjian2004-06-07
|
* Add new auto-detection of thread flags.Bruce Momjian2004-04-23
| | | | | | | Allow additional thread flags to be added via port templates. Change thread flag names to PTHREAD_CFLAGS and PTHREAD_LIBS to match new configure script.
* Fix getpwuid_r call:Bruce Momjian2004-03-23
| | | | *result = getpwuid_r(uid, resultbuf, buffer, buflen);
* Handle draft version of getpwuid_r() that accepts only four arguments.Bruce Momjian2004-03-20
| | | | Backpatch to 7.4.X. Required for Solaris 7 & 8.
* > (I also see some post-7.4.1 changes in src/template/solaris, so youBruce Momjian2004-03-14
| | | | | | | | | | | | | | | | | | | | | > possibly should look there too.) [snip] > I think I have the fix for part of it, but this remains... gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations -fPIC -I. -I../../../src/include -D_POSIX_PTHREAD_SEMANTICS -DFRONTEND -DSYSCONFDIR='"/usr/local/pgsql/etc"' -c -o thread.o thread.c thread.c: In function `pqGethostbyname': thread.c:189: error: `resbuf' undeclared (first use in this function) Looking at src/port/thread.c, line 189, it looks like somebody typo'd. Looks like that second parameter should be "resultbuf", not "resbuf"? Jim Seymour
* Add missing checks for Borland C compiler.Bruce Momjian2004-03-02
| | | | L J Bayuk
* Check and set thread-safe functions separately, rather than as a singleBruce Momjian2004-02-11
| | | | | | | | | | variable. Remove thread locking for non-thread-safe functions, instead throw a compile error. Platforms will have to re-run tools/thread to record their thread safety.
* make sure the $Id tags are converted to $PostgreSQL as well ...PostgreSQL Daemon2003-11-29
|
* Rename USE_THREADS to ENABLE_THREAD_SAFETY to avoid name clash with Perl.Peter Eisentraut2003-11-24
| | | | | Fixes compilation failure with --enable-thread-safety --with-perl and Perl 5.6.1.
* Allow win32 client compiles with MSC.Bruce Momjian2003-10-26
| | | | Hiroshi Saito
* Don't reference pthread.h unless we have threads enabled, per Peter.Bruce Momjian2003-10-24
|
* Update docs that point to thread test program.Bruce Momjian2003-09-29
|
* Rename thread compile flag. Move thread test program to tools/thread,Bruce Momjian2003-09-27
| | | | and improve tests.
* Add errno value for thread *_r function call buffer too small. ImproveBruce Momjian2003-09-15
| | | | thread comments.
* Attempt threading in this order:Bruce Momjian2003-09-13
| | | | | | | | | * use non-*_r function names if they are all thread-safe * (NEED_REENTRANT_FUNCS=no) * use *_r functions if they exist (configure test) * do our own locking and copying of non-threadsafe functions New to this patch is the last option.
* ifdef out pqGetpwuid() because Win32 doesn't have struct passwd.Bruce Momjian2003-09-05
| | | | | Needed for libpq builds, not just for native Win32 port, and probably for cygwin too.
* Add test for thread-safeness of libc functions.Bruce Momjian2003-09-03
|
* Make NEED_REENTRANT_FUNC_NAMES _require_ *_r functions, and add tests toBruce Momjian2003-08-16
| | | | configure to report if they are not found.
* Document threading status.Bruce Momjian2003-08-14
| | | | Update to POSIX getpwuid_r() function.