1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

fixed usage of socklen_t and also tidied up SIG_ATOMIC_T, using a typedef instead of a define

(This used to be commit e2ecff419f)
This commit is contained in:
Andrew Tridgell 2001-06-25 02:53:13 +00:00
parent 413ad23faf
commit b95a294a08
15 changed files with 683 additions and 622 deletions

View File

@ -8,6 +8,7 @@
#undef HAVE_UNSIGNED_CHAR
#undef HAVE_UTIMBUF
#undef HAVE_SIG_ATOMIC_T_TYPE
#undef HAVE_SOCKLEN_T_TYPE
#undef ssize_t
#undef ino_t
#undef ssize_t

1231
source3/configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -309,6 +309,19 @@ AC_CHECK_LIB(cups,httpConnect)
AC_CHECK_LIB(dl, dlopen, [LIBS="$LIBS -ldl";
AC_DEFINE(HAVE_LIBDL)])
AC_CACHE_CHECK([for socklen_t type],samba_cv_socklen_t, [
AC_TRY_COMPILE([
#include <sys/types.h>
#if STDC_HEADERS
#include <stdlib.h>
#include <stddef.h>
#endif
#include <sys/socket.h>],[socklen_t i = 0],
samba_cv_socklen_t=yes,samba_cv_socklen_t=no)])
if test x"$samba_cv_socklen_t" = x"yes"; then
AC_DEFINE(HAVE_SOCKLEN_T_TYPE)
fi
AC_CACHE_CHECK([for sig_atomic_t type],samba_cv_sig_atomic_t, [
AC_TRY_COMPILE([
#include <sys/types.h>

View File

@ -1,4 +1,4 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
/* include/config.h.in. Generated automatically from configure.in by autoheader 2.13. */
/* Define if on AIX 3.
System headers sometimes define this.
@ -71,6 +71,7 @@
#undef HAVE_UNSIGNED_CHAR
#undef HAVE_UTIMBUF
#undef HAVE_SIG_ATOMIC_T_TYPE
#undef HAVE_SOCKLEN_T_TYPE
#undef ssize_t
#undef ino_t
#undef ssize_t

View File

@ -372,15 +372,17 @@
#endif
/*
* Define SIG_ATOMIC_T if needed.
* Define additional missing types
*/
#if defined(HAVE_SIG_ATOMIC_T_TYPE)
#define SIG_ATOMIC_T sig_atomic_t
#else
#define SIG_ATOMIC_T int
#ifndef HAVE_SIG_ATOMIC_T_TYPE
typedef int sig_atomic_t;
#endif
#ifndef HAVE_SOCKLEN_T_TYPE
typedef int socklen_t;
#endif
#ifndef uchar
#define uchar unsigned char
#endif

View File

@ -145,7 +145,7 @@ int cli_get_backup_list(const char *myname, const char *send_to_name)
struct in_addr sendto_ip, my_ip;
int dgram_sock;
struct sockaddr_in sock_out;
int name_size;
socklen_t name_size;
if (!resolve_name(send_to_name, &sendto_ip, 0x1d)) {

View File

@ -83,7 +83,7 @@ static void sig_term(int sig)
/**************************************************************************** **
catch a sighup
**************************************************************************** */
static VOLATILE SIG_ATOMIC_T reload_after_sighup = False;
static VOLATILE sig_atomic_t reload_after_sighup = False;
static void sig_hup(int sig)
{

View File

@ -310,7 +310,8 @@ static void new_connection(int accept_sock)
{
struct sockaddr_un sunaddr;
struct winbindd_cli_state *state;
int len, sock;
socklen_t len;
int sock;
/* Accept connection */

View File

@ -49,7 +49,7 @@ extern int DEBUGLEVEL;
extern pstring samlogon_user;
extern BOOL sam_logon_in_ssb;
static VOLATILE SIG_ATOMIC_T gotalarm;
static VOLATILE sig_atomic_t gotalarm;
/***************************************************************

View File

@ -24,9 +24,9 @@
#if HAVE_KERNEL_CHANGE_NOTIFY
extern int DEBUGLEVEL;
static VOLATILE SIG_ATOMIC_T fd_pending;
static VOLATILE SIG_ATOMIC_T signals_received;
static VOLATILE SIG_ATOMIC_T signals_processed;
static VOLATILE sig_atomic_t fd_pending;
static VOLATILE sig_atomic_t signals_received;
static VOLATILE sig_atomic_t signals_processed;
#ifndef DN_ACCESS
#define DN_ACCESS 0x00000001 /* File accessed in directory */
@ -65,7 +65,7 @@ the signal handler for change notify
static void signal_handler(int sig, siginfo_t *info, void *unused)
{
BlockSignals(True, sig);
fd_pending = (SIG_ATOMIC_T)info->si_fd;
fd_pending = (sig_atomic_t)info->si_fd;
signals_received++;
sys_select_signal();
}
@ -89,7 +89,7 @@ static BOOL kernel_check_notify(connection_struct *conn, uint16 vuid, char *path
DEBUG(3,("kernel change notify on %s fd=%d\n", path, (int)fd_pending));
close((int)fd_pending);
fd_pending = (SIG_ATOMIC_T)-1;
fd_pending = (sig_atomic_t)-1;
data->directory_handle = -1;
signals_processed++;
BlockSignals(False, RT_SIGNAL_NOTIFY);
@ -105,7 +105,7 @@ static void kernel_remove_notify(void *datap)
int fd = data->directory_handle;
if (fd != -1) {
if (fd == (int)fd_pending) {
fd_pending = (SIG_ATOMIC_T)-1;
fd_pending = (sig_atomic_t)-1;
signals_processed++;
BlockSignals(False, RT_SIGNAL_NOTIFY);
}

View File

@ -1195,7 +1195,7 @@ setup oplocks for this process
BOOL init_oplocks(void)
{
struct sockaddr_in sock_name;
int len = sizeof(sock_name);
socklen_t len = sizeof(sock_name);
DEBUG(3,("open_oplock_ipc: opening loopback UDP socket.\n"));

View File

@ -25,9 +25,9 @@
extern int DEBUGLEVEL;
static VOLATILE SIG_ATOMIC_T signals_received;
static VOLATILE SIG_ATOMIC_T signals_processed;
static VOLATILE SIG_ATOMIC_T fd_pending; /* the fd of the current pending signal */
static VOLATILE sig_atomic_t signals_received;
static VOLATILE sig_atomic_t signals_processed;
static VOLATILE sig_atomic_t fd_pending; /* the fd of the current pending signal */
#ifndef F_SETLEASE
#define F_SETLEASE 1024
@ -55,7 +55,7 @@ handle a LEASE signal, incrementing the signals_received and blocking the signal
static void signal_handler(int sig, siginfo_t *info, void *unused)
{
BlockSignals(True, sig);
fd_pending = (SIG_ATOMIC_T)info->si_fd;
fd_pending = (sig_atomic_t)info->si_fd;
signals_received++;
sys_select_signal();
}
@ -160,7 +160,7 @@ dev = %x, inode = %.0f\n", (unsigned int)dev, (double)inode ));
out:
/* now we can receive more signals */
fd_pending = (SIG_ATOMIC_T)-1;
fd_pending = (sig_atomic_t)-1;
signals_processed++;
BlockSignals(False, RT_SIGNAL_LEASE);

View File

@ -48,7 +48,7 @@ extern char *last_inbuf;
extern char *InBuffer;
extern char *OutBuffer;
extern int smb_read_error;
extern VOLATILE SIG_ATOMIC_T reload_after_sighup;
extern VOLATILE sig_atomic_t reload_after_sighup;
extern BOOL global_machine_password_needs_changing;
extern fstring global_myworkgroup;
extern pstring global_myname;

View File

@ -208,7 +208,7 @@ max can be %d\n",
num = sys_select(FD_SETSIZE,&lfds,NULL);
if (num == -1 && errno == EINTR) {
extern VOLATILE SIG_ATOMIC_T reload_after_sighup;
extern VOLATILE sig_atomic_t reload_after_sighup;
/* check for sighup processing */
if (reload_after_sighup) {
@ -228,7 +228,7 @@ max can be %d\n",
accept on these. */
for( ; num > 0; num--) {
struct sockaddr addr;
int in_addrlen = sizeof(addr);
socklen_t in_addrlen = sizeof(addr);
s = -1;
for(i = 0; i < num_interfaces; i++) {
@ -366,7 +366,7 @@ BOOL reload_services(BOOL test)
Catch a sighup.
****************************************************************************/
VOLATILE SIG_ATOMIC_T reload_after_sighup = False;
VOLATILE sig_atomic_t reload_after_sighup = False;
static void sig_hup(int sig)
{

View File

@ -179,7 +179,7 @@ static void start_filter(char *desthost)
fd_set fds;
int num;
struct sockaddr addr;
int in_addrlen = sizeof(addr);
socklen_t in_addrlen = sizeof(addr);
FD_ZERO(&fds);
FD_SET(s, &fds);